Microsoft login removes the Cypress test frame when it redirects, causing tests to fail
See original GitHub issueCurrent behavior
Using 9.6.0, I want to use the origin
function to firstly, login through Microsoft and then continue with the test within the baseUrl.
Using the code below, when cy.visit('/');
is executed, the test frame around Cypress (when using yarn cypress open
) is removed and consequently, Cypress can no longer communicate with the browser and all tests fail.
describe('Authenticate', () => {
beforeEach(() => {
cy.origin('https://login.microsoftonline.com', () => {
cy.visit('/');
cy.get('[name="loginfmt"]').type(`${Cypress.env('email')}{enter}`);
cy.get('[name="passwd"]').type(`${Cypress.env('password')}{enter}`);
cy.get('[type="submit"]').type('{enter}');
});
});
it('Show homepage once logged in', () => {
});
});
Is there a working solution for this?
Desired behavior
For the Cypress test frame to persist whilst the login occurs.
Test code to reproduce
As above.
Cypress Version
9.6.0
Other
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:8
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Azure AD Authentication in Cypress Tests
With Azure AD, the usual login flow is to check if the user has a valid token and if not, redirect them to...
Read more >Error Messages | Cypress Documentation
We found an error preparing your test file. This message means that Cypress encountered an error when compiling and/or bundling your test file....
Read more >While running the tests, cypress is redirecting - Stack Overflow
while I am running the tests in cypress, it is redirecting to login page, then remaining tests become fails . What is the...
Read more >Cypress Best Practices For Test Automation - LambdaTest
Cypress is an amazing framework for testing your frontend applications. ... login page, which means you have failed the test in isolation.
Read more >Using Cypress to test Azure Active Directory protected Single ...
Cypress is an all-in-one, end-to-end testing framework and assertion library ... authenticated and not redirecting the user to the Microsoft login page.
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 FreeTop 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
Top GitHub Comments
@thecodeholic have you tried adding the new
experimentalModifyObstructiveThirdPartyCode
along sideexperimentalSessionAndOrigin
as described here? It looks like you are being frame busted, which theexperimentalModifyObstructiveThirdPartyCode
should modify to get you up and running.@AtofStryker That was the case. Thanks a lot.