| Filename | Latest commit message | Latest commit date |
|---|---|---|
The screenshot report went silent on green CI runs. CI runs four sequential
`playwright test` invocations (wx, asyncify, kicad, perf) that all default their
outputDir to `test-results`; Playwright clears the whole outputDir at the start
of every run, so each suite wiped the previous suite's screenshots. By the time
`compare` ran, only perf-*.json remained -> all 354 baselines read as "removed"
-> the no-render guard stayed silent.
- Gate Playwright's outputDir off test-results/ in CI only
(process.env.CI ? 'pw-artifacts/<suite>' : 'test-results') in the wx / asyncify
/ kicad configs, so the committed-baseline screenshots (page.screenshot to
'test-results/...') accumulate in test-results/ across the suites for compare.
Local single-suite behavior is unchanged.
- post-discord: replace the silent no-render guard with a loud, image-less
pipeline alert ("No screenshots produced this run") when 0 render; genuine
partial removals still post as the normal capped REMOVED list.
- gitignore pw-artifacts/; upload tests/pw-artifacts/** as a CI artifact.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
||
| .. | ||
| changelog.ts | ||
| compare.ts | ||
| config.ts | ||
| gen-manifest.ts | ||
| image-ops.ts | ||
| noise.ts | ||
| perf-report.ts | ||
| post-discord.ts | ||
| promote.ts | ||
| README.md | ||
Screenshot regression + Discord review tooling
One comparison engine + a churn-free updater + a Discord reporter for the e2e
screenshots. Design and rationale: ~/.claude/plans/…snowglobe.md (or ask).
Source of truth = CI's Linux render. The dev never authors baselines on the Mac (Mac fonts/GL ≠ CI). Instead, CI renders on every push; when a render change is intentional you promote CI's artifact into the committed baselines. The environment isn't pinned — if the host's Mesa/fonts drift, the gate lights up in Discord and you just re-promote (broad + low-intensity change ⇒ likely drift).
Files
config.ts— thresholds, baseline dirs, per-engine floors (calibrate!), clustering knobs.image-ops.ts— PNG load/save, pixelmatch diff (AA-excluded), connected-component boxes, triptych compositing, size-cap resize.compare.ts— the engine: classify baselines vstest-results/→test-results/screenshot-diff/report.json+ triptych/heatmap PNGs.--pairdiffs two files.promote.ts— churn-free updater: pull a CI run's shots (gh run download) or--from DIR; overwrite a baseline only when pixels differ beyond the floor (verbatim bytes, no re-encode) → no git churn.perf-report.ts— renders the track-only runtime-perf table (loadMs/openMs/FPS) with Δ vs the previous main run (fetched viagh).post-discord.ts— the always-on CI-on-main report: SHA + e2e status + perf table, then screenshot triptychs (batched, size-capped, flood-collapsed).changelog.ts— Discord trigger B: git-history diff of committed baseline PNGs (no build/GPU).noise.ts— calibration: diff two identical-input renders → per-engine noise floor.gen-manifest.ts— regeneratescreenshot-manifest.json(canonical name list + best-effort engine tag) by scanning the committed baselines + specs.
npm scripts (run from tests/)
npm run screenshots:check # gate: baselines vs test-results → report.json (exit 0; add --fail-on-change to gate)
npm run screenshots:promote -- --run <ci-run-id> # churn-free re-baseline from a CI run (or --from DIR)
npm run screenshots:report -- --e2e pass # post the CI report to Discord (main+push only; needs DISCORD_WEBHOOK_URL)
npm run screenshots:changelog # post the baseline changelog (main+push only)
npm run screenshots:noise -- run1/ run2/ # calibrate floors
npm run screenshots:manifest # regenerate the manifest (--check to verify it's fresh)
Activation checklist
screenshot-manifest.jsongenerated (name list authoritative; engine tags best-effort until calibration).scale:'device'→'css'normalized (no-op at CI's DSF=1).
- Add the
DISCORD_WEBHOOK_URLrepo secret — until then everything is inert. - Calibrate: run the suite twice in CI,
screenshots:noisethe two dirs, setFLOORSinconfig.ts. - First re-baseline:
promotea clean CI run's render, commit (expect a big, one-time chrome-font diff vs the Mac baselines). - Delete the old
scripts/{compare,update-baseline}-screenshots.sh. - Once floors are proven stable, flip the gate to
--fail-on-change.