Snapvisor
How it worksFeaturesIntegrationsPricingAppsDocs
Sign inStart free
How it worksFeaturesIntegrationsPricingAppsDocs Join our DiscordSign in

Guide

Visual regression testing in GitLab CI

Keep your pipeline and your test runner. Connect GitLab to Snapvisor once, upload the screenshots from a GitLab CI job, and each build posts its result as a commit status on the matching merge request. Self-managed GitLab is supported.

Connect GitLab to Snapvisor

Snapvisor talks to GitLab with a personal access token that has repository access. Add it in your team or account settings. Snapvisor updates commit statuses on behalf of the user who created the token, so use an account that should appear as the status author.

Only team admins can configure the GitLab connection. If you are not an admin, ask your team owner to set it up.

Once the token is set up, import a repository from GitLab and link it to a Snapvisor project. From then on every build posts its result as a commit status on the matching merge request.

Read more: GitLab, CI integration.

Self-managed GitLab

Running GitLab on your own infrastructure is supported. Configure the GitLab proxy URL for your instance so Snapvisor reaches your self-managed server instead of gitlab.com.

Give the job the project token

Create a project in the Snapvisor app and copy its project token (ARGOS_TOKEN) from the project settings. Store it as a CI secret, never in the repository.

Tokenless authentication is documented for GitHub Actions only, so a GitLab job needs ARGOS_TOKEN in its environment. Set it as a CI/CD variable in your GitLab project settings.

Capture screenshots with your test runner

GitLab CI only runs the command. Screenshots come from the adapter for your test runner, set up exactly as on its own guide: Playwright, Cypress, Storybook or Puppeteer. The adapter uploads when the run finishes, or you upload a folder with @snapvisor/cli.

.gitlab-ci.yml
# .gitlab-ci.yml
visual-tests:
  image: mcr.microsoft.com/playwright:v1.64.0-noble # match your @playwright/test version
  stage: test
  script:
    - npm ci
    - npm run build
    - npx playwright test # captures via argosScreenshot, uploads via the reporter

The job needs an image that has the Playwright browsers installed. The example uses Microsoft's official Playwright image; pick the tag that matches the @playwright/test version in your project, because the image and the package must agree.

A green GitLab job after the upload means the screenshots arrived, not that they are unchanged. The result is the commit status Snapvisor posts to the merge request, so look at that status before you merge.

What the SDK reads from the job

When a job runs in GitLab CI (GITLAB_CI is true), the SDK recognizes it and reads these GitLab variables, so the build is tied to the right commit without any flags:

  • CI_COMMIT_SHA for the commit.
  • CI_COMMIT_REF_NAME for the branch.
  • CI_PROJECT_PATH for the project path.
  • CI_PIPELINE_ID as the build's nonce, the tag that parallel shards share.

Large suites can shard their uploads across jobs and be reviewed as one build.

Read more: Parallel testing, Access tokens.

What the first build does

The first build on your base 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. Later builds are diffed against the last approved build on the base branch, and approving a change promotes it to the new baseline for that branch.

Read more: Baseline builds, Review workflow.

Frequently asked questions

Yes. Snapvisor uses a GitLab personal access token to update commit statuses, so each build posts its result on the matching merge request, the same way it does on GitHub pull requests.

Yes. Configure the GitLab proxy URL for your instance so Snapvisor reaches your self-managed server instead of gitlab.com.

Only team admins can configure it. If you are not an admin, ask your team owner.

No. Tokenless authentication is documented for GitHub Actions only, so a GitLab job sets ARGOS_TOKEN, your project token, as a CI/CD variable.

When GITLAB_CI is true it reads CI_COMMIT_SHA for the commit, CI_COMMIT_REF_NAME for the branch and CI_PROJECT_PATH for the project path, and it uses CI_PIPELINE_ID as the nonce that parallel shards share.

No. It means the screenshots arrived. The result is the commit status Snapvisor posts to the merge request, so check that status before you merge.

Where to go next

Visual regression testing in GitHub pull requestsThe same review loop on GitHub, with tokenless authentication.
Visual regression testing guideHow the capture, compare and review loop works.
Playwright visual regression testingThe same workflow for Playwright.
Storybook visual regression testingThe same workflow for Storybook.
Cypress visual regression testingThe same workflow for Cypress.
Puppeteer visual regression testingThe same workflow for Puppeteer scripts.

Sources

Every command, package name and option on this page comes from the Snapvisor documentation and the published @snapvisor packages:

  • GitLab
  • CI integration
  • SDKs
  • Getting started
  • Baseline builds
  • Review workflow
  • Parallel testing
  • Access tokens

Try Snapvisor free

Start free Getting started guideAll SDKsSee pricing
Snapvisor

Visual regression testing that catches every pixel before it ships — built on a proven open-source visual-diff engine.

Open source at the core

Product

  • Features
  • How it works
  • Pricing
  • Get the app
  • Agent setup
  • MCP server overview
  • Visual regression testing guide
  • Self-hosted visual regression testing
  • Visual regression testing in GitHub pull requests
  • Support
  • Refer & Earn
  • Integrations

Compare

  • vs Percy
  • vs Chromatic
  • vs Applitools
  • vs Argos CI
  • vs Lost Pixel
  • vs Playwright

Frameworks

  • Playwright
  • Storybook
  • Cypress
  • Puppeteer
  • GitLab CI

Docs

  • Quickstart
  • MCP server
  • Access tokens
  • Support

Legal

  • Privacy Policy
  • Terms of Service
  • Delete your account
  • Partner Terms
  • Contact

Contact

  • support@snapvisor.io
  • Join our Discord
All documentation
  • Snapvisor
  • Getting started
  • Baseline builds
  • Monitoring mode
  • Parallel testing
  • Summary checks
  • Flaky test detection
  • GitHub
  • GitLab
  • GitHub tokenless authentication
  • GitHub Actions OIDC authentication
  • Slack notifications
  • Deployments
  • Environments
  • URLs and domains
  • Access protection
  • Members and roles
  • SAML SSO
  • Spend management
  • MCP server
  • Access tokens
  • API reference
  • Frequently asked questions
  • Open source
  • Support
  • Self-hosting
  • Review workflow
  • CI integration
  • Migrate from Lost Pixel
  • Migrate from Percy
  • Pricing
  • SDKs
  • API
© 2026 Snapvisor. All rights reserved.Zero third-party runtime requests.