DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk5 min

Run Storybook Visual Tests with GitHub Actions

Use Chromatic’s Storybook integration for screenshot-based visual regression in GitHub Actions, and choose Vitest or the test-runner for other story checks.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For screenshot-based visual regression, add Storybook’s @chromatic-com/storybook integration, store its project token in a GitHub Actions secret, and run the visual check in CI. It compares rendered stories with accepted visual baselines and reports changes for review. Use Storybook’s Vitest addon or test-runner for render, interaction, and accessibility tests; those serve different purposes and can complement visual comparison.

Choose the right kind of Storybook test

“Visual test” can mean different things. Select a tool based on what you need CI to detect:

Need Suitable path What it checks Trade-off
Detect changes in how stories look Chromatic visual testing through @chromatic-com/storybook Rendered pixels compared with visual baselines Uses a cloud service and project token; reviewing and deciding whether to accept diffs is part of the workflow.
Test story rendering, interactions, or accessibility Storybook Vitest addon Story tests executed through Vitest Runs in repository CI and requires a correctly configured Storybook project and browser/runtime setup.
Run custom tests against a built or published Storybook Storybook test-runner Tests against a running Storybook Typically requires building or publishing Storybook, serving it, and waiting until it is available.
Exercise full application journeys A separate end-to-end tool such as Cypress or Playwright End-to-end flows Complements component and story checks; it does not replace visual diffs.

A pixel comparison can flag a visible change even when the markup is unchanged. A markup snapshot can flag an HTML change that does not affect appearance. Choose the check that corresponds to the regression you want to catch. Storybook’s testing overview describes the different test types.

Set up Chromatic visual tests

Requirements and project setup

Storybook’s visual-testing documentation says @chromatic-com/storybook requires Storybook 7.6 or higher. The separate Chromatic integration page lists Storybook 6.5+ among requirements for its CLI/action system. These describe different parts of the integration; check both pages against the versions in your repository rather than treating them as one minimum version.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. From the repository root, run the documented setup command:

    npx storybook@latest add @chromatic-com/storybook

  2. Create or select a Chromatic project when prompted. Setup adds project configuration to Storybook. Review the generated files and settings, including chromatic.config.json if present; it can contain a project ID and optional build-script name, debug setting, or zip option.

  3. In Chromatic, obtain the project token for CI. Add it to the repository’s GitHub Actions secrets, for example as CHROMATIC_PROJECT_TOKEN. Do not commit the token into workflow YAML, application code, or other repository files.

Add a GitHub Actions step

Add the Chromatic invocation to the workflow that runs for pull requests or other changes you want checked. Pass the token from the secret as an environment variable. Action syntax and inputs can change, so use the current Chromatic action documentation and the setup output for the exact invocation; Storybook’s visual testing guide documents the integration and CI review flow.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep the workflow aligned with your repository’s package manager, install command, Storybook version, and security policy. Pin or update Node and GitHub Action versions according to versions you have verified for your project; an example workflow should not be treated as a permanent version or permissions policy. The Storybook GitHub Actions tutorial provides broader workflow context.

Review results before merging

When CI reports visual changes, inspect the highlighted stories and pixel differences. Accept the new baseline only when the appearance change is intentional; otherwise, fix the component or styling issue and rerun the check. Storybook documents that accepted baselines are synchronized for CI. Teams can configure the resulting Git-provider check as required before merging.

Run story behavior tests with Vitest instead

If your goal is to exercise stories and their render, interaction, or accessibility assertions rather than compare screenshots, Storybook’s Vitest addon is the closer fit. The documented CI script is:

{
  "scripts": {
    "test-storybook": "vitest --project=storybook"
  }
}

The project name assumes the default Storybook Vitest project. Change it if your repository uses another name. In GitHub Actions, the usual shape is checkout, set up a Node version appropriate for the project, install dependencies with the repository’s package manager, and run the script. Storybook’s example uses a Playwright container/image; match browser dependencies and runtime to your own framework and CI environment. See Storybook’s CI guide for the documented workflow and debugging options.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the test-runner when the Vitest addon does not fit

The test-runner is an alternative for automated story tests against a running Storybook, including cases where you need to test a prebuilt or published instance. The local-built pattern is to check out the source, configure Node, install dependencies and Playwright, build Storybook, serve the static output, wait for the server, and run test-storybook. For a deployed Storybook, another documented pattern runs after a deployment-status event and points the command at the published URL; Storybook’s Storybook 8 example requires that published Storybook to be publicly available.

Consult the test-runner documentation for current command details. Large story counts or low-memory CI can lead to timeouts; reducing worker parallelism, for example with --maxWorkers=2, is a diagnostic option rather than a universal setting.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common CI problems

  • The visual integration does not match the Storybook version. Check the visual addon’s 7.6+ requirement separately from the Chromatic integration page’s 6.5+ CLI/action requirement. Confirm the versions supported by the pages and packages you are using before changing dependencies.

  • The CI result links to localhost. A localhost URL on the CI runner is not accessible to you. For Vitest debugging, publish Storybook and provide its URL using the documented SB_URL approach where useful.

    Free tools Windows power users keep installed

    One-click scans. No signup required.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • The test-runner times out or exhausts memory. A large number of stories or limited CI memory can be responsible. Try lowering worker parallelism, such as --maxWorkers=2, then adjust based on the runner’s available resources.

  • A markup snapshot changes but the UI looks the same. Snapshot tests inspect markup, not rendered pixels. Use a visual baseline comparison when appearance is the intended target.

  • The CI job cannot authenticate with Chromatic. Verify that the project token is stored as a GitHub Actions secret and exposed to the Chromatic step under the variable name expected by its current action or CLI configuration. Keep the secret out of committed files.

Or skip the browser setup

For standalone website screenshots outside Storybook’s story-baseline workflow, ScreenshotNeo offers a screenshot API and MCP server. A single GET request returns an image or PDF; for example, this cURL request saves a WebP screenshot:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for options and response details. It removes cookie/consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server provides screenshot tools for AI agents, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. It is an alternative for capturing pages, not a replacement for Chromatic’s Storybook visual-baseline review.

Sign up for 1,000 free screenshots a month with no card.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.