Skip to content

fix MPP-4152 - refactor(e2e-tests): v2+v3 SubscriptionPaymentPage #5515

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

Merged
merged 1 commit into from
Apr 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions e2e-tests/pages/subscriptionPaymentPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ export class SubscriptionPaymentPage {
readonly postalCodeField: Locator;
readonly authorizationCheckbox: Locator;
readonly subscriptionTitle: Locator;
readonly subscription3Title: Locator;
readonly subscriptionType: Locator;
readonly planDetails: Locator;
readonly planDetails3: Locator;
readonly planType: Locator;
readonly planType3: Locator;

constructor(page: Page) {
this.page = page;
Expand All @@ -40,7 +43,41 @@ export class SubscriptionPaymentPage {
this.subscriptionTitle = page.locator(
'[data-testid="subscription-create-title"]',
);
this.subscription3Title = page.getByRole("heading", {
name: "Set up your subscription",
});
this.planDetails = page.locator("#plan-details-product");
this.planDetails3 = page
.getByLabel("Purchase details")
.first()
.getByRole("heading")
.first();
this.planType = page.locator(".plan-details-description");
this.planType3 = page.getByTestId("total-price");
}

private isVersion3(): boolean {
return this.page.url().includes("payments-next");
}

async getSubscriptionTitleText(): Promise<string> {
if (this.isVersion3()) {
return await this.subscription3Title.textContent();
}
return await this.subscriptionTitle.textContent();
}

async getPlanDetailsText(): Promise<string> {
if (this.isVersion3()) {
return await this.planDetails3.textContent();
}
return await this.planDetails.textContent();
}

async getPriceDetailsText(): Promise<string> {
if (this.isVersion3()) {
return await this.planType3.textContent();
}
return await this.planType.textContent();
}
}
30 changes: 15 additions & 15 deletions e2e-tests/specs/relay-e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ test.describe("Subscription flows @health_check", () => {

await landingPage.selectYearlyEmailsPlan();
// verify redirect to subscription page
expect(await subscriptionPage.subscriptionTitle.textContent()).toContain(
expect(await subscriptionPage.getSubscriptionTitleText()).toContain(
"Set up your subscription",
);
expect(await subscriptionPage.planDetails.textContent()).toEqual(
expect(await subscriptionPage.getPlanDetailsText()).toEqual(
expectedEmailsPlansDetails,
);
expect(await subscriptionPage.planType.textContent()).toContain("yearly");
expect(await subscriptionPage.getPriceDetailsText()).toContain("yearly");
});

test('Verify that the monthly emails plan "Sign Up" button works correctly, C1818792', async ({
Expand All @@ -125,13 +125,13 @@ test.describe("Subscription flows @health_check", () => {

await landingPage.selectMonthlyEmailsPlan();
// verify redirect to subscription page
expect(await subscriptionPage.subscriptionTitle.textContent()).toContain(
expect(await subscriptionPage.getSubscriptionTitleText()).toContain(
"Set up your subscription",
);
expect(await subscriptionPage.planDetails.textContent()).toEqual(
expect(await subscriptionPage.getPlanDetailsText()).toEqual(
expectedEmailsPlansDetails,
);
expect(await subscriptionPage.planType.textContent()).toContain("monthly");
expect(await subscriptionPage.getPriceDetailsText()).toContain("monthly");
});

test('Verify that the yearly emails and phones bundle plan "Sign Up" button works correctly, C1818792', async ({
Expand All @@ -141,13 +141,13 @@ test.describe("Subscription flows @health_check", () => {
await landingPage.selectYearlyPhonesEmailsBundle();

// verify redirect to subscription page
expect(await subscriptionPage.subscriptionTitle.textContent()).toContain(
expect(await subscriptionPage.getSubscriptionTitleText()).toContain(
"Set up your subscription",
);
expect(await subscriptionPage.planDetails.textContent()).toEqual(
expect(await subscriptionPage.getPlanDetailsText()).toEqual(
expectedPhonesEmailsPlanDetails,
);
expect(await subscriptionPage.planType.textContent()).toContain("yearly");
expect(await subscriptionPage.getPriceDetailsText()).toContain("yearly");
});

test('Verify that the monthly emails and phones bundle plan "Sign Up" button works correctly, C1818792', async ({
Expand All @@ -161,13 +161,13 @@ test.describe("Subscription flows @health_check", () => {

await landingPage.selectMonthlyPhonesEmailsBundle();
// verify redirect to subscription page
expect(await subscriptionPage.subscriptionTitle.textContent()).toContain(
expect(await subscriptionPage.getSubscriptionTitleText()).toContain(
"Set up your subscription",
);
expect(await subscriptionPage.planDetails.textContent()).toEqual(
expect(await subscriptionPage.getPlanDetailsText()).toEqual(
expectedPhonesEmailsPlanDetails,
);
expect(await subscriptionPage.planType.textContent()).toContain("monthly");
expect(await subscriptionPage.getPriceDetailsText()).toContain("monthly");
});

test('Verify that the VPN bundle "Sign Up" button works correctly, C1818792', async ({
Expand All @@ -177,12 +177,12 @@ test.describe("Subscription flows @health_check", () => {
await landingPage.selectVpnBundlePlan();

// verify redirect to subscription page
expect(await subscriptionPage.subscriptionTitle.textContent()).toContain(
expect(await subscriptionPage.getSubscriptionTitleText()).toContain(
"Set up your subscription",
);
expect(await subscriptionPage.planDetails.textContent()).toEqual(
expect(await subscriptionPage.getPlanDetailsText()).toEqual(
expectedVPNBundleDetails,
);
expect(await subscriptionPage.planType.textContent()).toContain("yearly");
expect(await subscriptionPage.getPriceDetailsText()).toContain("yearly");
});
});