-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
80 lines (76 loc) · 2.49 KB
/
Copy pathplaywright.config.ts
File metadata and controls
80 lines (76 loc) · 2.49 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
69
70
71
72
73
74
75
76
77
78
79
80
import { defineConfig } from "@playwright/test";
// Allow self-signed certs when running e2e against a TLS-enabled dev server.
// e2e-isolated.sh unsets TLS_CERT so this only fires for manual TLS test runs.
if (process.env.TLS_CERT) {
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
}
const devPort = process.env.E2E_PORT ?? "8788";
const protocol = process.env.TLS_CERT ? "https" : "http";
const baseURL = `${protocol}://127.0.0.1:${devPort}`;
const databaseUrl =
process.env.DATABASE_URL ??
"postgres://dispatch:[email protected]:5433/dispatch_dev";
const mediaRoot =
process.env.MEDIA_ROOT ?? `${process.env.HOME}/.dispatch/media-dev`;
const agentRuntime =
process.env.DISPATCH_AGENT_RUNTIME === "tmux" ? "tmux" : "inert";
// Tests that mutate global settings, create agents via UI, or have explicit
// serial constraints. These run after the parallel suite with a single worker.
const serialTests = [
"e2e/settings.spec.ts",
"e2e/jobs-api.spec.ts",
"e2e/agent-crud.spec.ts",
"e2e/terminal-live.spec.ts",
"e2e/persona-recheck-ui.spec.ts",
"e2e/mobile-layout.spec.ts",
"e2e/media-sidebar.spec.ts",
];
export default defineConfig({
testDir: "./e2e",
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
reporter: "list",
use: {
baseURL,
headless: true,
ignoreHTTPSErrors: true,
screenshot: "only-on-failure",
trace: "retain-on-failure",
extraHTTPHeaders: {},
},
webServer: {
// `start` runs the server without `bun --watch`. Watch mode is actively
// harmful here: `prepare:runtime-assets` (run by test/check/build/start)
// unconditionally rewrites apps/server/src/generated/runtime-assets.js,
// which is inside the watched tree. Any concurrent pnpm task therefore
// restarted the server mid-run and surfaced as `socket hang up` on
// whatever request was in flight. E2E never needs hot reload.
command: process.env.E2E_SKIP_WEB_BUILD
? "pnpm run start"
: "pnpm run build:web && pnpm run start",
env: {
DATABASE_URL: databaseUrl,
DISPATCH_PORT: devPort,
MEDIA_ROOT: mediaRoot,
DISPATCH_AGENT_RUNTIME: agentRuntime,
},
url: `${baseURL}/api/v1/health`,
reuseExistingServer: false,
timeout: 60_000,
},
projects: [
{
name: "parallel",
testIgnore: serialTests,
fullyParallel: false,
workers: 4,
},
{
name: "serial",
testMatch: serialTests,
fullyParallel: false,
workers: 1,
dependencies: ["parallel"],
},
],
});