-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
68 lines (63 loc) · 1.82 KB
/
playwright.config.ts
File metadata and controls
68 lines (63 loc) · 1.82 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
65
66
67
68
import { defineConfig, devices } from '@playwright/test';
import { readFileSync } from 'fs';
import { resolve } from 'path';
// Load VERITAS_ADMIN_KEY from server/.env so E2E tests use the same key as the server
if (!process.env.VERITAS_ADMIN_KEY) {
try {
const envContent = readFileSync(resolve(__dirname, 'server', '.env'), 'utf-8');
const match = envContent.match(/^VERITAS_ADMIN_KEY=(.+)$/m);
if (match) {
process.env.VERITAS_ADMIN_KEY = match[1].trim();
}
} catch {
// server/.env not found — fall through to default
}
}
/**
* Playwright E2E test configuration for Veritas Kanban.
*
* Expects the dev server to be running:
* - Vite dev server on http://localhost:3000 (serves frontend, proxies API)
* - Express API server on http://localhost:3001
*
* Start with: pnpm dev
*/
export default defineConfig({
testDir: './e2e',
fullyParallel: false, // Run sequentially — tests may share board state
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: 1,
reporter: process.env.CI ? 'github' : 'html',
timeout: 30_000,
use: {
baseURL: 'http://localhost:3000',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
// Auth — read admin key from server/.env (loaded via dotenv above)
extraHTTPHeaders: {
'X-API-Key': process.env.VERITAS_ADMIN_KEY || 'dev-admin-key',
},
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
/* Run dev servers before starting tests (if not already running) */
webServer: [
{
command: 'pnpm --filter server dev',
port: 3001,
reuseExistingServer: true,
timeout: 15_000,
},
{
command: 'pnpm --filter web dev',
url: 'http://localhost:3000',
reuseExistingServer: true,
timeout: 15_000,
},
],
});