diff --git a/playwright.config.js b/playwright.config.js index 7aac2fbf270..4f2bb7f445f 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -57,7 +57,7 @@ export default defineConfig({ retries: process.env.CI ? 1 : 0, /* Use all of the available wokers in CI and use default locally. */ - workers: process.env.CI ? "100%" : undefined, + workers: process.env.CI ? "75%" : undefined, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ reporter: process.env.CI ? [['github'], ['html']] : 'html', diff --git a/src/e2e/pages/dashBoardPage.ts b/src/e2e/pages/dashBoardPage.ts index 262d0986fbf..ea9fc14f6eb 100644 --- a/src/e2e/pages/dashBoardPage.ts +++ b/src/e2e/pages/dashBoardPage.ts @@ -122,7 +122,7 @@ export class DashboardPage { '//a[starts-with(@class, "Shell_mozillaLink")]', ); this.allBreachesFooter = page.locator("footer a", { - hasText: "All Breaches", + hasText: "Recent data breaches", }); this.faqsFooter = page.locator("footer a", { hasText: "FAQs" }); this.termsOfServiceFooter = page.locator("footer a", { diff --git a/src/e2e/specs/auth.spec.ts b/src/e2e/specs/auth.spec.ts index a820b367893..ee6a098852e 100644 --- a/src/e2e/specs/auth.spec.ts +++ b/src/e2e/specs/auth.spec.ts @@ -27,8 +27,8 @@ test.describe(`${process.env.E2E_TEST_ENV} - Authentication flow verification @s await authPage.signUp(randomEmail, page); // assert successful login - const successUrl = "/user/welcome"; - expect(page.url()).toBe(`${process.env.E2E_TEST_BASE_URL}${successUrl}`); + const successUrl = `${process.env.E2E_TEST_BASE_URL}/user/welcome`; + expect(page.url()).toBe(successUrl); await testInfo.attach( `${process.env.E2E_TEST_ENV}-signup-monitor-dashboard.png`, diff --git a/src/e2e/specs/purchase.spec.ts b/src/e2e/specs/purchase.spec.ts index 064d8e2c992..d95242622c8 100644 --- a/src/e2e/specs/purchase.spec.ts +++ b/src/e2e/specs/purchase.spec.ts @@ -5,200 +5,197 @@ import { test, expect } from "../fixtures/basePage.js"; import { checkAuthState, setEnvVariables } from "../utils/helpers.js"; -test.describe.skip( - `${process.env.E2E_TEST_ENV} - Breach Scan, Monitor Plus Purchase Flow`, - () => { - test.beforeEach(async ({ page, authPage, landingPage, welcomePage }) => { - test.info().annotations.push({ - type: "testrail id", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463564", - }); - - test.slow( - true, - "this test runs through the welcome scan flow, increasing timeout to address it", - ); - - setEnvVariables(process.env.E2E_TEST_ACCOUNT_EMAIL as string); +test.describe(`${process.env.E2E_TEST_ENV} - Breach Scan, Monitor Plus Purchase Flow`, () => { + test.beforeEach(async ({ page, authPage, landingPage, welcomePage }) => { + test.info().annotations.push({ + type: "testrail id", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463564", + }); - // speed up test by ignoring non necessary requests - await page.route(/(analytics)/, async (route) => { - await route.abort(); - }); + test.slow( + true, + "this test runs through the welcome scan flow, increasing timeout to address it", + ); - // start authentication flow - await landingPage.open(); - await landingPage.goToSignIn(); + setEnvVariables(process.env.E2E_TEST_ACCOUNT_EMAIL as string); - // Fill out sign up form - const randomEmail = `_${Date.now()}@restmail.net`; - await authPage.signUp(randomEmail, page); + // speed up test by ignoring non necessary requests + await page.route(/(analytics)/, async (route) => { + await route.abort(); + }); - // wait for welcome page - await page.waitForURL("**/user/welcome"); - await welcomePage.goThroughFirstScan(); - expect(page.url()).toContain("/user/dashboard"); + // start authentication flow + await landingPage.open(); + await landingPage.goToSignIn(); + + // Fill out sign up form + const randomEmail = `_${Date.now()}@restmail.net`; + await authPage.signUp(randomEmail, page); + + // wait for welcome page + await page.waitForURL("**/user/welcome"); + await welcomePage.goThroughFirstScan(); + expect(page.url()).toContain("/user/dashboard"); + }); + + test("Verify that the user can purchase the plus subscription with a Stripe card - Yearly", async ({ + dashboardPage, + purchasePage, + page, + }) => { + test.skip( + process.env.E2E_TEST_ENV === "production", + "payment method test not available in production", + ); + // link to testrail case + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463627", }); - test("Verify that the user can purchase the plus subscription with a Stripe card - Yearly", async ({ - dashboardPage, - purchasePage, - page, - }) => { - test.skip( - process.env.E2E_TEST_ENV === "production", - "payment method test not available in production", + try { + await checkAuthState(page); + } catch { + console.log( + "[E2E_LOG] - No fxa auth required, proceeding... with stripe yearly", ); - // link to testrail case - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463627", - }); - - try { - await checkAuthState(page); - } catch { - console.log( - "[E2E_LOG] - No fxa auth required, proceeding... with stripe yearly", - ); - } - - // navigate to subscription - await dashboardPage.open(); - await dashboardPage.subscribeButton.click(); - await dashboardPage.subscribeDialogSelectYearlyPlanLink.click(); - await purchasePage.subscriptionHeader.waitFor(); - - // fill out subscription payment - await purchasePage.authorizationCheckbox.check(); - await purchasePage.fillOutStripeCardInfo(); - await purchasePage.payNowButton.click({ force: true }); - await page.getByText("Subscription confirmation").waitFor(); - // navigate to confirmation - await purchasePage.getStartedButton.click(); - await purchasePage.goToNextStep.waitFor(); - await purchasePage.goToNextStep.click(); - - // confirm successful payment - await dashboardPage.plusSubscription.waitFor(); - await expect(dashboardPage.plusSubscription).toBeVisible(); + } + + // navigate to subscription + await dashboardPage.open(); + await dashboardPage.subscribeButton.click(); + await dashboardPage.subscribeDialogSelectYearlyPlanLink.click(); + await purchasePage.subscriptionHeader.waitFor(); + + // fill out subscription payment + await purchasePage.authorizationCheckbox.check(); + await purchasePage.fillOutStripeCardInfo(); + await purchasePage.payNowButton.click({ force: true }); + await page.getByText("Subscription confirmation").waitFor(); + // navigate to confirmation + await purchasePage.getStartedButton.click(); + await purchasePage.goToNextStep.waitFor(); + await purchasePage.goToNextStep.click(); + + // confirm successful payment + await dashboardPage.plusSubscription.waitFor(); + await expect(dashboardPage.plusSubscription).toBeVisible(); + }); + + test("Verify that the user can purchase the plus subscription with a Stripe card - Monthly", async ({ + purchasePage, + dashboardPage, + page, + }) => { + test.skip( + process.env.E2E_TEST_ENV === "production", + "payment method test not available in production", + ); + // link to multiple testrail cases + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463627", }); - test("Verify that the user can purchase the plus subscription with a Stripe card - Monthly", async ({ - purchasePage, - dashboardPage, - page, - }) => { - test.skip( - process.env.E2E_TEST_ENV === "production", - "payment method test not available in production", - ); - // link to multiple testrail cases - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463627", - }); - - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2301529", - }); - - try { - await checkAuthState(page); - } catch { - console.log( - "[E2E_LOG] - No fxa auth required, proceeding... with stripe monthly", - ); - } - - // navigate to subscription - await dashboardPage.open(); - await dashboardPage.subscribeButton.click(); - - // verify user purchase choices - await expect(dashboardPage.subscribeDialogCloseButton).toBeVisible(); - await expect(dashboardPage.yearlyMonthlyTablist).toBeVisible(); - await dashboardPage.yearlyTab.click(); - await expect( - dashboardPage.subscribeDialogSelectYearlyPlanLink, - ).toBeVisible(); - - await dashboardPage.monthlyTab.click(); - await expect( - dashboardPage.subscribeDialogSelectMonthlyPlanLink, - ).toBeVisible(); - - await dashboardPage.monthlyTab.click(); - await dashboardPage.subscribeDialogSelectMonthlyPlanLink.click(); - await purchasePage.subscriptionHeader.waitFor(); - - // fill out subscription payment - await purchasePage.authorizationCheckbox.waitFor(); - await purchasePage.authorizationCheckbox.check(); - await purchasePage.fillOutStripeCardInfo(); - await purchasePage.payNowButton.click({ force: true }); - await page.getByText("Subscription confirmation").waitFor(); - // navigate to confirmation - await purchasePage.getStartedButton.click(); - await purchasePage.goToNextStep.click(); - - // confirm successful payment - await dashboardPage.plusSubscription.waitFor({ - state: "attached", - timeout: 5000, - }); - await expect(dashboardPage.plusSubscription).toBeVisible(); + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2301529", }); - test("Verify that the user can purchase the plus subscription with a PayPal account - yearly", async ({ - purchasePage, - dashboardPage, - context, - }) => { - test.skip( - process.env.E2E_TEST_ENV === "production", - "payment method test not available in production", + try { + await checkAuthState(page); + } catch { + console.log( + "[E2E_LOG] - No fxa auth required, proceeding... with stripe monthly", ); - // link to testrail case - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463628", - }); - - await purchasePage.gotoPurchaseFromDashboard(dashboardPage, true); - // fill out subscription payment - await purchasePage.authorizationCheckbox.check(); - await purchasePage.fillOutPaypalInfo(context); - await purchasePage.postPaymentPageCheck(dashboardPage); + } + + // navigate to subscription + await dashboardPage.open(); + await dashboardPage.subscribeButton.click(); + + // verify user purchase choices + await expect(dashboardPage.subscribeDialogCloseButton).toBeVisible(); + await expect(dashboardPage.yearlyMonthlyTablist).toBeVisible(); + await dashboardPage.yearlyTab.click(); + await expect( + dashboardPage.subscribeDialogSelectYearlyPlanLink, + ).toBeVisible(); + + await dashboardPage.monthlyTab.click(); + await expect( + dashboardPage.subscribeDialogSelectMonthlyPlanLink, + ).toBeVisible(); + + await dashboardPage.monthlyTab.click(); + await dashboardPage.subscribeDialogSelectMonthlyPlanLink.click(); + await purchasePage.subscriptionHeader.waitFor(); + + // fill out subscription payment + await purchasePage.authorizationCheckbox.waitFor(); + await purchasePage.authorizationCheckbox.check(); + await purchasePage.fillOutStripeCardInfo(); + await purchasePage.payNowButton.click({ force: true }); + await page.getByText("Subscription confirmation").waitFor(); + // navigate to confirmation + await purchasePage.getStartedButton.click(); + await purchasePage.goToNextStep.click(); + + // confirm successful payment + await dashboardPage.plusSubscription.waitFor({ + state: "attached", + timeout: 5000, + }); + await expect(dashboardPage.plusSubscription).toBeVisible(); + }); + + test("Verify that the user can purchase the plus subscription with a PayPal account - yearly", async ({ + purchasePage, + dashboardPage, + context, + }) => { + test.skip( + process.env.E2E_TEST_ENV === "production", + "payment method test not available in production", + ); + // link to testrail case + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463628", }); - test("Verify that the user can purchase the plus subscription with a PayPal account - monthly", async ({ - purchasePage, - dashboardPage, - context, - }) => { - test.skip( - process.env.E2E_TEST_ENV === "production", - "payment method test not available in production", - ); - // link to testrail case - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463628", - }); - - await purchasePage.gotoPurchaseFromDashboard(dashboardPage, false); - // fill out subscription payment - await purchasePage.authorizationCheckbox.check(); - await purchasePage.fillOutPaypalInfo(context); - await purchasePage.postPaymentPageCheck(dashboardPage); + await purchasePage.gotoPurchaseFromDashboard(dashboardPage, true); + // fill out subscription payment + await purchasePage.authorizationCheckbox.check(); + await purchasePage.fillOutPaypalInfo(context); + await purchasePage.postPaymentPageCheck(dashboardPage); + }); + + test("Verify that the user can purchase the plus subscription with a PayPal account - monthly", async ({ + purchasePage, + dashboardPage, + context, + }) => { + test.skip( + process.env.E2E_TEST_ENV === "production", + "payment method test not available in production", + ); + // link to testrail case + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463628", }); - }, -); + + await purchasePage.gotoPurchaseFromDashboard(dashboardPage, false); + // fill out subscription payment + await purchasePage.authorizationCheckbox.check(); + await purchasePage.fillOutPaypalInfo(context); + await purchasePage.postPaymentPageCheck(dashboardPage); + }); +});