Cypress is an end-to-end testing tool that works really well for single-page applications (SPAs) like ours. In this section, we are going to implement an end-to-end test for signing in and asking a question.
Implementing end-to-end tests with Cypress
Getting started with Cypress
Cypress executes in our frontend, so let's carry out the following steps to install and configure Cypress in our frontend project:
- We'll start by installing cypress from the Terminal:
> npm install cypress --save-dev
- We are going to add an npm script to open Cypress by adding the following line to package.json:
"scripts": {
...,
"cy:open": "cypress open"
},
- Let's open Cypress by executing our npm...