I've read that in Cypress I should not use await
and that it is not needed because you can remove nesting through chaining. Here I have a cy.fixure
nested in cy.origin
nested in cy.session
, is there a way to flatten this?
cy.session([], () => {
cy.visit("")
cy.origin("https://my-address.com", () => {
cy.fixture("user").then((user) => {
cy.get("#username").type(user.username)
cy.get("#password").type(user.password)
})
cy.get("button[type='submit']").click()
cy.url().should("equal", "/login-success")
})
})
Edit
This is not a question regarding regular javascript, it's Cypress specific and normal async / await won't work here.