medium10 pts · first answer countsui-automationcypressauthentication
Logging in once in Cypress
Every Cypress spec logs in through the UI, adding 8 seconds per test. Which feature caches the login between tests?
cy.session(['admin'], () => {
cy.visit('/login')
cy.get('[data-cy=email]').type('admin@test.ae')
cy.get('[data-cy=password]').type(Cypress.env('ADMIN_PW'), { log: false })
cy.get('[data-cy=submit]').click()
cy.url().should('include', '/dashboard')
})Discussion 0
Join free to post in the discussion.
Related questions
- Choosing a stable locatorAutomation Test Engineer
- Waiting for an elementAutomation Test Engineer
- Headless modeAutomation Test Engineer
- Finding a button by role and nameAutomation Test Engineer
- Recording a first draft of a testAutomation Test Engineer
- Stepping through a failing testAutomation Test Engineer
- What a browser context gives youAutomation Test Engineer
- Uploading a fileAutomation Test Engineer