cy.request with failOnStatusCode: false not working
See original GitHub issueRunning the call cy.request({url: '/abcde', failOnStatusCode: false}); returns the following error for me.
CypressError: cy.request() failed on:
https://mysite.com/abcde
The response we received from your web server was:
> 404: Not Found
This was considered a failure because the status code was not '2xx' or '3xx'.
If you do not want status codes to cause failures pass the option: 'failOnStatusCode: false'
-----------------------------------------------------------
I actually want the 404 to appear and check do some checks there. I am currently on the last version of Cypress(3.6.1) so that’s not the problem.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:8 (1 by maintainers)
Top Results From Across the Web
How to test a bad request in cypress - Stack Overflow
So pass failOnStatusCode: false to not fail on bad status codes: cy.request({ method: 'POST', url: 'https://myrAPI', failOnStatusCode: false ...
Read more >request - Cypress Documentation
request() requires that the response status code be 2xx or 3xx when failOnStatusCode is true . Assertions. cy.request() will only run assertions you...
Read more >cypress-io/cypress - Gitter
cy.visit('/404-url', { failOnStatusCode: false }); ... I am facing issues in logging to my application that I am trying to automate.
Read more >Requested resource not found | Cypress examples (v9.5.0)
Sometimes you use cy.request to get a resource that might not exist. ... INCORRECT, this will NOT WORK, just for DEMO function getTodo(id)...
Read more >CypressError cy.visit() failed trying to load - Laracasts
I followed the tutorial step by step but the test does not go ... pass the option: failOnStatusCode: false cypress/integration/ex_spec.js:2:5 1 | it('works' ......
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 Free
Top 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
@yunusHW @gissavem
cy.request()does not accept 2, 3, args with an options argument as the last arg as you have written. If you need to pass options, you need to pass a single options argument with all arguments includingurl,method(if necessary) andfailOnStatusCode. Please check the docs: https://on.cypress.io/requesttax@jennifer-shehane I tried your sample code, still not working for me. my test code:
and the output is:
pls help:) Thanks in advance.
I’m using:
on macOS BigSure 11.2.3