-
-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
78 lines (77 loc) · 2.26 KB
/
playwright.config.ts
File metadata and controls
78 lines (77 loc) · 2.26 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
import { defineConfig, devices } from '@playwright/test'
export default defineConfig({
testDir: './test/e2e',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0, // Reduced retries
workers: process.env.CI ? 2 : 4, // Increased parallel workers
timeout: 20000, // Reduced from default 30s
reporter: process.env.CI ? [
['html'],
['list'],
['github'],
] : [
['html'],
['list'],
],
use: {
// Prefer explicit IPv4 loopback to avoid environments where `localhost`
// resolves to IPv6 (::1) but the app only listens on 127.0.0.1.
baseURL: 'http://127.0.0.1:20000',
trace: 'retain-on-failure', // Only on failure, not first retry
screenshot: 'only-on-failure',
video: 'retain-on-failure',
headless: true,
viewport: { width: 1280, height: 720 },
ignoreHTTPSErrors: true,
actionTimeout: 10000, // Reduced from 15s
navigationTimeout: 20000, // Reduced from 30s
serviceWorkers: 'allow', // Enable service worker support for PWA testing
},
// Optimized browser projects - focus on Chrome for speed
projects: [
{
name: 'desktop',
use: {
...devices['Desktop Chrome'],
viewport: { width: 1280, height: 720 },
},
},
{
name: 'mobile',
use: {
...devices['Pixel 5'],
viewport: { width: 393, height: 851 },
},
},
// Run Safari tests only in CI or when specifically needed
...(process.env.RUN_SAFARI ? [
{
name: 'desktop-safari',
use: {
...devices['Desktop Safari'],
viewport: { width: 1280, height: 720 },
},
},
{
name: 'mobile-safari',
use: {
...devices['iPhone 13'],
viewport: { width: 390, height: 844 },
},
},
] : []),
],
webServer: {
// Keep a long-lived process so Playwright's webServer harness doesn't fail
// with "exited early" when the app is already running (e.g. via Docker).
command: 'bash -lc "curl -fsS http://127.0.0.1:20000/api/ping >/dev/null && tail -f /dev/null"',
url: 'http://127.0.0.1:20000',
reuseExistingServer: true,
timeout: 5000, // Reduced timeout
},
outputDir: 'test-results/',
expect: {
timeout: 5000, // Reduced from 10s
},
})