-
Notifications
You must be signed in to change notification settings - Fork 370
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
51 lines (46 loc) · 1.38 KB
/
Copy pathplaywright.config.ts
File metadata and controls
51 lines (46 loc) · 1.38 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
import {defineConfig, devices} from "@playwright/test";
export default defineConfig({
testDir: "./e2e",
snapshotDir: "./e2e/snapshots/reference",
// CI (Linux) writes/reads a single shared baseline; local non-Linux runs
// get their own per-platform files so font/anti-aliasing diffs don't fail
// local e2e and don't overwrite the committed Linux baseline.
snapshotPathTemplate:
process.env.CI || process.platform === "linux"
? "{snapshotDir}/{testFilePath}-snapshots/{arg}-{projectName}{ext}"
: "{snapshotDir}/{testFilePath}-snapshots/{arg}-{projectName}-{platform}{ext}",
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: "html",
// Screenshot comparison settings
expect: {
toHaveScreenshot: {
maxDiffPixels: 100,
threshold: 0.2,
// Higher quality snapshots
scale: "css",
animations: "disabled",
},
},
use: {
baseURL: "http://localhost:3000",
trace: "on-first-retry",
screenshot: "only-on-failure",
},
projects: [
{
name: "chromium",
use: {...devices["Desktop Chrome"]},
},
],
webServer: process.env.CI
? undefined
: {
command: "npm run build && npx serve dist -l 3000",
url: "http://localhost:3000",
reuseExistingServer: true,
timeout: 120000,
},
});