How to login with Microsoft SSO in Cypress test when getting cookies blocked error

Viewed 61

I'm trying to login to microsoft SSO account in my cypress test and I'm getting "Your browser is currently set to block cookies." error. I am using Cypress version 10+. I've seen posts about using Cypress.Cookies.preserveOnce() but it is deprecated in the 10+ version. This is the error I'm seeing in my cypress test:

enter image description here

This is how I'm trying to login.

cy.session(args, () => {
        cy.origin(`https://login.microsoftonline.com/`, {args}, ({ email, password}) => {
            cy.visit('/')
            cy.get('[name="loginfmt"]').type(email);
            cy.get('[name="passwd"]').type(password);
            cy.get('[type="submit"]').type('{enter}');
        })
    });

Any help will be appreciated!

0 Answers
Related