-
-
Notifications
You must be signed in to change notification settings - Fork 278
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-runner] Sauce Labs launcher #472
Comments
We are still waiting for our sauce labs open source account to get activated 🙈 it should be very similar to the browserstack one so there is already a possible implementation but we could not verify it yet 🙈 |
We're very interested in that too over at the Preact team. It's the last remaining point for us before we make the switch. |
Thanks for looping me in @marvinhagemeister @LarsDenBakker I upgraded the account. Please let me know if you need more concurrency for the project. I am happy to assist in this effort! For updating jobs, add metadata information and interact with our API you should use our NPM package. Let me know if there are any questions |
@christian-bromann Thanks a lot! I got something up and running now. One question about the url to point selenium to. I'm in the EU datacenter so I picked Just using We're really grateful for having a free open source account, but since you're offerring.. having more concurrency would be great as two concurrent sessions would start to queue up pretty quickly as the project grows. 👍 |
@LarsDenBakker Sauce Labs has currently 3 WebDriver endpoints:
This is our legacy endpoint and we are in the process of deprecating it. It also points to our
I could expose the ondemand url so that you wouldn't need to build it by yourself in the
Just bumped it to 10 concurrent sessions. |
@christian-bromann Thanks! 🙏 Exposing the URL would be great, also helps with migration between endpoints. |
I released a @marvinhagemeister @justinfagnani it would be great if you could give it a try and see if it works for you. Docs are here: https://modern-web.dev/docs/test-runner/browsers/saucelabs/ |
@christian-bromann just checking, it still shows "Team Concurrency" as 2 under My Account. Am I looking at the right place? |
So I've finally had some time to play around with the plugin. It's a fantastic start and I was able to connect to saucelabs and run some tests 🎉 Problems encountered: 1) Unable to start firefox on Windows 10. Not sure what's happening here, but I haven't been able to instantiate a firefox browser at all. It works fine with our karma setup, so I'm assuming there is some difference somewhere. The error I'm seeing is: (node:4017) UnhandledPromiseRejectionWarning: InvalidArgumentError: Expected "handle" to be a string, got [object Undefined] undefined
at Object.throwDecodedError (/home/runner/work/***/***/node_modules/selenium-webdriver/lib/error.js:550:15)
at parseHttpResponse (/home/runner/work/***/***/node_modules/selenium-webdriver/lib/http.js:565:13)
at Executor.execute (/home/runner/work/***/***/node_modules/selenium-webdriver/lib/http.js:491:26)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async mixin.execute (/home/runner/work/***/***/node_modules/selenium-webdriver/lib/webdriver.js:700:17)
at async WindowManager.switchToAvailableWindow (/home/runner/work/***/***/node_modules/@web/test-runner-selenium/dist/WindowManager.js:92:9)
at async WindowManager.startSession (/home/runner/work/***/***/node_modules/@web/test-runner-selenium/dist/WindowManager.js:97:30)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:4017) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:4017) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
test/browser/cloneElement.test.js:
❌ The browser was unable to open the test page after 300000ms. (failed on Windows 10 firefox latest) 2) Increased tests times Spent a while debugging this and checking what karma is doing and it seems like karma loads all test files at once in the same browser instance, whereas web-test-runner opens a browser for each test file. The timing data I have here is heavily skewed by 1), so I'm not sure how valid this is. Probably best to wait until 1) is resolved. Our karma setup roughly takes around 2-3s whereas current runs with web-test-runner take a few minutes. |
I can confirm the problem with Firefox on Windows. Also, I was only able to get Safari and iOS Simulator builds passing after I set |
Thanks for trying it out. The firefox issue looks like a problem opening a browser tab, will see if we can do something about that. For the speed the roundtrips between saucelabs and your local machine are a big bottleneck. There are two things to consider: Your current karma config uses webpack to bundle before serving to saucelabs, this reduces the total roundtrips significantly. We could use rollup to quickly bundle the test files and see if that improves the speed. Because we run tests in separate pages there are more requests from the browser. When watch is not turned on, we do agressive caching so once its served once it should be served from the browser cache. I need to double check whether this works correctly with selenium. We can add a flag to run all tests in a single page, like karma. This would break encapsulation between tests and efficient refresh in watch mode - but that would be fine for tests in the CI. |
Yeah, personally I'm not sure if running all tests in a single page is the way to go. I'd leave that of the table for now. |
Hello! I'm trying out Here's our wtr config:
With chrome/latest/linux we get:
With safari/11/macos 10.13 we get:
With microsoftedge/17/windows 10 we get:
I've also noticed that the Saucelabs tunnels stay open after this crash (maybe after a success too?), and it creates a new tunnel every time, so after a few attempts I have to go to the Saucelabs website to close the tunnels or else I'll get a connection error due to all our tunnels being used up. I'm investigating, but let me know if any of this looks familiar! |
These are working for us in the CI right now:
IE11 requires a legacy plugin. I added an example project here: https://github.com/modernweb-dev/example-projects/tree/master/saucelabs I'm getting similar errors like you with the other configurations, we need to investigate that. The error on edge: |
As mentioned above, I got the tests passing on MacOS and iOS Simulator with the following config: const sharedCapabilities = {
'sauce:options': {
name: 'vaadin-date-picker unit tests',
build: `build ${process.env.TRAVIS_JOB_NUMBER || ''}`
}
};
config.concurrency = 1;
config.browsers = [
sauceLabsLauncher({
...sharedCapabilities,
browserName: 'safari',
platform: 'macOS 10.14',
version: '13'
}),
sauceLabsLauncher({
...sharedCapabilities,
browserName: 'safari',
platform: 'iOS Simulator',
version: '13.1'
})
]; There is a logging output problem when using same browserName, here is what happens:
Build example: https://github.com/vaadin/vaadin-date-picker/pull/733/checks?check_run_id=1133888849 |
I released BrowsersI dug into some different browsers configurations, this is what I've found so far. Firefox: saucelabs uses a version of geckodriver which is incompatible with Firefox 80. Firefox 79 seems to work fine. See mozilla/geckodriver#1771 and https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html. Edge: on edge saucelabs blocks popups. it works with concurrency set to 1 since we don't open extra pages in that case. For browserstack we set some special capabilities: https://github.com/modernweb-dev/web/blob/master/packages/test-runner-browserstack/src/browserstackLauncher.ts#L82 I'm trying to find a similar settings at saucelabs. chrome/latest/linux and safari/11/macos 10.13: I haven't been able to find out if we're doing something wrong here. We just pass the capabilities as is, so they might be errors on saucelabs side. Linux isn't in their platform configurator: https://wiki.saucelabs.com/display/DOCS/Platform+Configurator @christian-bromann anything you can help out with here? SpeedI added a plugin for bundling on the fly with rollup: https://modern-web.dev/docs/dev-server/plugins/rollup/#bundling I'm going to test it out on some projects to see if that makes testing on a remote service faster. A general improvement I also want to make is to open browsers sequentially, instead of all in parallel. This should improve speed when running tests in a lot of remote browsers. Tracking this in #602 |
Confirmed that the browser names issue is now fixed and the test report is looking better, thanks! The only thing is that I just noticed it celebrates the build success twice 🙂
Build: https://github.com/vaadin/vaadin-date-picker/pull/733/checks?check_run_id=1137688725 |
Hmm, I can't get the safari configs @web-padawan had luck with to work for us. If I try macOS 10.14/safari/13, I get:
Note that the version number has a redundant trailing |
Also FYI, I just noticed an uncaught promise error from WebDriver in a test run that reported success:
https://github.com/Polymer/lit-html/pull/1305/checks?check_run_id=1147546061 |
Thanks for reporting, will look into those. I also looked into improving the speed. I did some tests and while the speed varies between runs, bundling didn't seem to make things faster for both the Lion and Preact projects. Lion has a lot of tests, so if anything I expected to see an improvement there. Running all tests from a single file, like karma did, instead of running each test in a separate file is faster on saucelabs. This in part due to a limitation in selenium where it can only send commands to the current focused window. Locally using puppeteer or playwright it's faster. I'm going to investigate if there are improvements we can make there. Otherwise we may need to offer the option to run tests from a single file. We might be able to use iframes, though each iframe will still request the files again. |
@aomarks please note that I'm getting These are the configs that worked:
|
Ah, thank you @web-padawan! I blanked that part of your earlier comment. It does seem like using Another experience to share, on
Maybe there are some extra errors/logs being caught somewhere that aren't getting displayed? It looks like everything passed, yet it still reports an error. |
- Set up the rigging for Sauce with `@web/test-runner`. - Adds Firefox 68 (ESR) on Windows to our CI. - For now, running the sauce browsers in a separate job, because I think it's likely we'll see some failures, and it will be less disruptive if we can quickly see whether its local vs sauce that's failing. - The other browsers still don't work, since the plugin is very new. Firefox 68 is the only one I've gotten to work from the preliminary set for lit-next. modernweb-dev/web#472 is tracking the problems, so we'll just keep an eye on it and uncomment browsers as they start working. - Adds a `BROWSER` environment variable, read by our wtr config. Makes it easy to pick the browsers from the commandline. You can specify Sauce ones like `SAUCE_USERNAME=polymer-devs SAUCE_ACCESS_KEY=<redacted> BROWSERS="sauce:Windows 10/firefox@68" npm test`, Playwright ones like `BROWSERS=chromium,firefox npm test`, or the same set we run in CI with `BROWSERS=preset:sauce npm test`.
I'm experimenting with running tests in a single page using iframes (web component tester did this too). This keeps the encapsulation intact and avoids the overhead I'm seeing with selenium jumping between tabs. I'm not sure if browsers execute iframes on a separate thread, but that would retain some of the concurrency too. It also avoids some rendering issues I was seeing where tests that rely on layout/rendering were timing out because unfocused tabs are deprioritized. This isn't an issue with puppeteer or playwright though. It seems to speed up the tests on preact and lit-html repositories, going to do some more testing. Hope to wrap this up soon! |
@LarsDenBakker this is fantastic news! Thank you so much for working on this 🙌 |
I've enabled the new iframe mode by default. This makes the tests much more stable and faster, as mentioned above. As a side effect, because we're no longer switching tabs, we don't suffer from the Edge and Firefox issues in saucelabs mentioned above. There are all the browser configurations that I've tested to be working (and now run in a CI for us): https://github.com/modernweb-dev/example-projects/blob/master/saucelabs/web-test-runner.config.mjs#L33 Other browsers errors look like errors on saucelabs side, but let me know if you think otherwise. I also reworked the concurrency mode of the test runner itself. Before we were booting up all browsers at once, which is a problem when testing in remote browsers. Now there is a new Locally you probably don't want to set For preact testing on the latest chrome, firefox and edge it takes 100sec. For lit-html testing on firefox 68, chrome latest-3 and safari takes 43sec (2x for dev and prod tests). This is with For IE11 and other browsers that don't use modules there are test failures on both projects. This might be because of conflicting polyfills, we will make this configurable (#659). Let me know if there are other issues on these browsers. |
Did anyone manage to get iPhone Simulator working in Sauce Labs? I just realised my above example might be wrong. This is what I previously got working with Karma: 'sl-ios-12': {
base: 'SauceLabs',
browserName: 'iphone',
platform: 'OS X 10.13',
version: '12.2'
},
'sl-ios-13': {
base: 'SauceLabs',
browserName: 'iphone',
platform: 'iPhone X Simulator',
version: '13.0'
} But when I try the above combinations with WTR, there is an error:
UPD: the above config is valid for |
Enables the new iframe mode (see modernweb-dev/web#472 (comment)). This drops the sauce test time from ~7m30s to ~3m40s! Also adds npm run nuke command to bump all dependencies in all packages.
I will close this issue since we have a basic functioning version now. If anyone finds any bugs or has new feature requests - please open new issues :) @web-padawan if you find anything actionable from your investigations into the iPhone simulator, let me know |
Thanks for the great work here! |
It would be great to have a Sauce Labs launcher similar to the Browserstack launcher.
The text was updated successfully, but these errors were encountered: