Testing form inputs and submission
If you're building a web app, there's a high chance that you're going to have at least one form in it, and when it comes to forms we need to make sure that we have the right user experience (UX) and the right business logic in place. What better way to make sure everything works as expected than writing E2E tests for them? In this recipe, we're going to test a login form using Cypress.
Getting ready
The project for this recipe resides in chapter11/start_here/cy-testing-forms
:
- Open the project in VS Code.
- Open the terminal and run
npm install
to install the dependencies of the project. - Once done, run
npm run cypress:test
.
This should open a new Cypress window. Tap the app.spec.ts
file and you should see the tests, as follows:
Now that we have the Cypress tests running, let's see the steps of the...