Error: A snapshot doesn't exist at .../example.spec.ts-snapshots/home-chromium-linux.png, writing actual.
toHaveScreenshot() has no baseline image to compare against for this exact browser and OS combination, so it fails the first run and writes one.
Published
Why this happens
This is the first run of a new visual test and no baseline has been committed yet
Baselines were generated on macOS (`-darwin.png`) but CI runs on Linux (`-linux.png`), so the filename Playwright looks for doesn't exist
A new browser project was added to the config, and it has no baselines of its own yet
The snapshot folder is excluded by `.gitignore`, so baselines never reached the CI checkout
How to fix it
Generate baselines with `npx playwright test --update-snapshots`, review the images, and commit them
Generate Linux baselines inside the same Docker image CI uses (`mcr.microsoft.com/playwright:<version>`) so fonts and rendering match
Don't let CI silently accept the 'writing actual' image as the new baseline. Update snapshots deliberately in a reviewed PR
Example
# Generate Linux baselines locally in the same image CI uses
docker run --rm -v $(pwd):/work -w /work \
mcr.microsoft.com/playwright:v1.55.0-noble \
npx playwright test --update-snapshots