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.
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
Let’s edit the file
src/test/e2e/cypress/support/commands.js by adding the following code: