-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
chore: refactor e2e tests to playwright #5080
base: master
Are you sure you want to change the base?
Changes from 63 commits
69e21f1
9a1b7e7
e690789
f371ae6
512e9ef
c451168
aa8ebcc
764d300
b508045
3882b7b
a7adbfa
124d006
17d8da7
8b6536d
d753fb5
b2e867f
c76af2d
35b555e
9957ee3
46d2120
a163664
9b11e01
6ae0b39
7f54b1e
72905b7
fb4534c
69fbd95
a9f7e90
c5804d1
44730ee
ed26d7a
e2b6f79
ed33c1d
01975fd
c35a665
6e32b09
0f6d526
c6866ce
4a434cf
b24cac0
391243b
ba581f1
f2b5215
b004d29
ac7e66f
efed0ab
194efc8
2422c38
a1db5bb
8b5a432
770dfcf
b712f5d
ca440a7
0198183
451c63e
fa2f080
fc79cef
be142a2
94c0398
ad847ec
2b9a487
222d64c
ad6e3e0
a19f9a8
f710750
5cd5658
1b662b8
5542e00
d2de702
2194b0e
297028b
6fa543c
3a9d14b
c3a2f7c
ae857cd
42aad22
73db1e0
ea20ee7
dacc639
c87f84f
73c7b04
0aba203
c4233e1
bf11adb
76a469e
b184afe
3da63fe
2296ca0
81cd13e
ec5fa86
965ea9f
f0a9f89
480b502
f53c614
215fb24
540c07b
77dd4ea
b1dd12c
0ecb064
f1cb666
375665a
c3f7b16
ab7cf84
ef8a227
954904b
92f6156
c85de43
999a8bd
7c1bee7
5f0de61
12799c6
c120892
5e91dd7
cf67985
45ec116
63670d9
64bb8ea
ee29b46
943e397
210ff8a
fc53905
bbb31a4
c5b9473
383bbc9
4b07fcc
5142e7a
8a9c533
1cd209d
9bc2602
e17e676
f1f47a5
77b6523
c8815ad
3dfe585
a7b204c
d7b92d8
fee0ba7
ef3f14c
a2632ae
176b747
24fc9f7
f4c7d08
6df1555
7a78abd
9e470b5
9998d51
ead0cf8
a6a9ceb
3f2f662
790a871
6b347ef
b101a6d
547f7db
3105fe8
78e4048
5e2391c
c42847a
ecb160a
c049129
d83e240
ff50b55
02bd9e0
e54f61e
80bf569
5a37b5d
1c0b48f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -12,6 +12,18 @@ on: | |||||||||
- next | ||||||||||
- v4 | ||||||||||
|
||||||||||
workflow_call: | ||||||||||
inputs: | ||||||||||
update-snapshots: | ||||||||||
description: "Update snapshots?" | ||||||||||
type: boolean | ||||||||||
|
||||||||||
workflow_dispatch: | ||||||||||
inputs: | ||||||||||
update-snapshots: | ||||||||||
description: "Update snapshots?" | ||||||||||
type: boolean | ||||||||||
|
||||||||||
permissions: | ||||||||||
contents: read | ||||||||||
|
||||||||||
|
@@ -67,6 +79,7 @@ jobs: | |||||||||
name: Test - ${{ matrix.os }} - Node v${{ matrix.node-version }}, Webpack ${{ matrix.webpack-version }} (${{ matrix.shard }}) | ||||||||||
|
||||||||||
strategy: | ||||||||||
fail-fast: false | ||||||||||
matrix: | ||||||||||
os: [ubuntu-latest, windows-latest, macos-latest] | ||||||||||
node-version: [18.x, 20.x, 22.x] | ||||||||||
|
@@ -97,12 +110,6 @@ jobs: | |||||||||
node ./scripts/prepare-test-for-old-node.js | ||||||||||
if: matrix.node-version == '18.x' | ||||||||||
|
||||||||||
- name: Setup firefox | ||||||||||
if: matrix.os != 'windows-latest' | ||||||||||
uses: browser-actions/setup-firefox@latest | ||||||||||
with: | ||||||||||
firefox-version: latest | ||||||||||
|
||||||||||
- name: Link webpack-dev-server | ||||||||||
run: | | ||||||||||
cp -R client tmp-client | ||||||||||
|
@@ -119,6 +126,24 @@ jobs: | |||||||||
run: npm run test:coverage -- --ci --shard=${{ matrix.shard }} | ||||||||||
if: matrix.node-version != '18.x' | ||||||||||
|
||||||||||
- name: Install Playwright browsers and dependencies | ||||||||||
run: npx playwright install --with-deps | ||||||||||
|
||||||||||
- name: Set up cache | ||||||||||
id: cache | ||||||||||
uses: actions/cache@v4 | ||||||||||
with: | ||||||||||
key: cache/${{github.repository}}/${{github.ref}} | ||||||||||
restore-keys: cache/${{github.repository}}/refs/heads/master | ||||||||||
path: .test/** | ||||||||||
|
||||||||||
- name: Initialize snapshots | ||||||||||
if: ${{steps.cache.outputs.cache-hit != 'true' || inputs.update-snapshots == 'true'}} | ||||||||||
run: npx playwright test --update-snapshots | ||||||||||
|
||||||||||
- name: Run E2E tests for webpack version ${{ matrix.webpack-version }} | ||||||||||
run: npm run test:e2e | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the steps at line 121 and 125, also this should be:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. after removing update snapshot step, it still does not work as expected. I'm not sure but I'll try to set a specific folder for snaps. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I set a specific folder for tests and now its working. |
||||||||||
|
||||||||||
- name: Submit coverage data to codecov | ||||||||||
uses: codecov/codecov-action@v4 | ||||||||||
with: | ||||||||||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -41,6 +41,7 @@ | |||||
"test:coverage": "npm run test:only -- --coverage", | ||||||
"test:watch": "npm run test:coverage --watch", | ||||||
"test": "npm run test:coverage", | ||||||
"test:e2e": "npx playwright test", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
"pretest": "npm run lint", | ||||||
"prepare": "husky && npm run build", | ||||||
"release": "standard-version" | ||||||
|
@@ -86,6 +87,7 @@ | |||||
"@babel/runtime": "^7.22.5", | ||||||
"@commitlint/cli": "^19.0.3", | ||||||
"@commitlint/config-conventional": "^19.0.3", | ||||||
"@playwright/test": "^1.44.0", | ||||||
"@types/compression": "^1.7.2", | ||||||
"@types/default-gateway": "^3.0.1", | ||||||
"@types/node": "^20.11.16", | ||||||
|
@@ -110,6 +112,7 @@ | |||||
"husky": "^9.0.10", | ||||||
"jest": "^29.5.0", | ||||||
"jest-environment-jsdom": "^29.5.0", | ||||||
"jest-mock": "^29.7.0", | ||||||
"klona": "^2.0.4", | ||||||
"less": "^4.1.1", | ||||||
"less-loader": "^12.1.0", | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"use strict"; | ||
|
||
module.exports = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally you use defineConfig + '// @ts-check' |
||
testIgnore: "**/*.ignore.*", | ||
testDir: "./test/e2e", | ||
outputDir: ".test/spec/output", | ||
snapshotPathTemplate: | ||
".test/spec/snaps/{projectName}/{testFilePath}/{arg}{ext}", | ||
fullyParallel: false, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally you enable fullyParallel - didn't it work with having it enabled? Might be a potential follow-up. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, it didn't work at first since we need to set ports, we planed to benefit from it later on. |
||
forbidOnly: process.env.CI !== "true", | ||
retries: process.env.CI ? 2 : 0, | ||
snitin315 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
workers: 1, | ||
reporter: process.env.CI ? "github" : "list", | ||
use: { | ||
trace: "on-first-retry", | ||
}, | ||
projects: [ | ||
{ | ||
name: "chromium", | ||
use: { | ||
browserName: "chromium", | ||
launchOptions: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you set |
||
args: ["--ignore-certificate-errors"], | ||
}, | ||
}, | ||
}, | ||
], | ||
}; |
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.
Let's not add this. Tests should ideally fail if snapshots are not in sync with the master branch, this would let user bypass failing CI.