Repository navigation
Expand file tree
/
Copy pathplaywright.config.js
More file actions
63 lines (60 loc) · 2.04 KB
/
Copy pathplaywright.config.js
File metadata and controls
63 lines (60 loc) · 2.04 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
// @ts-check
const { defineConfig } = require('@playwright/test');
const fs = require('fs');
// In some environments (CI sandboxes, offline containers) Playwright can't
// download its managed browsers. If a system Chromium is available, use it.
const SYSTEM_CHROMIUM = ['/usr/bin/chromium', '/usr/bin/chromium-browser'].find((p) => fs.existsSync(p));
const PORT = Number(process.env.PW_PORT || (process.env.CI ? 4173 : 4174));
module.exports = defineConfig({
testDir: './e2e',
timeout: 30_000,
expect: { timeout: 8_000 },
fullyParallel: false,
// Tests share a single in-memory session map + reset endpoint; run one worker for deterministic e2e.
workers: 1,
retries: process.env.CI ? 1 : 0,
projects: [
{
name: 'chromium',
use: {
browserName: 'chromium',
...(SYSTEM_CHROMIUM
? {
launchOptions: {
executablePath: SYSTEM_CHROMIUM,
args: ['--no-sandbox']
}
}
: {})
}
}
],
use: {
// Use IPv6 loopback explicitly; on this machine, 127.0.0.1 may be proxied.
baseURL: `http://[::1]:${PORT}`,
trace: 'on-first-retry'
},
webServer: {
// Use `exec` so the node process replaces the shell. This helps Playwright
// reliably terminate the server across environments.
command: 'exec node server/index.js',
url: `http://[::1]:${PORT}/api/health`,
// Always start/stop the server for deterministic local + CI runs.
reuseExistingServer: false,
env: {
NODE_ENV: 'test',
PORT: String(PORT),
TEST_RESET_TOKEN: 'test-reset',
ADMIN_TOKEN: 'test-admin',
// Force deterministic non-Privy test mode, even if host env has Privy creds.
ENABLE_PRIVY_IN_TEST: '0',
PRIVY_APP_ID: '',
PRIVY_CLIENT_ID: '',
PRIVY_APP_SECRET: '',
PRIVY_PUBLIC_CONFIG_JSON: '{}',
START_PAGE_ENABLED: '0',
// Avoid modifying tracked data/store.json during e2e runs.
STORE_PATH: require('path').join(process.cwd(), 'data', 'store.e2e.sqlite')
}
}
});