Mounting React Components
Learn how to mount React components for Cypress component tests.
We'll cover the following
Let’s practice mounting our React components and running our first component test. Mounting React components for Cypress component testing means we render them in a Cypress browser test environment, which enables us to test them in isolation. In this lesson, we will mount a component in each test. It’s comparable to visiting a page in end-to-end tests.
Cypress component test script
First, we’ll need to create a new script specifically for running component tests instead of end-to-end tests. In our package.json
file, we make the following change:
Get hands-on with 1400+ tech skills courses.