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 kit package tests in WebKit #4918

Closed
wants to merge 12 commits into from
Closed

Conversation

mrienstra
Copy link

Run tests in WebKit, in addition to Chrome (existing behavior).

This builds on #4847, which was (seemingly) inspired by #4065.

According to Statcounter Global Stats (used by Can I use), Safari currently has a global browser market share of 19.16%, second only to Chrome (64.34%). Additionally, all iPhone browsers are powered by WebKit, and iOS has a global mobile OS market share of 27.68%, second only to Android (71.59%).

Thus, it would be worthwhile to know if future changes to this repo cause tests to fail when using WebKit. Thanks to #4847 (mentioned above), they are passing at the moment.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. All changesets should be patch until SvelteKit 1.0

Run tests in WebKit, in addition the Chrome
@changeset-bot
Copy link

changeset-bot bot commented May 14, 2022

⚠️ No Changeset found

Latest commit: 774a1d3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@mrienstra
Copy link
Author

mrienstra commented May 14, 2022

Failing tests:
Mac: browserType.launch: Executable doesn't exist at /Users/runner/Library/Caches/ms-playwright/chromium-1000/chrome-mac/Chromium.app/Contents/MacOS/Chromium
Windows: browserType.launch: Executable doesn't exist at C:\Users\runneradmin\AppData\Local\ms-playwright\chromium-1000\chrome-win\chrome.exe
Ubuntu 16: browserType.launch: Executable doesn't exist at /home/runner/.cache/ms-playwright/chromium-1000/chrome-linux/chrome

Not sure how best to recreate these errors locally.

[Edit: resolved by 0f66814]

... Rather than using `deviceDescriptors`. Let's see if this fixes failing tests.
... and removed unused `device` definition, should've been removed in the previous commit
@mrienstra
Copy link
Author

@timothycohen, any thoughts?

@timothycohen
Copy link
Contributor

I agree WebKit should be added to the config. I omitted it from the PR because it adds ~800 tests, and I wanted to first check if the core maintainers had decided to omit it purposefully, or if it simply hadn't been added during the switch to Playwright.

I used the same config when testing other than the nested use object 👍

 	projects: [
 		{
-			name: `${process.env.DEV ? 'dev' : 'build'}+js`,
+			name: `${process.env.DEV ? 'dev' : 'build'}+js+chromium`,
 			use: {
 				javaScriptEnabled: true
 			}
 		},
 		{
-			name: `${process.env.DEV ? 'dev' : 'build'}-js`,
+			name: `${process.env.DEV ? 'dev' : 'build'}-js+chromium`,
 			use: {
 				javaScriptEnabled: false
 			}
+		},
+		{
+			name: `${process.env.DEV ? 'dev' : 'build'}+js+webkit`,
+			use: {
+				javaScriptEnabled: true,
+				browserName: 'webkit'
+			}
+		},
+		{
+			name: `${process.env.DEV ? 'dev' : 'build'}-js+webkit`,
+			use: {
+				javaScriptEnabled: false,
+				browserName: 'webkit'
+			}
 		}
 	],

... Byproduct of rushed refactor
Not sure what the magic combo is to use Chrome instead of Chromium, while also running WebKit.
@mrienstra
Copy link
Author

other than the nested use object

Whoops, sloppy refactor, fixed!

Huh, but that exposes another problem -- it tries to apply channel: 'chrome', to WebKit. I tried a few variations before that worked locally, I'll try some more and see if I can get them to pass CI.

@mrienstra
Copy link
Author

Latest failing tests:

16, ubuntu-latest

@sveltejs/kit:test:   5 failed
@sveltejs/kit:test:     [dev-js_webkit] › test/test.js:4:1 › amp is true
@sveltejs/kit:test:     [dev-js_webkit] › test/test.js:18:1 › styles are applied
@sveltejs/kit:test:     [dev-js_webkit] › test/test.js:36:1 › prints validation errors
@sveltejs/kit:test:     [dev-js_webkit] › test/test.js:52:1 › sets origin
@sveltejs/kit:test:     [dev-js_webkit] › test/test.js:62:1 › only includes CSS for rendered components

16, macOS-latest

@sveltejs/kit:test:   1 failed
@sveltejs/kit:test:     [dev+js_webkit] › test/test.js:229:2 › Scrolling › scroll is restored after hitting the back button for an in-app cross-document navigation 

16, windows-2019

@sveltejs/kit:test:   4 failed
@sveltejs/kit:test:     [dev-js_webkit] › test\test.js:4:1 › amp is true
@sveltejs/kit:test:     [dev-js_webkit] › test\test.js:18:1 › styles are applied
@sveltejs/kit:test:     [dev-js_webkit] › test\test.js:36:1 › prints validation errors
@sveltejs/kit:test:     [dev-js_webkit] › test\test.js:52:1 › sets origin
@sveltejs/kit:test:   1 flaky
@sveltejs/kit:test:     [dev-js_webkit] › test\test.js:62:1 › only includes CSS for rendered components

18, ubuntu-latest

@sveltejs/kit:test:   5 failed
@sveltejs/kit:test:     [dev-js_webkit] › test/test.js:4:1 › amp is true
@sveltejs/kit:test:     [dev-js_webkit] › test/test.js:18:1 › styles are applied
@sveltejs/kit:test:     [dev-js_webkit] › test/test.js:36:1 › prints validation errors
@sveltejs/kit:test:     [dev-js_webkit] › test/test.js:52:1 › sets origin
@sveltejs/kit:test:     [dev-js_webkit] › test/test.js:62:1 › only includes CSS for rendered components

@mrienstra
Copy link
Author

FYI: Addition of pnpm exec playwright install --with-deps to build script in packages/kit/package.json is probably temporary, seems like the desired setup is preinstalled browsers. Just needed a way to test WebKit in CI to see where it's at.

@mrienstra
Copy link
Author

Running this locally (macOS), seems flaky (different tests failing on different runs), which is interesting, that wasn't the case before. Did a bunch of runs (10?), at first it was alternating between A & B (1 failing at a time), then it switched to B & C failing together on the same run, that now seems to be stable.

A:

    [dev+js_webkit] › test/test.js:1765:2 › $app/stores › navigating store clears after aborted navigation

B:

    [build+js_webkit] › test/test.js:295:2 › Scrolling › scroll positions are recovered on reloading the page 

C:

    [dev+js_webkit] › test/test.js:1595:2 › Page options › disables router if router=false

@mrienstra
Copy link
Author

Summary of latest CI failures:

16, ubuntu-latest:

5 failed
  [dev-js_webkit] › test/test.js:4:1 › amp is true
  [dev-js_webkit] › test/test.js:18:1 › styles are applied
  [dev-js_webkit] › test/test.js:36:1 › prints validation errors
  [dev-js_webkit] › test/test.js:52:1 › sets origin
  [dev-js_webkit] › test/test.js:62:1 › only includes CSS for rendered components

16, macOS-latest:

1 failed
  [dev+js_webkit] › test/test.js:229:2 › Scrolling › scroll is restored after hitting the back button for an in-app cross-document navigation

16, windows-2019:

4 failed
  [dev-js_webkit] › test\test.js:4:1 › amp is true
  [dev-js_webkit] › test\test.js:18:1 › styles are applied
  [dev-js_webkit] › test\test.js:36:1 › prints validation errors
  [dev-js_webkit] › test\test.js:52:1 › sets origin

18, ubuntu-latest:

5 failed
  [dev-js_webkit] › test/test.js:4:1 › amp is true
  [dev-js_webkit] › test/test.js:18:1 › styles are applied
  [dev-js_webkit] › test/test.js:36:1 › prints validation errors
  [dev-js_webkit] › test/test.js:52:1 › sets origin
  [dev-js_webkit] › test/test.js:62:1 › only includes CSS for rendered components

@mrienstra mrienstra marked this pull request as draft May 15, 2022 17:54
@Rich-Harris
Copy link
Member

Thank you — there's also #5058 (admittedly a more recent PR) which adds Firefox and Safari, and does so in a way that they can run be separate (i.e. concurrent) CI tasks. So I think this PR should be closed in favour of that one — have I got that right?

@Rich-Harris
Copy link
Member

Merged #5058, so I'll close this — thanks

@Rich-Harris Rich-Harris closed this Jul 8, 2022
@mrienstra mrienstra deleted the patch-1 branch July 19, 2022 18:18
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.

None yet

3 participants