-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
109 lines (105 loc) · 3.24 KB
/
Copy pathplaywright.config.ts
File metadata and controls
109 lines (105 loc) · 3.24 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import { defineConfig, devices } from '@playwright/test';
import { env } from './playwright/utils/env';
export const baseURL = env.baseURL;
const chromeArgs = [
'--ignore-certificate-errors',
'--start-maximized',
'--window-size=1920,1080',
'--disable-dev-shm-usage',
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-background-networking',
'--disable-client-side-phishing-detection',
'--disable-default-apps',
'--disable-extensions',
'--disable-popup-blocking',
'--disable-sync',
'--disable-translate',
'--no-first-run',
'--js-flags=--max-old-space-size=4096',
];
export default defineConfig({
expect: { timeout: 60_000 },
forbidOnly: !!process.env.CI,
fullyParallel: false,
outputDir: './playwright/test-results/artifacts',
/**
* Projects run in dependency order:
* 1. setup — logs in and saves auth state (single worker, must succeed before gating)
* 2. gating — all gating specs run in parallel after setup completes
*/
projects: [
{
fullyParallel: false,
name: 'setup',
testDir: './playwright/tests/setup',
use: {
...devices['Desktop Chrome'],
launchOptions: {
args: chromeArgs,
headless: !process.env.DEBUG_MODE && !process.env.HEADED,
},
viewport: { height: 1080, width: 1920 },
},
},
{
dependencies: ['setup'],
fullyParallel: false,
name: 'gating',
testDir: './playwright/tests/gating',
use: {
...devices['Desktop Chrome'],
launchOptions: {
args: chromeArgs,
headless: !process.env.DEBUG_MODE && !process.env.HEADED,
},
storageState: 'playwright/.auth/session.json',
viewport: { height: 1080, width: 1920 },
},
},
...(process.env.RUN_FEATURE_TESTS === 'true'
? [
{
dependencies: ['setup'],
fullyParallel: false,
name: 'features',
retries: 2,
testDir: './playwright/tests/features',
use: {
...devices['Desktop Chrome'],
launchOptions: {
args: chromeArgs,
headless: !process.env.DEBUG_MODE && !process.env.HEADED,
},
storageState: 'playwright/.auth/session.json',
viewport: { height: 1080, width: 1920 },
},
},
]
: []),
],
reporter: [
['list'],
['junit', { outputFile: './playwright/test-results/results.xml' }],
['html', { open: 'never', outputFolder: './playwright/test-results/html-report' }],
],
retries: process.env.CI ? 1 : 0,
timeout: 480 * 1000,
use: {
actionTimeout: 60_000,
baseURL,
headless: process.env.HEADLESS !== 'false',
ignoreHTTPSErrors: true,
navigationTimeout: 120_000,
screenshot: 'only-on-failure',
trace: 'retain-on-failure',
video: 'retain-on-failure',
viewport: { height: 1080, width: 1920 },
},
/**
* Number of parallel workers. Setup runs a single file so it naturally uses one
* worker regardless of this value. Gating spec files run across all workers.
* Override with the WORKERS env var (e.g. WORKERS=2 for resource-constrained envs).
*/
workers: process.env.WORKERS ? parseInt(process.env.WORKERS, 10) : 4,
});