Snapvisor Docs

SDKs

Official Snapvisor JavaScript packages under the @snapvisor namespace, plus a Python SDK and CLI for uploading builds from any pipeline.

Snapvisor ships open-source SDKs for JavaScript and Python. The JavaScript packages are drop-in forks of the official @argos-ci SDKs and deliberately keep the ARGOS_* environment variable names, so they work unchanged in pipelines already wired for Argos.

JavaScript packages

Pick the high-level SDK for your test framework:

  • @snapvisor/playwright — capture screenshots from your Playwright tests
  • @snapvisor/storybook — capture screenshots of your Storybook stories
  • @snapvisor/vitest — capture screenshots from your Vitest browser tests
  • @snapvisor/cli — interact with and upload screenshots from the command line
  • @snapvisor/core — Node.js SDK, the base for building other integrations
  • @snapvisor/api-client — typed client for the Snapvisor API
  • @snapvisor/browser — browser utilities to stabilize visual testing
  • @snapvisor/util — shared utilities used across the SDKs

Playwright example

npm install --save-dev @snapvisor/playwright

Set up the reporter in your Playwright config:

// 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 capture stable screenshots in your tests:

// 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");
});

CLI example

npm install --save-dev @snapvisor/cli
ARGOS_TOKEN="<your-project-token>" npx @snapvisor/cli upload ./screenshots

The CLI also exposes commands to deploy a static build, inspect and review builds, post a comment, and more — list them with npx @snapvisor/cli --help.

Python SDK and CLI

The Python SDK uploads a directory of screenshots as a build from any Python test suite or CI pipeline — no Node.js required. It speaks the same upload protocol as @snapvisor/core and reads the same ARGOS_* environment variables. Requires Python 3.10+.

pip install git+https://github.com/DevinoSolutions/snapvisor-python

The package is coming to PyPI as snapvisor; until then, install straight from GitHub as shown above.

CLI usage:

export ARGOS_TOKEN="<your-project-token>"
snapvisor upload ./screenshots

Python API:

from snapvisor import upload

result = upload(
    "screenshots",
    token="...",            # or set ARGOS_TOKEN
    build_name="my-suite",  # optional
    branch="main",          # optional; resolved from env/git otherwise
    commit="abc...def",     # optional; resolved from env/git otherwise
    reference_branch="main" # optional baseline
)

The Python CLI also supports parallel shards (--parallel-nonce, --parallel-total, --parallel-index) and a custom --api-base-url.

On this page