-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
62 lines (60 loc) · 2.5 KB
/
Copy pathplaywright.config.ts
File metadata and controls
62 lines (60 loc) · 2.5 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
import { defineConfig, devices } from '@playwright/test'
const hasExplicitBaseUrl = Boolean(process.env.PLAYWRIGHT_BASE_URL)
const defaultPlaywrightPort = '3847'
const baseURL =
process.env.PLAYWRIGHT_BASE_URL ?? `http://127.0.0.1:${defaultPlaywrightPort}`
const webServerCommand = `npm run preview:e2e -- --port ${defaultPlaywrightPort}`
export default defineConfig({
testDir: './e2e',
// Vitest node-unit helpers live beside Playwright specs as
// `*.node.test.ts`; do not treat them as Playwright tests.
testIgnore: ['**/*.node.test.ts'],
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
// CI runs `validate`, which executes unit, MCP, and Playwright suites
// concurrently on one runner. The default 30s per-test budget flakes under
// that resource contention (page.goto alone has been observed taking >30s).
timeout: process.env.CI ? 60_000 : 30_000,
// Every worker hits the same local D1 file (`.wrangler/state/e2e`) through
// Wrangler and the `d1 execute` helpers. Parallel workers cause SQLITE_BUSY
// and transient 500s during auth/admin flows.
workers: 1,
reporter: process.env.CI ? 'github' : 'list',
use: {
baseURL,
trace: 'on-first-retry',
},
webServer: {
command: webServerCommand,
url: baseURL,
// Startup (client build + D1 migrations + Wrangler boot) competes with
// the parallel unit test workers at the beginning of `validate`, and the
// default 60s budget times out on 4-core CI runners.
timeout: process.env.CI ? 180_000 : 60_000,
reuseExistingServer: hasExplicitBaseUrl,
env: {
CLOUDFLARE_ENV: 'test',
// Fatal wrangler exits land here; CI uploads this directory on E2E
// failure (see validate.yml + e2e/web-server-liveness.ts).
WRANGLER_LOG_PATH: './logs.local',
// Keep wrangler's default incoming-body drain. Setting
// WRANGLER_DISABLE_REQUEST_BODY_DRAINING=true recreates the
// workers-sdk#5106 ProxyWorker "Network connection lost" race on
// POST /auth and other JSON posts; wrangler 4.114+ then exits
// instead of recovering (workers-sdk#14926).
// Wrangler 4.118+ enables local observability capture by default in
// `wrangler dev`. The extra collector/tail services have crashed the
// Playwright webServer mid-suite here; opt out for e2e stability.
X_LOCAL_OBSERVABILITY: 'false',
// Reduce ProxyWorker "Network connection lost" flakes under e2e load.
WRANGLER_CI_DISABLE_CONFIG_WATCHING: 'true',
},
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
})