WebdriverIO Quickstart
Set up visual testing in your WebdriverIO tests with the Argos WebdriverIO SDK.
Set up Argos with WebdriverIO, the Node.js test automation framework for web and mobile applications, to run visual tests on every pull request: capture screenshots with the SDK, then upload them with the Argos CLI.
Prerequisites
WebdriverIO set up in your project
Install
Install the Argos CLI and the Argos WebdriverIO SDK:
npm i --save-dev @argos-ci/cli @argos-ci/webdriverioyarn add --dev @argos-ci/cli @argos-ci/webdriveriopnpm add --save-dev @argos-ci/cli @argos-ci/webdriveriobun add --dev @argos-ci/cli @argos-ci/webdriverioNo configuration is needed — the SDK works directly in your tests.
Capture screenshots
Use the argosScreenshot helper to capture screenshots in your tests:
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.
Set up CI
Run your WebdriverIO tests in CI, then upload the screenshots to Argos with the CLI:
name: Argos
on:
pull_request:
push:
branches:
- main
jobs:
argos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
- 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.
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.
Next steps
Stabilize screenshots – Prevent flaky diffs before they reach your pull requests
WebdriverIO SDK reference – All options
CLI reference – All upload options
Need help? Join our Discord, open an issue on GitHub, or send us an email.
Last updated
Was this helpful?