diff --git a/src/e2e/specs/dashboard.spec.ts b/src/e2e/specs/dashboard.spec.ts index a72dba31d56..92b77d78f44 100644 --- a/src/e2e/specs/dashboard.spec.ts +++ b/src/e2e/specs/dashboard.spec.ts @@ -515,6 +515,7 @@ test.describe(`${process.env.E2E_TEST_ENV} - Breaches Dashboard - Overview Card` }); await dashboardPage.open(); + await page.waitForURL("**/dashboard/**"); //get the number of exposures count const overviewCardSummary = diff --git a/src/e2e/utils/helpers.ts b/src/e2e/utils/helpers.ts index ddb6da2800f..406bec589c4 100644 --- a/src/e2e/utils/helpers.ts +++ b/src/e2e/utils/helpers.ts @@ -208,12 +208,10 @@ export const forceLoginAs = async ( await page.context().clearCookies(); await landingPage.open(); await landingPage.goToSignIn(); - let visible = true; - try { - await expect(authPage.useDifferentEmailButton).toBeVisible(); - } catch { - visible = false; - } + await page + .locator("//input[@type='password'] | //div/input[@type='email']") + .waitFor({ state: "visible" }); + const visible = await authPage.useDifferentEmailButton.isVisible(); if (visible) { await authPage.useDifferentEmailButton.click(); await page.waitForURL(/^(?!.*signin).*/);