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 DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk6 min

How to Run Storybook Component and Visual Tests with Vitest

Run Storybook stories as Vitest component tests in Playwright Chromium, and add Storybook’s separate visual-testing workflow when you need screenshot baselines.

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.

Use Storybook’s @storybook/addon-vitest to run stories as browser-based component tests with Vitest. To compare screenshots against accepted visual baselines, add Storybook’s separate visual-testing workflow—running the Vitest component tests alone does not create screenshot comparisons.

First, know which kind of test you need

Storybook’s Vitest addon turns stories into component tests. It checks that a story renders and, when the story defines a play function, runs that interaction and its assertions in a browser. The documented default browser is Playwright Chromium.

As an Amazon Associate I earn from qualifying purchases.

Visual tests answer a different question: does the rendered appearance still match an accepted screenshot baseline? Storybook documents a separate visual-testing workflow using the @chromatic-com/storybook addon and Chromatic. With that visual addon installed, its results can appear alongside component tests in Storybook’s testing widget, but screenshot comparison is not an automatic feature of running Vitest component tests.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
What you want to verify Workflow What you review
Stories render and interactions behave as expected Storybook Vitest addon Test status, assertions, and story failure/debug links
Story screenshots have not changed unexpectedly Storybook visual testing with Chromatic Highlighted screenshot changes compared with accepted baselines

Storybook describes the goal succinctly: “Visual tests catch bugs in UI appearance.” See its Visual tests documentation.

#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Check compatibility before installing

  • Your Storybook framework must be Vite-based. Storybook lists React, Vue, Preact, SvelteKit, and Next.js Vite among its examples.
  • Use Vitest 3.0 or newer, as specified in the current addon guide.
  • For the documented Next.js Vite path, use Next.js 14.1 or newer with @storybook/nextjs-vite.
  • If your project uses MSW, the guide says to use MSW 2.0 or newer to avoid conflicts with Vitest’s dependency.
  • If your Storybook project uses Webpack or Rsbuild, the Vitest addon route is not the documented fit. Storybook’s migration guide says to continue with @storybook/test-runner unless you move to a supported Vite framework.

These are the compatibility requirements stated in Storybook’s documentation checked on October 3, 2026; consult the current Vitest addon guide before upgrading because supported versions can change.

Install and run the Vitest addon

  1. From your project root, run npx storybook add @storybook/addon-vitest. The setup command installs and registers the addon, checks the project’s Vite/Vitest configuration, configures defaults where needed, and enables browser mode with Playwright Chromium. It may prompt you to install Playwright browser binaries.
  2. Run the generated Storybook Vitest project with npx vitest --project=storybook. The addon’s project can run without starting a Storybook server.
  3. To make the command easy to use locally and in CI, add a package script such as "test-storybook": "vitest --project=storybook", then run npm run test-storybook.

The command and project name are the documented setup path; if the add command cannot configure your repository, use the manual setup steps below rather than layering guesses onto the generated config.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

What the addon tests in each story

The addon uses portable stories to transform your stories into tests. A story that renders successfully can pass its render check. If a story has a play function, the test executes it and validates its assertions as part of the story test. This makes the workflow useful for component behavior as well as basic rendering; it does not, by itself, establish a screenshot baseline.

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.

Browser mode runs the test in a real browser rather than a simulated DOM such as JSDOM or Happy DOM. Storybook recommends browser mode for component work because browser-dependent APIs and behavior are better represented there. Playwright Chromium is the default setup described by the addon documentation.

Rank #3
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Add screenshot-based visual tests and baselines

  1. Set up Storybook’s @chromatic-com/storybook visual-testing addon and link the Storybook project to Chromatic. This is a separate setup from adding @storybook/addon-vitest.
  2. Run the initial visual build. The first build creates screenshot baselines for the stories.
  3. On later runs, inspect the Visual Tests panel for highlighted changes. Compare each change with the intended UI update.
  4. Accept intentional appearance changes as new baselines. If the change is unintended, fix the component or story and run the visual tests again.

Storybook also points to storybook-addon-vis as a local option for image snapshot testing. The documented workflow and review experience differ, so choose the approach that fits whether you want the hosted Chromatic flow or a local snapshot option. See Storybook’s visual-testing guide for its Chromatic setup and baseline review.

Manual setup when the automatic command does not work

Use Storybook’s manual addon instructions rather than copying a generic Vitest configuration: the exact setup depends on the existing Vite configuration and Vitest version.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor | 100Hz, Game Mode, Advanced Eye Comfort, HDMI and D-sub Ports (LS27D366GANXZA)
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
  1. Confirm that Vite and Vitest are configured for the project.
  2. Configure Vitest browser mode and make Playwright Chromium available.
  3. Install and register @storybook/addon-vitest in Storybook’s configuration.
  4. Create .storybook/vitest.setup.ts as described in the addon guide.
  5. Include the Storybook plugin in the Vitest configuration and run the Storybook project.

If the repository already has ordinary Vitest tests, Storybook recommends isolating the Storybook tests in a separate Vitest project or workspace configuration. Configuration details vary by Vitest version; use the current addon instructions for the version installed in your project.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Run the tests in CI and make failures easier to open

Use the same vitest --project=storybook command in CI that you use locally. The CI environment must have Playwright and its browser dependencies available; Storybook’s CI examples use Playwright container images. See Storybook’s testing-in-CI guide for its setup examples.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
  • Clickable links while watching locally: configure storybookScript so the addon can start Storybook and provide links from test failures to the relevant stories.
  • Links to a published Storybook in CI: build and publish Storybook first, then configure storybookUrl with the published URL. Without the published Storybook, CI cannot link failures to that deployed story view.
  • Different results between interfaces: Storybook notes that Vitest CLI/addon execution can differ from results in the Interactions panel. When behavior disagrees, verify the execution path and environment before treating it as a product regression.

Troubleshoot common setup failures

  • The addon setup or tests fail on a Webpack or Rsbuild project. The documented Vitest addon path requires a Vite-based Storybook framework. Continue with @storybook/test-runner or migrate Storybook to a supported Vite framework; see the migration guide.
  • Playwright cannot launch in CI. The browser or its system dependencies may be missing from the CI image. Use an environment with Playwright installed and available browser dependencies, following Storybook’s CI guidance.
  • Existing tests conflict with Storybook’s generated project. Separate Storybook’s tests into an isolated Vitest project/workspace configuration. Follow the addon guide for your Vitest version rather than assuming all versions use identical workspace syntax.
  • MSW-related dependency conflicts appear. If MSW is in use, check that it is version 2.0 or newer, as required by the addon guidance to avoid conflicts with Vitest’s dependency.
  • A failed test has no useful story link. In watch mode, configure storybookScript; for CI links, publish Storybook and configure storybookUrl.
  • A component test passes but a visual change is missed. The Vitest component test is not a screenshot-baseline comparison. Add and run the separate visual-testing addon workflow.

Or skip the browser setup

For a screenshot of a URL without configuring a browser test project, ScreenshotNeo provides a one-call screenshot API. It is a separate service from Storybook’s story-based component and visual-testing workflows; it captures a webpage URL rather than running your Storybook stories against Chromatic baselines.

ScreenshotNeo API documentation

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

ScreenshotNeo removes cookie 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 per month without a card; paid plans start at $5 for 3,000 screenshots. See ScreenshotNeo or sign up for 1,000 free screenshots a month with no card.

Sources

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 *

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
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

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.