-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
44 lines (40 loc) · 1.4 KB
/
Copy pathplaywright.config.ts
File metadata and controls
44 lines (40 loc) · 1.4 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
import { defineConfig, devices } from "@playwright/test";
import { E2E_PORT, E2E_BASE_URL, E2E_DATA_DIR } from "./tests/e2e/constants";
/**
* Web e2e config. Boots the PRODUCTION server (`pnpm build` → `node server.ts`)
* pointed at a seeded, isolated COMPENDUS_DATA_DIR, then drives it with Chromium.
* Mirrors what ships, and is hermetic enough to run identically on CI.
*
* Run: `pnpm test:e2e` (add `--ui` locally to debug).
*/
export default defineConfig({
testDir: "./tests/e2e",
testMatch: "**/*.spec.ts",
// Shared seeded DB → keep it serial + single-worker for deterministic state.
fullyParallel: false,
workers: 1,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
reporter: process.env.CI ? [["list"], ["html", { open: "never" }]] : "list",
globalSetup: "./tests/e2e/global-setup.ts",
use: {
baseURL: E2E_BASE_URL,
trace: "on-first-retry",
screenshot: "only-on-failure",
},
projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }],
webServer: {
command: "pnpm build && node --import tsx server.ts",
url: E2E_BASE_URL,
// Generous: the command does a full prod build (RSC + worker) before serving.
timeout: 300_000,
reuseExistingServer: !process.env.CI,
stdout: "pipe",
stderr: "pipe",
env: {
COMPENDUS_DATA_DIR: E2E_DATA_DIR,
PORT: String(E2E_PORT),
NODE_ENV: "production",
},
},
});