我在Cypress中读到过,我不应该使用await
,也不需要它,因为您可以通过链接来移除嵌套.这里我有一个cy.fixure
嵌套在cy.origin
中嵌套在cy.session
中,有什么方法可以平坦这个吗?
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.