-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cy.request() fails in 3.5.0 #5436
Comments
Thanks for opening the issue @pitgrap. I know this is likely difficult since this is just failing on your proprietary url, but we'll have to get a working example of the failure on our end. Which will mean. replicating 2 302 redirects or hitting a public url that redirects twice using 302. We will recreate this, but it will take time, so any clear way to reproduce providing test code will help save some time and also likely isolate the problem further. |
When I do a it('reroutes 301', () => {
cy.request({
url: 'http://amazon.com',
retryOnStatusCodeFailure: true,
})
}) |
Thank you for your investigation so far. I know it's not easy to investigate without a way to reproduce it. The URLs we're testing are all internal links. :( The whole test looks like it("check if links are available with valid response code", function() {
cy.visit("/");
cy.get("a").each($element => {
cy.clearCookies();
cy.wrap($element)
.should("have.attr", "href")
.then(link => {
cy.request({
url: link,
retryOnStatusCodeFailure: true,
retryOnNetworkFailure: true
});
});
});
}); And this works fine with 3.4.1. After upgrading to 3.5.0 one link fails with the weird error message above. And one difference between this link and the others I could find so far is the double redirection. |
I'm having a similar issue with the new cypress 3.5.0. In my case, I send a login request with the credentials and the csrf token that I grab from the HTML https://github.com/cypress-io/cypress-example-recipes/blob/master/examples/logging-in__csrf-tokens/cypress/integration/logging-in-csrf-tokens-spec.js#L7 There is a request between step 1 and 3 which is automatically done in the background that verifies if its a 302 and its failing there.
Yesterday afternoon around 3pm PST ( when my cypress updated to 3.5.0) all my mock login tests started failing. It returns a 403 instead of 200.
We had to switch to version |
I am also getting the error... Had to downgrade to 3.4.1 Same error as the original poster. |
Similar problem here, headers are not being sent with this commmand on 3.5.0: cy.request({ url: `${myUri}`, headers: exchangeHeaders, failOnStatusCode: false }); No problem when running the same on 3.4.1 |
Are you guys setting cookies for auth during your redirects? @srideeps I notice that you're getting a 403, could that be because the expected cookies are not being set on redirect? Setting cookies on a redirect is partially broken in 3.5.0, but there is a fix already: #5432 Let me know if this fits your situation. |
We are also getting the same error as @pitgrap. In our case, we have 2 requests (tests) that run after each other. The first test passes, the 2nd test we get the same error as @pitgrap. If I skip the first test, and only run the 2nd, it does indeed work without getting this error. Hope that helps. We are also using internal urls otherwise would have no problem sharing. |
@flotwig .. yes! that's exactly my situation. Also I'm sorry for not mentioning that we set cookies on re-direct. Hopefully that fix helps us!! and you guys are awesome! we ❤️ cypress!! |
Hey! |
We think this issue may be related to an issue with setting cookies detailed here: #5453 (comment) Please update if you can confirm or deny the cookies being a problem in your situation. |
@jennifer-shehane thanks :) |
Just checked the code again, we're using |
The code for this is done in cypress-io/cypress#5478, but has yet to be released. |
Released in |
Works! |
Yes, 3.6.1 is working again. Thank you. |
Current behavior:
A simple cy.request() test failed after upgrading to 3.5.0.
The URL has two 302 redirects.
https://XXX/backoffice (302)-> https://XXX/backoffice/ (302)-> https://XXX/backoffice/login.zul (200)
Cypress Error:
Desired behavior:
The same tests works in Cypress 3.4.1.
Calling the URL https://XXX/backoffice manually works too (200 after two 302).
Versions
Cypress 3.5.0 with Chrome
Windows 10 and macOS
The text was updated successfully, but these errors were encountered: