# Migrate from Visual Regression Tracker

Canonical: https://snapvisor.io/docs/migrate-from-visual-regression-tracker

> Move a Visual Regression Tracker (VRT) setup to Snapvisor - how the self-hosted server, vrt.json config, vrtTrack and trackPage calls, ignore areas, tolerance and baseline branches translate to the Playwright and Cypress SDKs.





{/* Built from the same `faqs` array rendered at the bottom of the page, so the
    structured data mirrors the visible questions and answers exactly (same
    pattern as faq.mdx). */}

<script
  type="application/ld+json"
  dangerouslySetInnerHTML="{
  __html: JSON.stringify({
    &#x22;@context&#x22;: &#x22;https://schema.org&#x22;,
    &#x22;@type&#x22;: &#x22;FAQPage&#x22;,
    mainEntity: faqs.map((item) => ({
      &#x22;@type&#x22;: &#x22;Question&#x22;,
      name: item.q,
      acceptedAnswer: { &#x22;@type&#x22;: &#x22;Answer&#x22;, text: item.a },
    })),
  }),
}"
/>

This guide moves a Visual Regression Tracker setup (the self-hosted server plus the `@visual-regression-tracker/agent-playwright` or `@visual-regression-tracker/agent-cypress` agent) to Snapvisor. You keep your tests and CI. What changes is the capture call, the config, and where baselines and review live.

VRT facts come from the READMEs of the published `@visual-regression-tracker/agent-playwright` 5.3.1, `@visual-regression-tracker/agent-cypress` 5.7.0 and `@visual-regression-tracker/sdk-js` 5.7.1 packages, and from the VRT repository README. Snapvisor facts were read from the published `@snapvisor/playwright` 8.0.0 and `@snapvisor/cypress` 8.0.0 packages. Check the versions you run.

## The one change that matters [#the-one-change-that-matters]

With VRT, you run a server. Your agent sends each screenshot to it, the server compares the image with the baseline for that name, branch, OS, browser, viewport and device, and you accept or reject the result in the VRT frontend. A failed comparison throws in your test unless you enable soft assertions.

**Snapvisor is not a server you operate.** The capture call stabilizes the page and takes the picture, your pipeline uploads the images with a project token, and Snapvisor compares them with the approved screenshots for the branch. Your test does not fail on a visual difference. The gate is the commit status check on the pull request, which asks for review until someone approves or rejects. See [Baseline builds](/baseline-build) and [Review workflow](/review-workflow).

Your VRT baselines do not carry over, and there is no import path. Your first Snapvisor build on your base branch becomes the baseline. Plan the switch for a moment when your base branch is visually correct.

## Concept mapping [#concept-mapping]

| Visual Regression Tracker                                                                                                    | Snapvisor equivalent                                                                                                                 |
| ---------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| VRT backend, frontend and database (Docker)                                                                                  | Nothing to host. See [Access tokens](/tokens).                                                                                       |
| `vrt.json`, the `VRT_*` environment variables, or `visualRegressionTracker` in Cypress `env` (`apiUrl`, `project`, `apiKey`) | A project token in `ARGOS_TOKEN`, and the SDK registered in your test config.                                                        |
| `branchName` (required)                                                                                                      | Detected from your CI. No setting.                                                                                                   |
| `baselineBranchName`                                                                                                         | The base branch of the project. See [Baseline builds](/baseline-build).                                                              |
| `ciBuildId`                                                                                                                  | Parallel builds with a shared nonce. See [Parallel testing](/parallel-testing).                                                      |
| `vrt.start()` / `vrt.stop()`, `cy.vrtStart()` / `cy.vrtStop()`                                                               | Not needed. The SDK uploads when the run ends.                                                                                       |
| `vrt.trackPage(page, name)`, `vrt.trackElementHandle(el, name)`, `cy.vrtTrack(name)`                                         | `argosScreenshot(page, name)` and `argosScreenshot(page, name, { element })` for Playwright, `cy.argosScreenshot(name)` for Cypress. |
| `ignoreAreas` (`x`, `y`, `width`, `height`)                                                                                  | Masking. See [Ignore regions](#ignore-regions).                                                                                      |
| `diffTollerancePercent`                                                                                                      | `threshold`. See [Tolerances](#tolerances).                                                                                          |
| `os`, `device`, `viewport`, `customTags`                                                                                     | The screenshot name, and the `viewports` option.                                                                                     |
| `enableSoftAssert`, the Cypress error callback                                                                               | Not needed. A visual difference never fails the test. The status check is the gate.                                                  |
| `retryCount` (Playwright), `retryLimit` (Cypress)                                                                            | Not needed. Snapvisor does not compare during the test, so there is no "difference found" result to retry.                           |
| Comparison provider setting (Pixelmatch, Looks-Same, Odiff, VLM)                                                             | No such setting. There is one `threshold`.                                                                                           |
| Accepting a test run in the VRT frontend                                                                                     | Approving in the review UI.                                                                                                          |

## Playwright [#playwright]

Install the SDK and register the reporter, which uploads screenshots when the run finishes:

```bash
npm install --save-dev @snapvisor/playwright
```

```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 }),
    ],
  ],
});
```

Then change the capture and drop the start and stop calls:

```diff
-import {
-  PlaywrightVisualRegressionTracker,
-} from "@visual-regression-tracker/agent-playwright";
+import { argosScreenshot } from "@snapvisor/playwright";

-const vrt = new PlaywrightVisualRegressionTracker(browserName, config);
-await vrt.start();
-await vrt.trackPage(page, "Home page");
-await vrt.trackElementHandle(page.locator("#navbar"), "Navbar");
-await vrt.stop();
+await argosScreenshot(page, "Home page");
+await argosScreenshot(page, "Navbar", { element: page.locator("#navbar") });
```

`argosScreenshot` takes Playwright's own screenshot options, so `mask` and `clip` work as in Playwright. Defaults worth knowing, all read from the package source:

* **Full page.** A capture of a page is full page unless you pass `fullPage: false`. The VRT agent documents `fullPage` as defaulting to `false`, so full-page captures are a change in what you get.
* **Animations** are disabled unless you pass `animations: "allow"`.
* **Masks.** `[data-visual-test="blackout"]` is masked by default. Passing your own `mask` replaces that default, so include `page.locator('[data-visual-test="blackout"]')` in your array if you rely on it.
* **Stabilization** is on by default: fonts, images and `aria-busy` regions settle first, carets and scrollbars are hidden, and font anti-aliasing is normalized.

See [SDKs](/sdks) for the full option list.

## Cypress [#cypress]

```bash
npm install --save-dev @snapvisor/cypress
```

```ts
// cypress.config.ts
import { defineConfig } from "cypress";
import { registerArgosTask } from "@snapvisor/cypress/task";

export default defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
      registerArgosTask(on, config, {
        // Upload only on CI. Without this option the default is to upload.
        uploadToArgos: !!process.env.CI,
      });
      return config;
    },
  },
});
```

```diff
 // cypress/support/e2e.ts
-import { addVrtCommands } from "@visual-regression-tracker/agent-cypress";
-addVrtCommands();
+import "@snapvisor/cypress/support";
```

```diff
-cy.vrtStart();
-cy.vrtTrack("Whole page");
-cy.get("#navbar").vrtTrack("Navbar");
-cy.vrtStop();
+cy.argosScreenshot("Whole page");
+cy.get("#navbar").argosScreenshot("Navbar");
```

Remove `addVisualRegressionTrackerPlugin(on, config)` and the `visualRegressionTracker` block in `env`. Defaults, read from the package source:

* `cy.argosScreenshot` accepts Cypress's own `cy.screenshot()` options.
* Elements matching `[data-visual-test="blackout"]` are blacked out by default. Passing your own `blackout` array replaces that default, so include `'[data-visual-test="blackout"]'` in it to keep it.
* Stabilization is on by default; pass `stabilize: false` to turn it off.

## Ignore regions [#ignore-regions]

VRT ignores rectangles by pixel coordinates. Prefer masking the element that moves, which keeps working when the layout shifts. In Playwright, pass locators:

```ts
await argosScreenshot(page, "Dashboard", {
  mask: [
    page.locator('[data-visual-test="blackout"]'),
    page.locator(".live-clock"),
  ],
});
```

In Cypress, pass selectors in `blackout`, keeping `'[data-visual-test="blackout"]'` if you rely on the default. If you can only describe an area by coordinates, Playwright's `clip` option limits the capture to a rectangle.

## Tolerances [#tolerances]

VRT's `diffTollerancePercent` is an acceptable difference from the baseline, a number between 0 and 100. Snapvisor has one setting, `threshold`, a sensitivity between 0 and 1 that defaults to `0.5`. &#x2A;*Higher means less sensitive.** The two scales measure different things, so do not copy a number across. Set it per screenshot:

```ts
await argosScreenshot(page, "chart", { threshold: 0.7 });
```

Start from the default and adjust only when a specific screenshot is noisy. A change is flagged for review, not failed, so a small difference is a decision for a reviewer and not a red build.

## The CI change [#the-ci-change]

Before, the job needed a reachable VRT server and its credentials. The `VRT_*` variables below apply when the suite relies on the environment or `vrt.json`; an explicit config object in code overrides them:

```yaml
- run: npm ci
- run: npx playwright test
  env:
    VRT_APIURL: ${{ secrets.VRT_APIURL }}
    VRT_APIKEY: ${{ secrets.VRT_APIKEY }}
    VRT_PROJECT: My project
    VRT_BRANCHNAME: ${{ github.head_ref || github.ref_name }}
    VRT_CIBUILDID: ${{ github.sha }}
```

After, the job runs your tests with the project token:

```yaml
- run: npm ci
- run: npx playwright test # captures via argosScreenshot, uploads via the reporter
  env:
    ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
```

Copy the project token from your project's settings in the app, and store it as a CI secret, never in the repository. See [Access tokens](/tokens). On GitHub Actions you can drop the secret with [tokenless authentication](/learn/integrations/github-tokenless-authentication). More workflows, including merge queues and fork pull requests, are in [GitHub Actions recipes](/github-actions).

## Run both side by side [#run-both-side-by-side]

You do not have to switch in one pull request. Keep the VRT calls and add the Snapvisor capture next to them:

1. Add the Snapvisor SDK and calls, and merge them to your base branch so the first Snapvisor build becomes the baseline.
2. Keep VRT as your gate, and the Snapvisor check optional, while you compare results.
3. When the Snapvisor builds match your expectations on a few pull requests, make the Snapvisor check required, then remove VRT.

## Make the Snapvisor check the gate [#make-the-snapvisor-check-the-gate]

The upload finishes once the build has been created, whether or not it contains changes. A failed upload (bad token, unresolvable commit, network) is an error. The review gate is the commit status check Snapvisor posts to the pull request, which asks for review until someone approves or rejects the changes.

<Callout type="warn">
  If the check is optional, nothing blocks a merge. A green test job means the screenshots arrived, not that they are unchanged. With VRT the test itself failed on a difference, so this is a change in where the gate sits. Require the check in branch protection — see [GitHub](/github) or [GitLab](/gitlab).
</Callout>

## What you can delete [#what-you-can-delete]

Once builds are landing in Snapvisor and the check is required:

1. The `@visual-regression-tracker/*` dependencies, `vrt.json`, and the `VRT_*` variables and CI secrets.
2. The start, stop and track calls, and the Cypress plugin and `env` block.
3. The VRT server stack (backend, frontend, database and their volumes). Export or keep what you want from its history first, since Snapvisor cannot import it.
4. Any soft-assertion and error-callback code.

## First-build checklist [#first-build-checklist]

After the first Snapvisor build on your base branch:

1. Open the build and confirm it has a screenshot for each image VRT tracked.
2. Look through the screenshots for fonts, images and animations that did not settle. Fix those first, before any threshold change.
3. Run the same build twice on one commit and check that nothing shows as changed.
4. Open a pull request with one small visual change. Confirm the Snapvisor status check appears, asks for review, and clears after you approve.
5. Make the Snapvisor check required in branch protection.

## Frequently asked questions [#frequently-asked-questions]

<dl>
  {faqs.map((item) => (
      <div key={item.q}>
        <dt><strong>{item.q}</strong></dt>
        <dd>{item.a}</dd>
      </div>
    ))}
</dl>

<Cards>
  <Card title="Getting started" href="/getting-started" description="Create a project, install an SDK, and upload your first build." />

  <Card title="Baseline builds" href="/baseline-build" description="How the reference build and base branch are resolved." />

  <Card title="Review workflow" href="/review-workflow" description="Approvals, monitoring mode, and flaky-change handling." />

  <Card title="Parallel testing" href="/parallel-testing" description="Split large suites across machines and review them as one build." />
</Cards>

