-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
57 lines (56 loc) · 1.82 KB
/
playwright.config.ts
File metadata and controls
57 lines (56 loc) · 1.82 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
import { defineConfig, devices } from '@playwright/test';
/**
* Playwright config for visual regression testing.
*
* Screenshots a fixed set of Ladle stories and diffs them against
* committed baselines. This is the pixel-level safety net for refactors
* that must not change rendered output.
*
* Run:
* bun run test:visual # compare against baselines
* bun run test:visual:update # regenerate baselines
*/
export default defineConfig({
testDir: './e2e/visual',
snapshotDir: './e2e/visual/__screenshots__',
// Keep strict. Any pixel drift surfaces as a failure.
expect: {
toHaveScreenshot: {
// Individual pixels can drift ~2 units per channel on anti-aliased edges.
// maxDiffPixelRatio keeps that from flagging as a failure, but we want
// any structural change to fail. Start tight.
maxDiffPixelRatio: 0.001,
threshold: 0.1,
animations: 'disabled',
caret: 'hide',
},
},
// Run serially so the Ladle dev server and chart rendering are deterministic.
fullyParallel: false,
workers: 1,
// No retries — we want flakes to be loud, not hidden.
retries: 0,
reporter: [['list'], ['html', { open: 'never' }]],
use: {
baseURL: 'http://localhost:61000',
viewport: { width: 1280, height: 900 },
// Force a consistent device scale so baselines compare cleanly across machines.
deviceScaleFactor: 1,
colorScheme: 'light',
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'], deviceScaleFactor: 1 },
},
],
webServer: {
// Ladle dev server. Port pinned so baseURL above matches.
command: 'cd examples && BROWSER=none bunx ladle serve --port 61000',
url: 'http://localhost:61000',
reuseExistingServer: !process.env.CI,
timeout: 120_000,
stdout: 'ignore',
stderr: 'pipe',
},
});