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

Cypress Component Testing can provide a fast, browser-based feedback loop for UI work: write a test for a visible behavior, mount the component, interact with it, and assert the result before implementing or changing the behavior. Cypress supplies the mounting, browser interaction, and assertion tools; this red/green/refactor sequence is a practical way to use them, not a methodology Cypress requires.

What Cypress Component Testing covers

Component Testing mounts an individual component in a real browser rather than a simulated DOM. A spec can inspect the rendered UI, interact with controls, and check visible results or callback behavior. Cypress describes the real-browser distinction in its Component Testing getting-started guide.

Its boundary is narrower than an end-to-end (E2E) test. Cypress starts a development server and serves compiled component specs; the test does not visit your deployed staging or production application. Use component tests for isolated rendering and behavior. Use E2E tests for journeys whose correctness depends on routing, deployment configuration, or integrated services. The layers complement each other rather than replace one another.

How to use a red/green/refactor loop

Start with an observable expectation, not an implementation detail. For example: “Clicking Increment changes the displayed count from 0 to 1.” Cypress does not prescribe this TDD sequence; it is a development practice built from Cypress’s mounting, interaction, and assertion primitives.

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.
  1. Write the expectation. Name the test after the user-visible behavior.
  2. Mount meaningful initial state. Supply the props or inputs needed for that scenario.
  3. Interact and assert. Query the rendered control, use a Cypress command such as .click(), and assert the resulting UI or callback.
  4. Run the spec. See the missing behavior fail or the expected content fail to appear.
  5. Implement the smallest change that satisfies it. Rerun the spec to check the behavior.
  6. Refactor under coverage. Add cases for important alternate props, empty states, and boundaries when they matter to the component.

This loop works best when each test expresses a behavior a user or consuming component depends on. Avoid asserting internal implementation details that can change without changing the interface.

How do I set up Cypress Component Testing?

  1. Open Cypress Launchpad. Follow its setup flow to select Component Testing; it can detect the UI framework and bundler and scaffold configuration.
  2. Configure the component development server. Cypress recommends specifying the framework and bundler in the component.devServer configuration. For a React and Vite project, a CommonJS config has this shape:
const { defineConfig } = require('cypress')

module.exports = defineConfig({
  component: {
    devServer: {
      framework: 'react',
      bundler: 'vite',
    },
  },
})

Adapt the framework and bundler values to the actual project. Cypress starts the matching development server, compiles the spec and support files using the app’s development transforms, serves the compiled resources, and shuts the server down after the run. See Cypress’s component configuration guide.

Cypress can reuse a discoverable Vite or Webpack configuration. If framework-generated settings, aliases, or plugins are not visible to Cypress, you may need explicit viteConfig or webpackConfig configuration. Nuxt is a notable case: Cypress does not execute nuxt.config, so aliases and auto-imports used by mounted components may require explicit setup. Consult the Vue and Nuxt overview for framework-specific detail.

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.

Check current framework compatibility

Compatibility changes over time. Cypress’s documentation, current as of October 3, 2026, lists these getting-started configurations; check its live setup page before choosing or upgrading a stack:

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.
Framework/configuration Documented versions and bundlers Qualification
React React 18–19 with Vite 8 or Webpack 5 React overview also lists Vite, Webpack, and Next.js.
Next.js Next.js 15–16 with React 18–19 and Webpack 5 Use the current Cypress compatibility page for the exact combination.
Vue Vue 3 with Vite 8 or Webpack 5 Nuxt does not receive dedicated framework treatment.
Angular Angular 21–22 with Webpack 5 Angular dependencies, standalone components, and test setup have framework-specific considerations.
Svelte Svelte 5 with Vite 8 or Webpack 5 Cypress labels this integration Alpha.

See the getting-started compatibility list and the framework-specific React, Vue, and Angular overviews. For an unsupported framework, Cypress exposes a framework-definition extension mechanism for community integrations; that is not the same as first-party framework support. Details are in Custom Frameworks.

How do I write my first component test?

Here is a minimal React example of the loop. It checks a user-visible result after clicking. The assertion fails if the component does not render the expected initial count or update it.

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 Counter from './Counter'

describe('<Counter />', () => {
  it('increments the displayed count when clicked', () => {
    cy.mount(<Counter initialCount={0} />)

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

This example assumes the component provides those data-cy attributes and accepts initialCount; choose selectors that are stable in your application. Where the accessible role and name are stable, querying by those user-facing attributes can make the test read more like the interaction. Cypress’s React examples show mounting, passing props, and asserting rendered behavior.

Check event or callback behavior

If a component calls a prop when an action occurs, pass a Cypress spy and check the call rather than inferring the event solely from the rendered result:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
it('calls onChange with the selected value', () => {
  const onChange = cy.spy().as('onChange')
  cy.mount(<Choice onChange={onChange} />)

  cy.get('[data-cy="choice-b"]')
    .click()

  cy.get('@onChange').should('have.been.calledWith', 'b')
})

Use the actual prop name and expected value for your component. Cypress’s assertion and retry behavior is useful for asynchronous UI updates, but tests should still wait on a meaningful observable condition rather than adding arbitrary delays.

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

How mounting differs by framework

React

Import the component and mount JSX with cy.mount(<Component ... />). Pass props through JSX. For repeated application context, create a reusable mount command that wraps the component in the providers your UI requires.

Vue

Mount a component with cy.mount(Component, { props: ... }). To check an emitted change, provide a spy as the event prop and assert the expected call. The Vue examples show the framework-specific form.

Angular

Angular mount options can pass component properties and configure imports, declarations, or providers needed by the component. Standalone components have different setup behavior, so follow the Angular-specific instructions rather than treating one configuration as universal. See Angular examples.

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.

Share setup without hiding the scenario

A custom cy.mount() command is useful when many specs require the same application context, such as React providers or Vue plugins. Keep test-specific props and other scenario-defining options in the spec so each behavior remains easy to understand. Cypress’s mount API documents framework adapters and cleanup.

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

Component tests or end-to-end tests?

Question Component test End-to-end test
What runs? An individual component mounted in Cypress’s browser testbed. A broader application flow in an end-to-end environment.
What it can establish That the component renders and responds as expected with the supplied inputs. That integrated parts of an application work together along a user journey.
What it does not establish by itself That a deployed application, its routes, or connected services work as a whole. Not limited to the isolated component boundary.

Choose the component layer for focused feedback while changing a UI unit, then retain broader flow coverage for behavior that depends on the assembled application. Cypress’s configuration documentation explains the component test development-server boundary.

Troubleshooting setup and spec failures

  • Cypress cannot start or identify the component dev server: confirm the framework and bundler in component.devServer, and verify the project has the required bundler configuration and dependencies.
  • An import alias or plugin works in the app but not the spec: Cypress may not be seeing the same Vite or Webpack settings. Provide the project configuration explicitly where needed and ensure relevant aliases or plugins are included.
  • A Nuxt component relies on an auto-import or alias: Cypress does not execute nuxt.config; configure the required behavior for the component test environment rather than assuming Nuxt setup is loaded.
  • An Angular component fails to mount due to missing services or imports: add the needed providers, imports, or declarations to the mount setup and verify standalone-component requirements in the Angular guide.
  • A Svelte setup behaves differently from a stable integration: Cypress labels its Svelte 5 setup Alpha; check current documentation for status and supported versions before treating the integration as settled.
  • The spec passes alone but misses a journey failure: component tests do not exercise the deployed application end to end. Add or retain an E2E test for routing, deployment, or integrated-service behavior.

Or skip the browser setup

If your goal is to capture a page screenshot for visual review or documentation rather than test a component’s behavior, ScreenshotNeo is a website screenshot API and MCP server: a single GET request can return a PNG, JPEG, WebP, or PDF. It is not a replacement for Cypress Component Testing or its assertions.

For example, save a screenshot of a URL with cURL:

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 request options. Cookie banners are accepted and removed before capture, along with supported newsletter popups and chat widgets; those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

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

Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.

Frequently Asked Questions

Does Cypress Component Testing require a deployed site?

No. Cypress starts a development server to serve compiled component specs; it does not visit the deployed staging or production application.

Can I use Cypress Component Testing with a framework that is not officially supported?

Cypress provides a framework-definition extension mechanism for community integrations, but this is not equivalent to first-party framework support.

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.

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.