-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
84 lines (72 loc) · 2.45 KB
/
Copy pathplaywright.config.ts
File metadata and controls
84 lines (72 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { defineConfig, devices } from '@playwright/test'
/**
* De-Complexify UI Verification Harness.
*
* Captures screenshots + a11y tree + network HAR + console logs for core flows.
* Used to verify M2 refactors (Redux kill, MUI kill, flow context consolidation)
* don't break observable UI behavior.
*
* Usage:
* # Start API + UI dev servers first, then:
* npx playwright test # all flows, all viewports
* npx playwright test e2e/flows/home.spec.ts # single flow
* npx playwright test --project=mobile # mobile only
*
* Auth: global-setup.ts hits /dev/test-session on the API to get a JWT,
* saved as storageState so all tests are pre-authenticated (skips passkey).
*/
const API_BASE = process.env.API_BASE_URL || 'http://localhost:5000'
const UI_BASE = process.env.UI_BASE_URL || 'http://localhost:3000'
export default defineConfig({
testDir: './e2e/flows',
outputDir: './e2e/__results__',
snapshotDir: './e2e/__snapshots__',
snapshotPathTemplate: '{snapshotDir}/{testFilePath}/{arg}-{projectName}{ext}',
/* Serial — flows depend on seeded state */
fullyParallel: false,
workers: 1,
retries: 1,
/* Generous timeout — dev server + mobile compilation can be slow */
timeout: 120_000,
expect: {
timeout: 15_000,
toHaveScreenshot: {
maxDiffPixelRatio: 0.01,
},
},
globalSetup: './e2e/global-setup.ts',
reporter: [['html', { open: 'never', outputFolder: './e2e/__report__' }], ['list']],
use: {
baseURL: UI_BASE,
storageState: './e2e/.auth/storage-state.json',
trace: 'retain-on-failure',
video: 'off',
screenshot: 'off', // manual screenshots at each step
},
projects: [
// Mobile first — Peanut is a mobile-first PWA.
// Uses Chromium with mobile viewport + mobile user agent so we get
// mobile rendering without needing WebKit system deps.
{
name: 'mobile',
use: {
...devices['Pixel 7'],
viewport: { width: 390, height: 844 },
isMobile: true,
hasTouch: true,
},
},
{
name: 'desktop',
use: {
viewport: { width: 1440, height: 900 },
},
},
],
webServer: {
command: 'npm run dev',
url: UI_BASE,
reuseExistingServer: true,
timeout: 120_000,
},
})