From 003cc73485591d3ca8baad2bd476ff2eabb50427 Mon Sep 17 00:00:00 2001 From: giancarlo Date: Sun, 14 Apr 2024 19:55:59 +0800 Subject: [PATCH] Update e2e tests for user and team billing Updated end-to-end tests to adjust for changes in user and team billing. Changes include adding await for URL on user-billing.spec.ts and adjusting selectors in billing.po.ts and team-accounts.po.ts. Additionally, we updated test parameters on team-billing.spec.ts. --- apps/e2e/tests/team-accounts/team-accounts.po.ts | 8 ++++---- apps/e2e/tests/team-billing/team-billing.spec.ts | 2 +- apps/e2e/tests/user-billing/user-billing.spec.ts | 4 +++- apps/e2e/tests/utils/billing.po.ts | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/e2e/tests/team-accounts/team-accounts.po.ts b/apps/e2e/tests/team-accounts/team-accounts.po.ts index eeefe25de..605f8332f 100644 --- a/apps/e2e/tests/team-accounts/team-accounts.po.ts +++ b/apps/e2e/tests/team-accounts/team-accounts.po.ts @@ -31,14 +31,14 @@ export class TeamAccountsPageObject { return this.page.locator('[data-test="account-selector-team"]'); } - async goToSettings() { - await this.page.locator('a', { + goToSettings() { + return this.page.locator('a', { hasText: 'Settings', }).click(); } - async goToBilling() { - await this.page.locator('a', { + goToBilling() { + return this.page.locator('a', { hasText: 'Billing', }).click(); } diff --git a/apps/e2e/tests/team-billing/team-billing.spec.ts b/apps/e2e/tests/team-billing/team-billing.spec.ts index 409ae2d66..f16ff0564 100644 --- a/apps/e2e/tests/team-billing/team-billing.spec.ts +++ b/apps/e2e/tests/team-billing/team-billing.spec.ts @@ -13,7 +13,7 @@ test.describe('Team Billing', () => { await po.teamAccounts.goToBilling(); }); - test('a team can subscribe to a plan', async () => { + test('a team can subscribe to a plan', async ({page}) => { await po.billing.selectPlan(0); await po.billing.proceedToCheckout(); diff --git a/apps/e2e/tests/user-billing/user-billing.spec.ts b/apps/e2e/tests/user-billing/user-billing.spec.ts index 78943784e..eabbfffee 100644 --- a/apps/e2e/tests/user-billing/user-billing.spec.ts +++ b/apps/e2e/tests/user-billing/user-billing.spec.ts @@ -22,7 +22,9 @@ test.describe('User Billing', () => { await expect(po.billing.successStatus()).toBeVisible(); await po.billing.returnToHome(); - const link = page.locator('a', { + await page.waitForURL('http://localhost:3000/home'); + + const link = page.locator('button', { hasText: 'Billing' }); diff --git a/apps/e2e/tests/utils/billing.po.ts b/apps/e2e/tests/utils/billing.po.ts index c05c38a3f..b47c08327 100644 --- a/apps/e2e/tests/utils/billing.po.ts +++ b/apps/e2e/tests/utils/billing.po.ts @@ -32,7 +32,7 @@ export class BillingPageObject { // wait a bit for the webhook to be processed await this.page.waitForTimeout(1000); - await this.successStatus().locator('button').click(); + return this.page.locator('[data-test="checkout-success-back-link"]').click(); } proceedToCheckout() {