Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober 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 Scan×
Skip to content
World desk5 min

How to Do Visual Testing for React Components in Storybook

A practical guide to visual-testing React components in Storybook: build repeatable stories, compare and review screenshot baselines, and choose a CI workflow.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To visual-test React components in Storybook, make representative component states into stories, compare their rendered screenshots with an approved baseline, review any differences, and run the checks in CI before merging. Storybook’s documented hosted path uses the @chromatic-com/storybook addon with Chromatic; its visual-testing guide requires Storybook 7.6 or later. The setup below covers that workflow and when to choose complementary options such as Playwright.

What visual testing checks—and what it does not

A visual regression test captures a rendered UI and compares it with a previously accepted image. A difference can flag changes to layout, color, size, contrast, or other visible details. This is distinct from a markup snapshot test, which compares HTML output: markup can change without changing the rendered appearance, and a screenshot diff focuses on what the browser displays. Visual diffs are signals for review, not automatic proof that a change is wrong.

Storybook stories are reusable, isolated examples of component states. In the documented Chromatic integration, stories can be turned into visual tests, so the same states serve as the inputs to repeated comparisons. See Storybook’s visual testing guide and Storybook’s testing overview.

Prepare stories that produce useful comparisons

Start with the states whose appearance matters, rather than trying to enumerate every possible prop combination. Include the ordinary state and meaningful variations—for example, empty or lengthy content, validation feedback, and interaction states—when those are relevant to the component. Use representative fixtures and consistent rendering conditions so that a diff reflects a product change rather than changing test input.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Clifford's Good Deeds (Classic Storybook)
  • Another classic tale of Clifford
  • Paperback
  • 32 pages
  • Keep each story focused on a recognizable visual state.
  • Make text, data, and other fixtures stable between runs.
  • Choose states that would be costly or easy to overlook in a manual review.
  • Do not treat the number of stories as a coverage target: Storybook’s guidance does not prescribe a universal story count.

Set up Storybook’s documented Chromatic workflow

The official addon is @chromatic-com/storybook. Storybook’s visual-testing guide says it requires Storybook 7.6 or higher; confirm compatibility with your project’s Storybook version and framework before installing, because setup guidance can change.

  1. Install the addon. From the project root, run npx storybook@latest add @chromatic-com/storybook. Review the files it changes and follow any prompts for your project.
  2. Connect a Chromatic project. Sign in to Chromatic and create or select a project. The setup can configure a project identifier and retrieve existing baselines. Follow the current setup instructions for credentials and your CI environment.
  3. Run a visual check during development. Use Storybook’s Visual Tests panel to run a check on uncommitted work. Inspect highlighted differences and the pixel comparison rather than accepting changes blindly.
  4. Resolve each difference. If the appearance is intended, accept the new baseline so future runs compare against it. If it is not intended, fix the component or story and rerun the check.
  5. Add the check to CI. Run visual checks before merging. Approved baselines can then be shared across the team, and the integration can expose test status in pull or merge requests. Configure the required check according to your repository and CI provider.

The Chromatic setup guide describes the project connection and cloud workflow. Chromatic’s CLI builds and uploads Storybook to its service; check its current service limits and plan details directly rather than inferring them from setup documentation.

Rank #2
Teacher Record Book
  • Keep track of everything from attendance to test scores
  • Spiral bound
  • Measures 8-1/2" x 11"

Review diffs as part of the merge decision

A newly detected difference may be a deliberate redesign, an accidental regression, or a change in rendering conditions. Inspect the affected story and the before-and-after pixels, then decide whether to fix the UI or approve the updated baseline. CI makes the comparison repeatable and visible to reviewers; it does not replace the human decision about whether the visual change is correct.

Choose a test scope: stories, Vitest, or Playwright

Story-level visual checks

Use the Chromatic integration when the important unit is an isolated component state and you want managed cross-browser checks with shared cloud baselines. It is the most direct documented Storybook path, but teams should weigh browser and viewport needs, CI integration, baseline review and storage, project compatibility, and current service limits.

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

Storybook Test and Vitest

Storybook describes its Test experience as transforming stories into Vitest tests run in browser mode. The older Storybook test-runner documentation says that runner has been superseded by the Vitest addon and specifically recommends the addon for Vite-powered Storybook frameworks. Use the current guidance for your framework and version; do not default to older test-runner instructions for a Vite-powered setup. See Storybook’s test-runner documentation.

Playwright for complete journeys

When the appearance worth checking occurs across a user journey rather than in one isolated story, Playwright can capture visual states during end-to-end tests. Chromatic documents an integration that extends Playwright’s test and expect utilities, sends test archives to its cloud, and generates snapshots for pixel comparison. Its documented black-box Playwright method requires Chrome in the Playwright configuration and is incompatible with TurboSnap. Check the current integration instructions before adopting it: Chromatic’s Playwright integration.

Reuse stories without adopting a hosted visual service

Stories can also be reused in Playwright or Cypress E2E tests and in Vitest or Jest environments. Reusing a story as a fixture is not the same as enabling a hosted visual-testing product; select the runner and comparison workflow that fit your project.

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

Or skip the browser setup

For a one-off screenshot or a separate capture workflow, ScreenshotNeo offers a screenshot API and MCP server. This does not replace Storybook’s story-based visual regression workflow or its baseline review. One GET request can capture a page as an image or PDF. For example, using the API’s documented cURL pattern (see ScreenshotNeo API documentation):

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://storybook.js.org -o shot.webp
  • Cookie and consent banners, newsletter popups, and chat widgets are removed before capture; each cleanup step can be turned off.
  • Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses indicate the page verdict and billing status.
  • An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and other MCP clients.
  • The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

Learn about ScreenshotNeo, or sign up for 1,000 free screenshots a month with no card.

Frequently Asked Questions

Does a visual test replace React unit tests?

No. A visual comparison checks rendered appearance; it does not by itself assert component logic or application behavior.

Can I use Storybook stories in Playwright without Chromatic?

Yes. Stories can be reused as fixtures in Playwright and other test environments; that is separate from enabling a hosted visual-testing service.

Quick Recap

SaleBestseller No. 1
Clifford's Good Deeds (Classic Storybook)
Clifford's Good Deeds (Classic Storybook)
Another classic tale of Clifford; Paperback; 32 pages
$4.40
Bestseller No. 2
Teacher Record Book
Teacher Record Book
Keep track of everything from attendance to test scores; Spiral bound; Measures 8-1/2" x 11"
$4.89
SaleBestseller No. 3
SaleBestseller No. 5

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.

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.

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. 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. 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…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair 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.