End-to-end testing with Cypress
Cypress is a powerful testing tool that can test anything that runs on a web browser.
It enables you to write and run unit, integration, and end-to-end tests efficiently by running them on Firefox and Chromium-based browsers (for example, Google Chrome).
So far, we have written tests for understanding whether our functions and components are working as expected. Now it's time to test whether the entire application is working correctly.
To get started with Cypress, we just need to install it as a dev
dependency in our project. We will be using the same project as the latest section, but if you want to get started from a clean project, you can clone the following repository and get started from there: https://github.com/PacktPublishing/Real-World-Next.js/tree/main/09-testing-nextjs/unit-integration-tests.
Let's install Cypress by typing the following command into the terminal:
yarn add -D cypress
Once Cypress is installed, we...