Skip to content

e2e test subscription flows fix #5731

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
Jul 21, 2025
Merged
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
34 changes: 24 additions & 10 deletions e2e-tests/pages/subscriptionPaymentPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,31 +47,45 @@ export class SubscriptionPaymentPage {
this.planDetails = page.locator("#plan-details-product");
this.planDetails3 = page.locator("#product-details-heading");
this.planType = page.locator(".plan-details-description");
this.planType3 = page.getByTestId("total-price");
// this is ugly but someone repeated the datatest-id="total-price" in the component
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (non-blocking): bring this up with FXA team too? I'm okay to merge this as-is, but it seems like they should fix this part themselves, and if they do, we might have to revert this particular code?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes i agree!

this.planType3 = page.locator(
".overflow-hidden.text-ellipsis.text-lg.whitespace-nowrap",
);
}

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

async getSubscriptionTitleText(): Promise<string> {
if (this.isVersion3()) {
return await this.subscription3Title.textContent();
const text = await this.subscription3Title.textContent();

if (!text) {
throw new Error("Subscription title text not found.");
}
return await this.subscriptionTitle.textContent();

return text;
}

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

if (!text) {
throw new Error("Get Plan title text not found.");
}
return await this.planDetails.textContent();

return text;
}

async getPriceDetailsText(): Promise<string> {
if (this.isVersion3()) {
return await this.planType3.textContent();
const text = await this.planType3.textContent();

if (!text) {
throw new Error("Get Plan type text not found.");
}
return await this.planType.textContent();

return text;
}
}