Storybook Legacy (<v8) Quickstart
Set up visual testing in a legacy Storybook (<v8) with Storycap and the Argos CLI.
Set up Argos with a legacy version of Storybook (<v8) using Storycap: Storycap crawls your Storybook and captures a screenshot of each story, then the Argos CLI uploads them.
Prerequisites
Storybook <v8 set up in your project
Capture screenshots
There are two ways to capture screenshots of your Storybook.
If your Storybook is already running and accessible via a URL, point Storycap at it:
npm exec -- storycap <STORYBOOK-URL> --outDir ./screenshotsIf it isn't deployed, build and serve it before capturing:
# Build Storybook
npm exec -- storybook build --output-dir ./storybook-static
# Screenshot Storybook with Storycap
npm exec -- storycap --serverCmd "npx http-server ./storybook-static --port 6006" http://127.0.0.1:6006/ --outDir ./screenshotsRead the Storycap documentation for advanced usage.
Screenshots are written to the ./screenshots directory. Add ./screenshots to your .gitignore file to avoid committing them.
Set up CI
Add a workflow that captures the screenshots and uploads them to Argos. If you use another CI provider, adapt the steps accordingly:
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: Build Storybook
run: npm exec -- storybook build --output-dir ./storybook-static
- name: Capture screenshots with Storycap
run: npm exec -- storycap --serverCmd "npx http-server ./storybook-static --port 6006" http://127.0.0.1:6006/ --outDir ./screenshots
- name: Upload screenshots to Argos
run: npm exec -- argos upload ./screenshots
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
CLI reference – All upload options
Storybook legacy example – A complete working setup
Need help? Join our Discord, open an issue on GitHub, or send us an email.
Last updated
Was this helpful?