Can I retry a test conditionally? #17129
Replies: 2 comments
-
This is an interesting use case. I'm not sure if it's possible today. The only ways to configure Test Retries are documented here: https://on.cypress.io/test-retries#Custom-Configurations You might be able to somehow combine creating dynamic tests with the test configuration options? I haven't tried this though. |
Beta Was this translation helpful? Give feedback.
-
Has anyone figured out if this is possible? I've run into a somewhat similar problem and could need conditional retries as well. But every now and then, the switching between accounts doesn't work properly, and while Cypress did load the correct account and it's session is the previous session running as far as SharePoint is concerned, which then fails the test. I've found a way to catch that issue separately but I've yet to find a way to retry the test in that case. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey, we run our Cypress tests against a web server that redeploys new versions of the product every so often. There are some known errors (such as Service Unavailable) which we recognise as symptoms of a redeploy. Under these circumstances, the test is inconclusive, and we'd like to retry.
We don't want to retry generally (we want to know when tests aren't robust, and fix the test rather than retrying it).
Is there a way to catch the first error in a
.spec.ts
file, perform a condition upon it, and explicitly trigger a retry?Or maybe a workaround (if I set the global retry count to 1, is it possible for me to conditionally decrement the test's retry count in a hook, making it skip the retry if I deem that there are no symptoms of redeploy)?
Beta Was this translation helpful? Give feedback.
All reactions