What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Cypress Component Testing lets you mount a React component in a real browser, then exercise and assert on the rendered UI with Cypress commands. To get started, configure Cypress’s component dev server for React and your bundler, import the component, and call cy.mount(<Component />). The current Cypress React overview documents React 18 and 19 with Vite 8 or Webpack 5, plus Next.js 15 and 16 using Webpack; check the current support overview before upgrading because compatibility can change.
What Cypress React Component Testing does
Component tests render a component directly in a real browser rather than a simulated DOM. You interact with the mounted UI and make assertions using Cypress commands. That gives you a focused way to check a component’s visible state and behavior without making every test depend on a full application flow. Cypress describes this as mounting components “directly in a real browser — not a simulated DOM.” (Cypress Component Testing: Getting Started)
What React setups are documented
Cypress’s React overview lists React 18 and 19, React with Vite 8, React with Webpack 5, and Next.js 15 or 16 with Webpack. These are the combinations documented by the overview, not a guarantee that every later or custom configuration is supported. Confirm the live compatibility guidance when changing major versions or bundlers.
| Setup | Documented combination |
|---|---|
| React + Vite | React 18 or 19 with Vite 8 |
| React + Webpack | React 18 or 19 with Webpack 5 |
| Next.js | Next.js 15 or 16 using Webpack |
For the documented React/Webpack path, Cypress lists Cypress, React, React DOM, and Webpack 5 as requirements. Cypress says the React mount adapter and Webpack dev server are bundled in the Cypress package for this path, so separate installation of those pieces is generally unnecessary. See the React overview for its current details.
#1 Best Overall
Set up the component dev server
The key configuration is component.devServer, where you identify the UI framework and bundler. For React with Vite, the shape is { framework: 'react', bundler: 'vite' }; for Webpack, use bundler: 'webpack'. Cypress’s setup flow can detect supported project tooling, check dependencies, and scaffold configuration through Launchpad. The generated component configuration names the framework and bundler explicitly. See Getting Started and the configuration reference.
A minimal configuration shape is:
component: {
devServer: {
framework: 'react',
bundler: 'vite'
}
}
Replace vite with webpack when that is your bundler. Cypress searches upward from the project root for the relevant Vite or Webpack configuration when an explicit configuration override is omitted. If the project needs a different configuration, the override can be an object or an asynchronous function that returns a config, as described in the configuration reference.
Write a first component test
-
Import the component into a Cypress component spec.
-
Mount it by passing JSX to
cy.mount(), for examplecy.mount(<Stepper />).Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
Use a stable selector such as a
data-cyattribute to find the relevant element. -
Interact with the rendered UI if needed, then assert the expected result.
A minimal example, following Cypress’s documented pattern, might look like this:
import Stepper from './Stepper'
describe('Stepper', () => {
it('renders and responds to a click', () => {
cy.mount(<Stepper />)
cy.get('[data-cy=counter]').should('have.text', '0')
cy.get('[data-cy=increment]').click()
cy.get('[data-cy=counter]').should('have.text', '1')
})
})
The exact selectors and expected values depend on your component. Cypress’s React guide also shows that props belong directly in the JSX passed to the mount call, such as cy.mount(<Stepper initial={100} />). Refer to React component testing examples for the documented mounting and assertion API.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesShare providers and other common setup
If components depend on shared context—such as a router, theme, or state provider—create a customized cy.mount() command in the component support file that wraps the node in the required providers. This avoids repeating wrapper setup in each spec. The React mount API also describes mount options such as strict rendering and provides a rerender function through the returned Cypress chainable. Use those features when the test specifically needs them; the standard starting point remains mounting the component with the props and context it needs. See the React API and Cypress FAQ.
Rank #4
Choose component tests or end-to-end tests for Next.js
Use component tests for individual React components. For a Next.js page that relies on server-only getServerSideProps or getStaticProps, Cypress recommends end-to-end testing: those methods run on the server and are not available in a component test. Manually supplying props to a mounted page can test how the page renders with those props, but it does not exercise the server data-loading method. Cypress explains this distinction in its React overview.
What to cover in a component spec
Cypress’s examples establish the mounting, props, event-handler, and assertion patterns; they do not prescribe a mandatory checklist. A useful way to organize your own coverage is to consider:
-
The initial rendered state and any important empty, loading, error, or disabled states.
Recommended Free Tools
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
Meaningful prop variations, especially values that change visible output or available actions.
-
User interactions and outcomes, including callbacks where the component exposes them.
-
Required shared context, using the same provider setup your component expects in the application.
Keep the test focused on the component’s contract. If the behavior depends on server execution, route navigation across the app, or other full-application wiring, choose an end-to-end test instead.
Free tools Windows power users keep installed
One-click scans. No signup 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.




