tests: dark-mode spec diffs against a per-engine light-mode reference

CI firefox read 0.228 header diff against the Chromium reference while its own
dark and light renders were pixel-identical — pure Firefox-vs-Chromium AA, not
a theme leak. Add the firefox light render as wizard-04-finish-headless-firefox.png
and pick the reference by browserName.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LvvARNMxQrq17vogn3REMU
This commit is contained in:
Gergő Törcsvári 2026-08-28 23:24:20 +02:00
commit c666a37f51
No known key found for this signature in database
GPG key ID: 8E75F2CDE64E5322
3 changed files with 15 additions and 3 deletions

View file

@ -1,5 +1,5 @@
import { test, expect } from './fixtures';
import { compareToReference, hideCursor, PCBNEW_REFERENCE, PCBNEW_HEADER_REGION } from './utils/screenshot-compare';
import { compareToReference, hideCursor, pcbnewReferenceFor, PCBNEW_HEADER_REGION } from './utils/screenshot-compare';
import { waitForEditorReady, shotPath } from '../e2e/utils/element-tracker';
/**
@ -27,7 +27,7 @@ test.use({
});
test.describe('PCBnew dark-mode browser', () => {
test('toolbar icons render the light theme under a dark-mode browser', async ({ page }) => {
test('toolbar icons render the light theme under a dark-mode browser', async ({ page, browserName }) => {
await page.goto('/kicad/pcbnew.html');
// Sanity-check the browser really reports dark mode to the app.
@ -43,7 +43,7 @@ test.describe('PCBnew dark-mode browser', () => {
scale: 'css'
});
const reference = await compareToReference(page, cssScreenshot, PCBNEW_REFERENCE, PCBNEW_HEADER_REGION);
const reference = await compareToReference(page, cssScreenshot, pcbnewReferenceFor(browserName), PCBNEW_HEADER_REGION);
expect(reference.actualWidth).toBe(reference.referenceWidth);
expect(reference.actualHeight).toBe(reference.referenceHeight);

View file

@ -38,6 +38,18 @@ export type ReferenceComparison = {
* spec with ENOENT once see the baselines-to-R2 migration).
*/
export const PCBNEW_REFERENCE = path.resolve(__dirname, '../../wizard-04-finish-headless.png');
/**
* Firefox rasterizes the toolbar text/icon edges differently enough from
* Chromium that the Chromium reference reads ~0.23 header diff on the CI
* firefox leg (2026-08-28, pure AA the firefox dark and light renders were
* pixel-identical), so each engine diffs against its own light-mode render.
* Both files are spec-owned and committed, like PCBNEW_REFERENCE.
*/
export const PCBNEW_REFERENCE_FIREFOX = path.resolve(__dirname, '../../wizard-04-finish-headless-firefox.png');
export function pcbnewReferenceFor(browserName: string): string {
return browserName === 'firefox' ? PCBNEW_REFERENCE_FIREFOX : PCBNEW_REFERENCE;
}
export const PCBNEW_HEADER_REGION: ReferenceRegion = {
// maxDiffRatio counts every pixel differing by >16 in any channel, so it is dominated
// by sub-pixel/anti-aliasing differences along text and icon edges. Those vary with the

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB