Skip to content

Commit 76eaf11

Browse files
committed
Enhance web-test-runner configuration to support Playwright for multiple browsers, add coverage settings, and adjust test timeouts. Update GitHub Actions workflow to run tests using the new configuration.
1 parent 5c5f37b commit 76eaf11

File tree

2 files changed

+30
-12
lines changed

2 files changed

+30
-12
lines changed

.github/workflows/deployment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
npm install -D @playwright/test @web/test-runner-playwright
3535
npx playwright install --with-deps chromium firefox webkit
3636
- name: Run tests
37-
run: npm test
37+
run: npx web-test-runner --config web-test-runner.config.mjs
3838
test_win:
3939
name: "Windows"
4040
runs-on: windows-latest
@@ -53,7 +53,7 @@ jobs:
5353
npm install -D @playwright/test @web/test-runner-playwright
5454
npx playwright install --with-deps chromium firefox webkit
5555
- name: Run tests
56-
run: npm test
56+
run: npx web-test-runner --config web-test-runner.config.mjs
5757
tag:
5858
name: "Publishing release"
5959
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'

web-test-runner.config.mjs

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
1+
import { playwrightLauncher } from '@web/test-runner-playwright';
2+
13
export default {
2-
files: 'test/**/*.test.js',
3-
nodeResolve: true,
4-
middleware: [
5-
function rewriteBase(context, next) {
6-
if (context.url.indexOf('/base') === 0) {
7-
context.url = context.url.replace('/base', '')
8-
}
9-
return next();
10-
}
11-
]
4+
files: 'test/**/*.test.js',
5+
nodeResolve: true,
6+
coverage: true,
7+
browsers: [
8+
playwrightLauncher({ product: 'chromium' }),
9+
playwrightLauncher({ product: 'firefox' }),
10+
playwrightLauncher({ product: 'webkit' })
11+
],
12+
testFramework: {
13+
config: {
14+
timeout: '60000',
15+
},
16+
},
17+
browserStartTimeout: 60000,
18+
testsStartTimeout: 60000,
19+
testsFinishTimeout: 60000,
20+
coverageConfig: {
21+
include: ['src/**/*.js'],
22+
exclude: ['test/**/*.js', 'demo/**/*.js'],
23+
threshold: {
24+
statements: 80,
25+
branches: 80,
26+
functions: 80,
27+
lines: 80
28+
}
29+
}
1230
};

0 commit comments

Comments
 (0)