I have a login script written in the command file that I use as a beforeEach in each test spec file. This worked in Cypress 9, but I recently upgraded to Cypress 11 and now the session doesn't carry over into the test. The command runs successfully, but when it goes to the test I'm not signed in, so it fails.
Cypress.Commands.add("login", () => {
cy.request({
method: 'POST',
url: '/Account/Login', // baseUrl is prepended to url
form: true, // indicates the body should be form urlencoded and sets Content-Type: application/x-www-form-urlencoded headers
body: {
UserName: Cypress.env('username'),
Password: Cypress.env('password'),
RememberMe: false,
FranchiseSelected: 1,
}
})
})
Screenshot:

Does anyone know what I'm missing to update this to work in Cypress 11?
I have made a login command that actually goes to the page and logs in, and that works, but I would really like for this POST command to work.