-
Notifications
You must be signed in to change notification settings - Fork 233
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
58 lines (57 loc) · 1.95 KB
/
playwright.config.ts
File metadata and controls
58 lines (57 loc) · 1.95 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
import { defineConfig, devices } from "@playwright/test";
export default defineConfig({
testDir: "./tests/e2e",
// Exclude the screenshot generation spec from default runs.
// It writes examples/*/grid-cell.png as a side effect and is meant to be
// invoked only via `npm run generate:screenshots` (which sets
// GENERATE_SCREENSHOTS=1 to bypass this ignore).
testIgnore: process.env.GENERATE_SCREENSHOTS
? []
: ["**/generate-grid-screenshots.spec.ts"],
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 2 : 16, // Parallel execution now works with factory pattern
timeout: 30000, // 30s per test
reporter: process.env.CI ? "list" : "html",
// Use platform-agnostic snapshot names (no -darwin/-linux suffix)
snapshotPathTemplate:
"{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}{ext}",
use: {
baseURL: "http://localhost:8080",
trace: "on-first-retry",
screenshot: "only-on-failure",
},
projects: [
{
name: "chromium",
use: {
...devices["Desktop Chrome"],
// Use default Chromium everywhere for consistent screenshot rendering
// Run `npm run test:e2e:docker` locally for CI-identical results
},
},
],
// Run examples server before tests
// Supports EXAMPLE=<folder> env var to run a single example (e.g., EXAMPLE=say-server npm run test:e2e)
webServer: {
command: "npm run examples:start",
url: "http://localhost:8080",
// Always start fresh servers to avoid stale state issues
reuseExistingServer: false,
// 3 minutes to allow uv to download Python dependencies on first run
timeout: 180000,
// Pass through EXAMPLE env var to filter to a single server
env: {
...process.env,
EXAMPLE: process.env.EXAMPLE ?? "",
},
},
// Snapshot configuration
expect: {
toHaveScreenshot: {
maxDiffPixelRatio: 0.06,
animations: "disabled",
},
},
});