Microsoft AAD Authentication fails in my cypress testing #26616
jayakumarn
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I have a webpage that runs on our company's intranet. When I try to access it via e.g https://abc.com/, it automatically redirects to login.microsoftonline.com for OAuth authentication. Once the user credentials are authenticated, it should redirect back to https://abc.com/. This works well when I manually perform the actions in the browser, but it fails when I run Cypress tests.
I've written a Cypress test that includes the command cy.visit("/"), but when I run the test, I only see a 302 redirection to login.microsoftonline.com. I don't see the user interface for login scenarios, even though the network stack in dev tools shows that the API calls for authentication was happening infinitely that too successful with no errors( because of this the user interface is not loading for logic scenarios). The test fails after a long time with the error "Browsers will not fire the load event until all stylesheets and scripts are done downloading."
I tied with the below e.g as well
Cy.visit("/")
Cy.origin("https://login.microsoftonline.com",()=>{
cy.get("#i0116").type("username");
});
Still facing the same issue no other clue or any errors. The only difference I see with the example provided by cypress in the documentation is they were redirecting to oauth authentication page after clicking on login button but in my case the page itself redirect to oauth login page by load balancers.
Can anyone help me understand why the authentication is failing in the Cypress tests, even though it works fine in the browser? Any suggestions on how to resolve this issue would be greatly appreciated.
Thank you in advance for your help!
Beta Was this translation helpful? Give feedback.
All reactions