Playwright
Save screenshots in your tests where VisualCI can find them. The path, without .png, becomes the snapshot's name:
import { test } from '@playwright/test'
test('signup form', async ({ page }, testInfo) => {
await page.goto('/signup')
await page.screenshot({ path: `screenshots/${testInfo.project.name}/signup_form.png`, fullPage: true })
})
Upload each browser project as its own platform, after the tests:
export VISUALCI_BUILD_ID=$(visualci build create)
npx playwright test
visualci upload --platform chromium-linux --threshold 0.1 screenshots/chromium
visualci upload --platform webkit-linux --threshold 0.1 screenshots/webkit
visualci build finalize
Use this instead of toHaveScreenshot: the baselines live on VisualCI, a change waits for review instead of failing the test, and no PNGs are committed. Hide content that changes on every run (times, avatars) with Playwright's mask option, or wait for animations to finish, before the screenshot.
Run the tests in CI's browsers, not on a laptop: see Platforms and Local runs.