Allow `cy.visit` to work on 404 pages (option `failOnStatusCode`)
See original GitHub issueRight now I can’t do any of the cy.visit()
-enabled BDD on our HTTP 404 pages. I can test it crudely with:
cy.request({url: '/abcde', failOnStatusCode: false})
.its('body').should('.include', 'Oops, something went wrong!');
But I (think I) can’t do any clicking etc.
If cy.visit()
options allowed for the failOnStatusCode: bool
option, I could do something like:
cy.visit('/abcde', {failOnStatusCode: false});
cy.get('#email').type('my@email.com');
cy.get('#submit').click();
cy.url().should('contain','/form-success');
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:13 (7 by maintainers)
Top Results From Across the Web
visit - Cypress Documentation
Pass in an options object to control the behavior of cy.visit() . By default, the cy.visit() commands' will use the pageLoadTimeout and baseUrl...
Read more >Visiting a Url in cypress - Stack Overflow
I have a deployed application. when i open the url the website opens just fine. when i try to test it using cypress...
Read more >cypress-io/cypress - Gitter
Hi, I am facing an issue with GET request when I tried to put wait on xhr 'GET' request it doesn't work in...
Read more >Handle 404 Status Code In cy.request Command - YouTube
This video shows how cy.request can handle the error server response, like 404 "Resource not found". Find this example and more at ...
Read more >CypressError cy.visit() failed trying to load - Laracasts
it doesn't work (laravel 8.x) I arrived at 7:10 I launch the test and it gives ... the option: failOnStatusCode: false cypress/integration/ex_spec.js:2:5 1 ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mellogarrett this is not coming from Cypress. This is an error literally coming from your application, which is why Cypress is failing. In other words, this is Cypress catching bugs in your own code.
By default Cypress automatically catches global uncaught exceptions.
Read this issue for more detail: https://github.com/cypress-io/cypress/issues/254
You can also turn off uncaught exception handling here: https://docs.cypress.io/api/events/catalog-of-events.html
If you were to click on the error message you would see the stack trace originating from your own code.