agentleFS
CaduS0uzaCaduS0uza/qa-supreme/skills/visual-regression/SKILL.md

visual-regression

Skill1 starsChanged 2 months agoMITView on GitHub

Catch unintended UI changes with deterministic screenshot baselines and review discipline — masking dynamic regions, freezing animations, pinning viewport and fonts, and triaging diffs. Use when asked about visual testing, UI regressions, pixel diffs, or after a CSS/design-system change.

7 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Update deliberately: npx playwright test --update-snapshots, then read the diff images in the PR.

    line 34

“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Visual Regression

Visual tests fail for two reasons: the UI changed, or your screenshots are not deterministic. The entire craft is eliminating the second so the first is trustworthy.

Determinism checklist (before your first baseline)

  • Fixed viewport and deviceScaleFactor. Never rely on the CI machine's default.
  • Fonts loaded and settled: await document.fonts.ready.
  • Animations and transitions disabled; caret hidden.
  • Dynamic regions masked: clocks, relative timestamps, avatars, ads, random IDs, charts with live data. mask: [page.getByTestId('updated-at')].
  • Seeded, frozen data — same rows, same order, fixed clock.
  • One OS/browser per baseline. Baselines from macOS never match Linux CI: generate them in CI.

Skipping any of these produces a suite that cries wolf and gets muted within a week.

Playwright (built in, no service required)

await expect(page).toHaveScreenshot('checkout.png', {
  maxDiffPixelRatio: 0.01,
  mask: [page.getByTestId('order-id'), page.getByRole('time')],
  animations: 'disabled',
  fullPage: true,
})

Update deliberately: npx playwright test --update-snapshots, then read the diff images in the PR. A baseline updated without review is a bug promoted to expected behavior.

What to baseline

Baseline components and key states, not every page: the design-system gallery, the empty state, the error state, the loaded state, the mobile breakpoint of each. Whole-page shots of data-heavy screens are the classic maintenance sink.

Triage of a diff

DiffAction
Intended design changeupdate baseline in the same PR as the CSS change, reviewer approves both
Unintended layout shiftbug — file it, do not update
Anti-aliasing / 1px noiseraise maxDiffPixelRatio slightly, or mask; never disable the test
Different every runthe determinism checklist was skipped — go back to it

Runner integration

node runner/bin/qa-supreme.mjs visual --url <url> stores a baseline per discovered state on the first run and compares afterwards with pixelmatch, writing a *.diff.png next to the current shot and reporting the exact pixel count. Animations are frozen and the HUD is hidden, so instrumentation never enters the frame.

The default threshold is 0.1% of pixels (visual.threshold: 0.001). That is deliberate: a changed headline is roughly 0.1%, so the looser bars people copy from byte-comparison tools pass real regressions silently. If your app has genuinely noisy regions, mask them rather than raising the threshold — a raised threshold hides every small regression, not just the noisy one.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.