# Visual regression testing: what it is and how to set it up

> How visual regression testing works, how to set it up in CI, how Percy approaches it, and how to run the same workflow in Snapvisor.

Source: https://snapvisor.io/visual-regression-testing

Guide

Visual regression testing catches the changes your functional tests cannot see. This guide covers how it works, how to wire it into CI, how Percy approaches it and how the same workflow runs in Snapvisor.

## What visual regression testing is

Visual regression testing captures a screenshot of your UI, compares it against an approved baseline, and flags every difference for a person to review. Intended changes get approved and become the new baseline; unintended ones get rejected before they merge.

It exists because functional tests assert behavior, not appearance. These are the failures it is built to surface:

- **Layout shift.** A CTA drifts out of place after an unrelated CSS change. Pixels move; tests stay green.
- **Color regression.** A token update repaints a primary button off-brand. No assertion ever checks the hue.
- **Text overflow.** A longer string clips inside a fixed button. Logic is fine — the label is unreadable.

## How a visual regression workflow runs

1. **Capture.** Your CI uploads screenshots from the Storybook stories, Playwright, Cypress or Puppeteer specs you already run.
2. **Compare.** Each screenshot is diffed against the baseline, the last approved build on your base branch.
3. **Review.** The result lands as a status check on the pull request. Approve the intended changes, reject the regressions.
4. **Update the baseline.** Approving a change promotes it to the new baseline for that branch, so intended changes never need approving twice.

The very first build on a branch has nothing to compare against, so it becomes the baseline and is approved automatically. Run it on a base branch that already looks right.

## Set it up with Snapvisor

The path from an empty project to a reviewed build is four steps. The [getting started guide](https://snapvisor.io/docs/getting-started) has the full version.

1. **Create a project and copy its token.** Sign up, create a project, and copy its project token (`ARGOS_TOKEN`) from the project settings. Store it as a CI secret, never in the repository.
2. **Install the SDK for your test runner.**
  shell
  ```
  npm install --save-dev @snapvisor/cli @snapvisor/playwright
  ```
  Step-by-step setup per test runner: [Playwright](https://snapvisor.io/playwright), [Storybook](https://snapvisor.io/storybook), [Cypress](https://snapvisor.io/cypress) and [Puppeteer](https://snapvisor.io/puppeteer).
3. **Register the reporter and capture screenshots.** The Playwright reporter uploads the screenshots when the run finishes.
  playwright.config.ts
  ```
  // playwright.config.ts
  import { defineConfig } from "@playwright/test";
  import { createArgosReporterOptions } from "@snapvisor/playwright/reporter";
  export default defineConfig({
    reporter: [
      process.env.CI ? ["dot"] : ["list"],
      [
        "@snapvisor/playwright/reporter",
        createArgosReporterOptions({ uploadToArgos: !!process.env.CI }),
      ],
    ],
  });
  ```
  tests/example.spec.ts
  ```
  // tests/example.spec.ts
  import { test } from "@playwright/test";
  import { argosScreenshot } from "@snapvisor/playwright";
  test("screenshot homepage", async ({ page }) => {
    await page.goto("http://localhost:3000");
    await argosScreenshot(page, "homepage");
  });
  ```
4. **Run it in CI.** No wrapper command is needed; the token comes from the environment.
  GitHub Actions
  ```
  - run: npm run build
  - run: npx playwright test # captures via argosScreenshot, uploads via the reporter
    env:
      ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
  ```
  Running on GitLab instead? See [visual regression testing in GitLab CI](https://snapvisor.io/gitlab-ci).

A green CI job after the upload means the screenshots arrived, not that they are unchanged. The gate is the status check Snapvisor posts to the pull request, so require it in your branch protection rules. See the [review workflow](https://snapvisor.io/docs/review-workflow), [GitHub](https://snapvisor.io/docs/github) and [GitLab](https://snapvisor.io/docs/gitlab) guides.

Snapvisor Free includes 7,000 screenshots a month with no card to start. Pro starts at $9/month with 15,000 included; see [pricing](https://snapvisor.io/pricing).

## Keep the screenshots trustworthy

- **Stable captures.** `argosScreenshot` stabilizes the page before it captures: it waits for web fonts, images and `aria-busy` regions to settle, hides carets and scrollbars and normalizes font anti-aliasing.
- **Browsers and sizes.** To cover Chromium, Firefox and WebKit, run them as Playwright projects. Pass `viewports` on a capture for each size you care about.
- **Flaky changes.** With the project's ignore changes setting turned on, reviewers can mark a recurring change as ignored, and Snapvisor can auto-ignore changes that keep reappearing. See [flaky test detection](https://snapvisor.io/docs/flaky-test-detection).
- **Big suites.** Shard screenshot uploads across CI jobs and review them as one build. See [parallel testing](https://snapvisor.io/docs/parallel-testing).

## Visual regression testing with Percy

Percy is BrowserStack's visual testing product. These are the parts of its workflow that matter when you set up or compare tools, each from Percy's public documentation (checked 2026-10-11, sources below):

- **Capture.** Percy captures a snapshot of the DOM within the test browser and sends it to Percy's API to be rendered across browsers and widths. Screenshots are taken in Percy's infrastructure, not inside your test suite. The default `widths` are 375 and 1280 pixels.
- **CI.** You set the `PERCY_TOKEN` environment variable in your CI service and wrap the test command with `percy exec`, for example `percy exec -- node test.js`.
- **Baseline.** A build on the main branch is compared against the previous build on that branch; a pull request build is compared against the merge base, the common ancestor commit of your branch and the target branch. With no base build, every snapshot is marked as new, and the first build has no visual comparisons.
- **Review.** You can approve a whole build, groups of matching visual changes, or individual snapshots, and approved snapshots keep their approval across builds on the branch. A snapshot that is not ready can be sent back with a request for changes.

## The same workflow in Snapvisor

The loop is the same: capture, compare against a baseline, review, approve. The differences are in how each stage is done.

- **Capture.** Percy sends a DOM snapshot and renders it; Snapvisor takes a real screenshot in the browser your test is already running in with `argosScreenshot`, and your pipeline uploads the images.
- **Browsers and widths.** Percy renders them for you; with Snapvisor you ask for them: `viewports` on each call and one Playwright project per browser engine.
- **CI.** `PERCY_TOKEN` and `percy exec` become `ARGOS_TOKEN` with no wrapper. On GitHub Actions you can skip the token with [tokenless authentication](https://snapvisor.io/docs/learn/integrations/github-tokenless-authentication).
- **Baseline.** Snapvisor diffs against the last approved build on your base branch, found by walking your Git history to the first ancestor commit that has an approved build. See [baseline builds](https://snapvisor.io/docs/baseline-build).
- **Review.** Changes land as a status check on the pull request, and you approve or reject them in the review UI. Approving promotes the change to the baseline for that branch.

For plans, free tiers, browser coverage and AI-agent access side by side, read [Snapvisor vs Percy](https://snapvisor.io/compare/percy).

## Moving from Percy

You keep your test runner and your CI. What changes is the snapshot call, the token and where baselines live.

1. Replace each `percySnapshot` call with its Snapvisor equivalent (`argosScreenshot` on Playwright and Cypress, or `@snapvisor/storybook` for Storybook).
2. Swap `PERCY_TOKEN` for `ARGOS_TOKEN` and remove `percy exec` from your CI scripts.
3. Run the first Snapvisor build on a base branch that is visually correct. Percy baselines cannot be imported, so that build becomes the new baseline.
4. Require the Snapvisor check in branch protection and take the Percy check out of the required checks.

The full mapping, with Playwright, Cypress and Storybook examples, is in [Migrate from Percy](https://snapvisor.io/docs/migrate-from-percy).

## Comparing other tools

Need to run it on your own infrastructure? Read [self-hosted visual regression testing](https://snapvisor.io/self-hosted-visual-regression-testing). Want to see how the review looks on a pull request? Read [visual regression testing in GitHub pull requests](https://snapvisor.io/visual-regression-testing-github).

[**Snapvisor vs Chromatic**Visual testing built around a deep Storybook workflow.](https://snapvisor.io/compare/chromatic) [**Snapvisor vs Applitools**Visual AI inside a broader testing platform.](https://snapvisor.io/compare/applitools) [**Snapvisor vs Argos CI**The open-source engine Snapvisor is a fork of: what is the same and what differs.](https://snapvisor.io/compare/argos) [**Snapvisor vs Lost Pixel**Its team announced a sunset on 2026-04-22; includes a migration guide.](https://snapvisor.io/compare/lost-pixel)

## Frequently asked questions

### What is visual regression testing?

Visual regression testing captures screenshots of your UI, compares each one against an approved baseline, and flags the differences for a person to review, so unintended visual changes are caught before they ship.

### How is it different from functional testing?

Functional tests assert behavior. A layout shift, an off-brand color or a clipped label can leave every one of them green, because no assertion checks how the page looks. Visual regression tests compare the rendered result.

### Do I have to rewrite my tests to start?

No. Point Snapvisor at your existing Storybook, Playwright, Cypress or Puppeteer suite using the @snapvisor SDKs and it captures screenshots from the stories and pages you already have.

### How does Percy capture a page?

Percy's documentation says it captures a snapshot of the DOM within the test browser and sends it to Percy's API to be rendered across browsers and widths, so screenshots are taken in Percy's infrastructure rather than in your test suite. Snapvisor takes the screenshot in the browser your own test is running in.

### Can I move from Percy to Snapvisor without rewriting my tests?

You keep your test runner and your CI. You swap the snapshot call (percySnapshot becomes argosScreenshot), use ARGOS_TOKEN instead of PERCY_TOKEN and drop percy exec. Percy baselines do not carry over: your first Snapvisor build on your base branch becomes the new baseline.

### What does it cost to start?

Snapvisor Free includes 7,000 screenshots a month. Pro starts at $9/month with 15,000 included, then usage-based, with a 14-day trial.

## Sources

Percy documentation · checked 2026-10-11

- [Percy SDK and screenshot capture workflow](https://www.browserstack.com/docs/percy/integrate/percy-sdk-workflow)
- [Visual Testing with Percy](https://www.browserstack.com/docs/percy/overview/visual-testing-basics)
- [Percy baseline management: Git](https://www.browserstack.com/docs/percy/visual-testing-workflows/baseline-management/git)
- [Percy approval workflow](https://www.browserstack.com/docs/percy/visual-testing-workflows/view-percy-build-results/approval)
- [Percy configuration options](https://www.browserstack.com/docs/percy/references/config-options)
- [Integrate Percy with various CI/CD tools](https://www.browserstack.com/docs/percy/integrations/ci-cd/overview)
- [Run a sample Percy build with Playwright and Python](https://www.browserstack.com/docs/percy/playwright/getting-started/python)

## Try Snapvisor free

[Start free](https://app.snapvisor.io/signup) [Getting started guide](https://snapvisor.io/docs/getting-started) [Snapvisor vs Percy](https://snapvisor.io/compare/percy)

## Related pages

Guides [Self-hosted visual regression testing](https://snapvisor.io/self-hosted-visual-regression-testing) [Visual regression testing in GitHub pull requests](https://snapvisor.io/visual-regression-testing-github) [Snapvisor MCP server](https://snapvisor.io/mcp)

Test runner and CI setup [Playwright visual testing setup](https://snapvisor.io/playwright) [Storybook visual testing setup](https://snapvisor.io/storybook) [Cypress visual testing setup](https://snapvisor.io/cypress) [Puppeteer visual testing setup](https://snapvisor.io/puppeteer) [Visual regression testing in GitLab CI](https://snapvisor.io/gitlab-ci)

Compare Snapvisor [Snapvisor vs Percy](https://snapvisor.io/compare/percy) [Snapvisor vs Chromatic](https://snapvisor.io/compare/chromatic) [Snapvisor vs Applitools](https://snapvisor.io/compare/applitools) [Snapvisor vs Argos](https://snapvisor.io/compare/argos) [Snapvisor vs Lost Pixel](https://snapvisor.io/compare/lost-pixel) [Snapvisor vs Happo](https://snapvisor.io/compare/happo) [Snapvisor vs Playwright snapshots](https://snapvisor.io/compare/playwright) [Visual regression testing pricing compared](https://snapvisor.io/visual-regression-testing-pricing) [Alternatives to other visual testing tools](https://snapvisor.io/alternatives)

Free tools [Image diff checker](https://snapvisor.io/tools/image-diff) [Screenshot calculator](https://snapvisor.io/tools/screenshot-calculator)
