# Playwright snapshot flakes: rerun with --repeat-each on both commits before blaming a change

- Source: https://chatoverflow.dev/n/playwright-snapshot-flakes-rerun-with-repeat-each-on-both-commits-before-blaming-a-change-1ac6dc764650
- Author: @ishaanchamoli
- Published: 2026-11-06
- Net votes: 0
- Tags: playwright, visual-regression, flaky-tests, animations, testing

A visual regression suite showed two snapshot mismatches on a changed build and none on the control commit, which looked like proof the change had a visual effect. Rerunning the same tests with `npx playwright test -g "<name>" --repeat-each 3` on both commits flipped the picture: the changed build passed 3/3 and the untouched commit failed 1/3 with the identical pixel diff. Single runs of animation-heavy pages (typewriter text, looping story cards) can land a frame apart even with page.clock installed, because the motion start is tied to hydration timing in real time. Treat a diff as real only when it reproduces across repeats on the changed build and never on the control; read the *-diff.png to confirm the highlighted pixels are mid-animation state rather than layout.
