For the complete documentation index, see llms.txt. This page is also available as Markdown.

WebdriverIO visual testing quickstart

Set up visual testing in your WebdriverIO tests with the Argos WebdriverIO SDK.

To add visual testing to WebdriverIO, the Node.js test automation framework for web and mobile applications, install @argos-ci/webdriverio and @argos-ci/cli, call argosScreenshot(browser, "name") in your tests, then upload the screenshots with npm exec -- argos upload ./screenshots/argos in CI with the ARGOS_TOKEN environment variable set. Argos compares every screenshot with a baseline build picked from your Git history and reports the changes as a check on your pull request.

What Argos adds

  • Baselines from your Git history. There are no reference images to commit or update.

  • Review on the pull request. Visual changes become a pull request check that your team approves or rejects.

  • Flaky test detection. Argos flags unstable tests with a flaky badge and a stability score.

Prerequisites

1

Install

Install the Argos CLI and the Argos WebdriverIO SDK:

npm i --save-dev @argos-ci/cli @argos-ci/webdriverio
yarn add --dev @argos-ci/cli @argos-ci/webdriverio
pnpm add --save-dev @argos-ci/cli @argos-ci/webdriverio
bun add --dev @argos-ci/cli @argos-ci/webdriverio

No configuration is needed — the SDK works directly in your tests.

2

Capture screenshots

Use the argosScreenshot helper to capture screenshots in your tests:

test/specs/homepage.e2e.js
import { browser } from "@wdio/globals";
import { argosScreenshot } from "@argos-ci/webdriverio";

describe("Integration test with visual testing", () => {
  it("covers homepage", async () => {
    await browser.url("http://localhost:3000");
    await argosScreenshot(browser, "homepage");
  });
});

Screenshots are written to the ./screenshots/argos directory. Add screenshots/ to your .gitignore file to avoid committing them.

3

Set up CI

Run your WebdriverIO tests in CI, then upload the screenshots to Argos with the CLI:

.github/workflows/argos.yml
name: Argos

on:
  pull_request:
  push:
    branches:
      - main

jobs:
  argos:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-node@v6
        with:
          node-version: 22
      - run: npm ci
      - name: Run WebdriverIO tests
        run: npm test

      - name: Upload screenshots to Argos
        run: npm exec -- argos upload ./screenshots/argos
        env:
          ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}

ARGOS_TOKEN is the project token from Settings → General → Token. On GitHub Actions, you can also use OIDC or tokenless authentication to avoid managing a secret. For GitLab CI, CircleCI, Buildkite, and other providers, see Run Argos in CI.

You're all set

Push your changes and open a pull request — the Argos check appears on it once the build is uploaded. Review the visual changes, approve or reject them, and merge with confidence.

Argos needs a baseline to compare against. Until a build runs on your default branch, pull request builds are marked as orphan. Merge this setup or run the workflow once on your default branch to establish the baseline.

Frequently asked questions

How do I update the baseline after an intended change?

You don't update any file. Review the build in Argos and approve the changes: an approved build is eligible as a baseline. Once you merge, the build on your default branch, which Argos approves automatically by default, becomes the baseline for the pull requests that follow. See Baseline build.

Why do screenshots differ between my machine and CI?

Fonts, text rendering, and browser versions depend on the operating system, so the same page renders slightly differently on macOS and on a Linux CI runner. The workflow above uploads screenshots only from CI, so Argos only compares screenshots captured on CI. Keep your CI on the same image and browser version from one run to the next. See Browser glitches and Stabilize screenshots.

Next steps


Last updated

Was this helpful?