import { describe, expect, it } from "vitest"; import visualConfig from "../../playwright.visual.config.ts"; // 11-03. Measured on this template's goldens: undoing the UI-04 fix changed // 1,146 px of the wide shell, and the compact golden drifted 175 px from the // code without failing. A 0.2% share of the image allowed 2,592 px on the // wide shell, 985 px on the compact shell and 7,781 px on the platform // overview, so the allowance grew with the page instead of covering only // rasterization noise (VD-08 item 8). const SMALLEST_MEASURED_REGRESSION_PX = 175; describe("visual regression tolerance", () => { const screenshot = visualConfig.expect?.toHaveScreenshot; it("does not scale with the image size", () => { expect(screenshot?.maxDiffPixelRatio).toBeUndefined(); }); it("stays below the smallest real change measured", () => { expect(screenshot?.maxDiffPixels).toBeGreaterThanOrEqual(0); expect(screenshot?.maxDiffPixels).toBeLessThan( SMALLEST_MEASURED_REGRESSION_PX, ); }); });