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

Cypress Component Testing lets you mount a UI component in a real browser, exercise it in isolation, and check what a user can see and do. To get started, open Cypress, choose Component Testing in the Launchpad, confirm the detected framework and bundler, then write a spec that mounts the component and tests its behavior. This guide covers setup, shared app context, a first test, troubleshooting, and where component tests fit alongside end-to-end tests.

What Cypress Component Testing does

Component testing mounts an individual component in a real browser without visiting the deployed application. Cypress starts a development server to compile and serve the component spec and support files using the project’s development transforms. That gives the test browser behavior while keeping the target component separate from the full production or staging app. Cypress’s getting-started guide describes the real-browser approach; the configuration guide explains the development server.

This is useful when you need to render a component in a controlled state—for example, to test a date picker across dates, a form that conditionally reveals sections, or a design-system control—without arranging the whole application and its external systems.

Check framework and bundler support first

Cypress’s getting-started framework matrix, accessed October 3, 2026, lists these combinations. Treat the matrix as a current-documentation snapshot: version support and preview labels can change, so confirm it for your stack before adopting the setup.

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 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Framework Versions and bundlers listed Availability note
React React 18–19 with Vite 8 or Webpack 5 Official mount library
Next.js Next.js 15–16 with React 18–19 and Webpack 5 Listed in the setup matrix
Vue Vue 3 with Vite 8 or Webpack 5 Official mount library
Angular Angular 21–22 with Webpack 5 Official mount library
Svelte Svelte 5 with Vite 8 or Webpack 5 Integration labelled Alpha
Qwik and Lit Not specified in the matrix as official version/bundler pairs Community-maintained integrations

Choose the integration that matches your existing framework and bundler. Don’t change bundlers solely to follow an example. For exact, changing compatibility details, consult the Cypress component-testing setup matrix.

Set up component testing in an existing project

  1. Install Cypress as a development dependency. Use your project’s package manager and the installation method in the official setup guide. The command depends on your package manager and project conventions.
  2. Open the Cypress app. Start Cypress using the project’s existing script or the command appropriate to your installation.
  3. Choose Component Testing in the Launchpad. Cypress detects the framework and bundler, checks dependencies, and guides you through any missing prerequisites.
  4. Review the generated component configuration. Pay particular attention to component.devServer, which tells Cypress how to compile and serve tests with your project’s framework and bundler.
  5. Inspect support files and the component test entry point. Confirm that the generated setup is appropriate for your app, then add the providers and global setup that the component actually needs.

The Launchpad scaffolds a starting configuration; it does not guarantee every application-specific alias, plugin, provider, or runtime initialization is represented. The configuration guide explains when Cypress can detect and reuse Vite or Webpack configuration and when explicit overrides are needed: Component framework configuration.

Write a first component test

A useful first spec follows a small cycle: mount the component, assert its initial user-visible state, interact with it, then assert the updated state. For example, a stepper with decrement and increment buttons can be tested like this:

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
import Stepper from './Stepper'

describe('Stepper', () => {
  it('updates the displayed count when a button is clicked', () => {
    cy.mount(<Stepper />)

    cy.get('[data-cy=count]').should('have.text', '0')
    cy.get('[data-cy=increment]').click()
    cy.get('[data-cy=count]').should('have.text', '1')
    cy.get('[data-cy=decrement]').click()
    cy.get('[data-cy=count]').should('have.text', '0')
  })
})

This example assumes a React project, a component with those selectors, and a registered cy.mount() command. Adapt the component import and selectors to your app. Cypress documents the mount command and framework-specific usage at cy.mount() and the React overview.

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

Use a custom mount command for shared setup

Instead of importing a framework mount function in every spec, define a custom cy.mount() in the component support file. It can wrap a component with the app context it needs, such as a React provider or a Vue plugin. Keep the wrapper project-specific: add a router, store, theme, or other provider only when the component under test depends on it.

For example, a React app could centralize a provider like this in its component support file:

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
import { mount } from 'cypress/react'
import { AppProviders } from '../../src/AppProviders'

Cypress.Commands.add('mount', (component, options = {}) => {
  return mount(<AppProviders>{component}</AppProviders>, options)
})

The import path and provider are illustrative and must match the installed Cypress adapter and your app. Cypress’s mount documentation shows how to register and type custom mount commands: Mounting framework components.

Expand coverage in a deliberate order

  • Check the default render and the content or controls visible to users.
  • Test meaningful alternate props or states, including empty, loading, and error states where applicable.
  • Exercise user actions and verify their visible outcome.
  • Use a Cypress spy or stub when the component calls an event handler or other dependency; the React overview includes examples of validating event handlers: React component testing.
  • Add layout or styling assertions only when dimensions, visibility, or appearance are part of the component’s contract.

Make isolated renders representative

A component can mount successfully yet look or behave unlike it does in the app if the test omits global CSS, fonts, resets, runtime initialization, or app-level context. Add the relevant setup through the component support file and, where appropriate, cypress/support/component-index.html. Cypress documents these entry points and styling considerations in Styling components.

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

Include only the real dependencies needed to reproduce the component’s application environment. A representative stylesheet matters for visibility, dimensions, and overflow assertions; a required provider matters when it supplies values or behavior the component consumes.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Component tests versus end-to-end tests

Question Component test End-to-end test
What runs? An individual component mounted in isolation An application workflow across integrated layers
How does the test begin? Mount the component with props and required setup Visit and exercise the application in its broader environment
What does it help establish? Component behavior in a controlled state That connected components and application layers work together for a workflow

Passing component tests does not establish that routing, backend integration, or other layers work together. Cypress recommends combining testing types rather than treating component tests as a replacement for end-to-end coverage. Use component tests for focused states and interactions; add broader tests for workflows that depend on application integration. See Cypress testing types.

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

Troubleshooting common setup problems

  • The Launchpad does not offer the expected integration. Check the current framework and bundler matrix, including any Alpha or community-maintained label, and verify that your versions match a listed combination. The setup guide is the source for current support.
  • The development server cannot compile the spec. Inspect component.devServer and the detected framework/bundler configuration. Resolve missing dependencies or necessary explicit overrides using the configuration guide.
  • The mount command is unavailable. Confirm that the component support file registers the custom command and that Cypress loads that support file for component specs. The mount setup is described in the mount API guide.
  • The component renders without expected theme, routing, or state. Add the provider or plugin the component relies on to its mount wrapper; avoid adding unrelated app context.
  • Assertions fail because the component looks different from the app. Load the relevant global CSS, fonts, reset styles, or initialization in component support setup or the component HTML entry point. See the styling guide.
  • A component test passes but the user workflow still fails. Add an end-to-end or other broader test for the integration path; isolated mounting does not exercise the complete app flow. Cypress’s testing-types guidance explains the different scopes.

Or skip the browser setup

If your goal is to capture a page rather than test a component, ScreenshotNeo is a website screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF; it is not a Cypress component-testing replacement.

cURL example, with the API documentation at ScreenshotNeo docs:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

It accepts cookie/consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits cost nothing, and response headers say which verdict and billing status applied. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

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

Frequently Asked Questions

Does Cypress Component Testing use a simulated DOM?

No. It mounts components in a real browser.

Can component tests replace end-to-end tests?

No. They cover isolated component behavior, not the full integration of app layers.

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.