Closed
Description
in this test
it('changes state by invoking action', () => {
// the component's actions are referenced in Cypress.main
Cypress.main.toggle()
cy.get('.toggle').should('be.checked')
// the action happens synchronously
// but Cypress commands are queued
// thus toggle again only after previous cy.get... has passed
cy.then(() => {
Cypress.main.toggle()
})
cy.get('.toggle').should('not.be.checked')
})
Cypress.main.toggle()
is called synchronously, but previous cypress command has not finished yet - it is queued up. Thus the second toggle has to be placed into the cy.then
to make sure previous check button has finished. Maybe we can wrap actions attached to Cypress.main
with cy.then
inside mount
function?