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.
This commit is contained in:
giancarlo
2024-04-14 19:55:59 +08:00
parent 7fab6d7335
commit 003cc73485
4 changed files with 9 additions and 7 deletions

View File

@@ -31,14 +31,14 @@ export class TeamAccountsPageObject {
return this.page.locator('[data-test="account-selector-team"]'); return this.page.locator('[data-test="account-selector-team"]');
} }
async goToSettings() { goToSettings() {
await this.page.locator('a', { return this.page.locator('a', {
hasText: 'Settings', hasText: 'Settings',
}).click(); }).click();
} }
async goToBilling() { goToBilling() {
await this.page.locator('a', { return this.page.locator('a', {
hasText: 'Billing', hasText: 'Billing',
}).click(); }).click();
} }

View File

@@ -13,7 +13,7 @@ test.describe('Team Billing', () => {
await po.teamAccounts.goToBilling(); 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.selectPlan(0);
await po.billing.proceedToCheckout(); await po.billing.proceedToCheckout();

View File

@@ -22,7 +22,9 @@ test.describe('User Billing', () => {
await expect(po.billing.successStatus()).toBeVisible(); await expect(po.billing.successStatus()).toBeVisible();
await po.billing.returnToHome(); await po.billing.returnToHome();
const link = page.locator('a', { await page.waitForURL('http://localhost:3000/home');
const link = page.locator('button', {
hasText: 'Billing' hasText: 'Billing'
}); });

View File

@@ -32,7 +32,7 @@ export class BillingPageObject {
// wait a bit for the webhook to be processed // wait a bit for the webhook to be processed
await this.page.waitForTimeout(1000); await this.page.waitForTimeout(1000);
await this.successStatus().locator('button').click(); return this.page.locator('[data-test="checkout-success-back-link"]').click();
} }
proceedToCheckout() { proceedToCheckout() {