From ec789703ea196486766fa11f618ee89b4831db2b Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 16 May 2026 20:46:07 +0000 Subject: [PATCH] [AI] Apply VRT threshold to electron config and drop redundant local override MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove `maxDiffPixels: 5` from `toMatchThemeScreenshots` — it duplicates the global config and obscured the fact that per-call options would override the global threshold if added there too. - Mirror the threshold in desktop-electron's playwright config so its VRT screenshots are subject to the same sensitivity. - Tighten the threshold comment: drop the PR/task reference per AGENTS.md and the worked-example numbers; keep the formula and the low-alpha rationale. --- packages/desktop-client/e2e/fixtures.ts | 1 - packages/desktop-client/playwright.config.ts | 13 ++++++------- packages/desktop-electron/playwright.config.ts | 3 ++- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/desktop-client/e2e/fixtures.ts b/packages/desktop-client/e2e/fixtures.ts index bb4018b797..ae358db36e 100644 --- a/packages/desktop-client/e2e/fixtures.ts +++ b/packages/desktop-client/e2e/fixtures.ts @@ -63,7 +63,6 @@ export const expect = baseExpect.extend({ const config = { mask: [target.locator('[data-vrt-mask="true"]')], - maxDiffPixels: 5, }; const page: Page = 'page' in target ? target.page() : target; diff --git a/packages/desktop-client/playwright.config.ts b/packages/desktop-client/playwright.config.ts index 3edb29655d..b75999a362 100644 --- a/packages/desktop-client/playwright.config.ts +++ b/packages/desktop-client/playwright.config.ts @@ -26,13 +26,12 @@ export default defineConfig({ // until layout provides width/height, and that can take >5s. Bumping // to 10s lets those assertions settle without per-test overrides. timeout: 10_000, - // `threshold` is pixelmatch's per-pixel YIQ-delta cutoff: a pixel only - // counts toward `maxDiffPixels` if its delta exceeds 35215 * threshold². - // Playwright's default (0.2 → cutoff 1408) silently swallows faint - // overlays — e.g. striping the transactions table with rgba(…, .15) - // produces deltas of ~270–320, so VRT reported 0 diff pixels and passed - // (PR #7841). Drop to 0.05 (cutoff ~88) so low-alpha tints are flagged - // while still leaving headroom for anti-aliasing noise. + // `threshold` is pixelmatch's per-pixel YIQ-delta cutoff — a pixel + // counts toward `maxDiffPixels` only if its delta exceeds + // 35215 * threshold². Playwright's 0.2 default lets faint color + // overlays (e.g. rgba(…, .15) row striping) slip through with 0 + // reported diff pixels; 0.05 catches them while staying above + // anti-aliasing noise. toHaveScreenshot: { maxDiffPixels: 5, threshold: 0.05 }, }, webServer: process.env.E2E_START_URL diff --git a/packages/desktop-electron/playwright.config.ts b/packages/desktop-electron/playwright.config.ts index fb47467858..03bd545bf3 100644 --- a/packages/desktop-electron/playwright.config.ts +++ b/packages/desktop-electron/playwright.config.ts @@ -16,7 +16,8 @@ export default defineConfig({ ignoreHTTPSErrors: true, }, expect: { - toHaveScreenshot: { maxDiffPixels: 5 }, + // See desktop-client playwright.config.ts for the threshold rationale. + toHaveScreenshot: { maxDiffPixels: 5, threshold: 0.05 }, timeout: 60000, // 60 seconds }, });