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

Add legacy bundle to test old browser compatibility #233

Merged
merged 1 commit into from
Nov 28, 2018
Merged

Conversation

cdata
Copy link
Contributor

@cdata cdata commented Nov 22, 2018

Important details about this change:

  • IE11 is now supported via a "legacy" bundle and tested on CI
  • Splits WCT configuration into three config files due to a bug in how wct parses command line options (filed WCT ignores --local when sauce plugin is skipped Polymer/tools#798 to track)
  • Configurations cover the following territory in order:
    1. Local Chrome (quick sanity check before running slower sauce tests)
    2. Battery of "modern" browsers via sauce
    3. Battery of "legacy" browsers via sauce, using "legacy" test entry point and bundle
  • Only Chrome is tested "locally," due to Firefox not actually running any tests in this mode on CI
  • Chrome 41 has been removed from the testing regime, as it was suffering the same issue as headless Firefox in CI only
    • I tried every platform configuration of this browser (Windows, Mac and Linux) and it always fails to create a WebGL context. It works just fine when I run Chrome 41 locally.
  • polymer-build is used to generate a "legacy"-compatible bundle
    • The amount of configuration to do this ourselves is rather large and complicated by the need for language feature polyfills; polymer-build is maintained and updated by a dedicated team of folks so it saves us some of that burden.
  • IE11 doesn't have remove on elements, so all usages have been changed to a more conservative check for parentNode and then using removeChild on that node if it exists.
  • We were previously misconfiguring the test timeout, this has been fixed
  • For a complete build, the following browsers are currently tested:
    • Chrome 70 Desktop
    • Chrome 70 Desktop (tested against "legacy" bundle)
    • Chrome 70 Android
    • Firefox 62 (pre-Web Components)
    • Firefox 63 (latest / post-Web Components)
    • Safari 12 Desktop
    • Safari 12 iOS
    • Safari 11 Desktop
    • Edge 17
    • Internet Explorer 11 (tested against "legacy" bundle)

Fixes #99

@cdata cdata force-pushed the fix-ie11 branch 10 times, most recently from 5134eda to 61adedb Compare November 27, 2018 20:05
@cdata cdata requested a review from jsantell November 27, 2018 20:41
@cdata cdata changed the title WIP Add legacy bundle to test old browser compatibility Add legacy bundle to test old browser compatibility Nov 27, 2018
script:
- xvfb-run npm run test
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then wct --plugin sauce; fi
- xvfb-run npm run test && if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then ./scripts/run-sauce-tests.sh; fi
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this only run the sauce tests when a commit lands on master?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The environment variable is a little misleading. Basically this only runs sauce tests for first-party PRs (so that malicious users cannot burn our finite sauce time) and for merges into master. TBD how we should go about running the full battery of browsers against third-party PRs, but open to suggestions.

jsantell
jsantell previously approved these changes Nov 27, 2018
Copy link
Contributor

@jsantell jsantell left a comment

Choose a reason for hiding this comment

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

Great work! One thing that I'd like is some sort of info on what features trigger the need for a legacy build/test, e.g. something in the readme Browser Support section

#!/usr/bin/env bash

set -e
set -x
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need to flip the chmod flags?

Copy link
Contributor Author

@cdata cdata Nov 27, 2018

Choose a reason for hiding this comment

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

These aren't chmod flags. These set flags tell the shell to:

  1. Exit the script on the first non-zero exit code (otherwise it would invoke all commands even if they fail)
  2. Print all the commands being run by the script as they are invoked

See https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html#The-Set-Builtin

@@ -21,11 +21,13 @@
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we move test.html and test-legacy.html to test/ maybe? Or test/index.html and test/legacy.html? Could also contain a README about writing tests (in the future) -- main rational being to minimize things in the root

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

test.html Outdated
@@ -45,13 +47,13 @@
<!-- Resize Observer polyfill is required for non-Chrome browsers: -->
<script src="./node_modules/resize-observer-polyfill/dist/ResizeObserver.js"></script>

<!-- Fullscreen polyfill is required to support all stable browsers: -->
<!-- Fullscreen polyfill is required to support Web XR-based AR in stable browsers that support it: -->
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: s/Web XR/WebXR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

"version": "11.285"
},
{
"browserName": "safari",
Copy link
Contributor

Choose a reason for hiding this comment

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

Does Safari 11.1 need the legacy build?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably not. I'll move it up.

Now that I think about it, it's probably valuable to ensure latest Chrome works against the legacy bundle, as the code is changed very significantly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

test-legacy.html Outdated

<!-- The following libraries and polyfills are recommended to maximize browser support -->
<!-- Include prismatic.js for Magic Leap support: -->
<!--<script src="../node_modules/@magicleap/prismatic/prismatic.min.js"></script>-->
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably be removed here and in test.html since it doesn't actually do anything when running tests AFAIK (we don't run tests on Helio or shim prismatic connection)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@cdata
Copy link
Contributor Author

cdata commented Nov 28, 2018

Added docs about the legacy bundle and Custom Elements ES5 Adapter

@cdata cdata merged commit 72fae39 into master Nov 28, 2018
@cdata cdata deleted the fix-ie11 branch November 28, 2018 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix IE11 (possibly as a separate bundled build)
2 participants