Bypassing Login

Learn how to use Cypress commands to create helper functions for testing.

We'll cover the following

There is something mesmerizing about watching Cypress type and click, but using Cypress in this manner for each test Login would be very time-consuming.

Cypress commands

As an alternative, we can write a Cypress command. Cypress commands allow the creation of helper functions we use in tests. This command will log in by directly submitting the form data and typing username/email and password.

Let’s edit the file src/test/e2e/cypress/support/commands.js by adding the following code:

Get hands-on with 1000+ tech skills courses.