Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mntor-3289-1: tests reverted in mntor-3289 #4742

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
bccbb1e
feat: mock HIBP
mansaj May 29, 2024
b32ca9f
Merge branch 'MNTOR-3227-2' of https://github.com/mozilla/blurts-serv…
Jun 11, 2024
a0d9df7
able to default to mock endpoint on failure locally.
Jun 13, 2024
695e1fc
made it host-flexibile for HIBP fallback
Jun 13, 2024
e07af0e
npx prettified fakeBraches.json
Jun 13, 2024
c0b253a
made the code cleaner, and switch back to true endpoint after using f…
Jun 13, 2024
25b590b
got rid of second promise wait
Jun 13, 2024
ffb0550
Merge branch 'main' of https://github.com/mozilla/blurts-server into …
Jun 17, 2024
ab680af
removed other features, kept only the mock endpoint
Jun 17, 2024
184cfcf
made breaches list match the fake breaches for a user
Jun 17, 2024
b7d9575
Merge branch 'main' of https://github.com/mozilla/blurts-server into …
Jun 17, 2024
c922556
Merge branch 'main' of https://github.com/mozilla/blurts-server into …
Jun 18, 2024
dda9c22
file endpoint additions
Jun 20, 2024
d809bea
Merge branch 'main' of https://github.com/mozilla/blurts-server into …
Jun 24, 2024
0f1d778
Merge branch 'main' of https://github.com/mozilla/blurts-server into …
Jun 25, 2024
988997c
funtional commit - mocked accessed endpoints
Jun 25, 2024
fb2d028
fixed the path overwriting issue, added responsive dynamic configurat…
Jun 25, 2024
2a4e504
moved mock user data into a separate file
Jun 26, 2024
0b1d9e5
fixed some code quality and substitued constants with function calls
Jun 26, 2024
f94238e
Merge branch 'main' of https://github.com/mozilla/blurts-server into …
Jun 26, 2024
29b6f0e
Allowed for data to be configured dynamically using an endpoint
Jun 26, 2024
8ec080d
lint fail fixed
Jun 26, 2024
9140e01
Merge branch 'main' of https://github.com/mozilla/blurts-server into …
Jun 26, 2024
f3e9b37
most tests pass when using mock onerep endpoint
Jun 26, 2024
bc7c4de
Merge branch 'main' of https://github.com/mozilla/blurts-server into …
Jun 28, 2024
11cb314
Merge branch 'main' of https://github.com/mozilla/blurts-server into …
Jun 28, 2024
71e5ddf
passes all tests except for those in purchase spec
Jun 28, 2024
d6eb4ed
added production checks
Jun 28, 2024
842b229
fixed lint errors
Jun 29, 2024
9d368c0
reverting smoke test
Jun 29, 2024
29af535
cleaned up query params and dynamic routing
Jun 29, 2024
fa16c41
fixed lint errors and corrected a POST endpoint
Jun 29, 2024
f3378b0
added form input
Jun 30, 2024
0a4e15b
substituted direct magic numbers access to wrapper methods
Jun 30, 2024
f076a56
merging with 3285
Jun 30, 2024
06b25ca
mock endpoint config - basic version
Jun 30, 2024
cf0ebf6
added more type checks and proper defaults
Jun 30, 2024
9fed164
functional OneRep config page, with styling
Jun 30, 2024
c98d0b2
lint error
Jun 30, 2024
f8e6b52
added a configuration endpoint and page for HIBP
Jul 1, 2024
a249654
reset package-lock
Jul 1, 2024
cb8e013
lint
Jul 1, 2024
21a6bc5
package-lock
Jul 1, 2024
839a9da
slightly modified hibp/breaches
Jul 1, 2024
feaf567
removed database retrieval from mock hibp endpoint
Jul 1, 2024
d3219fb
Merge branch 'main' of https://github.com/mozilla/blurts-server into …
Jul 1, 2024
f693e1a
Merged with main + minor error log change
Jul 1, 2024
9401fed
reverted e2e changes
Jul 2, 2024
d581682
e2e check
Jul 2, 2024
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
reverted e2e changes
  • Loading branch information
Mukhamediyar Kudaikulov committed Jul 2, 2024
commit 9401fedc9ba13dd88367cdfe7389de50bd19a1da
1 change: 0 additions & 1 deletion src/app/functions/server/getRelevantGuidedSteps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export type StepLinkWithStatus = (typeof stepLinks)[number] & {
};

export function isGuidedResolutionInProgress(stepId: StepLink["id"]) {
if (stepId === "Scan" || stepId === "Done") return false; //this fixes a lint check
const inProgressStepIds = stepLinks
.filter((step) => step.id !== "Scan" && step.id !== "Done")
.map(({ id }) => id);
Expand Down
2 changes: 1 addition & 1 deletion src/e2e/pages/purchasePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
expect(pwdToUse).not.toBeUndefined();

//away from mozilla
const pagePromise = context.waitForEvent("page");

Check failure on line 81 in src/e2e/pages/purchasePage.ts

View workflow job for this annotation

GitHub Actions / e2e-tests

[chromium] › purchase.spec.ts:179:3 › stage - Breach Scan

1) [chromium] › purchase.spec.ts:179:3 › stage - Breach Scan, Monitor Plus Purchase Flow › Verify that the user can purchase the plus subscription with a PayPal account - monthly Error: browserContext.waitForEvent: Test timeout of 180000ms exceeded. at ../pages/purchasePage.ts:81 79 | 80 | //away from mozilla > 81 | const pagePromise = context.waitForEvent("page"); | ^ 82 | await this.paypalButton.click(); 83 | const newPage = await pagePromise; 84 | await newPage.waitForLoadState(); at PurchasePage.fillOutPaypalInfo (/home/runner/work/blurts-server/blurts-server/src/e2e/pages/purchasePage.ts:81:33) at /home/runner/work/blurts-server/blurts-server/src/e2e/specs/purchase.spec.ts:198:24

Check failure on line 81 in src/e2e/pages/purchasePage.ts

View workflow job for this annotation

GitHub Actions / e2e-tests

[chromium] › purchase.spec.ts:179:3 › stage - Breach Scan

1) [chromium] › purchase.spec.ts:179:3 › stage - Breach Scan, Monitor Plus Purchase Flow › Verify that the user can purchase the plus subscription with a PayPal account - monthly Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: browserContext.waitForEvent: Test timeout of 180000ms exceeded. at ../pages/purchasePage.ts:81 79 | 80 | //away from mozilla > 81 | const pagePromise = context.waitForEvent("page"); | ^ 82 | await this.paypalButton.click(); 83 | const newPage = await pagePromise; 84 | await newPage.waitForLoadState(); at PurchasePage.fillOutPaypalInfo (/home/runner/work/blurts-server/blurts-server/src/e2e/pages/purchasePage.ts:81:33) at /home/runner/work/blurts-server/blurts-server/src/e2e/specs/purchase.spec.ts:198:24
await this.paypalButton.click();

Check failure on line 82 in src/e2e/pages/purchasePage.ts

View workflow job for this annotation

GitHub Actions / e2e-tests

[chromium] › purchase.spec.ts:179:3 › stage - Breach Scan

1) [chromium] › purchase.spec.ts:179:3 › stage - Breach Scan, Monitor Plus Purchase Flow › Verify that the user can purchase the plus subscription with a PayPal account - monthly Error: locator.click: Test timeout of 180000ms exceeded. Call log: - waiting for getByTitle('PayPal').nth(1) - locator resolved to <iframe title="PayPal" scrolling="no" allowtransparency=…></iframe> - attempting click action - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <iframe title="PayPal" scrolling="no" allowtransparency=…></iframe> intercepts pointer events - retrying click action, attempt #1 - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <iframe title="PayPal" scrolling="no" allowtransparency=…></iframe> intercepts pointer events - retrying click action, attempt #2 - waiting 20ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <iframe title="PayPal" scrolling="no" allowtransparency=…></iframe> intercepts pointer events - retrying click action, attempt #3 - waiting 100ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <iframe title="PayPal" scrolling="no" allowtransparency=…></iframe> intercepts pointer events - retrying click action, attempt #4 - waiting 100ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <iframe title="PayPal" scrolling="no" allowtransparency=…></iframe> intercepts pointer events - retrying click action, attempt #5 - waiting 500ms - waiting for element to be visible, enabled and stable - element was detached from the DOM, retrying at ../pages/purchasePage.ts:82 80 | //away from mozilla 81 | const pagePromise = context.waitForEvent("page"); > 82 | await this.paypalButton.click(); | ^ 83 | const newPage = await pagePromise; 84 | await newPage.waitForLoadState(); 85 | await newPage.waitForURL(/.*paypal\.com.*checkout.*/); at PurchasePage.fillOutPaypalInfo (/home/runner/work/blurts-server/blurts-server/src/e2e/pages/purchasePage.ts:82:29) at /home/runner/work/blurts-server/blurts-server/src/e2e/specs/purchase.spec.ts:198:24

Check failure on line 82 in src/e2e/pages/purchasePage.ts

View workflow job for this annotation

GitHub Actions / e2e-tests

[chromium] › purchase.spec.ts:179:3 › stage - Breach Scan

1) [chromium] › purchase.spec.ts:179:3 › stage - Breach Scan, Monitor Plus Purchase Flow › Verify that the user can purchase the plus subscription with a PayPal account - monthly Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.click: Test timeout of 180000ms exceeded. Call log: - waiting for getByTitle('PayPal').nth(1) - locator resolved to <iframe title="PayPal" scrolling="no" allowtransparency=…></iframe> - attempting click action - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <iframe title="PayPal" scrolling="no" allowtransparency=…></iframe> intercepts pointer events - retrying click action, attempt #1 - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <iframe title="PayPal" scrolling="no" allowtransparency=…></iframe> intercepts pointer events - retrying click action, attempt #2 - waiting 20ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <iframe title="PayPal" scrolling="no" allowtransparency=…></iframe> intercepts pointer events - retrying click action, attempt #3 - waiting 100ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <iframe title="PayPal" scrolling="no" allowtransparency=…></iframe> intercepts pointer events - retrying click action, attempt #4 - waiting 100ms - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - <iframe title="PayPal" scrolling="no" allowtransparency=…></iframe> intercepts pointer events - retrying click action, attempt #5 - waiting 500ms - waiting for element to be visible, enabled and stable - element was detached from the DOM, retrying at ../pages/purchasePage.ts:82 80 | //away from mozilla 81 | const pagePromise = context.waitForEvent("page"); > 82 | await this.paypalButton.click(); | ^ 83 | const newPage = await pagePromise; 84 | await newPage.waitForLoadState(); 85 | await newPage.waitForURL(/.*paypal\.com.*checkout.*/); at PurchasePage.fillOutPaypalInfo (/home/runner/work/blurts-server/blurts-server/src/e2e/pages/purchasePage.ts:82:29) at /home/runner/work/blurts-server/blurts-server/src/e2e/specs/purchase.spec.ts:198:24
const newPage = await pagePromise;
await newPage.waitForLoadState();
await newPage.waitForURL(/.*paypal\.com.*checkout.*/);
Expand Down Expand Up @@ -121,7 +121,7 @@
(await this.planDetails.textContent()) as string,
);
expect(planDetails).toContain(
`${process.env.E2E_TEST_ENV!.match(/prod|local/) ? "yearly" : "every 2 months"}`,
`${process.env.E2E_TEST_ENV === "prod" ? "yearly" : "every 2 months"}`,
);
}

Expand Down
17 changes: 9 additions & 8 deletions src/e2e/specs/dashboard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
removeUnicodeChars,
clickOnATagCheckDomain,
escapeRegExp,
forceLoginAs,
} from "../utils/helpers.js";

// bypass login
Expand Down Expand Up @@ -375,7 +376,7 @@
test.describe(`${process.env.E2E_TEST_ENV} - Breaches Dashboard - Breaches Scan, Continuous Protection, Data Profile Actions`, () => {
test.use({ storageState: { cookies: [], origins: [] } });

test.beforeEach(async ({ landingPage, page, authPage, welcomePage }) => {

Check failure on line 379 in src/e2e/specs/dashboard.spec.ts

View workflow job for this annotation

GitHub Actions / e2e-tests

[chromium] › dashboard.spec.ts:401:3 › stage - Breaches Dashboard - Breaches Scan

2) [chromium] › dashboard.spec.ts:401:3 › stage - Breaches Dashboard - Breaches Scan, Continuous Protection, Data Profile Actions › Verify that the Premium upsell modal is displayed correctly - Continuous Protection, verify that the user can mark Data broker profiles as fixed Test timeout of 180000ms exceeded while running "beforeEach" hook. 377 | test.use({ storageState: { cookies: [], origins: [] } }); 378 | > 379 | test.beforeEach(async ({ landingPage, page, authPage, welcomePage }) => { | ^ 380 | test.slow( 381 | true, 382 | "this test runs through the welcome scan flow, increasing timeout to address it", at /home/runner/work/blurts-server/blurts-server/src/e2e/specs/dashboard.spec.ts:379:8
test.slow(
true,
"this test runs through the welcome scan flow, increasing timeout to address it",
Expand Down Expand Up @@ -425,6 +426,7 @@
const count = await dashboardPage.allExposures.count();
// Fix first exposure
await dashboardPage.markAsFixed.click();

for (let i = 1; i < count; i++) {
const exposure = dashboardPage.allExposures.nth(i);
await exposure.click();
Expand Down Expand Up @@ -718,14 +720,13 @@
});

test.describe(`${process.env.E2E_TEST_ENV} - Breaches Dashboard - Data Breaches`, () => {
test.beforeEach(async ({ dashboardPage, page }) => {
await dashboardPage.open();

try {
await checkAuthState(page);
} catch {
console.log("[E2E_LOG] - No fxa auth required, proceeding...");
}
test.beforeEach(async ({ landingPage, page, authPage }) => {
const emailToUse = process.env
.E2E_TEST_ACCOUNT_EMAIL_EXPOSURES_STARTED as string;
const pwdToUse = process.env.E2E_TEST_ACCOUNT_PASSWORD as string;
expect(emailToUse).not.toBeUndefined();
expect(pwdToUse).not.toBeUndefined();
await forceLoginAs(emailToUse, pwdToUse, page, landingPage, authPage);
});

test("Verify that the High risk data breaches step is displayed correctly", async ({
Expand Down
20 changes: 16 additions & 4 deletions src/e2e/specs/landing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,14 @@ test.describe(`${process.env.E2E_TEST_ENV} - Verify the Landing Page Functionali
await authPage.enterPassword();

// verify dashboard redirect
const successUrl = process.env.E2E_TEST_BASE_URL + "/user/dashboard";
expect(page.url()).toContain(successUrl);
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 ({
Expand All @@ -330,7 +336,13 @@ test.describe(`${process.env.E2E_TEST_ENV} - Verify the Landing Page Functionali
await authPage.enterPassword();

// verify dashboard redirect
const successUrl = process.env.E2E_TEST_BASE_URL + "/user/dashboard";
expect(page.url()).toContain(successUrl);
const successUrl =
process.env.E2E_TEST_BASE_URL +
`${
process.env.E2E_TEST_ENV === "local"
? "/user/welcome"
: "/user/dashboard"
}`;
expect(page.url()).toBe(successUrl);
});
});
4 changes: 1 addition & 3 deletions src/e2e/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ export const clickOnATagCheckDomain = async (
page: Page,
) => {
if (typeof host === "string")
host = new RegExp(
escapeRegExp(host.replace(/^(https?:\/\/)/, "").replace(/:\d+$/, "")),
);
host = new RegExp(escapeRegExp(host.replace(/^(https?:\/\/)/, "")));
if (typeof path === "string") path = new RegExp(".*" + path + ".*");

const href = await aTag.getAttribute("href");
Expand Down
Loading