Repository navigation
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
66 lines (57 loc) · 2.18 KB
/
Copy pathplaywright.config.ts
File metadata and controls
66 lines (57 loc) · 2.18 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
import { defineConfig, devices } from "@playwright/test";
// Set by `npm run e2e:docker` — the suite runs against the real dockerized
// backend (with PLAYWRIGHT_SKIP_WEBSERVER + its own PLAYWRIGHT_BASE_URL)
// instead of page.route() stubs. See e2e/README.md.
const IS_REAL_API = process.env.E2E_REAL_API === "true";
// Override for a pre-running server (typically together with PLAYWRIGHT_SKIP_WEBSERVER).
const BASE_URL = process.env.PLAYWRIGHT_BASE_URL ?? "http://localhost:5173";
const IS_CI = !!process.env.CI;
const REUSE_EXISTING_SERVER = process.env.PLAYWRIGHT_REUSE_EXISTING_SERVER === "true";
export default defineConfig({
testDir: "./e2e",
testMatch: /.*\.spec\.ts$/,
timeout: 30_000,
expect: { timeout: 10_000 },
fullyParallel: true,
forbidOnly: IS_CI,
retries: IS_CI ? 2 : 0,
// Real mode: the sqlite-backed test gateway chokes on too many concurrent real logins.
workers: IS_REAL_API ? 2 : IS_CI ? 2 : undefined,
reporter: IS_CI
? [["github"], ["html", { open: "never", outputFolder: "playwright-report" }], ["list"]]
: [["list"], ["html", { open: "on-failure", outputFolder: "playwright-report" }]],
outputDir: "./test-results",
use: {
baseURL: BASE_URL,
// e2e:docker:tls points BASE_URL at the self-signed https://localhost:8443
// stack. Covers both the browser and Playwright's own `request` context;
// stays off for every existing http:// mode.
ignoreHTTPSErrors: BASE_URL.startsWith("https"),
trace: "on-first-retry",
screenshot: "only-on-failure",
video: "retain-on-failure",
actionTimeout: 10_000,
navigationTimeout: 15_000,
extraHTTPHeaders: {
// Identify Playwright traffic in dev-server logs.
"X-Playwright": "1",
},
},
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
],
// e2e:docker sets PLAYWRIGHT_SKIP_WEBSERVER — it points at the already-running docker stack instead.
webServer: process.env.PLAYWRIGHT_SKIP_WEBSERVER
? undefined
: {
command: "npm run dev:e2e",
url: BASE_URL,
reuseExistingServer: REUSE_EXISTING_SERVER,
timeout: 120_000,
stdout: "pipe",
stderr: "pipe",
},
});