cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.68k stars 3.16k forks source link

Click on submit form does not recognize HTTP 302 response code #29488

Closed AngeloBadellino closed 1 week ago

AngeloBadellino commented 4 months ago

Current behavior

When attempting to automate a login using Auth0's Universal Login, the automation fails to execute the click on the submit button, preventing the completion of the process.

On a live environment the user input the username and click on the form submit. The click triggers a POST that return a 302 response. Then the user can see the password field and conclude the login by performing another click on the submit button.

During the cypress e2e run the first submit seems to be performed since the password field become visible, but the test timeout after 60 second while waiting for the page to be loaded.

image

Desired behavior

On submit click Cypress should recognize the response code returned after posting the form and continue the login process.

Test code to reproduce

The described behavior can be seen by cloning and running the following repo.

Its enough to run npm install and npm run serve and then open cypress to run the only test,

https://github.com/AngeloBadellino/cypress_auth0

Cypress Version

13.8.1

Node version

v18.20.2

Operating System

Windows 10 enterpsice 19045.4291

Debug Logs

No response

Other

No response

bsdmon commented 3 weeks ago

I had a similar behavior in one of my internal application and I managed to found out what was going on : Location response header value has http:// and it seems that Cypress refuses to load the page (which may be an expected behavior, I guess).

Of course, I'm not telling that it is the same issue but it is worth to check your Location header value ?

AngeloBadellino commented 1 week ago

Running the test under HTTPS make cypress correctly intercept the responses from the external domain. Thanks!