Storybook Test Runner Quickstart
Learn how to setup visual testing in a Storybook using Test Runner
Prerequisites
1
2
3
4
Setup CI to run tests and upload screenshots
name: Storybook Test
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Install dependencies
run: npm ci
- name: Build Storybook
run: npm run build-storybook
- name: Install Playwright dependencies
run: npx playwright install --with-deps chromium
- name: Run Storybook tests and capture screenshots
run: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server ./storybook-static --port 6006 --silent" \
"npx wait-on tcp:127.0.0.1:6006 && npm run test-storybook"
- name: Upload screenshots to Argos
# 👇 Replace `<ARGOS_TOKEN>` with your project token, available in your Argos project settings.
run: npm exec -- argos upload --token <ARGOS_TOKEN> ./screenshotsCongratulations on installing Argos! 👏
Additional resources
Last updated
Was this helpful?