Skip to content

Microsoft login removes the Cypress test frame when it redirects, causing tests to fail #21307

@blittle91

Description

@blittle91

Current 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

Metadata

Metadata

Labels

topic: cy.originProblems or enhancements related to cy.origin command

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions