Cypress stops working properly after an app server request fail and makes the app return to its initial screen #19966
Unanswered
Bartaf83
asked this question in
Component Testing
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm very new with Cypress. I could start making tests which naviguate on my app views from one to another by simulating clicking buttons. I didn't develop all the app i'm testing myself so i don't know much about everything on it but when accessing some of its specific views the app emits server requests that might fail.
When naviguating in the app as a real user (not through Cypress tests) these requests are emitted too and might fail but an appropriate fail reaction are made in the catch statement code (after emitting POST requests). That's why these fails when they happen the app never crash and the user dont even notice any consequence.
Now the problem i got is that when these fails happen, the app suddenly returns back to its initial screen (which is the login form) and as a consequence , the next test will fail and an assertion error will rise as Cypress won't find the element of the dom its looking for that is supposed to exists before the app returns to the initial login form screen (with a cy.get('selector')...).
I've been trying around with my tests code , so instead of writting 3 tests, i wrote only 2 by combining the two last tests together :
and the app during tests strangely didn't return back to the initial screen as it did with 3 separated tests and also none of its assertions fail but in a last step of the second test "Test 2 and 3 combined", a button that is supposed to be clicked by Cypress cy.get('button selector').click() didn't work and also a code from a then() statement after trying to get that same button never get executed.
So i guess Cypress actually stopped working properly and as you see in the following dashboard screenshot, none of my tests fail but i see there are these said server requests failures i've been talking about previously which happen before the last button failing click (which isn't the one mentionned in the last test report)
I'd like to understand why Cypress has to be sensible to the app own server requests failures , and if there is a way to make it ignore them and just continue its own tests. These requests in my case don't even affect the normal functionning of the app and aren't related to the tested scenarios too.
Cheers!
Beta Was this translation helpful? Give feedback.
All reactions