question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow `cy.visit` to work on 404 pages (option `failOnStatusCode`)

See original GitHub issue

Right 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:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
brian-manncommented, Oct 9, 2017

@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.

0reactions
toastcrunchcommented, Jan 3, 2020
it('visit site while bypassing 4xx authorization', ()=> {
    cy.visit('https://xxxx  .com/', {failOnStatusCode: false}) //Bypass 4xx authorization
    cy.get('input').type('xxxx').type('{enter}')
})
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found