Repository navigation
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
64 lines (61 loc) · 2.53 KB
/
Copy pathplaywright.config.ts
File metadata and controls
64 lines (61 loc) · 2.53 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
import { defineConfig, devices } from '@playwright/test'
import {
annotatedVideoUseOption,
shouldRecordAnnotatedVideo,
} from './scripts/dev/playwright-annotated-video.mjs'
const FIXTURE_PORT = Number(process.env.PLAYWRIGHT_WEB_PORT ?? 5179)
const FIXTURE_BASE_URL = `http://localhost:${FIXTURE_PORT}`
const peerWebUrl = process.env.HAPI_PEER_WEB_URL?.replace(/\/$/, '')
const usePeerStack = Boolean(peerWebUrl)
const baseURL = peerWebUrl ?? FIXTURE_BASE_URL
export default defineConfig({
testDir: './e2e',
// Peer-stack specs need HAPI_PEER_* (set by run-e2e-on-peer-stack.mjs).
// Fixture-only runs must not pick them up accidentally.
testIgnore: usePeerStack ? [] : ['**/peer/**'],
timeout: usePeerStack ? 60_000 : 30_000,
expect: { timeout: usePeerStack ? 10_000 : 5_000 },
fullyParallel: false,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
workers: 1,
reporter: process.env.CI ? [['list'], ['html', { open: 'never' }]] : 'list',
use: {
baseURL,
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
// When video is on it MUST be annotated (pointer + action overlay).
// Raw `video: 'on'` is a kill-criterion — humans cannot see the click.
video: shouldRecordAnnotatedVideo()
? annotatedVideoUseOption('on', usePeerStack ? { width: 1440, height: 900 } : undefined)
: 'off',
},
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
launchOptions: {
// The CI runner and most sandboxed dev environments
// run as root or under restricted user namespaces;
// without --no-sandbox chromium silently exits 0 a
// few seconds after launch and the page handshake
// times out. Keep the flag scoped to launchOptions
// so this is the only place a future maintainer has
// to revisit if they harden the runner.
args: ['--no-sandbox', '--disable-dev-shm-usage'],
},
},
},
],
webServer: usePeerStack
? undefined
: {
command: `bun run --cwd web dev -- --port ${FIXTURE_PORT} --strictPort`,
url: `${FIXTURE_BASE_URL}/e2e-fixtures/scratchlist-fixture.html`,
timeout: 60_000,
reuseExistingServer: !process.env.CI,
stdout: 'ignore',
stderr: 'pipe',
},
})