Repository navigation
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
90 lines (88 loc) · 2.36 KB
/
Copy pathplaywright.config.ts
File metadata and controls
90 lines (88 loc) · 2.36 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
import { defineConfig, devices } from '@playwright/test';
import { existsSync } from 'node:fs';
import { homedir } from 'node:os';
import { join } from 'node:path';
const baseURL = process.env.BASE_URL || 'http://127.0.0.1:4322';
const windowsChromium = join(
homedir(),
'AppData/Local/ms-playwright/chromium-1228/chrome-win64/chrome.exe',
);
const chromiumExecutable =
process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE ||
(process.platform === 'win32' && existsSync(windowsChromium)
? windowsChromium
: undefined);
const browserSmoke =
/@smoke|@matrix|@keyboard|@preferences|@privacy|@profile|@motion/;
export default defineConfig({
testDir: './tests',
testMatch: 'site.spec.ts',
timeout: 60_000,
expect: { timeout: 10_000 },
fullyParallel: true,
forbidOnly: Boolean(process.env.CI),
retries: 0,
workers: process.env.CI ? 2 : 1,
outputDir: 'artifacts/final/test-results',
reporter: [
['list'],
['json', { outputFile: 'artifacts/final/playwright-results.json' }],
[
'html',
{ outputFolder: 'artifacts/final/playwright-report', open: 'never' },
],
],
use: {
baseURL,
viewport: { width: 1440, height: 1000 },
colorScheme: 'light',
reducedMotion: 'no-preference',
actionTimeout: 10_000,
navigationTimeout: 30_000,
screenshot: 'only-on-failure',
trace: 'retain-on-failure',
video: 'off',
},
projects: [
{
name: 'chromium',
grepInvert: /@windows-native/,
use: {
...devices['Desktop Chrome'],
viewport: { width: 1440, height: 1000 },
launchOptions: chromiumExecutable
? { executablePath: chromiumExecutable }
: {},
},
},
{
name: 'firefox',
grep: browserSmoke,
grepInvert: /@windows-native/,
use: {
...devices['Desktop Firefox'],
viewport: { width: 1440, height: 1000 },
},
},
{
name: 'webkit',
grep: browserSmoke,
use: {
...devices['Desktop Safari'],
viewport: { width: 1440, height: 1000 },
},
},
],
webServer:
process.env.PLAYWRIGHT_NO_SERVER === '1'
? undefined
: {
command:
process.env.PLAYWRIGHT_WEB_SERVER_COMMAND || 'npm run preview',
url: baseURL,
reuseExistingServer: true,
timeout: 120_000,
stdout: 'pipe',
stderr: 'pipe',
},
});