The tests in cypress/e2e/logging-in-html-web-form-spec.cy.js show how log into protected website using a regular form like this:
- Test a standard
username/password
HTML form. - Test errors submitting invalid data.
- Test unauthenticated redirects.
- Authenticate users with cookies.
- Create a custom
cy.login()
test command. - Bypass needing to use your actual UI.
- Increase speed of testing with
cy.request()
.
You should be able to log in with username "jane.lane" and password "password123".
tip to start the server and run Cypress GUI use script npm run dev
Highly recommended: watch video "Organizing Tests, Logging In, Controlling State"