Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Flatten test environment for Chromecast #6640

Conversation

joeyparrish
Copy link
Member

@joeyparrish joeyparrish commented May 18, 2024

Chromecast WebDriver Server and Karma both used iframes, which caused complications when testing on Chromecast. The test environment couldn't directly access cast.__platform__ APIs, and more recently stopped being able to access EME due to presumed mistakes in the platform's implementation of iframe permission policies.

This resolves the issue by removing iframes at both levels.

  • Flatten Karma's environment using "useIframe: false" and "runInParent: true"
  • Remove test flag --single-run; not supported in combination with Karma's "useIframe: false" option
  • Add a test boot file to force closure to use dynamic script tags instead of document.write; required with Karma's "useIframe: false" option
  • Adjust screenshot tests not to assume an iframe host
  • Fix compatibilty between Tizen and Karma's useIframe:false

@joeyparrish
Copy link
Member Author

A preview of shaka-project/shaka-lab#52 is already deployed in the lab to enable support for this in the lab infra.

@joeyparrish
Copy link
Member Author

@shaka-bot please test

@shaka-bot
Copy link
Collaborator

@joeyparrish: Lab tests started with arguments:

  • pr=6640

@shaka-bot
Copy link
Collaborator

Incremental code coverage: No instrumented code was changed.

@avelad
Copy link
Collaborator

avelad commented May 18, 2024

@shaka-bot test

@shaka-bot
Copy link
Collaborator

@avelad: Lab tests started with arguments:

  • pr=6640

@avelad avelad added type: CI An issue with our continuous integration tests platform: Cast Issues affecting Cast devices labels May 20, 2024
@avelad avelad added this to the v4.9 milestone May 20, 2024
avelad
avelad previously requested changes May 20, 2024
Copy link
Collaborator

@avelad avelad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this PR breaks the tests in Tizen and is not working on ChromecastHub either due to play restrictions.

@avelad
Copy link
Collaborator

avelad commented May 21, 2024

@joeyparrish can we close it with ec4bc1d ?

@joeyparrish
Copy link
Member Author

No, because we now have WV DRM tests skipped IIRC, and cast.__platform__ is still unavailable to tests until we finish this

@avelad
Copy link
Collaborator

avelad commented May 22, 2024

Note MSS PlayReady test is working on Cast now

@joeyparrish
Copy link
Member Author

I'm rebasing and simplifying this, then I'll run tests, then I'll upload.

After this lands, I still have to go back and try to fix and re-enable Fuchsia.

@joeyparrish joeyparrish force-pushed the flatten-chromecast-test-environment branch from 13983ee to 5f5f5d9 Compare May 22, 2024 16:40
@joeyparrish
Copy link
Member Author

@shaka-bot please test

@joeyparrish joeyparrish force-pushed the flatten-chromecast-test-environment branch from 5f5f5d9 to aee3a06 Compare May 22, 2024 16:42
@shaka-bot
Copy link
Collaborator

@joeyparrish: Lab tests started with arguments:

  • pr=6640

@joeyparrish
Copy link
Member Author

Still having an issue with this with disconnects on Tizen, which I did not see when I tested locally.

Chromecast WebDriver Server and Karma both used iframes, which caused complications when testing on Chromecast.  The test environment couldn't directly access `cast.__platform__` APIs, and more recently stopped being able to access EME due to presumed mistakes in the platform's implementation of iframe permission policies.

This resolves the issue by removing iframes at both levels.

 - Flatten Karma's environment using "useIframe: false" and "runInParent: true"
 - Remove test flag --single-run; not supported in combination with Karma's "useIframe: false" option
 - Add a test boot file to force closure to use dynamic script tags instead of document.write; required with Karma's "useIframe: false" option
 - Adjust screenshot tests not to assume an iframe host
 - Fix compatibilty between Tizen and Karma's useIframe:false
   - joeyparrish/karma@32e8735
   - joeyparrish/karma@f2132cc
@joeyparrish joeyparrish force-pushed the flatten-chromecast-test-environment branch from aee3a06 to c30f1be Compare May 22, 2024 21:51
@joeyparrish
Copy link
Member Author

I found and fixed some incompatibilities between Karma's flat mode and Tizen, and between Karma's flat mode and Tizen WebDriver Server.

@joeyparrish
Copy link
Member Author

@shaka-bot please test

@shaka-bot
Copy link
Collaborator

@joeyparrish: Lab tests started with arguments:

  • pr=6640

@joeyparrish joeyparrish dismissed avelad’s stale review May 22, 2024 23:59

Tizen and Fuchsia issues addressed

@joeyparrish joeyparrish merged commit c48e435 into shaka-project:main May 22, 2024
31 checks passed
@joeyparrish joeyparrish deleted the flatten-chromecast-test-environment branch May 23, 2024 00:00
avelad pushed a commit that referenced this pull request May 27, 2024
Chromecast WebDriver Server and Karma both used iframes, which caused
complications when testing on Chromecast. The test environment couldn't
directly access `cast.__platform__` APIs, and more recently stopped
being able to access EME due to presumed mistakes in the platform's
implementation of iframe permission policies.

This resolves the issue by removing iframes at both levels.

- Flatten Karma's environment using "useIframe: false" and "runInParent: true"
- Remove test flag --single-run; not supported in combination with Karma's "useIframe: false" option
- Add a test boot file to force closure to use dynamic script tags instead of document.write; required with Karma's "useIframe: false" option
 - Adjust screenshot tests not to assume an iframe host
 - Fix compatibilty between Tizen and Karma's useIframe:false
- joeyparrish/karma@32e8735
- joeyparrish/karma@f2132cc
@@ -221,6 +221,7 @@ module.exports = (config) => {
'node_modules/eme-encryption-scheme-polyfill/dist/eme-encryption-scheme-polyfill.js',

// load closure base, the deps tree, and the uncompiled library
'test/test/closure-boot.js',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like this causes karma's debug.html to stop working.
For whatever reason, if I try to run the debug file via something like python3 build/test.py --uncompiled --no-build --quick --auto-watch --no-browsers, it fails to load node_modules/google-closure-library/closure/goog/deps.js as well as errors out because it never ends up setting up var shaka = {}.

Not really sure how to fix it but thought it's worth mentioning it. Maybe this file could only be configured on chromecast?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the problem, and it's more general. It has to do with the order in which scripts load. I'll work on a fix.

What seems to happen now is that Karma inserts shaka-player.uncompiled.js directly, which uses Closure to load the individual source files of Shaka, not with createElement attached to head instead of document.write. This allows some subsequent scripts inserted by Karma to execute before those createElement scripts load, which is what causes the problem.

In normal testing, Karma also loads scripts with createElement, so it works. Since flattening the environment, it's only debug.html that sticks <script> tags directly into HTML.

Since we're on a fork of the now-dead-upstream Karma, I may be able to fix it there.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wrong. Easier to fix in closure-boot.js, since the correct behavior depends on context.

#6730

joeyparrish added a commit that referenced this pull request May 31, 2024
Chromecast WebDriver Server and Karma both used iframes, which caused
complications when testing on Chromecast. The test environment couldn't
directly access `cast.__platform__` APIs, and more recently stopped
being able to access EME due to presumed mistakes in the platform's
implementation of iframe permission policies.

This resolves the issue by removing iframes at both levels.

- Flatten Karma's environment using "useIframe: false" and "runInParent: true"
- Remove test flag --single-run; not supported in combination with Karma's "useIframe: false" option
- Add a test boot file to force closure to use dynamic script tags instead of document.write; required with Karma's "useIframe: false" option
 - Adjust screenshot tests not to assume an iframe host
 - Fix compatibilty between Tizen and Karma's useIframe:false
- joeyparrish/karma@32e8735
- joeyparrish/karma@f2132cc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Cast Issues affecting Cast devices type: CI An issue with our continuous integration tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants