-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
33 lines (31 loc) · 1.11 KB
/
Copy pathplaywright.config.ts
File metadata and controls
33 lines (31 loc) · 1.11 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
import { defineConfig, devices } from "@playwright/test";
import { readFileSync } from "node:fs";
const pkg = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8")) as {
name: string;
};
const appName = pkg.name;
const PORT = Number(process.env["PLAYWRIGHT_PORT"] ?? 4173);
const baseURL = `http://localhost:${PORT}/${appName}/`;
export default defineConfig({
testDir: "./tests/e2e",
timeout: 30_000,
expect: { timeout: 5_000 },
fullyParallel: false,
reporter: process.env["CI"] ? "list" : [["list"], ["json", { outputFile: "test-results.json" }]],
use: {
baseURL,
trace: "retain-on-failure",
screenshot: "only-on-failure",
actionTimeout: 5_000,
navigationTimeout: 10_000,
},
webServer: {
// Build (cheap when up-to-date) + preview, so tests always run against
// the current source — never a stale docs/.
command: `npm run build && npx vite preview --host 127.0.0.1 --port ${PORT} --strictPort`,
url: baseURL,
reuseExistingServer: !process.env["CI"],
timeout: 60_000,
},
projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }],
});