test(e2e): give the visual gate an absolute pixel budget

`maxDiffPixelRatio: 0.01` allows 9,216 differing pixels on a 1280x720 baseline
— more than the area any single foreground token covers — so the gate could not
fail on the palette regression it was tightened for. Verified: swapping the
primary token from blue to green passed all 20 baselines before this change and
fails 6 of them after.

Both baselines and runs render in the pinned container, so the remaining noise
is glyph anti-aliasing; 200 pixels covers it with 20/20 still matching.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Sergey Kozyrenko
2026-07-24 13:13:16 +07:00
co-authored by Claude Opus 4.8
parent 7b1ecfdc77
commit 5cec81b860
+3 -1
View File
@@ -51,8 +51,10 @@ export default defineConfig<BackendOptions>({
// Playwright's default 0.2 so a one-step palette shift is caught, with a small
// maxDiffPixelRatio for anti-aliasing at glyph edges. cross/contrast.spec.ts still
// measures colour numerically as the belt-and-suspenders check.
// Absolute, not a ratio: 1% of a 1280x720 baseline is 9,216 pixels, more than any one foreground
// token covers, so a token could change hue with every baseline still matching.
expect: {
toHaveScreenshot: { maxDiffPixelRatio: 0.01, threshold: 0.02 },
toHaveScreenshot: { maxDiffPixels: 200, threshold: 0.02 },
},
forbidOnly: isCI,
fullyParallel: true,