October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Run Visual Testing with Storybook

Set up Storybook visual testing with the official Chromatic addon: create baselines, review changes, and run checks locally and in CI.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To run visual testing with Storybook, install the official @chromatic-com/storybook addon, connect a Chromatic project, create a baseline from your stories, then review screenshot differences after UI changes. Add the check to CI so visual changes are surfaced before a pull request or merge is approved.

What Storybook visual testing checks

A Storybook story is a reproducible example of a component or UI state, and visual testing compares its rendered appearance with an accepted screenshot baseline. A difference is a signal to review—not proof by itself that the change is a bug. Storybook documents this route through Chromatic, its cloud visual testing service, using the official addon. Storybook’s visual testing documentation describes the workflow.

As an Amazon Associate I earn from qualifying purchases.

  • Visual test: detects changes in rendered appearance by comparing snapshots.
  • Render test: checks that a story renders without an error.
  • Interaction test: uses a story’s play function to simulate actions and assert behavior. It answers whether the UI behaves as expected, not whether its pixels match a baseline. See Storybook’s interaction testing guide.
  • Accessibility and markup snapshot tests: separate test types; neither should be described as visual regression testing.

Use visual checks for appearance changes and interaction tests for behaviors such as opening a menu, submitting a form, or displaying an error state. They complement one another.

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

Set up visual testing with Chromatic

  1. Install the official addon. From the project directory, run npx storybook@latest add @chromatic-com/storybook. The Storybook guide identifies this as the official addon maintained by the Storybook maintainers. See the setup instructions.
  2. Start Storybook and connect the project. Open Storybook and find the Visual Tests panel. If you are using the Vitest addon, look for the Visual Tests section in the testing widget. Sign in to Chromatic, then select an existing project or create one.
  3. Run the first visual test build. This initial run creates baseline snapshots for the project’s stories. Those accepted snapshots are the reference for subsequent runs.
  4. Run checks after UI changes. Use the Run button in the expanded testing widget or the Visual Tests addon panel. The stories are sent to Chromatic’s cloud service for snapshot comparison and visual-change detection.
  5. Review each reported difference. Open a highlighted story and inspect the changed pixels in context. If the new appearance is intentional, accept it as the new baseline. If it is unexpected, correct the story or component and run the checks again.
  6. Make the check part of CI. Configure authentication using the Chromatic project token, then run visual tests in your CI workflow. Use the pull-request or merge-request check to surface errors and changes awaiting review before merge. Storybook recommends checking during development as well as in CI.

Decide whether a visual change is a regression

Do not accept every diff automatically. Compare the changed image with the intended design and the story’s purpose. A changed label, spacing, color, or component state might be an intentional update; it might also expose a broken style or unexpected state. The right response depends on the product change, not simply on the existence of a diff.

  • Intentional change: verify the new appearance is correct, then accept the updated baseline.
  • Unexpected change: fix the component or story, then rerun the visual test.
  • Unclear change: inspect the story and its relevant state before accepting or rejecting it. A screenshot comparison identifies what changed; it does not decide whether the change is correct.

Run checks locally and in CI

Local runs help catch visual changes while developing. CI runs provide a pre-merge check so changes can be reviewed in the pull or merge request. Use both where they fit your team’s workflow: local checks shorten the feedback loop, while CI ensures the proposed change is checked before it is merged.

Keep the project token in CI authentication configuration rather than committing credentials to source control. The documented workflow uses that token to authenticate the visual test build and surfaces changes or errors through the code-hosting check.

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

Choose the right Storybook test runner

Do not copy older @storybook/test-runner setup instructions into a new project without checking compatibility and current support. The official addon listing says official support for Storybook Test Runner has ended and points Vite-based projects toward Storybook’s Vitest integration. It lists different compatible test-runner package versions for Storybook 6, 7, 8, 9, and 10, so check your installed Storybook version against the current listing before adding packages: the Storybook Test Runner addon listing.

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

For story interaction tests, Storybook’s current guide describes running them with the Vitest addon through the Storybook UI, editor, CLI, or CI. Visual regression coverage described here uses the Chromatic addon; interaction assertions remain a separate concern.

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

Or skip the browser setup:

ScreenshotNeo is a website screenshot API, not a replacement for Storybook’s story-based visual regression workflow. For a one-off page capture, one GET request returns an image or PDF. The request below saves a WebP screenshot of Storybook’s documentation page; replace the URL with the page you need to capture.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

ScreenshotNeo API documentation

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://storybook.js.org/docs -o shot.webp

ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, failed loads, and cache hits are not billed. Its MCP server lets AI agents using Claude, Cursor, or another MCP client take screenshots. The Free plan includes 1,000 screenshots a month without a card; paid plans start at $5 for 3,000 screenshots. Sign up for 1,000 free screenshots a month, with no card required.

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.

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

Leave a Reply

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

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.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
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.