Skip to content

Can I have cy.task retry until assertion passes? #1936

@bahmutov

Description

@bahmutov

cy.task is great but does not retry its action, even if it is idempotent code. In situations like "checking if the database has been updated" (see cypress-io/cypress-example-recipes@e6f3b4c#diff-11f8d1f12b6eb04ff4abd710d5e9d786) it would be perfect NOT to implement "retry until my assertion passes" logic in Node, but instead have cy.task behave like a regular Cypress command.

Something like this

cy.taks('find item in the database').should('deep.equal', {id: 1, text: 'something'})

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions