Includes a YAML config file for our lab, and documentation on how to
create a custom config for another Selenium grid.
A workflow will run tests nightly in the Shaka lab, using a
self-hosted runner with access to our private grid.
The workflow can also be triggered manually by maintainers to test a
PR in the lab. This will report status back to the PR.
The depswriter.py tool from google-closure-library was generating
deprecation warnings. This switches to a newer, rewritten version
called google-closure-deps.
In #3991, I changed the syntax of our colors to a modern rgba syntax.
For example, rgba(255, 255, 255, 0.85) would become rgba(255 255 255 /
85%). However, less v3 seems not to understand that properly, and
performs division on the last two parts, resulting in output of
rgba(255 255 3%), which is indeed invalid.
This fixes the issue by upgrading to less v4, which understands the
new rgba syntax and leaves it alone. The output for that will now
match the input.
To work around an issue with less v4, this uses a prerelease version
with a fix for https://github.com/less/less.js/issues/3693 . See also
https://github.com/tomas/needle/issues/391
This doesn't affect any release branches, since #3991 hasn't been
cherry-picked.
Closes#4027
These projects have vulnerable dependencies, but are not being
properly maintained. This replaces both with forks that have upgraded
their deps.
This brings the NPM audit vulnerability count from 6 to 0.
This updates the jsdoc fork to one based on the latest jsdoc. (The
fork adds features for tutorial sorting.)
We also have an in-repo fork of the default jsdoc template from 2019.
The newer default template no longer includes the same dependencies,
so three deps we used to get transitively from jsdoc are now explicit
at the shaka-player level: open-sans-fonts, code-prettify, and
color-themes-for-google-code-prettify. This is appropriate, since the
dependency comes from our in-repo fork of the default template.
This upgrade brings our NPM audit vulnerabilities from 10 to 6.
The new version requires additional configuration for less syntax, and
has new default rules we were out of compliance with.
I disabled rules about avoiding explicit vendor prefixes (such as
"-webkit") because we are not using any auto-prefixer tools. Other
violations have been fixed:
- kebab-case for element ids
- quotes around URLs
- double quotes instead of single quotes
- disable class selector pattern matching for MDL (external)
- use modern rgb/rgba syntax
- no quotes on font families
- no long-hand when short-hand will do
This brings our NPM audit vulnerabilities from 20 down to 10.
Downgrade less to v3. v4 is failing on macOS for some reason. See
less/less.js#3693
This also makes some less/CSS changes that are useful for future
upgrades:
- wrap all calculations in calc(), which is required in less v4
- remove unneeded @transparent variable
Finally, this fixes an erroneous error message that said "extern
generation failed" instead of "CSS compilation failed".
Closes#3981
This updates the compiler and closure library to the latest releases.
This required a few small tweaks:
- Drop custom extern for WebCrypto (now built into the compiler)
- Remove require() in cea parser, only used in `throws` annotations
- Hack around a typing issue in a fake version of TextTrack in tests
Most dependencies are not used in Shaka Player itself, but in our
build and test infra or in our demo app. Still, GitHub reported 29
potential vulnerabilities in these deps, and NPM reported 37.
The changes below being NPM's audit report from 37 down to 24
vulnerabilities.
Detailed updates:
- Dropped explicit deps for transitive dependencies that we no longer
need to update for ourselves:
- ua-parser-js (via karma)
- Dropped because we no longer need them:
- karma-ie-launcher
- Updated to latest versions:
- awesomplete
- core-js
- dialog-polyfill
- htmlhint
- jimp
- karma*
- less
- pwacompat
- rimraf
- tippy.js
- which
- Updated as far as possible without code or config changes in Shaka:
- mux.js
- stylelint*
- Still needs an update:
- *babel*
- eslint
- eslint-config-google
- google-closure-compiler
- google-closure-library
Some of the vulnerabilities stem from stylelint, babel, and others
that haven't been updated yet, so follow-up work is needed to address
those with breaking updates.
mux.js is actually used at runtime (optional), so it was only updated
to the latest non-breaking release.
* test: Switch local Chrome, Edge, Firefox, and Safari launchers to WebDriver-based
This will enable WebDriver-based screenshot tests in local test runs.
* test: Add screenshots for Edge on Mac
Instead of pixel-wise comparison with a change threshold, we now use a
structural similarity (ssim) module to decide how much a screenshot
has changed. This better tolerates small rendering differences due to
differences in GPUs across machines.
The latest compiler should treat `@expose` as a parser error, so the
BanExpose conformance rule is no longer needed.
This upgrades the compiler & closure libraries to the latest releases
from NPM, makes matching updates to the compiler command line (no more
`strictMissingRequire` error category), and removes the BanExpose
conformance rule.
Change-Id: I45e8e71ad5f42fee289a8ddd30141e15f3f425a8
In StreamUtils, use MediaCapabilities.decodingInfo() instead of
MediaSource.isTypeSupported() to check if the stream is supported.
MediaCapabilities.decodingInfo() takes an
MediaDecodingConfiguration object as input, and returns a Promise
with a MediaCapabilitiesInfo object. The returned object tells us
whether decoding the media is supported, smooth, and
powerefficient.
Steps:
1. Create a MediaDecodingConfiguration object for each variant as
the input.
2. Query the decodingInfo API with the config.
3. Get the 'supported' info from the decodingInfo result, to know
whether the variant is supported.
Issue #1391
Change-Id: I8fc2d3ec6a9868f38269d550d35f45c298faae98
Karma had an explicit dependency on ua-parser-js "0.7.22". Not
"^0.7.22", which is a range including newer bugfix releases, but
_exactly_ 0.7.22. This meant our explicit requirement for a newer
version of ua-parser-js wasn't working, because it conflicted with
Karma's.
This dependency bug was fixed in Karma v6. Upgrading Karma to v6
allows us to get an updated version of ua-parser-js which includes
fixes for Xbox & Chromecast detection. (Karma's new dependency is
"^0.7.23", which includes 0.7.24, where Xbox detection was fixed.)
We will keep our explicit dependency on ua-parser-js "^0.7.24", which
will ensure we don't get 0.7.23, which could not correctly detect Xbox
One (which we now support). But this explicit dependency no longer
conflict's with Karma's, and will serve as an "upgrade" to theirs.
Change-Id: I72b0df9c1bda33c0ae937d79e0b143b1219ef1cb
The ua-parser-js fork was created to add Xbox One detection support,
but the PR has been merged and the released upstream as 0.7.24.
Change-Id: I14016837bc20da43b077fef7654f9bab8404046e
This updates the UA parser to one that recognizes Xbox devices
including Xbox One. Corresponds to PR faisalman/ua-parser-js#479
Change-Id: I5e92e78b06c981df1659f73264b6fabfc5eb56ac
The new eslint found many style errors which have now been corrected.
It also complains a lot about atomic update issues that do not seem to
exist, so that rule has been disabled.
This upgrade will allow us to adopt eslint's "id-denylist" instead of
the older "id-blacklist" rule, the name of which violates new Google
guidelines about respectful language.
Bug: 178203011
Change-Id: Ia65581b96e4dd1331f720fa396183dca020b9caf
For a while, we were forced to use a fork of stylelint with a
bugfix necessary for our test bots to run the tool.
That behavior has now been merged into normal stylelint, so we
can stop using that fork.
Change-Id: I51196f8dab73ac1f814137d2f191a08c231fd369
The output of Clutz is not directly usable. We must perform several
transformations on the generated defs:
- Remove the prefix clutz puts on all namespaces ("ಠ_ಠ.clutz")
- Replace "GlobalObject" (from Clutz) with TypeScript-native "object"
- Remove "Global" prefix from Date, Element, Event, and EventTarget
and use the original definitions instead
- Remove "protected", which appears on some fields, but is only
supported on methods
- Remove duplicate extension of EventTarget on IAdManager
- Transform "Promise | null | undefined" return type into "Promise |
void"
- Fix the definitions of Error and shaka.util.Error
- Remove an unnecessary second interface on SegmentIndex types
- Remove definitions for Closure Compiler built-ins
We still need some basic TypeScript sample code that references Shaka
Player, so that we can try to compile it and automatically verify that
the defs work at every commit.
Issue #1030
Change-Id: If394269205e57dbcce4e0f76f6ef582fba0afacb
TextDecoder/TextEncoder is not supported in IE and legacy Edge.
Add a polyfill for that.
Issue #2843
b/168908529
Change-Id: Ia7a3ca87081835fd7dc8e607e05d8090730f9fc5
For backwards compatibility reasons, the StyleLint PR had to
be moved to a separate branch of our StyleLint fork. This
changes Shaka Player to use that branch.
Change-Id: Ia1d1ad475a446f36b6c16262320dbd36acb99d8a
Previously, StyleLint had a problem that was preventing us from
using their library in our buildbot tests. To get around this, we
made a custom branch of their library.
Recently, they almost fixed the issue. There's just one minor change
left before we can use their master branch. In the meantime, this
CL changes Shaka Player to use a new fork of StyleLint that is based
on their current master branch, and makes the LESS modifications
that the newest versions ask for.
Change-Id: I78624b3d366e6c22c577ca6707f5a3311f8e808e
Our Chromecast tests have started reporting the device as "Linux
aarch64", which is not useful. This moves us to a fork of
ua-parser-js which can recognize a Chromecast and report its firmware
version. A pull request has been submitted at
faisalman/ua-parser-js#439.
Change-Id: I158cc2b0dd6fb6ec03825ac9648b05a3096da31b
The latest version of Jasmine has deprecated several properties of
jasmine.Env in favor of a configure() method. This updates our
bootstrap code to use the configure() method.
The latest version of the karma-jasmine adapter hard-codes its own
specFilter configuration at a time that overwrites ours. There is no
way to configure karma-jasmine not to do this, so we shim
jasmine.getEnv().execute() to work around it.
I filed karma-runner/karma-jasmine#273 to track this latter issue.
Change-Id: Ie6a32f67009b52edeeb8f1974ee131753a75ba3f
The new version has license headers, which means mux.js release
bundles now comply with some internal Google policies, which in turn
simplifies some of our internal release procedures for Shaka Player.
Change-Id: I796775231c2be2b252d7cbd7adce5d4002e4df76
This upgrades the compiler to the latest release and fixes some type
errors in the tests found by the new compiler.
Change-Id: I3a555cbdfc94c51fb0683f8397c6adb8ea43f120
This adds our first screenshot-based layout tests and the
infrastructure to use WebDriver for screenshots through Karma.
This new kind of test will be skipped in any non-WebDriver context.
There are many pieces to this system.
First, we update the Karma WebDriver launcher to a newly-released
version that lets us access the client spec object from the launcher.
Second, we build a Karma middleware plugin to respond to HTTP requests
from the tests. We handle /screenshot/isSupported and return a bool
so tests can be skipped on non-WebDriver launchers. We also handle
/screenshot/diff to take the screenshot and compare it to a known-good
version.
The screenshot is a full-page screenshot, since element screenshots
don't work consistently across all the browsers in our test lab. The
screenshot is then cropped to a rectangle specified in the request.
This rectangle is measured to match a specific element, so in
practice, we are screenshotting just one element.
Browsers use sub-pixel rendering, effectively rendering at a scale
larger than the "pixels" seen by JS. The screenshot comes in at this
scale, so the requested cropping rectangle is scaled to match, then
the cropped screenshot is scaled down to the JS-measured size.
Because of sub-pixel rendering, element offsets can be non-integer
numbers. Normally, Karma puts the tests in a iframe, above which is a
variable-height banner showing which devices are connected to Karma
and what state they are in. So this variation and the lack of integer
offsets means we can run into stability issues due to rounding errors.
To make offsets consistent and improve stability of the screenshots,
this banner is now disabled in our Karma config.
The cropping, scaling, and diffing of images is handled Karma-side by
a node module called Jimp.
Before we start the layout tests for UITextDisplayer, we use a node
module in the browser called fontfaceonload to wait for our web fonts
to be fully loaded. This module is a polyfill that polls on IE and
uses a standard API in modern browsers to wait for our font to load.
This is all wrapped into a new test util called waitForFont.
Screenshots are stored in test/test/assets/screenshots/ and are
organized into folders by platform and browser and named according to
an identifier specified by each test case. The new screenshot is
written to disk with the suffix "-new", and a diff image is written
with the suffix "-diff". When a test fails, we can review the changes
in a browser with test/test/assets/screenshots/review.html. The
known-good screenshots can be updated with the new tool
build/updateScreenshots.py.
Change-Id: Ib477fd3c459de466c6dc91e9a60d3e2579164b12
This updates to mux.js 5.6.3, which includes a fix for v1 trun box
parsing to fix caption extraction for content with b-frames.
Closes#2395
Change-Id: I206ce26bb43e8187599e8ca7be2e718f4ea345c3
The Closure Library's base.js, the Closure Compiler, and the Closure
deps-writer are all now loaded via NPM instead of commiting them
directly to the repo. This also updates both the library and compiler
to the latest version: 20200406.
We still have a fork of the Closure Library's URI parser. The latest
upstream version of that has too many dependencies on the rest of the
library to import directly from NPM.
Some internals of the build system have been refactored, and the
"complete" set of files in the build system now includes third_party.
Our forked URI parser does not pass lint checks yet, so the linter
does not run over third_party yet.
A couple of overly-severe sets of compiler checks have been disabled,
since even the latest Closure Library's base.js doesn't pass them.
The script-loader in load.js had to be updated for compatibility with
the new Closure Library. If you don't return "true" now, Closure's
base.js will stop loading subsequent source files.
Some local externs that we had written are now available from the
compiler, so our local copies have been deleted.
A few type-related changes have been made as well, removing casts that
were necessary with the old compiler, but not necessary with the new
one.
Finally, this corrects some type issues in the tests using the new
"typeof" annotation from the compiler. This allows us to type a
variable as a class defined elsewhere. For example, after loading the
compiled library, we can reference compiledShaka.Player, which has the
type "typeof shaka.Player". The compiler can then type-check all uses
of it in the tests.
Closes#2528 (bad polyfill code generated by the old compiler)
Change-Id: I62ec61e82d4edf342b2c576c2d4f89f11562ee65