Feature
When testing our error page the response code was 404 i.s.o. 200 and when using the visit() command this fails as it requires a 2xx response.
Don't fail tests when a response code other then 2xx is fired upon visiting an url. Or make it explicit that you expect another code than 2xx.
Visit a 404/500 page to reproduce
Was brought here via https://github.com/cypress-io/cypress/issues/421 and this issue.
Was looking to maybe help out and throw up a potential PR if the feature is not too big.
I was playing around with adding a failOnStatusCode option to be used with cy.visit(url, options) in navigation.coffee.
This works, but for non 2XX status code pages it results in loading the actual page url and not the test runner view. I'm assuming some on error handler or logic needs to be added for this. Any thoughts? 馃槃
You likely just want to restructure the logic around this part:
I'd have to see your code to know what you're doing differently. Feel free to open a PR thats WIP.
If you follow the resolve:url websocket event it will eventually reach this code...
There is ridiculous and considerable complexity around this function - but I don't think it actually needs to be modified. This should all just work with a couple driver changes and 1 or 2 tests around it.
EDIT:
Nope, this needs to be modified https://github.com/cypress-io/cypress/blob/628281dd65055374958ef223a00ff75c93a0c31b/packages/server/lib/server.coffee#L372
The server is making assumptions about what is acceptable - so this code also needs to take into account the options override for enabling non Ok responses to go through.
That's probably why it's switching to the domain and not re-running cypress - it's not setting the current super domain under test correctly. It needs that state for everything to work.
How we juggle and buffer visits is some of the most complex code inside of Cypress.
@brian-mann Amazing. Thanks for the pointers. I'll open a WIP PR when I next get a chance 馃槃
Released in 1.1.3.
Most helpful comment
Fixed by https://github.com/cypress-io/cypress/pull/982