-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
65 lines (64 loc) · 2.11 KB
/
Copy pathplaywright.config.ts
File metadata and controls
65 lines (64 loc) · 2.11 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
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests/e2e',
testMatch: '**/*.spec.ts',
snapshotPathTemplate: 'tests/e2e/__screenshots__/{projectName}/{testFileName}/{arg}{ext}',
fullyParallel: true,
workers: 4,
// Locally a failure should surface at once; CI keeps retries for flakes.
retries: process.env.CI ? 2 : 0,
reporter: [['html', { open: 'never' }], ['list']],
// Tests run in 3-6s against a built app; this is headroom, not a wait budget.
timeout: 60_000,
expect: {
toHaveScreenshot: { maxDiffPixelRatio: 0.01 },
},
use: {
baseURL: 'http://127.0.0.1:4175',
storageState: 'tests/e2e/.auth/state-4175.json',
trace: 'on-first-retry',
// Sheets skip their entrance animation here, so a click cannot land mid-slide.
reducedMotion: 'reduce',
},
projects: [
{
name: 'setup',
testMatch: /global\.setup\.ts/,
teardown: 'teardown',
retries: 0,
},
{
name: 'teardown',
testMatch: /global\.teardown\.ts/,
},
// touch.spec.ts drives page.touchscreen, which throws unless hasTouch is set.
{
name: 'desktop',
dependencies: ['setup'],
testIgnore: /touch\.spec\.ts/,
use: { ...devices['Desktop Chrome'], viewport: { width: 1280, height: 800 } },
},
{
name: 'mobile',
dependencies: ['setup'],
testIgnore: /touch\.spec\.ts/,
use: { ...devices['Desktop Chrome'], viewport: { width: 390, height: 844 } },
},
// hasTouch + isMobile: covers long-press, swipe-to-dismiss and tap targets,
// which the `mobile` project (a viewport-narrowed desktop) cannot reach.
{
name: 'touch',
dependencies: ['setup'],
testMatch: ['**/touch.spec.ts', '**/permalink-jump.spec.ts'],
use: { ...devices['Pixel 7'] },
},
],
webServer: {
// Test the production build.
command: 'pnpm run build && pnpm exec vite preview --host 127.0.0.1 --port 4175 --strictPort',
url: 'http://127.0.0.1:4175',
reuseExistingServer: false,
timeout: 180_000,
env: { NODE_OPTIONS: '--max-old-space-size=8192' },
},
});