Skip to content

ci: make /update-snapshots regenerate all baselines again - #456

Merged
mmcky merged 1 commit into
mainfrom
ci/update-snapshots-all-mode
Oct 9, 2026
Merged

mmcky merged 1 commit into
mainfrom
ci/update-snapshots-all-mode

Conversation

@mmcky

@mmcky mmcky commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

What was wrong

/update-snapshots is documented as "Regenerates all baselines", but the update-all-snapshots job runs npx playwright test --update-snapshots with no mode. Since Playwright 1.50 a bare --update-snapshots means changed, and this repo is on 1.61.1. In changed mode a screenshot that passes comparison, meaning it stays within maxDiffPixelRatio, is treated as matching and is not rewritten (handleMatching() in playwright/lib/matchers/expect.js). Only all rewrites a snapshot whose bytes differ from its baseline.

So a real visual change that stays within tolerance can't be captured with the bot. The summary comment then says the snapshots "came out identical to the existing baselines", which isn't true. The case that turned this up: since #453 the fixtures site no longer shows the toolbar's GitHub icon (the fixtures set no repository_url), but the change is within tolerance (3% for toolbar.png, 1% for full-page shots), so /update-snapshots would leave the baselines showing an icon the site no longer renders.

npm run test:visual:update, which tox -e visual-update uses for the local macOS baselines, has the same drift.

The change

  • update-snapshots.yml (update-all-snapshots job) and the test:visual:update npm script now pass --update-snapshots=all, with a comment in the workflow saying why the mode has to be explicit. all writes only snapshots whose new render differs byte-for-byte from the baseline, so baselines that render identically are left alone.
  • /update-new-snapshots already passes --update-snapshots=missing and is unchanged.
  • In all mode Playwright skips the comparison and writes only the new image to test-results/, so the snapshot-update-diff artifact no longer has before/after pairs. docs/developer/visual-testing.md, tests/visual/README.md and the summary comment now point to the PR's Files changed view, which shows each rewritten baseline before and after.
  • CHANGELOG entry under ### CI.

Needs merging before it can be used

GitHub runs the default branch's copy of this workflow on issue_comment, so the change only takes effect for /update-snapshots once it's on main. The snapshot refresh for the #453 toolbar change is the follow-up: after this merges, I'll comment /update-snapshots on that PR.

Verification

  • I read the toHaveScreenshot update path in the installed Playwright 1.61.1. A comparison that passes returns handleMatching() in changed mode. In all mode the expected image is not used for comparison, and the new render is written if its bytes differ.
  • pre-commit (check-yaml, check-json, whitespace hooks) passes.
  • Not run end to end: the workflow can't run from a PR branch for issue_comment, so the first real test is the follow-up refresh.

🤖 Generated with Claude Code

The update-all-snapshots job and npm run test:visual:update passed a
bare --update-snapshots. Since Playwright 1.50 that means "changed",
which only rewrites snapshots that fail comparison, so a real change
within maxDiffPixelRatio left the baselines untouched and the summary
comment reported them as identical. Pass --update-snapshots=all, which
rewrites every snapshot whose render differs, as the docs describe.

In "all" mode Playwright writes only the new image to test-results, so
the artifact no longer carries before/after pairs; point the docs and
the summary comment at the PR's Files changed view instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 9, 2026 02:12
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

@github-actions
github-actions Bot temporarily deployed to pull request October 9, 2026 02:13 Inactive
@codecov

codecov Bot commented Oct 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@11d4b12). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #456   +/-   ##
=======================================
  Coverage        ?   59.48%           
=======================================
  Files           ?        2           
  Lines           ?      548           
  Branches        ?        0           
=======================================
  Hits            ?      326           
  Misses          ?      222           
  Partials        ?        0           
Flag Coverage Δ
pytests 59.48% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

It is a minimal, well-understood one-flag correction applied consistently across the workflow, npm script, docs, and changelog, with no leftover inconsistencies or objective issues.

0 open findings

What changed in this PR

This PR fixes a behavioral drift in the visual-snapshot tooling. Since Playwright 1.50, a bare --update-snapshots means changed mode, which only rewrites baselines that fail comparison — so a real visual change that stays within maxDiffPixelRatio tolerance was silently left un-regenerated, and the bot incorrectly reported the snapshots as "identical". The fix makes /update-snapshots and the local tox -e visual-update path explicitly use --update-snapshots=all so any baseline whose render differs byte-for-byte is rewritten, and updates the docs/comment to point reviewers at the PR's Files changed view for before/after comparison (since all mode no longer produces diff pairs in the artifact).

Changes:

  • Pass --update-snapshots=all in the update-all-snapshots workflow job and the test:visual:update npm script, with an explanatory comment on why the mode must be explicit.
  • Update the summary comment and developer docs to reflect that the artifact now holds only regenerated images and to point to the Files changed view.
  • Add a ### CI CHANGELOG entry documenting the fix.
File Description
.github/​workflows/​update-snapshots.yml Switches the regenerate-all job to --update-snapshots=all with explanatory comment; updates summary-comment wording about the artifact.
package.json Updates test:visual:update script to --update-snapshots=all (used by tox -e visual-update).
docs/​developer/​visual-testing.md Documents the all mode behavior and points to the Files changed view for before/after.
tests/​visual/​README.md Mirrors the same documentation update for the regenerate-all flow.
CHANGELOG.md Adds a ### CI entry describing the fix.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

🎭 Visual Regression Test Results

passed  103 passed
skipped  3 skipped

Details

stats  106 tests across 1 suite
duration  3 minutes, 35 seconds
commit  2a359ee

Skipped tests

desktop-chrome › theme.spec.ts › Visual Regression Tests › prob-matrix - full page screenshot
mobile-chrome › theme.spec.ts › Visual Regression Tests › prob-matrix - full page screenshot
mobile-chrome › theme.spec.ts › Theme Features › f-string interpolation styling

@mmcky
mmcky merged commit f43b75d into main Oct 9, 2026
13 checks passed
@mmcky
mmcky deleted the ci/update-snapshots-all-mode branch October 9, 2026 02:24
mmcky added a commit that referenced this pull request Oct 9, 2026
)

* test: refresh visual baselines after #453

Starter commit for the snapshot refresh; the regenerated baselines are
added by /update-snapshots once #456 is on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* UPDATE: Regenerate all visual snapshots (39 files)

* ci: trigger run on regenerated baselines

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@mmcky mmcky mentioned this pull request Oct 9, 2026

This branch was previously deployed

1 inactive deployment
pull request — 2a359ee8 Deployed Oct 9, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants