Files
myeasycms-v2/apps/e2e/tests/user-billing/user-billing.spec.ts
giancarlo 0824ac8e9f Refactor billing process in e2e tests
Code for billing process was refactored in end-to-end tests for clean code and better structure. In the described tests, related codes and classes have been moved to a new class named BillingPageObject. All corresponding calls were updated accordingly.
2024-04-14 17:54:15 +08:00

29 lines
823 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 page.goto('/home/billing');
await expect(await po.billing.getStatus()).toContainText('active');
await expect(po.billing.manageBillingButton()).toBeVisible();
});
});