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

refactor(test-runner-saucelabs): use webdriver launcher #1053

Merged
merged 4 commits into from
Dec 9, 2020
Merged

refactor(test-runner-saucelabs): use webdriver launcher #1053

merged 4 commits into from
Dec 9, 2020

Conversation

web-padawan
Copy link
Contributor

@web-padawan web-padawan commented Dec 4, 2020

What I did

  1. Updated @web/test-runner-saucelabs to depend on @web/test-runner-webdriver
  2. Updated the createSauceLabsLauncher to accept three arguments, to allow passing shared sauceLabsCapabilities instead of having to include them to every launcher individually.

The second change is required to support JWP capabilities and especially iOS Simulators, and fixes #788

/cc @christian-bromann I would appreciate if you have time to take a quick look 🙇‍♂️

@changeset-bot
Copy link

changeset-bot bot commented Dec 4, 2020

🦋 Changeset detected

Latest commit: 97c6343

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@web/test-runner-saucelabs Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines 50 to 71
// W3C capabilities: only browserVersion is mandatory, platformName is optional.
// Note that setting 'sauce:options' forces SauceLabs to use W3C capabilities.
if (capabilities.browserVersion) {
finalCapabilities.platformName =
finalCapabilities.platformName || finalCapabilities.platform || 'Windows 10';
finalCapabilities['sauce:options'] = {
...finalSauceCapabilities,
...(finalCapabilities['sauce:options'] || {}),
};

// Delete JWP capabilities, if any.
delete finalCapabilities.version;
delete finalCapabilities.platform;
} else {
// JWP capabilities for remote environments not yet supporting W3C.
// This enables running tests on iPhone Simulators in SauceLabs.
finalCapabilities = { ...finalCapabilities, ...finalSauceCapabilities };
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are the lines that do the trick to fix #788. The solution is copied from karma-sauce-launcher.

See karma-runner/karma-sauce-launcher@97315f3

Copy link
Contributor

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -46,11 +46,12 @@
],
"dependencies": {
"@web/dev-server-esbuild": "^0.2.4",
"@web/test-runner-selenium": "^0.3.3",
"@web/test-runner-webdriver": "^0.0.3",
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

// W3C capabilities: only browserVersion is mandatory, platformName is optional.
// Note that setting 'sauce:options' forces Sauce Labs to use W3C capabilities.
if (capabilities.browserVersion) {
finalCapabilities.platformName =
Copy link
Member

Choose a reason for hiding this comment

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

Is this needed to fix a bug? Otherwise I prefer that the defaults are set by saucelabs, not by us.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you set browserVersion with platform(instead of platformName), then the following error will happen:

"message": "Illegal key values seen in w3c capabilities: [platform]",
"error": "unknown error",

Removed the fallback to Windows 10 to let Sauce Labs choose the default platform as you suggested.


// Delete JWP capabilities, if any.
delete finalCapabilities.version;
delete finalCapabilities.platform;
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to delete these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to document that non-W3C capabilities need to be removed.

@LarsDenBakker LarsDenBakker merged commit 18b3766 into modernweb-dev:master Dec 9, 2020
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.

[test-runner-saucelabs] Support JWP capabilities for testing iOS simulators
3 participants