Cypress Component Testing mounts a UI component in a real browser so you can check its rendering and behavior without running the full deployed application. Start the Cypress Launchpad, let it configure a development server for your existing framework and bundler, then mount the component, provide any required app context, and assert what a user can see or do.
What Cypress Component Testing covers
A component test exercises an individual component in isolation. Cypress serves the test through a development server using the project’s framework and bundler, then renders the component in a real browser—not a simulated DOM. That makes it possible to check browser behavior and visible output while avoiding the setup required to run the complete application. Cypress Component Testing overview
Isolation is useful for driving a component into specific states, such as a form with validation errors or a date picker showing a particular date. It also means the test does not automatically verify app routing, backend integration, or the way multiple application layers work together.
Check framework and bundler support first
Cypress’s getting-started documentation lists the following integrations and versions. The matrix is a snapshot of official documentation accessed October 3, 2026; check the current page before selecting an adapter because support and preview labels can change. Current Cypress framework matrix
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →| Framework | Listed versions and bundlers | Support 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 official 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 | Community-maintained integrations | Not listed as official mount libraries |
Use the integration that matches your existing framework, bundler, and versions. Don’t change bundlers solely to copy an example; first check whether Cypress supports your current project configuration and whether it needs explicit configuration.
Set up component testing
- Install Cypress as a development dependency. Use your project’s package manager and the Cypress installation instructions for the current release. Cypress installation guide
- Open the Cypress app from your project. The first-run Launchpad detects the framework and bundler and checks for required dependencies.
- Choose Component Testing. Review the detected setup and allow the Launchpad to install missing dependencies and scaffold the component configuration.
- Inspect the generated configuration. In particular, review
component.devServer: it defines how Cypress compiles and serves component specs using the project’s framework and bundler. - Start the component-testing interface and select a spec. Cypress starts the development server and serves the test to its browser. This is not a visit to a deployed or staging application.
The generated configuration may reuse existing Vite or Webpack settings when Cypress can detect them. If the project needs configuration overrides, follow the framework-specific configuration guidance rather than assuming every project has the same setup. Framework and bundler configuration
Write a first component test
A useful first test checks the default render, performs an interaction, and verifies the resulting visible state. This React example uses Cypress’s mount command and a Stepper component with decrement and increment buttons:
import Stepper from './Stepper'
describe('<Stepper />', () => {
it('increments and decrements the displayed count', () => {
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')
})
})
The selectors above assume the component exposes matching data-cy attributes; use selectors that are stable in your own app. The React mount API and examples are documented in the React Component Testing overview and mount command reference.
Free tools Windows power users keep installed
One-click scans. No signup required.
Register a reusable mount command
For a React project, put common mount setup in the component support file rather than repeating framework imports and providers in each spec. The exact support-file path depends on your generated configuration; Cypress’s mount documentation shows how to register the command.
// cypress/support/component.tsx
import { mount } from 'cypress/react'
import { MemoryRouter } from 'react-router-dom'
import { AppProviders } from '../../src/AppProviders'
Cypress.Commands.add('mount', (component, options = {}) => {
return mount(
<MemoryRouter>
<AppProviders>{component}</AppProviders>
</MemoryRouter>,
options
)
})
This is a project-specific pattern, not a universal wrapper. Add only the router, store, theme, or other provider the component needs; unnecessary providers make an isolated test harder to understand. Adapt TypeScript command declarations if your project requires them.
Rank #4
Expand coverage by component contract
- Check default rendering and important alternate props.
- Exercise user actions and assert their visible result.
- Use a Cypress spy when the component contract includes calling a callback.
- Cover meaningful empty, loading, and error states.
- Add layout or styling assertions only when those are part of the component’s expected behavior.
Bring in the application’s styles and context
A component can mount successfully and still look unlike the application if the test environment omits global CSS, fonts, resets, runtime initialization, or app-level context. Load the setup the component relies on through the component support file or cypress/support/component-index.html, as appropriate for the project. Cypress guide to styling components
This matters especially for assertions involving dimensions, visibility, overflow, or other rendered layout. A browser can only tell you whether the component behaves under the conditions you supplied; match the application’s relevant styling and runtime setup when those conditions are part of the test.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Best Value
Know when to add end-to-end tests
| Question | Component test | End-to-end test |
|---|---|---|
| What is exercised? | An individual component mounted in isolation | An application workflow across integrated layers |
| How is it started? | Mount the component and provide its required setup | Visit and use the application in its broader environment |
| What does it help establish? | The component’s rendering and behavior in selected states | That the relevant parts of the application work together |
Use component tests for focused cases such as a date picker with varied dates, a form that conditionally shows sections, or a design-system control. Add end-to-end or other broader tests for workflows that depend on routing, backend integration, or multiple system layers. Cypress recommends combining testing types rather than treating component tests as a replacement for broader coverage. Cypress testing types
Or skip the browser setup
If you need a website screenshot rather than an interactive component test, ScreenshotNeo is a separate screenshot API and MCP server for developers. It does not replace Cypress component testing: use it to capture a URL as an image or PDF.
One GET request returns a screenshot; see the ScreenshotNeo API documentation for request options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
- Cookie and consent banners are accepted and 60+ known consent platforms, newsletter popups, and chat widgets are removed before capture; each step can be turned off.
- Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed. Response headers identify the page verdict and billing status.
- An MCP server provides
take_screenshot,get_page_info, andcapture_pdftools for AI agents, including Claude, Cursor, and other MCP clients. - The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.
Sign up for 1,000 free screenshots a month, with no card required.
Quick Recap
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.




