kuceb / cypress-plugin-retries

A Cypress plugin to retry failed tests.
MIT License
237 stars 20 forks source link

Retry only if specific error happens? #54

Open Jacek-fstack opened 4 years ago

Jacek-fstack commented 4 years ago

Hello! I have a case in which tests fail once every 100-300 runs because the "load" event was not fired. This is some cypress bug that's not going to be fixed any time soon as there is no 'reliable way to reproduce it'. So - is there an option with retries plugin that I would wrap only the initial cy.visit to be retried if it fails? I don't want to retry all tests, because we need to see 'flakes', but there's nothing we can do about that bug for now. Thank you!

kuceb commented 4 years ago

you might be able to listen on the 'fail' event and if the error matches your criteria, set Cypress.currentTest.retries(1)