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 form using Cypress and validate if the correct errors are being shown in appropriate situations.
Getting ready
The app that we are going to work with resides in start/apps/chapter11/ng-cy-forms
inside the cloned repository. However, the e2e tests are in the folder start/apps/chapter11/ng-cy-forms-e2e
. In this recipe, we’re going to modify files in both folders. Let’s run the e2e tests first by following these steps:
- Open the code repository in your code editor.
- Open the terminal, navigate to the code repository directory, and...