Repository navigation
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
49 lines (47 loc) · 2.16 KB
/
Copy pathplaywright.config.ts
File metadata and controls
49 lines (47 loc) · 2.16 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
import { defineConfig } from '@playwright/test';
const FRONTEND_URL = process.env.TEST_FRONTEND_URL ?? 'http://localhost:5173';
const BACKEND_URL = process.env.TEST_BACKEND_URL ?? 'http://localhost:5001';
const MAILPIT_URL = process.env.TEST_MAILPIT_URL ?? 'http://localhost:8025';
const TURNSTILE_BYPASS = process.env.TEST_TURNSTILE_BYPASS ?? 'dev-bypass';
export default defineConfig({
testDir: 'e2e/integration',
testMatch: /.*\.spec\.ts$/,
// `github` annotates the run; `html` is what the workflow uploads on failure.
reporter: process.env.CI ? [['github'], ['html', { open: 'never' }]] : 'html',
fullyParallel: false,
workers: 1,
// The `user` fixture signs up and activates an account before the test body runs, and
// activation waits on mail that the Cron host delivers asynchronously. That wait counts
// against the test's own budget, so the 30s default leaves too little for the test itself.
timeout: 60 * 1000,
retries: process.env.CI ? 1 : 0,
globalSetup: './e2e/integration/lib/global-setup.ts',
globalTeardown: './e2e/integration/lib/global-teardown.ts',
webServer: {
command: 'pnpm dev:integration',
url: FRONTEND_URL,
reuseExistingServer: !process.env.CI,
// Playwright's default is SIGKILL, which gives dev-integration.mjs no chance to stop the
// Testcontainers stack. The containers then keep their fixed host ports until Ryuk reaps
// them some seconds later, and a run started in that window fails on "port is already
// allocated". SIGTERM lets the script tear the stack down before it exits.
gracefulShutdown: { signal: 'SIGTERM', timeout: 30 * 1000 },
// Cold CI runs pull docker images and wait for healthchecks before Vite
// starts (see scripts/dev-integration.mjs). 10 minutes covers worst-case
// cold pulls on the GitHub-hosted runner.
timeout: 10 * 60 * 1000,
},
use: {
baseURL: FRONTEND_URL,
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
extraHTTPHeaders: { 'x-test-run': '1' },
},
metadata: {
frontendUrl: FRONTEND_URL,
backendUrl: BACKEND_URL,
mailpitUrl: MAILPIT_URL,
turnstileBypass: TURNSTILE_BYPASS,
},
});