Skip to content

Commit 6c10427

Browse files
committed
add e2e
1 parent 85f9b14 commit 6c10427

File tree

5 files changed

+148
-4
lines changed

5 files changed

+148
-4
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,7 @@ storybook-static
7272

7373
# claude
7474
.claude/settings.local.json
75+
76+
# playwright
77+
testing/e2e/.output/
78+
testing/e2e/playwright/.cache/

pnpm-lock.yaml

Lines changed: 57 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

testing/e2e/package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "@opendatacapture/test",
3+
"type": "module",
4+
"version": "0.0.0",
5+
"private": true,
6+
"scripts": {
7+
"lint": "tsc && eslint --fix .",
8+
"test": "env-cmd -f ../../.env playwright test",
9+
"test:dev": "playwright test --ui"
10+
},
11+
"dependencies": {
12+
"@douglasneuroinformatics/libjs": "catalog:",
13+
"@opendatacapture/schemas": "workspace:*",
14+
"@playwright/test": "^1.51.1"
15+
}
16+
}

testing/e2e/playwright.config.ts

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import * as path from 'node:path';
2+
3+
import { parseNumber } from '@douglasneuroinformatics/libjs';
4+
import { defineConfig, devices } from '@playwright/test';
5+
6+
const API_PORT = parseNumber(process.env.API_DEV_SERVER_PORT);
7+
const WEB_PORT = parseNumber(process.env.WEB_DEV_SERVER_PORT);
8+
9+
export default defineConfig({
10+
fullyParallel: true,
11+
outputDir: path.resolve(import.meta.dirname, '.output/results'),
12+
projects: [
13+
{
14+
name: 'Global Setup',
15+
teardown: 'Global Teardown',
16+
testMatch: '**/global/global.setup.spec.ts'
17+
},
18+
{
19+
name: 'Global Teardown',
20+
testMatch: '**/global/global.teardown.spec.ts'
21+
},
22+
{
23+
dependencies: ['Global Setup'],
24+
name: 'Desktop Chrome',
25+
testIgnore: '**/global/**',
26+
use: { ...devices['Desktop Chrome'] }
27+
},
28+
{
29+
dependencies: ['Global Setup'],
30+
name: 'Desktop Firefox',
31+
testIgnore: '**/global/**',
32+
use: { ...devices['Desktop Firefox'] }
33+
},
34+
{
35+
dependencies: ['Global Setup'],
36+
name: 'Desktop Safari',
37+
testIgnore: '**/global/**',
38+
use: { ...devices['Desktop Safari'] }
39+
}
40+
],
41+
reporter: [['html', { open: 'never', outputFolder: path.resolve(import.meta.dirname, '.output/report') }]],
42+
testDir: path.resolve(import.meta.dirname, 'src'),
43+
use: {
44+
baseURL: `http://localhost:${WEB_PORT}`,
45+
trace: 'on-first-retry'
46+
},
47+
webServer: [
48+
{
49+
command: 'pnpm dev:test',
50+
cwd: path.resolve(import.meta.dirname, '../../apps/api'),
51+
gracefulShutdown: {
52+
signal: 'SIGINT',
53+
timeout: 1000
54+
},
55+
url: `http://localhost:${API_PORT}`
56+
},
57+
{
58+
command: 'pnpm dev:test',
59+
cwd: path.resolve(import.meta.dirname, '../../apps/web'),
60+
gracefulShutdown: {
61+
signal: 'SIGINT',
62+
timeout: 1000
63+
},
64+
url: `http://localhost:${WEB_PORT}`
65+
}
66+
]
67+
});

testing/e2e/tsconfig.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": ["../../tsconfig.base.json"],
3+
"include": ["src/**/*", "playwright.config.ts"]
4+
}

0 commit comments

Comments
 (0)