E2E testing is a valuable part of the SDLC for any frontend application. It can help to ensure that changes to the application do not break existing functionality, and it can also help to identify bugs that might not be caught by unit or integration tests.

Cypress is a great choice for E2E testing because it is easy to use, has a good test runner, and provides a lot of flexibility in how you can write your tests. It is also open source, which means that there is a large community of users and contributors who can help you troubleshoot problems and find new ways to use the framework.

Cypress Directory

Untitled

The directories and files in a Cypress project contain different configurations that are used to build E2E tests.

Configuration

The cypress.json configuration file is used to store any configuration values that you supply to Cypress. The following lines in the cypress.json file:

{
  "projectId": "",
  "baseUrl": "<http://localhost:3000>",
  "testFiles": "**/*.spec.ts"
}

Adding tests

Let's write our first test to see the "local" run of this in action.

Go over to the integrations folder and create a file first_test.spec.ts with the following: