-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
46 lines (42 loc) · 1.46 KB
/
Copy pathplaywright.config.ts
File metadata and controls
46 lines (42 loc) · 1.46 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
import { defineConfig, devices } from "@playwright/test";
// Allow overriding port/host; fall back to a higher, less contended port for local dev.
const port = process.env.PLAYWRIGHT_PORT || process.env.PORT || "4000";
const host = process.env.PLAYWRIGHT_HOST || "127.0.0.1";
const baseURL =
process.env.PLAYWRIGHT_BASE_URL || `http://${host}:${port}`;
// Default to auto-starting the dev server; set PLAYWRIGHT_START_SERVER=false to opt out.
const startServer = process.env.PLAYWRIGHT_START_SERVER !== "false";
// Default to mock verification endpoints during Playwright runs unless explicitly overridden
process.env.VERIFY_USE_MOCKS = process.env.VERIFY_USE_MOCKS ?? "true";
export default defineConfig({
testDir: "./tests/e2e",
// Only run Playwright specs (avoid picking up unit tests in tests/unit)
testMatch: /.*\.spec\.(ts|tsx|js)/,
retries: 0,
use: {
baseURL,
// Prefer system Chrome to avoid sandbox restrictions in some environments
channel: "chrome",
trace: "on-first-retry",
headless: true,
launchOptions: {
args: ["--no-sandbox"],
},
},
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
],
webServer: startServer
? {
command:
process.env.PLAYWRIGHT_WEB_SERVER_COMMAND ||
`npm run dev -- --hostname ${host} --port ${port}`,
url: baseURL,
reuseExistingServer: !process.env.CI,
timeout: 120_000,
}
: undefined,
});