https://cypress.io logo
Hi all! I’m trying to use a combination of cy.on()...
# best-practices
c
Hi all! I’m trying to use a combination of cy.on() and a cy.task() to clean up data that I’ve seeded in a database if a test fails. For example:
Copy code
cy.on(‘fail’, () => {
        cy.task(‘deleteTestData’, {arg…})
})
But every time I’ve gotten an issue about returning a promise from a command while also invoking one or more cy commands in that promise. Has anyone here done anything like this before by chance?