published fresh until

Screenshot tests fail after my agent changed the UI: update baselines?

Summary Require a reviewer to approve intended visual changes and keep approval authority outside the editing agent. The R2 workflow replaces baselines after a PR label triggers --update-snapshots=all

Not for screenshot tests passing locally but failing in CI; see playwright-screenshot-tests-pass-locally-fail-in-ci

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

As of November 2026, require review of the intended visual change before replacing screenshot baselines. The R2 workflow uses a PR label to trigger replacement; the update flag itself is not restricted to missing baselines.

Do first: inspect the expected, actual and diff images before accepting the new baseline, using Playwright’s update workflow.

The problem

Your agent changes some CSS. Visual regression tests fail. The quickest way to green is npx playwright test --update-snapshots, which accepts whatever the page now looks like, including an accidental regression.

One workflow that separates the two

In his flaky-screenshots post (updated 12 October 2026), Alex Turner stores baselines in object storage (Cloudflare R2), not git. CI downloads them before each run. To accept a new look, a visual-approved label is added to the pull request. That triggers a rerun with --update-snapshots=all, uploads the regenerated images and pushes an empty commit so the tests run against the new baselines. The post also mentions --update-snapshots for bootstrapping missing baselines; it does not say that the flag can only create missing files. Playwright documents it as updating references. The post is not about agents, but the design fits them: a separate reviewer can control the approval label. The label is only a human gate if the agent cannot apply it itself.

Other guidance found

  • In the R2 workflow, CI updates are intentional and label-gated. Review distinguishes intended changes from regressions.
  • Playwright's docs show the update command and note that snapshot folders should be committed (the default layout), so a team using git baselines should require review of the image diff in the pull request.

Rules to give the agent

  • Never run --update-snapshots or change snapshot files unless the task says the visual change is intended.
  • When visual tests fail, show the actual versus expected image paths and say whether the change matches the task.
  • Do not change maxDiffPixels or threshold to get green.

Check yourself

Look at the PR file list: if image files changed in a task that was not about looks, treat it as a regression until a person approves.

Limits

This is a design pattern from one practitioner plus general guidance, without a measured agent outcome.

Sources

  • Alex Turner’s Playwright tips: R2 baselines, downloads before CI, the visual-approved label, snapshot regeneration, upload and empty-commit rerun.
  • Playwright visual comparisons: replacing references with --update-snapshots, committing baseline images, threshold and maxDiffPixels. The agent permission rules above are a suggested team policy.

Started from a post by @Alex Turner, packaged by the editor. Original post

Subjects

More in testing

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Screenshot tests fail after my agent changed the UI: update baselines?
Summary: Require a reviewer to approve intended visual changes and keep approval authority outside the editing agent. The R2 workflow replaces baselines after a PR label triggers `--update-snapshots=all`
Copy for agent
get the whatworks thread agent-ui-change-who-approves-new-screenshot-baselines and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread agent-ui-change-who-approves-new-screenshot-baselines
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks