diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b3301191072..88b41611de9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,6 +1,8 @@ name: Build -on: [push] +on: + pull_request: + types: [closed] jobs: npm-build: diff --git a/.github/workflows/docker_build_deploy.yml b/.github/workflows/docker_build_deploy.yml index b26578fdc68..c235a37807f 100644 --- a/.github/workflows/docker_build_deploy.yml +++ b/.github/workflows/docker_build_deploy.yml @@ -1,8 +1,8 @@ name: Build Docker image and publish on: - push: - branches: [ main ] + pull_request: + types: [closed] jobs: push_to_registry: name: Push Docker image to Docker Hub diff --git a/.github/workflows/docker_check.yml b/.github/workflows/docker_check.yml index ef75f7751bc..214f7667391 100644 --- a/.github/workflows/docker_check.yml +++ b/.github/workflows/docker_check.yml @@ -1,6 +1,7 @@ name: Build Docker image check on: pull_request: + types: [closed] jobs: docker_build: name: Build Docker image diff --git a/.github/workflows/e2e_pr_full.yml b/.github/workflows/e2e_pr_full.yml index b3f2219478c..93174fe9933 100644 --- a/.github/workflows/e2e_pr_full.yml +++ b/.github/workflows/e2e_pr_full.yml @@ -1,4 +1,4 @@ -name: Monitor E2E Full Test Suite +name: Monitor E2E Test Suite (full) on: push jobs: e2e-tests: diff --git a/.github/workflows/e2e_pr_smoke.yml b/.github/workflows/e2e_pr_smoke.yml index 08b33d561a0..361ec7ef7b6 100644 --- a/.github/workflows/e2e_pr_smoke.yml +++ b/.github/workflows/e2e_pr_smoke.yml @@ -1,4 +1,4 @@ -name: Monitor E2E Smoke Test Suite +name: Monitor E2E Test Suite (smoke) on: push: branches: [ main ] diff --git a/.github/workflows/preview_deploy_gcp.yml b/.github/workflows/preview_deploy_gcp.yml index c6fdef23a32..9115a1a72a0 100644 --- a/.github/workflows/preview_deploy_gcp.yml +++ b/.github/workflows/preview_deploy_gcp.yml @@ -1,7 +1,8 @@ name: Deploy Preview -on: +on: pull_request: + types: [closed] env: PROJECT_ID: ${{ secrets.GCP_PROJECT }} diff --git a/.github/workflows/reference_linter.yaml b/.github/workflows/reference_linter.yaml index 173b7180b3d..0355144fb89 100644 --- a/.github/workflows/reference_linter.yaml +++ b/.github/workflows/reference_linter.yaml @@ -1,8 +1,7 @@ name: Lint Reference Files on: - push: pull_request: - workflow_dispatch: + types: [closed] jobs: l10n-lint: runs-on: ubuntu-latest diff --git a/.github/workflows/unittests.yaml b/.github/workflows/unittests.yaml index 83c3a974b96..b8ef110377a 100644 --- a/.github/workflows/unittests.yaml +++ b/.github/workflows/unittests.yaml @@ -1,6 +1,8 @@ name: Unit Tests -on: [push] +on: + pull_request: + types: [closed] jobs: unit-tests: diff --git a/playwright.config.js b/playwright.config.js index bede251a300..7aac2fbf270 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -50,11 +50,14 @@ export default defineConfig({ /* Fail the build on CI if you accidentally left test.only in the source code. */ forbidOnly: !!process.env.CI, + /* Limit the number of failures */ + maxFailures: process.env.CI ? 1 : undefined, + /* Retry on CI only */ retries: process.env.CI ? 1 : 0, - /* Opt out of parallel tests on CI. */ - workers: process.env.CI ? 1 : undefined, + /* Use all of the available wokers in CI and use default locally. */ + workers: process.env.CI ? "100%" : undefined, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ reporter: process.env.CI ? [['github'], ['html']] : 'html', diff --git a/src/e2e/specs/auth.spec.ts b/src/e2e/specs/auth.spec.ts index 120be8bcc48..92959b012d7 100644 --- a/src/e2e/specs/auth.spec.ts +++ b/src/e2e/specs/auth.spec.ts @@ -4,74 +4,71 @@ import { test, expect } from "../fixtures/basePage.js"; -test.describe.skip( - `${process.env.E2E_TEST_ENV} - Authentication flow verification @smoke`, - () => { - test.beforeEach(async ({ landingPage }) => { - await landingPage.open(); +test.describe(`${process.env.E2E_TEST_ENV} - Authentication flow verification @smoke`, () => { + test.beforeEach(async ({ landingPage }) => { + await landingPage.open(); + }); + + test("Verify sign up with new user", async ({ + page, + authPage, + landingPage, + }, testInfo) => { + // speed up test by ignore non necessary requests + await page.route(/(analytics)/, async (route) => { + await route.abort(); }); - test("Verify sign up with new user", async ({ - page, - authPage, - landingPage, - }, testInfo) => { - // speed up test by ignore non necessary requests - await page.route(/(analytics)/, async (route) => { - await route.abort(); - }); + // start authentication flow + await landingPage.goToSignIn(); - // start authentication flow - await landingPage.goToSignIn(); + // Fill out sign up form + const randomEmail = `${Date.now()}_tstact@restmail.net`; + await authPage.signUp(randomEmail, page); - // Fill out sign up form - const randomEmail = `${Date.now()}_tstact@restmail.net`; - await authPage.signUp(randomEmail, page); + // assert successful login + const successUrl = + process.env.E2E_TEST_ENV === "local" + ? "/user/dashboard" + : "/user/welcome"; + expect(page.url()).toBe(`${process.env.E2E_TEST_BASE_URL}${successUrl}`); - // assert successful login - const successUrl = - process.env.E2E_TEST_ENV === "local" - ? "/user/dashboard" - : "/user/welcome"; - expect(page.url()).toBe(`${process.env.E2E_TEST_BASE_URL}${successUrl}`); + await testInfo.attach( + `${process.env.E2E_TEST_ENV}-signup-monitor-dashboard.png`, + { + body: await page.screenshot(), + contentType: "image/png", + }, + ); + }); - await testInfo.attach( - `${process.env.E2E_TEST_ENV}-signup-monitor-dashboard.png`, - { - body: await page.screenshot(), - contentType: "image/png", - }, - ); + test("Verify sign in with existing user", async ({ + page, + authPage, + landingPage, + dashboardPage, + }, testInfo) => { + // speed up test by ignore non necessary requests + await page.route(/(analytics)/, async (route) => { + await route.abort(); }); - test("Verify sign in with existing user", async ({ - page, - authPage, - landingPage, - dashboardPage, - }, testInfo) => { - // speed up test by ignore non necessary requests - await page.route(/(analytics)/, async (route) => { - await route.abort(); - }); - - // start authentication flow - await landingPage.goToSignIn(); + // start authentication flow + await landingPage.goToSignIn(); - // sign in - await authPage.signIn(process.env.E2E_TEST_ACCOUNT_EMAIL as string); + // sign in + await authPage.signIn(process.env.E2E_TEST_ACCOUNT_EMAIL as string); - // assert successful login - await expect(dashboardPage.fixedTab).toBeVisible(); - await expect(dashboardPage.actionNeededTab).toBeVisible(); + // assert successful login + await expect(dashboardPage.fixedTab).toBeVisible(); + await expect(dashboardPage.actionNeededTab).toBeVisible(); - await testInfo.attach( - `${process.env.E2E_TEST_ENV}-signin-monitor-dashboard.png`, - { - body: await page.screenshot(), - contentType: "image/png", - }, - ); - }); - }, -); + await testInfo.attach( + `${process.env.E2E_TEST_ENV}-signin-monitor-dashboard.png`, + { + body: await page.screenshot(), + contentType: "image/png", + }, + ); + }); +}); diff --git a/src/e2e/specs/dashboard.spec.ts b/src/e2e/specs/dashboard.spec.ts index d30c1745e3b..5b37e3b8b00 100644 --- a/src/e2e/specs/dashboard.spec.ts +++ b/src/e2e/specs/dashboard.spec.ts @@ -20,216 +20,213 @@ import { // bypass login test.use({ storageState: "./e2e/storageState.json" }); -test.describe.skip( - `${process.env.E2E_TEST_ENV} - Breaches Dashboard - Headers @smoke`, - () => { - test.beforeEach(async ({ dashboardPage, page }) => { - await dashboardPage.open(); - - try { - await checkAuthState(page); - } catch { - console.log("[E2E_LOG] - No fxa auth required, proceeding..."); - } - }); +test.describe(`${process.env.E2E_TEST_ENV} - Breaches Dashboard - Headers @smoke`, () => { + test.beforeEach(async ({ dashboardPage, page }) => { + await dashboardPage.open(); - test("Verify that the site header is displayed correctly for signed in users", async ({ - dashboardPage, - }) => { - // link to testrail - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2301512", - }); + try { + await checkAuthState(page); + } catch { + console.log("[E2E_LOG] - No fxa auth required, proceeding..."); + } + }); - await expect(dashboardPage.dashboardNavButton).toHaveAttribute( - "href", - "/user/dashboard", - ); - await expect(dashboardPage.FAQsNavButton).toHaveAttribute( - "href", - "https://support.mozilla.org/kb/firefox-monitor-faq", - ); + test("Verify that the site header is displayed correctly for signed in users", async ({ + dashboardPage, + }) => { + // link to testrail + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2301512", }); - test("Verify that the site header and navigation bar is displayed correctly", async ({ - dashboardPage, - }) => { - // link to testrail - test.info().annotations.push( - { - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2301511", - }, - { - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463567", - }, - ); - - // verify the navigation bar left side elements - await expect(dashboardPage.fireFoxMonitorLogoImgButton).toBeVisible(); - await expect(dashboardPage.dashboardNavButton).toBeVisible(); - await expect(dashboardPage.exposuresHeading).toBeVisible(); - await expect(dashboardPage.settingsPageLink).toBeVisible(); - await expect(dashboardPage.FAQsNavButton).toBeVisible(); - - // verify the site header elements - await expect(dashboardPage.actionNeededTab).toBeVisible(); - await expect(dashboardPage.fixedTab).toBeVisible(); - - // auto data removal button - await expect(dashboardPage.subscribeButton).toBeVisible(); - - // apps and services - await expect(dashboardPage.appsAndServices).toBeVisible(); - await dashboardPage.appsAndServices.click(); - await expect(dashboardPage.servicesVpn).toBeVisible(); - await expect(dashboardPage.servicesRelay).toBeVisible(); - await expect(dashboardPage.servicesPocket).toBeVisible(); - await expect(dashboardPage.servicesFirefoxDesktop).toBeVisible(); - await expect(dashboardPage.servicesFirefoxMobile).toBeVisible(); - - // profile button - await dashboardPage.closeAppsAndServices.click(); - await expect(dashboardPage.profileButton).toBeVisible(); - await dashboardPage.profileButton.click(); - await expect(dashboardPage.profileEmail).toBeVisible(); - await expect(dashboardPage.manageProfile).toBeVisible(); - await expect(dashboardPage.settingsPageLink).toBeVisible(); - await expect(dashboardPage.helpAndSupport).toBeVisible(); - await expect(dashboardPage.signOut).toBeVisible(); - }); + await expect(dashboardPage.dashboardNavButton).toHaveAttribute( + "href", + "/user/dashboard", + ); + await expect(dashboardPage.FAQsNavButton).toHaveAttribute( + "href", + "https://support.mozilla.org/kb/firefox-monitor-faq", + ); + }); - test("Verify that the correct message is displayed on the Action Needed tab when all the exposures are fixed", async ({ - dashboardPage, - }) => { - // link to testrail - test.info().annotations.push({ + test("Verify that the site header and navigation bar is displayed correctly", async ({ + dashboardPage, + }) => { + // link to testrail + test.info().annotations.push( + { type: "testrail", description: "https://testrail.stage.mozaws.net/index.php?/cases/view/2301511", - }); + }, + { + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463567", + }, + ); - // verify overview card - await expect(dashboardPage.dashboardMozLogo).toBeVisible(); + // verify the navigation bar left side elements + await expect(dashboardPage.fireFoxMonitorLogoImgButton).toBeVisible(); + await expect(dashboardPage.dashboardNavButton).toBeVisible(); + await expect(dashboardPage.exposuresHeading).toBeVisible(); + await expect(dashboardPage.settingsPageLink).toBeVisible(); + await expect(dashboardPage.FAQsNavButton).toBeVisible(); + + // verify the site header elements + await expect(dashboardPage.actionNeededTab).toBeVisible(); + await expect(dashboardPage.fixedTab).toBeVisible(); + + // auto data removal button + await expect(dashboardPage.subscribeButton).toBeVisible(); + + // apps and services + await expect(dashboardPage.appsAndServices).toBeVisible(); + await dashboardPage.appsAndServices.click(); + await expect(dashboardPage.servicesVpn).toBeVisible(); + await expect(dashboardPage.servicesRelay).toBeVisible(); + await expect(dashboardPage.servicesPocket).toBeVisible(); + await expect(dashboardPage.servicesFirefoxDesktop).toBeVisible(); + await expect(dashboardPage.servicesFirefoxMobile).toBeVisible(); + + // profile button + await dashboardPage.closeAppsAndServices.click(); + await expect(dashboardPage.profileButton).toBeVisible(); + await dashboardPage.profileButton.click(); + await expect(dashboardPage.profileEmail).toBeVisible(); + await expect(dashboardPage.manageProfile).toBeVisible(); + await expect(dashboardPage.settingsPageLink).toBeVisible(); + await expect(dashboardPage.helpAndSupport).toBeVisible(); + await expect(dashboardPage.signOut).toBeVisible(); + }); - // TODO: add verifications for all fixed exposures state + test("Verify that the correct message is displayed on the Action Needed tab when all the exposures are fixed", async ({ + dashboardPage, + }) => { + // link to testrail + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2301511", }); - test("Verify that the Fixed tab layout and tooltips are displayed correctly", async ({ - dashboardPage, - }) => { - // link to testrail - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2301532", - }); + // verify overview card + await expect(dashboardPage.dashboardMozLogo).toBeVisible(); - // verify fixed tab's tooltips and popups - await dashboardPage.fixedTab.click(); + // TODO: add verifications for all fixed exposures state + }); - // verify tooltip - await expect(dashboardPage.fixedHeading).toBeVisible(); - await dashboardPage.chartTooltip.click(); - await expect(dashboardPage.aboutFixedExposuresPopup).toBeVisible(); - await dashboardPage.popupCloseButton.click(); - await expect(dashboardPage.aboutFixedExposuresPopup).toBeHidden(); + test("Verify that the Fixed tab layout and tooltips are displayed correctly", async ({ + dashboardPage, + }) => { + // link to testrail + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2301532", }); - test("Verify that the Apps and Services header options work correctly.", async ({ - dashboardPage, - page, - }) => { - // link to testrail - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463569", - }); + // verify fixed tab's tooltips and popups + await dashboardPage.fixedTab.click(); - await dashboardPage.fixedTab.click(); - expect(page.url()).toMatch(/.*dashboard\/fixed\/?/); - await dashboardPage.actionNeededTab.click(); - expect(page.url()).toMatch(/.*dashboard\/action-needed\/?/); - - //apps and services button check - const clickOnLinkAndGoBack = async ( - aTag: Locator, - host: string | RegExp = /.*/, - path: string | RegExp = /.*/, - ) => { - await expect(dashboardPage.appsAndServices).toBeVisible(); - await dashboardPage.appsAndServices.click(); - await expect(dashboardPage.appsAndServicesMenu).toBeVisible(); - await clickOnATagCheckDomain(aTag, host, path, page); - }; + // verify tooltip + await expect(dashboardPage.fixedHeading).toBeVisible(); + await dashboardPage.chartTooltip.click(); + await expect(dashboardPage.aboutFixedExposuresPopup).toBeVisible(); + await dashboardPage.popupCloseButton.click(); + await expect(dashboardPage.aboutFixedExposuresPopup).toBeHidden(); + }); - await clickOnLinkAndGoBack( - dashboardPage.servicesVpn, - "www.mozilla.org", - /.*\/products\/vpn\/?.*/, - ); - await clickOnLinkAndGoBack( - dashboardPage.servicesRelay, - "relay.firefox.com", - ); - await clickOnLinkAndGoBack( - dashboardPage.servicesPocket, - /getpocket\.com|apps\.apple\.com|app\.adjust\.com/, - /.*(\/pocket-and-firefox\/?).*|.*about.*|.*pocket-stay-informed.*/, - ); - await clickOnLinkAndGoBack( - dashboardPage.servicesFirefoxDesktop, - "www.mozilla.org", - /.*\/firefox\/new\/?.*/, - ); - await clickOnLinkAndGoBack( - dashboardPage.servicesFirefoxMobile, - "www.mozilla.org", - /.*\/browsers\/mobile\/?.*/, - ); - await clickOnLinkAndGoBack( - dashboardPage.servicesMozilla, - "www.mozilla.org", - ); + test("Verify that the Apps and Services header options work correctly.", async ({ + dashboardPage, + page, + }) => { + // link to testrail + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463569", + }); - const openProfileMenuItem = async ( - what: Locator, - whatUrl: string | RegExp, - ) => { - await dashboardPage.open(); - await dashboardPage.profileButton.click(); - await expect(what).toBeVisible(); - if (await what.evaluate((e) => e.hasAttribute("href"))) { - const href = await what.getAttribute("href"); - expect(href).not.toBeNull(); - await page.goto(href!); - } else { - await what.click(); - } - await page.waitForURL(whatUrl); - }; + await dashboardPage.fixedTab.click(); + expect(page.url()).toMatch(/.*dashboard\/fixed\/?/); + await dashboardPage.actionNeededTab.click(); + expect(page.url()).toMatch(/.*dashboard\/action-needed\/?/); + + //apps and services button check + const clickOnLinkAndGoBack = async ( + aTag: Locator, + host: string | RegExp = /.*/, + path: string | RegExp = /.*/, + ) => { + await expect(dashboardPage.appsAndServices).toBeVisible(); + await dashboardPage.appsAndServices.click(); + await expect(dashboardPage.appsAndServicesMenu).toBeVisible(); + await clickOnATagCheckDomain(aTag, host, path, page); + }; + + await clickOnLinkAndGoBack( + dashboardPage.servicesVpn, + "www.mozilla.org", + /.*\/products\/vpn\/?.*/, + ); + await clickOnLinkAndGoBack( + dashboardPage.servicesRelay, + "relay.firefox.com", + ); + await clickOnLinkAndGoBack( + dashboardPage.servicesPocket, + /getpocket\.com|apps\.apple\.com|app\.adjust\.com/, + /.*(\/pocket-and-firefox\/?).*|.*about.*|.*pocket-stay-informed.*/, + ); + await clickOnLinkAndGoBack( + dashboardPage.servicesFirefoxDesktop, + "www.mozilla.org", + /.*\/firefox\/new\/?.*/, + ); + await clickOnLinkAndGoBack( + dashboardPage.servicesFirefoxMobile, + "www.mozilla.org", + /.*\/browsers\/mobile\/?.*/, + ); + await clickOnLinkAndGoBack( + dashboardPage.servicesMozilla, + "www.mozilla.org", + ); - await openProfileMenuItem( - dashboardPage.manageProfile, - /.*accounts.*settings.*/, - ); - await openProfileMenuItem( - dashboardPage.profileSettings, - /.*\/user\/settings.*/, - ); + const openProfileMenuItem = async ( + what: Locator, + whatUrl: string | RegExp, + ) => { + await dashboardPage.open(); + await dashboardPage.profileButton.click(); + await expect(what).toBeVisible(); + if (await what.evaluate((e) => e.hasAttribute("href"))) { + const href = await what.getAttribute("href"); + expect(href).not.toBeNull(); + await page.goto(href!); + } else { + await what.click(); + } + await page.waitForURL(whatUrl); + }; - const base_url = process.env["E2E_TEST_BASE_URL"]; - expect(base_url).toBeTruthy(); - await openProfileMenuItem(dashboardPage.profileSignOut, base_url!); - }); - }, -); + await openProfileMenuItem( + dashboardPage.manageProfile, + /.*accounts.*settings.*/, + ); + await openProfileMenuItem( + dashboardPage.profileSettings, + /.*\/user\/settings.*/, + ); + + const base_url = process.env["E2E_TEST_BASE_URL"]; + expect(base_url).toBeTruthy(); + await openProfileMenuItem(dashboardPage.profileSignOut, base_url!); + }); +}); // fix coming - playwright does not currently have access to the aws headers, skipping for now test.describe.skip( diff --git a/src/e2e/specs/error.spec.ts b/src/e2e/specs/error.spec.ts new file mode 100644 index 00000000000..af490baa60b --- /dev/null +++ b/src/e2e/specs/error.spec.ts @@ -0,0 +1,16 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +import { test, expect } from "../fixtures/basePage.js"; + +test.describe(`${process.env.E2E_TEST_ENV} - Verify Error Pages Functionality`, () => { + test("Verify that the 404 page shows up on non-existent pages @smoke", async ({ + page, + }) => { + await page.goto("/non-existent-page/"); + await expect( + page.locator("h1").getByText("⁨404⁩ Page not found"), + ).toBeVisible(); + }); +}); diff --git a/src/e2e/specs/landing.spec.ts b/src/e2e/specs/landing.spec.ts index ceed1323585..a1de87ad34f 100644 --- a/src/e2e/specs/landing.spec.ts +++ b/src/e2e/specs/landing.spec.ts @@ -9,405 +9,376 @@ import { getVerificationCode, } from "../utils/helpers.js"; -test.describe.configure({ mode: "parallel" }); -test.describe.skip( - `${process.env.E2E_TEST_ENV} - Verify the Landing Page content`, - () => { - test.beforeEach(async ({ landingPage }) => { - await landingPage.open(); +test.describe(`${process.env.E2E_TEST_ENV} - Verify the Landing Page content`, () => { + test.beforeEach(async ({ landingPage }) => { + await landingPage.open(); + }); + + test("Observe page header", async ({ landingPage, page }) => { + // link to testrail case + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463517", }); - test("Observe page header", async ({ landingPage, page }) => { - // link to testrail case - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463517", - }); + await expect(landingPage.monitorLandingHeader).toBeVisible(); + await landingPage.signInButton.click(); + await page.waitForURL("**/oauth/**"); + expect(page.url()).toContain("oauth"); + }); + + test('Observe "Find where your private info is exposed and take it back" section', async ({ + landingPage, + }) => { + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463517", + }); - await expect(landingPage.monitorLandingHeader).toBeVisible(); - await landingPage.signInButton.click(); - await page.waitForURL("**/oauth/**"); - expect(page.url()).toContain("oauth"); + await expect(landingPage.monitorHeroTitle).toBeVisible(); + await expect(landingPage.monitorHeroSubtitle).toHaveText( + "We scan to see if your phone number, passwords or home address have been leaked, and help you make it private again.", + ); + if (await emailInputShouldExist(landingPage)) { + await expect(landingPage.monitorHeroFormEmailInputField).toBeVisible(); + await expect(landingPage.monitorHeroFormInputSubmitButton).toBeVisible(); + } + await expect(landingPage.monitorLandingMidHeading).toBeVisible(); + }); + + test('Observe "We will help you fix your exposures" section', async ({ + landingPage, + }) => { + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463517", }); - test('Observe "Find where your private info is exposed and take it back" section', async ({ - landingPage, - }) => { - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463517", - }); + await expect(landingPage.fixExposuresTitle).toBeVisible(); + await expect(landingPage.fixExposuresSubtitle).toBeVisible(); + if (await emailInputShouldExist(landingPage)) { + await expect(landingPage.fixExposuresFormEmailInputField).toBeVisible(); + await expect(landingPage.fixExposuresFormInputSubmitButton).toBeVisible(); + } + await expect(landingPage.fixExposuresGraphic).toBeVisible(); + }); + + test('Observe "What info could be at risk?" section', async ({ + landingPage, + }) => { + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463517", + }); - await expect(landingPage.monitorHeroTitle).toBeVisible(); - await expect(landingPage.monitorHeroSubtitle).toHaveText( - "We scan to see if your phone number, passwords or home address have been leaked, and help you make it private again.", - ); - if (await emailInputShouldExist(landingPage)) { - await expect(landingPage.monitorHeroFormEmailInputField).toBeVisible(); - await expect( - landingPage.monitorHeroFormInputSubmitButton, - ).toBeVisible(); - } - await expect(landingPage.monitorLandingMidHeading).toBeVisible(); + await expect(landingPage.couldBeAtRiskTitle).toBeVisible(); + await expect(landingPage.couldBeAtRiskSubtitle).toBeVisible(); + if (await emailInputShouldExist(landingPage)) { + await expect(landingPage.couldBeAtRiskFormEmailInputField).toBeVisible(); + } + await expect(landingPage.couldBeAtRiskFormInputSubmitButton).toBeVisible(); + await expect(landingPage.couldBeAtRiskGraphic).toBeVisible(); + }); + + test('Observe "Scan your email to get started" section', async ({ + landingPage, + }) => { + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463517", }); - test('Observe "We will help you fix your exposures" section', async ({ - landingPage, - }) => { - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463517", - }); + await expect(landingPage.getStartedScanTitle).toBeVisible(); + if (await emailInputShouldExist(landingPage)) + await expect(landingPage.getStartedScanFormEmailInputField).toBeVisible(); + await expect(landingPage.getStartedScanFormSubmitButton).toBeVisible(); + }); + + test('Observe "Choose your level of protection" section', async ({ + landingPage, + }) => { + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463517", + }); - await expect(landingPage.fixExposuresTitle).toBeVisible(); - await expect(landingPage.fixExposuresSubtitle).toBeVisible(); - if (await emailInputShouldExist(landingPage)) { - await expect(landingPage.fixExposuresFormEmailInputField).toBeVisible(); - await expect( - landingPage.fixExposuresFormInputSubmitButton, - ).toBeVisible(); - } - await expect(landingPage.fixExposuresGraphic).toBeVisible(); + await expect(landingPage.chooseLevelSection).toHaveScreenshot( + `${process.env.E2E_TEST_ENV}-chooseLevelSection.png`, + defaultScreenshotOpts, + ); + }); + + test("Observe FAQ section", async ({ landingPage }) => { + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463517", }); - test('Observe "What info could be at risk?" section', async ({ - landingPage, - }) => { - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463517", - }); + await expect(landingPage.faqSection).toHaveScreenshot( + `${process.env.E2E_TEST_ENV}-faqSection.png`, + defaultScreenshotOpts, + ); + }); + + test('Observe "Take back control of your data" section', async ({ + landingPage, + }) => { + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463517", + }); - await expect(landingPage.couldBeAtRiskTitle).toBeVisible(); - await expect(landingPage.couldBeAtRiskSubtitle).toBeVisible(); - if (await emailInputShouldExist(landingPage)) { - await expect( - landingPage.couldBeAtRiskFormEmailInputField, - ).toBeVisible(); - } + await expect(landingPage.takeBackControlTitle).toBeVisible(); + if (await emailInputShouldExist(landingPage)) { await expect( - landingPage.couldBeAtRiskFormInputSubmitButton, + landingPage.takeBackControlFormEmailInputField, ).toBeVisible(); - await expect(landingPage.couldBeAtRiskGraphic).toBeVisible(); + await expect(landingPage.takeBackControlFormSubmitButton).toBeVisible(); + } + }); + + test("Observe footer section", async ({ landingPage }) => { + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463517", }); - test('Observe "Scan your email to get started" section', async ({ - landingPage, - }) => { - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463517", - }); - - await expect(landingPage.getStartedScanTitle).toBeVisible(); - if (await emailInputShouldExist(landingPage)) - await expect( - landingPage.getStartedScanFormEmailInputField, - ).toBeVisible(); - await expect(landingPage.getStartedScanFormSubmitButton).toBeVisible(); + await expect(landingPage.mozillaFooterLogoLink).toBeVisible(); + await expect(landingPage.faqLink).toBeVisible(); + await expect(landingPage.termsLink).toBeVisible(); + await expect(landingPage.privacyLink).toBeVisible(); + await expect(landingPage.githubLink).toBeVisible(); + }); + + test("Verify the 'Get data removal' button UI and functionality for both yearly and monthly options", async ({ + landingPage, + purchasePage, + }) => { + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463525", }); - test('Observe "Choose your level of protection" section', async ({ - landingPage, - }) => { - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463517", - }); - - await expect(landingPage.chooseLevelSection).toHaveScreenshot( - `${process.env.E2E_TEST_ENV}-chooseLevelSection.png`, - defaultScreenshotOpts, - ); + await expect(landingPage.getDataRemoval).toBeVisible(); + await expect(landingPage.getDataRemovalMonthly).toBeVisible(); + await expect(landingPage.getDataRemovalYearly).toBeVisible(); + + // Monthly + await landingPage.getDataRemovalMonthly.click(); + await landingPage.getDataRemoval.click(); + await purchasePage.verifyMonthlyPlanDetails(); + + // Yearly + await landingPage.open(); + await landingPage.getDataRemoval.click(); + await purchasePage.verifyYearlyPlanDetails(); + }); + + test('Verify the "Get free scan" corresponding email fields', async ({ + landingPage, + authPage, + }) => { + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463504", }); - - test("Observe FAQ section", async ({ landingPage }) => { - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463517", + if (await emailInputShouldExist(landingPage)) { + ///free-scan-cta experiment is off + await landingPage.monitorHeroFormEmailInputField.fill("invalid"); + await landingPage.monitorHeroFormInputSubmitButton.click(); + await expect(landingPage.monitorHeroFormEmailInputField).toBeVisible(); + + const randomEmail = `_${Date.now()}_tstact@restmail.net`; + await landingPage.monitorHeroFormEmailInputField.fill(randomEmail); + await landingPage.monitorHeroFormInputSubmitButton.click(); + await authPage.passwordInputField.waitFor(); + await expect(authPage.passwordInputField).toBeVisible(); + } else { + ///free-scan-cta experiment is on + await landingPage.monitorHeroFormInputSubmitButton.click(); + await authPage.emailInputField.waitFor({ + state: "visible", + timeout: 10000, }); - - await expect(landingPage.faqSection).toHaveScreenshot( - `${process.env.E2E_TEST_ENV}-faqSection.png`, - defaultScreenshotOpts, - ); + const randomEmail = `_${Date.now()}_tstact@restmail.net`; + await authPage.emailInputField.fill(randomEmail); + await authPage.continueButton.click(); + await authPage.passwordInputField.waitFor(); + await expect(authPage.passwordInputField).toBeVisible(); + } + }); + + test('Verify manual/automatic removal "more info" tips from "Choose your level of protection" section', async ({ + landingPage, + }) => { + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463504", }); + await landingPage.freeMonitoringTooltipTrigger.click(); + await expect(landingPage.freeMonitoringTooltipText).toBeVisible(); + await landingPage.closeTooltips.click(); + await landingPage.monitorPlusTooltipTrigger.click(); + await expect(landingPage.monitorPlusTooltipText).toBeVisible(); + }); +}); - test('Observe "Take back control of your data" section', async ({ - landingPage, - }) => { - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463517", - }); - - await expect(landingPage.takeBackControlTitle).toBeVisible(); - if (await emailInputShouldExist(landingPage)) { - await expect( - landingPage.takeBackControlFormEmailInputField, - ).toBeVisible(); - await expect(landingPage.takeBackControlFormSubmitButton).toBeVisible(); - } +test.describe(`${process.env.E2E_TEST_ENV} - Verify the Landing Page Functionality - without existing Account`, () => { + test.beforeEach(async ({ landingPage }) => { + await landingPage.open(); + }); + + test('Verify "Get free scan" buttons functionality without existing account', async ({ + landingPage, + page, + authPage, + }) => { + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463502", }); - test("Observe footer section", async ({ landingPage }) => { - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463517", + const randomEmail = `${Date.now()}_tstact@restmail.net`; + if (await emailInputShouldExist(landingPage)) { + await landingPage.monitorHeroFormEmailInputField.fill(randomEmail); + await landingPage.monitorHeroFormInputSubmitButton.click(); + await page.waitForURL("**/oauth/**"); + } else { + await landingPage.monitorHeroFormInputSubmitButton.click(); + await authPage.emailInputField.waitFor({ + state: "visible", + timeout: 10000, }); - - await expect(landingPage.mozillaFooterLogoLink).toBeVisible(); - await expect(landingPage.faqLink).toBeVisible(); - await expect(landingPage.termsLink).toBeVisible(); - await expect(landingPage.privacyLink).toBeVisible(); - await expect(landingPage.githubLink).toBeVisible(); - }); - - test("Verify the 'Get data removal' button UI and functionality for both yearly and monthly options", async ({ - landingPage, - purchasePage, - }) => { - test.info().annotations.push({ - type: "testrail", + await authPage.emailInputField.fill(randomEmail); + await authPage.continueButton.click(); + } + // continue with the common steps + await authPage.passwordInputField.fill( + process.env.E2E_TEST_ACCOUNT_PASSWORD as string, + ); + await authPage.passwordConfirmInputField.fill( + process.env.E2E_TEST_ACCOUNT_PASSWORD as string, + ); + await authPage.ageInputField.fill("31"); + await authPage.continueButton.click(); + const vc = await getVerificationCode(randomEmail, page); + await authPage.enterVerificationCode(vc); + const successUrl = process.env.E2E_TEST_BASE_URL + "/user/welcome"; + expect(page.url()).toBe(successUrl); + }); + + test('Verify the "Start free monitoring" button UI and functionality without existing account', async ({ + landingPage, + page, + authPage, + }) => { + test.info().annotations.push( + { + type: "testrail id #1", description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463525", - }); + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463524", + }, + { + type: "testrail id #2", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463564", + }, + ); - await expect(landingPage.getDataRemoval).toBeVisible(); - await expect(landingPage.getDataRemovalMonthly).toBeVisible(); - await expect(landingPage.getDataRemovalYearly).toBeVisible(); + await landingPage.startFreeMonitoringButton.click(); - // Monthly - await landingPage.getDataRemovalMonthly.click(); - await landingPage.getDataRemoval.click(); - await purchasePage.verifyMonthlyPlanDetails(); + const randomEmail = `${Date.now()}_tstact@restmail.net`; + await authPage.signUp(randomEmail, page); - // Yearly - await landingPage.open(); - await landingPage.getDataRemoval.click(); - await purchasePage.verifyYearlyPlanDetails(); - }); + const successUrl = process.env.E2E_TEST_BASE_URL + "/user/welcome"; + expect(page.url()).toBe(successUrl); + }); +}); - test('Verify the "Get free scan" corresponding email fields', async ({ - landingPage, - authPage, - }) => { - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463504", - }); - if (await emailInputShouldExist(landingPage)) { - ///free-scan-cta experiment is off - await landingPage.monitorHeroFormEmailInputField.fill("invalid"); - await landingPage.monitorHeroFormInputSubmitButton.click(); - await expect(landingPage.monitorHeroFormEmailInputField).toBeVisible(); - - const randomEmail = `_${Date.now()}_tstact@restmail.net`; - await landingPage.monitorHeroFormEmailInputField.fill(randomEmail); - await landingPage.monitorHeroFormInputSubmitButton.click(); - await authPage.passwordInputField.waitFor(); - await expect(authPage.passwordInputField).toBeVisible(); - } else { - ///free-scan-cta experiment is on - await landingPage.monitorHeroFormInputSubmitButton.click(); - await authPage.emailInputField.waitFor({ - state: "visible", - timeout: 10000, - }); - const randomEmail = `_${Date.now()}_tstact@restmail.net`; - await authPage.emailInputField.fill(randomEmail); - await authPage.continueButton.click(); - await authPage.passwordInputField.waitFor(); - await expect(authPage.passwordInputField).toBeVisible(); - } +test.describe(`${process.env.E2E_TEST_ENV} - Verify the Landing Page Functionality - with existing account`, () => { + test.beforeEach(async ({ landingPage }) => { + await landingPage.open(); + }); + + test('Verify "Get free scan" buttons functionality with existing account', async ({ + landingPage, + page, + authPage, + }) => { + // link to testrail case + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463503", }); - test('Verify manual/automatic removal "more info" tips from "Choose your level of protection" section', async ({ - landingPage, - }) => { - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463504", - }); - await landingPage.freeMonitoringTooltipTrigger.click(); - await expect(landingPage.freeMonitoringTooltipText).toBeVisible(); - await landingPage.closeTooltips.click(); - await landingPage.monitorPlusTooltipTrigger.click(); - await expect(landingPage.monitorPlusTooltipText).toBeVisible(); - }); - }, -); - -test.describe.skip( - `${process.env.E2E_TEST_ENV} - Verify the Landing Page Functionality - without existing Account`, - () => { - test.beforeEach(async ({ landingPage }) => { - await landingPage.open(); - }); + const existingEmail = process.env.E2E_TEST_ACCOUNT_EMAIL as string; - test('Verify "Get free scan" buttons functionality without existing account', async ({ - landingPage, - page, - authPage, - }) => { - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463502", + if (await emailInputShouldExist(landingPage)) { + // Scenario where the form is still used + await landingPage.monitorHeroFormEmailInputField.fill(existingEmail); + await landingPage.monitorHeroFormInputSubmitButton.click(); + await page.waitForURL("**/oauth/**"); + } else { + // Scenario where direct redirection happens + await landingPage.monitorHeroFormInputSubmitButton.click(); + await authPage.emailInputField.waitFor({ + state: "visible", + timeout: 10000, }); - - const randomEmail = `${Date.now()}_tstact@restmail.net`; - if (await emailInputShouldExist(landingPage)) { - await landingPage.monitorHeroFormEmailInputField.fill(randomEmail); - await landingPage.monitorHeroFormInputSubmitButton.click(); - await page.waitForURL("**/oauth/**"); - } else { - await landingPage.monitorHeroFormInputSubmitButton.click(); - await authPage.emailInputField.waitFor({ - state: "visible", - timeout: 10000, - }); - await authPage.emailInputField.fill(randomEmail); - await authPage.continueButton.click(); - } - // continue with the common steps - await authPage.passwordInputField.fill( - process.env.E2E_TEST_ACCOUNT_PASSWORD as string, - ); - await authPage.passwordConfirmInputField.fill( - process.env.E2E_TEST_ACCOUNT_PASSWORD as string, - ); - await authPage.ageInputField.fill("31"); + await authPage.emailInputField.fill(existingEmail); await authPage.continueButton.click(); - const vc = await getVerificationCode(randomEmail, page); - await authPage.enterVerificationCode(vc); - const successUrl = process.env.E2E_TEST_BASE_URL + "/user/welcome"; - expect(page.url()).toBe(successUrl); + } + + // complete sign in form + await authPage.enterPassword(); + + // verify dashboard redirect + const successUrl = + process.env.E2E_TEST_BASE_URL + + (process.env.E2E_TEST_ENV === "local" + ? "/user/welcome" + : "/user/dashboard"); + expect(page.url()).toBe(successUrl); + }); + + test('Verify the "Start free monitoring" button UI and functionality with existing account', async ({ + landingPage, + page, + authPage, + }) => { + test.info().annotations.push({ + type: "testrail", + description: + "https://testrail.stage.mozaws.net/index.php?/cases/view/2463524", }); - test('Verify the "Start free monitoring" button UI and functionality without existing account', async ({ - landingPage, - page, - authPage, - }) => { - test.info().annotations.push( - { - type: "testrail id #1", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463524", - }, - { - type: "testrail id #2", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463564", - }, - ); - - await landingPage.startFreeMonitoringButton.click(); - - const randomEmail = `${Date.now()}_tstact@restmail.net`; - await authPage.signUp(randomEmail, page); - - const successUrl = process.env.E2E_TEST_BASE_URL + "/user/welcome"; - expect(page.url()).toBe(successUrl); - }); - }, -); - -test.describe.skip( - `${process.env.E2E_TEST_ENV} - Verify the Landing Page Functionality - with existing account`, - () => { - test.beforeEach(async ({ landingPage }) => { - await landingPage.open(); - }); + await landingPage.startFreeMonitoringButton.click(); - test('Verify "Get free scan" buttons functionality with existing account', async ({ - landingPage, - page, - authPage, - }) => { - // link to testrail case - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463503", - }); + await authPage.enterEmail(process.env.E2E_TEST_ACCOUNT_EMAIL as string); + await authPage.enterPassword(); - const existingEmail = process.env.E2E_TEST_ACCOUNT_EMAIL as string; - - if (await emailInputShouldExist(landingPage)) { - // Scenario where the form is still used - await landingPage.monitorHeroFormEmailInputField.fill(existingEmail); - await landingPage.monitorHeroFormInputSubmitButton.click(); - await page.waitForURL("**/oauth/**"); - } else { - // Scenario where direct redirection happens - await landingPage.monitorHeroFormInputSubmitButton.click(); - await authPage.emailInputField.waitFor({ - state: "visible", - timeout: 10000, - }); - await authPage.emailInputField.fill(existingEmail); - await authPage.continueButton.click(); - } - - // complete sign in form - await authPage.enterPassword(); - - // verify dashboard redirect - const successUrl = - process.env.E2E_TEST_BASE_URL + - (process.env.E2E_TEST_ENV === "local" + // verify dashboard redirect + const successUrl = + process.env.E2E_TEST_BASE_URL + + `${ + process.env.E2E_TEST_ENV === "local" ? "/user/welcome" - : "/user/dashboard"); - expect(page.url()).toBe(successUrl); - }); - - test('Verify the "Start free monitoring" button UI and functionality with existing account', async ({ - landingPage, - page, - authPage, - }) => { - test.info().annotations.push({ - type: "testrail", - description: - "https://testrail.stage.mozaws.net/index.php?/cases/view/2463524", - }); - - await landingPage.startFreeMonitoringButton.click(); - - await authPage.enterEmail(process.env.E2E_TEST_ACCOUNT_EMAIL as string); - await authPage.enterPassword(); - - // verify dashboard redirect - const successUrl = - process.env.E2E_TEST_BASE_URL + - `${ - process.env.E2E_TEST_ENV === "local" - ? "/user/welcome" - : "/user/dashboard" - }`; - expect(page.url()).toBe(successUrl); - }); - }, -); - -test("Verify that the 404 page shows up on non-existent pages @smoke", async ({ - page, -}) => { - await page.goto("/non-existent-page/"); - await expect( - page.locator("h1").getByText("⁨404⁩ Page not found"), - ).toBeVisible(); + : "/user/dashboard" + }`; + expect(page.url()).toBe(successUrl); + }); }); diff --git a/src/e2e/specs/settings.spec.ts b/src/e2e/specs/settings.spec.ts index 4d2f7f04dad..e86390f5616 100644 --- a/src/e2e/specs/settings.spec.ts +++ b/src/e2e/specs/settings.spec.ts @@ -6,7 +6,7 @@ import { test, expect } from "../fixtures/basePage.js"; // bypass login test.use({ storageState: "./e2e/storageState.json" }); -test.describe.skip(`${process.env.E2E_TEST_ENV} Settings Page`, () => { +test.describe(`${process.env.E2E_TEST_ENV} Settings Page`, () => { test("Verify settings page loads", async ({ settingsPage }) => { // should go directly to data breach page await settingsPage.open();