In contrast to testing rendered components (such as with React Testing Library, Enzyme, and Jest), end-to-end testing tests the entire workflow of a web application, from start to finish. This is where Cypress comes in. If you need a quick refresher on the differences between these types of testing, I recommend you take a quick look back at Part 1 of this series.

Cypress is written in JavaScript, and can handle testing anything that runs in a browser. It can be used to write end-to-end tests, integration tests, and unit tests. In addition, Cypress can be used for setting up, writing, running, and debugging these tests, which is no small feat. Prior to Cypress, end-to-end testing was handled through the implementation of numerous tools, at the heart of which sat Selenium.

There are two main components of Cypress — a free test runner, and a paid dashboard service (with a free tier). For the purposes of this blog we will focus on implementation using the free test runner.


Installing Cypress

We did not cover the installation of the previous tools because they are simple CLI commands. Cypress is a little different. Cypress is a desktop application, and this application is what will run your tests. I highly recommend you take a look at the installation guide before moving on here, as there are multiple options to install and open the desktop application from the command line.

Installing Cypress in your application will create a cypress/integration folder for you — this is where you’ll be writing your tests.

#javascript #software-development #programming #react #software-engineering #react native

Testing in React, : End-to-End Testing with Cypress
1.20 GEEK