-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Run unit tests on Chrome and Safari via Sauce Labs #11827
Conversation
Is there value in running tests on Saucelabs + Chrome latest? I'm not sure we're actually getting additional signal here. |
@choumx This is a prequel to the PRs that will enable the unit tests on non-chrome-latest browsers. Right now, there are a bunch of unit tests that fail when run on other browsers, so I'm going to have to do that clean up in a separate PR. |
So we'd disable latest-Chrome once we add support for other browsers? I guess it's not obvious to me that #6039 is a good idea in the first place. Will we need to start transpiling test code to get it to run on browsers other than latest Chrome? |
@choumx You've raised a good point :) We wouldn't disable unit tests on latest chrome on sauce labs, since this PR will no longer run unit tests on the version of chrome that's native to Travis. The idea is to (soon) run unit tests on latest chrome, latest safari, and latest chrome android. I don't believe we'll need to transpile the tests on a couple of the latest browsers. The intention isn't to run unit tests on the entire sauce labs browsers. @aghassemi can comment on the rationale underlying his original issue, after which we can determine if this PR is still a good idea. |
@choumx @choumx The rational behind #6039 is that we had a few production bugs due to code using web platforms API's not available in Safari. Unit tests would have caught those bugs but they do not run on Safari. So getting unit tests run in latest Safari same way we do in latest Chrome is the important part of this. Other browsers, older versions is a nice to have. |
@aghassemi Integration testing + presubmit bans for APIs with cross-browser issues seems better IMO. We already have infra for both and we won't need to polyfill/transpile test code. |
@choumx @aghassemi As of now, there are ~20 failures when unit tests are run on Safari: https://travis-ci.org/ampproject/amphtml/jobs/293802513 I expect that with a few fixes, we should be able to run unit tests on Safari for all PRs (or at least for push builds). Since tests on different browsers are run in parallel, I expect that the overall increase in build time should be small relative to the increase in the number of tests we run. Edit: I typed this before the reply above. Will hold off until we're sure of the direction we want to pursue. |
@aghassemi @choumx Is there a list of APIs with cross-browser issues? Would it make sense to ban those APIs via presubmit checks instead of running unit tests on Safari? |
@rsimha-amp @choumx The idea behind running unit tests in Safari was to "catch" these cross-browser issues that devs initially didn't realize is an issue and hence is not banned in presubmit. After we know they are an issue, then yes banning them is the right action. I see having unit tests run in Safari as just anther safety check to increases chances of catching issues we are not aware of. |
@aghassemi @choumx I've gone ahead and added a new commit to this PR that fixes / skips the individual tests that currently fail on Safari, and assigned TODOs to the owners of each of those tests. I've also enabled unit test runs on Chrome and Safari by default for PR runs. Hopefully, the next Travis PR check build should be green. When I looked at the overall timing of the build, there wasn't a significant increase in duration, due to the fact that tests are run in parallel on the two browsers. With this, I'm hoping both your concerns should be addressed. PTAL. Tip: Use this link for review, so that whitespace-only changes due to indentation are hidden: https://github.com/ampproject/amphtml/pull/11827/files?w=1 |
This issue doesn't have a category which makes it harder for us to keep track of it. @rsimha-amp Please add an appropriate category. |
@rsimha-amp unit tests are still failing, will review after green? |
@aghassemi Running a subset of the tests on Safari works. See https://travis-ci.org/ampproject/amphtml/jobs/302595652 This is ready for a full review. You can use https://github.com/ampproject/amphtml/pull/11827/files?w=1 to filter out whitespace-only changes while reviewing. |
@aghassemi Ping |
@erwinmombay could you take a look? I have a couple other PRs that are waiting for this to be merged. |
resumeCallback() { | ||
testElementResumeCallback(); | ||
// TODO(dvoytenko): Make this test work on Safari. See #11827. | ||
describe.configure().skipSafari().run('CustomElement', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHub UI doesn't make it clear what actually changed here. Is there anything changes other than skipSafari
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this just adds the skipSafari
.
Did you click the link I sent you (https://github.com/ampproject/amphtml/pull/11827/files?w=1)? Adding ?w=1
will filter out whitespace changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoa! had no idea about ?w=1
stealing it for the next time I am assigned tip of the week.
test/functional/test-ampdoc.js
Outdated
@@ -166,7 +166,8 @@ describe('AmpDocService', () => { | |||
}).to.throw(/The shadow root already contains ampdoc/); | |||
}); | |||
|
|||
it('should navigate via host', () => { | |||
// TODO(dvoytenko): Make this test work on Safari. See #11827. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: // TODO(dvoytenko, #11827)
(Dima has a tool that extracts these if the TODO(username, #issue) format is followed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
With this PR, in addition to running all unit tests on Chrome (latest), we run a subset of the unit tests on Safari (latest) via Sauce Labs.
We also add Safari 10 and 11 to the mix for integration tests.
Fixes #6039
/to @choumx @erwinmombay @aghassemi