-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.js
More file actions
62 lines (60 loc) · 2.35 KB
/
Copy pathplaywright.config.js
File metadata and controls
62 lines (60 loc) · 2.35 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
import { defineConfig, devices } from "@playwright/test";
const useWebServer = process.env.PW_NO_WEB_SERVER !== "1";
const useSystemChrome = process.env.PW_USE_SYSTEM_CHROME === "1";
const port = Number(process.env.PW_PORT ?? "8787");
const baseURL = process.env.PW_BASE_URL ?? `http://127.0.0.1:${port}`;
// PW_SKIP_BUILD=1 → skip `bun run build` in webServer.command.
// Set this in CI when dist/ is downloaded from a prior build job artifact
// so the e2e job tests the same dist/ the deploy job will ship.
// Locally, leave it unset so `bun run test:e2e` auto-builds first.
const skipBuild = process.env.PW_SKIP_BUILD === "1";
const buildPrefix = skipBuild ? "" : "bun run build && ";
export default defineConfig({
testDir: "./tests",
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: "html",
use: {
baseURL,
trace: "on-first-retry",
screenshot: "only-on-failure",
permissions: ["clipboard-read", "clipboard-write"],
},
projects: [
{
name: "chromium",
use: {
...devices["Desktop Chrome"],
launchOptions: {
args: ["--disable-gpu"],
// The chromium build this Playwright version resolves (1208) is
// corrupt on this machine — truncated extraction, missing framework
// dylib — which reads as "Executable doesn't exist" and looks like a
// blanket environment failure. A working headless shell (Chromium
// 151) is installed alongside it; point at it explicitly.
...(process.env.PW_CHROMIUM_PATH
? { executablePath: process.env.PW_CHROMIUM_PATH }
: {}),
},
...(useSystemChrome ? { channel: "chrome" } : {}),
},
},
],
...(useWebServer
? {
webServer: {
// NOTE: do not use --no-bundle; this Worker relies on bundling for module resolution.
// buildPrefix is empty when PW_SKIP_BUILD=1 (CI with artifact); otherwise `bun run build && `.
command: `${buildPrefix}bunx wrangler dev --local --no-live-reload --ip 127.0.0.1 --port ${port} --inspector-port 0 --log-level none`,
url: baseURL,
env: {
WRANGLER_LOG_PATH: ".wrangler/logs",
},
reuseExistingServer: !process.env.CI,
timeout: 600000,
},
}
: {}),
});