Skip to content

Commit 3c98e08

Browse files
test: add playwright suite.
1 parent 6e7eb54 commit 3c98e08

9 files changed

Lines changed: 1442 additions & 7 deletions

File tree

.github/workflows/playwright.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Playwright
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'src/**'
9+
- 'package-lock.json'
10+
pull_request:
11+
branches:
12+
- main
13+
workflow_dispatch:
14+
15+
jobs:
16+
e2e:
17+
name: E2E (Playwright)
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 25
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v6.0.1
24+
25+
- name: Setup Node
26+
uses: actions/setup-node@v6.2.0
27+
with:
28+
node-version: '24.14.0'
29+
30+
- name: Install Dependencies
31+
run: npm ci
32+
33+
- name: Check Types
34+
run: npm run check-types
35+
36+
- name: Lint Playwright Files
37+
run: npm run lint:playwright
38+
39+
- name: Install Browsers
40+
run: npx playwright install --with-deps chromium webkit
41+
42+
- name: Run Playwright Tests
43+
env:
44+
CI: 'true'
45+
run: npm run test:e2e
46+
47+
- name: Upload Playwright report
48+
uses: actions/upload-artifact@v6.0.0
49+
if: ${{ failure() }}
50+
with:
51+
name: playwright-report
52+
path: playwright-report
53+
if-no-files-found: ignore
54+
55+
- name: Upload Playwright test results
56+
uses: actions/upload-artifact@v6.0.0
57+
if: ${{ failure() }}
58+
with:
59+
name: test-results
60+
path: test-results
61+
if-no-files-found: ignore

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
node_modules
2-
dist
2+
dist
3+
playwright-report
4+
test-results

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,22 @@ npm run dev
2222

2323
Then open the URL printed by the dev server (it should open `src/index.html`).
2424

25+
## End-to-end tests
26+
27+
Run local Playwright tests (Chromium):
28+
29+
```bash
30+
npm run test:e2e
31+
```
32+
33+
Run locally with headed browser:
34+
35+
```bash
36+
npm run test:e2e:headed
37+
```
38+
39+
CI runs Playwright on Chromium and WebKit.
40+
2541
## Notes
2642

2743
- This is currently a development playground, not a stable product.

eslint.config.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import playwright from 'eslint-plugin-playwright'
2+
import tsParser from '@typescript-eslint/parser'
3+
4+
const playwrightConfig = playwright.configs['flat/recommended']
5+
6+
export default [
7+
{
8+
ignores: [
9+
'dist/**',
10+
'coverage/**',
11+
'node_modules/**',
12+
'playwright-report/**',
13+
'test-results/**',
14+
],
15+
},
16+
{
17+
files: ['playwright/**/*.{ts,tsx,js,jsx}', 'playwright.config.ts'],
18+
languageOptions: {
19+
parser: tsParser,
20+
sourceType: 'module',
21+
ecmaVersion: 'latest',
22+
},
23+
},
24+
{
25+
...playwrightConfig,
26+
files: ['playwright/**/*.{ts,tsx,js,jsx}'],
27+
},
28+
]

0 commit comments

Comments
 (0)