Perform additional Cypress commands after a failed test (without closing the browser window) #29418
Unanswered
AlexGuironnetRTE
asked this question in
Questions and Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I was wondering if anyone else had a similar use case (I checked issues & discussions but couldn't find anything related). Regarding flakiness on our CI, we've come a long way but we still occasionally have failing tests.
When that happens, it would be nice to be able to specify additional commands to run ONLY if the test has failed, and while keeping the browser window open, to collect evidence that might explain the failure.
What I had it mind for example is since we keep video from our CI tests, it would be nice to be able to say "wait X more seconds if the test fails" so we could have X extra seconds of footage at the end of our failing tests. This would allow us to see straight away whether the test failed because what we were expecting arrived just a little too late, or if it's another problem.
Another example could be "when my test fails, I want to look at an element of my application that displays a connection status on an interface that I have, to see if that might be the reason for the failure".
I'm looking for ideas if you've ever attempted or achieved something similar, but I'm also open to feedback if this is a bad path to follow / too complicated.
So far I've looked at https://docs.cypress.io/api/plugins/after-spec-api but it doesn't look like it would help as at this point the test is over so we're no longer recording video.
Thanks in advance for any input!
Beta Was this translation helpful? Give feedback.
All reactions