-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.static.config.ts
More file actions
61 lines (56 loc) · 1.77 KB
/
playwright.static.config.ts
File metadata and controls
61 lines (56 loc) · 1.77 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
import { defineConfig, devices } from '@playwright/test'
const PORT = Number(process.env.PLAYWRIGHT_STATIC_PORT ?? '4173')
const RAW_BASE_PATH = process.env.TRAVELBACK_BASE_PATH ?? process.env.STATIC_BASE_PATH ?? '/travelback'
function normalizeBasePath(value: string): string {
if (!value || value === '/') return ''
const trimmed = value.trim().replace(/^\/+/, '').replace(/\/+$/, '')
return trimmed ? `/${trimmed}` : ''
}
const BASE_PATH = normalizeBasePath(RAW_BASE_PATH)
const BASE_URL_PATH = BASE_PATH ? `${BASE_PATH}/` : '/'
const SERVER_BASE_PATH_ARG = BASE_PATH || '/'
if (!Number.isInteger(PORT) || PORT <= 0) {
throw new Error(`Invalid PLAYWRIGHT_STATIC_PORT: ${process.env.PLAYWRIGHT_STATIC_PORT ?? '4173'}`)
}
export default defineConfig({
testDir: './e2e',
timeout: 120_000,
expect: { timeout: 30_000 },
fullyParallel: false,
retries: 1,
workers: 1,
reporter: 'html',
use: {
baseURL: `http://localhost:${PORT}${BASE_URL_PATH}`,
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
actionTimeout: 15_000,
locale: 'en-US',
},
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
launchOptions: {
args: [
'--enable-features=SharedArrayBuffer',
'--enable-experimental-web-platform-features',
'--use-gl=angle',
'--use-angle=swiftshader',
'--enable-webgl',
'--ignore-gpu-blocklist',
'--disable-gpu-sandbox',
],
},
},
},
],
webServer: {
command: `node scripts/serve-static.mjs --port ${PORT} --base-path ${SERVER_BASE_PATH_ARG}`,
url: `http://localhost:${PORT}${BASE_URL_PATH}`,
reuseExistingServer: false,
timeout: 60_000,
},
})