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-snapshotsor 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
maxDiffPixelsorthresholdto 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