Files
myeasycms-v2/apps/e2e/tests/user-billing/user-billing.spec.ts
giancarlo 7dcd688ca9 Update user billing flow and improve error handling
Updated the user billing process to add a return to home function and redirect users to their specific account page after payment. Enhanced error handling in the billing event handler to handle scenarios where no account id is found in the subscription. Removed unused billing page object from the stripe page object.
2024-04-14 18:25:33 +08:00

32 lines
894 B
TypeScript

import { expect, Page, test } from '@playwright/test';
import { UserBillingPageObject } from './user-billing.po';
test.describe('User Billing', () => {
let page: Page;
let po: UserBillingPageObject;
test.beforeAll(async ({ browser }) => {
page = await browser.newPage();
po = new UserBillingPageObject(page);
await po.setup();
});
test('user can subscribe to a plan', async ({page}) => {
await po.billing.selectPlan(0);
await po.billing.proceedToCheckout();
await po.billing.stripe.fillForm();
await po.billing.stripe.submitForm();
await expect(po.billing.successStatus()).toBeVisible();
await po.billing.returnToHome();
await page.locator('a', {
hasText: 'Billing',
}).click();
await expect(await po.billing.getStatus()).toContainText('active');
await expect(po.billing.manageBillingButton()).toBeVisible();
});
});