future-journalist-95278
05/20/2021, 9:58 PMjs
Cypress.Commands.add('login', () => {
const data = JSON.stringify({
username: Cypress.env('TEST_USERNAME'),
password: Cypress.env('TEST_USER_PASSWORD'),
})
cy.window().then((window) => {
window.nuxtApp.$auth.loginWith('login', data)
})
})
What I don't understand is this is giving me a Xhr request with canceled: true. I read that canceled: true occurs because I am attempting a URL change after calling my login command like: js
cy.login()
cy.visit('http://localhost:3000/settings/info')
Should I be waiting for the login command to finish? I tried adding an alias like: js
cy.login().as('login')
cy.wait('@login')
but Cypress didn't seem to like that...