-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.js
More file actions
78 lines (77 loc) · 2.16 KB
/
playwright.config.js
File metadata and controls
78 lines (77 loc) · 2.16 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
// Playwright config with accessibility testing
// To run: npx playwright test
// To run accessibility only: npx playwright test --project=accessibility
// To run mobile only: npx playwright test --project=mobile
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests',
retries: process.env.CI ? 2 : 0,
// Longer timeout in CI due to slower GitHub Actions runners
timeout: process.env.CI ? 90000 : 60000,
// Run tests in parallel for better CI performance
fullyParallel: true,
// Single worker in CI to reduce resource contention on shared runners
workers: process.env.CI ? 1 : undefined,
expect: {
timeout: 10000,
},
use: {
baseURL: 'http://localhost:4321',
headless: true,
trace: 'on-first-retry',
navigationTimeout: 60000,
actionTimeout: 30000,
screenshot: 'only-on-failure',
video: 'retain-on-failure',
},
webServer: {
command: 'npm run build && npm run preview',
port: 4321,
reuseExistingServer: !process.env.CI,
timeout: 240000, // Allow 4 minutes for build + server startup in CI
stdout: 'pipe',
stderr: 'pipe',
},
projects: [
// Desktop Chrome
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
testMatch: /.*\.spec\.js/,
},
// Desktop Firefox
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
testMatch: /.*\.spec\.js/,
},
// Mobile Chrome (Android)
{
name: 'mobile',
use: { ...devices['Pixel 5'] },
testMatch: /.*\.spec\.js/,
},
// Mobile Safari (iOS)
{
name: 'mobile-safari',
use: { ...devices['iPhone 13'] },
testMatch: /.*\.spec\.js/,
},
// Accessibility tests (Chrome only for speed)
{
name: 'accessibility',
use: { ...devices['Desktop Chrome'] },
testMatch: /.*\.a11y\.js/,
},
// Accessibility tests - Mobile viewport
{
name: 'accessibility-mobile',
use: { ...devices['Pixel 5'] },
testMatch: /.*\.a11y\.js/,
},
],
// Reporter configuration
reporter: process.env.CI
? [['html', { open: 'never' }], ['github']]
: [['html', { open: 'on-failure' }]],
});