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

Run unit tests on Chrome and Safari via Sauce Labs #11827

Merged
merged 9 commits into from
Nov 16, 2017
Merged

Run unit tests on Chrome and Safari via Sauce Labs #11827

merged 9 commits into from
Nov 16, 2017

Conversation

rsimha
Copy link
Contributor

@rsimha rsimha commented Oct 27, 2017

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

@dreamofabear
Copy link

Is there value in running tests on Saucelabs + Chrome latest? I'm not sure we're actually getting additional signal here.

@rsimha
Copy link
Contributor Author

rsimha commented Oct 27, 2017

@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.

@dreamofabear
Copy link

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?

@rsimha
Copy link
Contributor Author

rsimha commented Oct 27, 2017

@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.

@aghassemi
Copy link
Contributor

@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.

@dreamofabear
Copy link

@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.

@rsimha
Copy link
Contributor Author

rsimha commented Oct 30, 2017

@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.

@ampprojectbot ampprojectbot added this to the Pending Triage milestone Oct 30, 2017
@rsimha
Copy link
Contributor Author

rsimha commented Oct 31, 2017

@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?

@aghassemi
Copy link
Contributor

@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.

@rsimha rsimha changed the title Run unit tests on a subset of Sauce labs browsers Run unit tests on Chrome and Safari via Sauce Labs Oct 31, 2017
@rsimha
Copy link
Contributor Author

rsimha commented Oct 31, 2017

@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

@ampprojectbot
Copy link
Member

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.

@aghassemi
Copy link
Contributor

@rsimha-amp unit tests are still failing, will review after green?

@rsimha
Copy link
Contributor Author

rsimha commented Nov 14, 2017

@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.

@rsimha
Copy link
Contributor Author

rsimha commented Nov 15, 2017

@aghassemi Ping

@rsimha
Copy link
Contributor Author

rsimha commented Nov 15, 2017

@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', () => {
Copy link
Contributor

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?

Copy link
Contributor Author

@rsimha rsimha Nov 16, 2017

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.

Copy link
Contributor

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.

@@ -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.
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@rsimha rsimha merged commit 1f605cc into ampproject:master Nov 16, 2017
@rsimha rsimha deleted the 2017-10-24-SauceBrowsers branch November 16, 2017 00:31
riklund pushed a commit to riklund/amphtml that referenced this pull request Nov 16, 2017
neko-fire pushed a commit to 3qnexx/amphtml that referenced this pull request Nov 17, 2017
@rsimha rsimha removed this from the Sprint H1 November milestone Nov 17, 2017
ghost pushed a commit that referenced this pull request Dec 6, 2017
gzgogo pushed a commit to gzgogo/amphtml that referenced this pull request Jan 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants