Skip to content

Should actions triggered through Cypress.main automatically queue up? #2

Closed
@bahmutov

Description

@bahmutov

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?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions