# VisualCI vs Playwright toHaveScreenshot

> Playwright's built-in screenshot comparisons and VisualCI compared, covering baselines in git, cross-machine rendering, review and approval, CI behaviour and cost, with sources.

Source: https://visualci.com/compare/playwright/

_Checked against Playwright's documentation on 1 December 2026._

Playwright Test compares screenshots itself: `await expect(page).toHaveScreenshot()` writes a reference image on the
first run and compares against it after that. It's free and already installed if you use Playwright. VisualCI doesn't
replace it. Your Playwright tests keep taking the screenshots, and VisualCI stores the baselines, compares them, and
lets your coding agent review each change.

## At a glance

| | VisualCI | Playwright `toHaveScreenshot` |
| --- | --- | --- |
| Who takes the screenshot | Your tests (Playwright or anything else) | Playwright |
| Browsers | The ones your tests run | Chromium, Firefox and WebKit |
| Where baselines live | On VisualCI, for each branch, found from the nearest ancestor commit | In git, next to each test file, one per browser and OS |
| A Mac and a Linux CI machine | Each platform tag keeps its own baseline. PDFs are rendered by VisualCI, so they match everywhere | The docs advise taking baselines in the same environment that checks them |
| When a change is found | CI passes and the GitHub check waits for approval. `strict` mode fails CI instead | The assertion fails the test |
| Approving a change | Your agent approves it over MCP, or a person does in the web app. Every approval is recorded on the build | Re-run with `--update-snapshots` and commit the new images |
| Reviewing a diff | Side by side, diff image or slider in the web app; images and changed regions over MCP | Diff, actual and expected images in UI Mode or the HTML report |
| PDFs | Yes, with a text diff for every page | No |
| JSON, HTML and text snapshots | Yes. Jest, Vitest, insta, syrupy and rspec-snapshot files upload as they are | `toMatchSnapshot` compares text, and ARIA snapshots store the accessibility tree |
| Cost | Free: 25,000 credits a month. Team: $29 a month for 1,000,000 credits | Free |
| Licence | Apache-2.0 | Apache-2.0 |

## Using them together

Take screenshots with Playwright's `page.screenshot()` and upload the folder with the VisualCI CLI, as the
[Playwright guide](https://visualci.com/docs/screenshots/playwright.md) shows. Playwright keeps its masking, animation and waiting options,
and VisualCI handles baselines and review.

## When Playwright on its own is enough

- One person or a small team reviews screenshot changes, and committing new images to git is fine.
- Everyone runs the tests in the same container, so baselines match.
- You don't want to send screenshots to a service.

## When to add VisualCI

- Coding agents open your pull requests, and you want them to review a visual change instead of updating the
  baseline.
- You want CI to stay green while a change waits for review, instead of a failing test.
- You'd rather not keep screenshot images in git.
- Your app also generates PDFs, or your tests write JSON and text snapshots.

## FAQ

**Can I keep my `toHaveScreenshot` assertions?**
Yes, but each failure still fails the test. To have VisualCI review a change, save the screenshot with
`page.screenshot()` and upload it.

**Does VisualCI run my Playwright tests?**
No. Your CI runs them. The VisualCI CLI uploads what they wrote.

## Sources

- [Playwright visual comparisons](https://playwright.dev/docs/test-snapshots)
- [Playwright `toHaveScreenshot` options](https://playwright.dev/docs/api/class-pageassertions)
- [Playwright ARIA snapshots](https://playwright.dev/docs/aria-snapshots)
- [Playwright UI Mode](https://playwright.dev/docs/test-ui-mode)
- [VisualCI screenshots](https://visualci.com/docs/screenshots.md), [credits and plans](https://visualci.com/docs/reference/credits.md) and [agents](https://visualci.com/docs/agents.md)
