Update UI, improve E2E tests and modify trial period configuration

The code changes incorporate UI updates for better usability and user experience. E2E test scripts(in `user-billing.spec.ts` and `team-billing.spec.ts`) were also updated for improved efficiency and accuracy, primarily replacing 'Active' status check with 'Trial'. Changes have been made in the trialDays configuration, with the term 'trialPeriod' now replaced by 'trialDays' across different components. Notably, a new error handling case is included in `lemon-squeezy-billing-strategy.service.ts` for failed subscription cancellation attempts.
This commit is contained in:
giancarlo
2024-04-15 01:18:27 +08:00
parent 26f1371283
commit 4e305bf8c9
14 changed files with 69 additions and 86 deletions

View File

@@ -13,7 +13,7 @@ test.describe('Team Billing', () => {
await po.teamAccounts.goToBilling();
});
test('a team can subscribe to a plan', async ({page}) => {
test('a team can subscribe to a plan', async () => {
await po.billing.selectPlan(0);
await po.billing.proceedToCheckout();
@@ -25,7 +25,7 @@ test.describe('Team Billing', () => {
await po.teamAccounts.goToBilling();
await expect(await po.billing.getStatus()).toContainText('Active');
await expect(await po.billing.getStatus()).toContainText('Trial');
await expect(po.billing.manageBillingButton()).toBeVisible();
});
});

View File

@@ -22,15 +22,13 @@ test.describe('User Billing', () => {
await expect(po.billing.successStatus()).toBeVisible();
await po.billing.returnToHome();
await page.waitForURL('http://localhost:3000/home');
const link = page.locator('button', {
hasText: 'Billing'
});
await link.click();
await expect(await po.billing.getStatus()).toContainText('Active');
await expect(await po.billing.getStatus()).toContainText('Trial');
await expect(po.billing.manageBillingButton()).toBeVisible();
});
});

View File

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