diff --git a/packages/e2e/integration/login_flow_spec.ts b/packages/e2e/integration/login_flow_spec.ts index 03ccd47f1..5d97805fe 100644 --- a/packages/e2e/integration/login_flow_spec.ts +++ b/packages/e2e/integration/login_flow_spec.ts @@ -413,17 +413,18 @@ describe("login", () => { describe("Login redirect", () => { it("Redirects to customer bookings page on customer (non-admin) login", () => { const password = "password"; - cy.addAuthUser({ email: saul.email, password }); - // log in saul, who is not an admin, but exists in customers collection - cy.clickButton(t(AuthTitle.SignInWithEmail)); - cy.getAttrWith("type", "email").type(saul.email); - cy.clickButton(t(ActionButton.Next)); - cy.contains(t(AuthTitle.SignIn)); - cy.getAttrWith("type", "password").type(password); - cy.clickButton(t(ActionButton.SignIn)); - // on successful login, should redirect to saul's customer bookings - cy.url().should("include", saul.secretKey); - cy.contains(`${saul.name} ${saul.surname}`); + cy.addAuthUser({ email: saul.email, password }).then(() => { + // log in saul, who is not an admin, but exists in customers collection + cy.clickButton(t(AuthTitle.SignInWithEmail)); + cy.getAttrWith("type", "email").type(saul.email); + cy.clickButton(t(ActionButton.Next)); + cy.contains(t(AuthTitle.SignIn)); + cy.getAttrWith("type", "password").type(password); + cy.clickButton(t(ActionButton.SignIn)); + // on successful login, should redirect to saul's customer bookings + cy.url().should("include", saul.secretKey); + return cy.contains(`${saul.name} ${saul.surname}`); + }); }); it("redirects to self registration page if user not admin, nor a registered customer", () => {