Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Update cy.visit to allow for visiting non-2xx response pages when option set #982



Copy link

Address #574 #421

Attempt at adding the behaviour as described in #574.


Allows cy.visit to successfully visit a page which responds with a non-2xx status.

This is opt-in only behaviour and is configured by setting the optionfailOnStatusCode to false.
Similar behaviour to cy.request.

Use Case

Writing tests for a 404 page and validating the UI looks/behaves as expected.

I saw in the readme for the Driver package that the tests were no longer relevant? Anywhere else I should be adding test cases?

Let me know if any more changes or tests you require 馃槃

Copy link

CLAassistant commented Nov 29, 2017

CLA assistant check
All committers have signed the CLA.

Copy link

brian-mann commented Nov 29, 2017

Oh god I have no idea why the readme says that. It's completely inaccurate. I'll clean it up.

The driver is the single most tested package we have.

To test the driver couldn't be easier - you just write a regular cypress test!

In this case you need something to return you a 404 status code - so you'd add a route here:

And then you'd add a test here in this block:

To start the testing just npm start inside of the driver to boot the server, and then just run npm start in the root repo to boot cypress, and add driver/test into cypress. Then it acts like a normal project. I will document all this in the readme.

Copy link

All this looks good. I'll cleanup a couple stylistic things, and assuming the tests pass we'll merge this in tonight.

Copy link
Contributor Author

Awesome, go for it! Thanks for your help @brian-mann.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

4 participants