Cypress test passed due to briefly picking up element in the DOM

Viewed 17

I have some Cypress tests which are passing due to the fact that the cy.get elements have briefly come up in the DOM before an error page has been redirected to. I can only get the test to fail if a cy.wait is added before the assertion but I do not want to use those. Has anyone come across this before and able to offer some best practices on what to assert next?

I am thinking to either assert cy.url does not exist, but I would have to put this at the end of absolutely every test so hoping for a better option. Thanks

0 Answers
Related