How to set up visual regression testing
Set up visual regression testing by choosing how UI Verify captures your UI: your Vitest, Storybook, or Playwright tests, or screenshots from any tool.
You do not have to write new tests to start. UI Verify reuses whatever already renders your components or pages, screenshots each state, diffs it against a baseline, and posts a check on every pull request. The one decision that shapes your setup is where those screenshots come from, so start there.
Choose how UI Verify captures your UI
Pick the capture method that matches what your project already has. Every path lands in the same place - a diff check on each pull request - so this choice is about your existing tooling, not features you gain or lose.
| Capture method | Pick this if | Setup guide |
|---|---|---|
| Vitest | You have (or want) Vitest browser-mode component tests and no Storybook | Vitest setup |
| Storybook | You already have Storybook stories, so every story is a capture target | Storybook setup |
| Playwright | You have Playwright tests driving real pages or flows you want captured whole | Playwright setup |
| Custom screenshots | You produce PNGs from another tool, including native, mobile, and React Native | Custom screenshots |
What every setup has in common
Whichever capture method you pick, the moving parts are the same four steps.
- Get a project API key from uiverify.ai and store it in CI as
UIVERIFY_API_KEY. - Run the
uiverifyCLI to upload a build. Your first run captures every state as new and flags it for review; accept those to set your baselines. - On later runs, UI Verify diffs each capture against its baseline and reports what moved.
- The GitHub App posts a check and a comment on each pull request, where you or an AI judge accept or reject each change.
The fastest way: let your coding agent set it up
Each setup guide opens with a copy-paste prompt for your coding agent. Paste it into Claude Code, Cursor, or any agent and it reads the guide, installs the packages, adds the config, and uploads the first build for you. It is the same work the guides describe by hand, done in one step, which is why the quickest start is to open the guide for your capture method and hand its prompt to your agent.
Which visual testing setup should I choose?
Choose by what your project already renders. If you have Storybook, use the Storybook guide, since each story is already a capture target. With no Storybook, use Vitest for component tests or Playwright for real pages and flows. For screenshots produced by any other tool, including native and mobile, use the custom screenshots guide.
What if I don't have any tests yet?
You do not need existing tests or stories to start. Your coding agent writes them: point it at the components or pages worth covering and it scaffolds the Vitest component tests, Storybook stories, or Playwright tests, then UI Verify captures each one. Use Vitest or Storybook for components and Playwright for an app's pages and flows. Then add a rule to your agent's instructions, a CLAUDE.md rule and a lint check, that asks for a test on every new component or page, so coverage grows as the agent builds. See Stop writing Storybook stories by hand.
Do I need to write new tests to start?
No. UI Verify captures the components and pages your existing tests or stories already render, so there is nothing new to author. See Visual testing setup: no new tests to write.
Do I need Storybook for visual testing?
No. Storybook is one capture method, not a requirement. Vitest browser-mode tests, Playwright tests, and custom screenshots all capture without it, so a project with no Storybook sets up just as fast.
Set up visual testing
From no visual tests to a green check on every pull request.
Visual testing setup: no new tests to write
The one thing the docs of most tools bury: visual testing setup is not authoring a new snapshot suite. If you have Storybook stories, Playwright tests, or Vitest browser tests, those already are your visual tests. Swap an import or point the CLI at your build, and you get a diff on every PR.
Visual testing for agents
UI Verify captures your UI on every pull request and an AI judge tells an intended change from a real regression. See how it works.
Get started