Files
myeasycms-v2/apps/e2e/tests/user-billing/user-billing.spec.ts
Giancarlo Buomprisco 02e2502dcc Enhance E2E Tests and Configuration (#358)
* Enhance E2E Tests and Configuration

- Updated `.gitignore` to exclude `.auth/` directory for cleaner test environment.
- Added `test:fast` script in `package.json` for faster Playwright test execution.
- Configured Playwright to include a setup project for initializing tests.
- Introduced `AUTH_STATES` utility for managing authentication states in tests.
- Created `auth.setup.ts` for user authentication tests, ensuring proper login flows.
- Refactored various test files to utilize the new authentication state management, improving test reliability and maintainability.
- Adjusted team and user billing tests to streamline setup and enhance clarity.
- Refactored some dialogs
2025-09-21 12:28:42 +08:00

40 lines
1.0 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { AuthPageObject } from '../authentication/auth.po';
import { UserBillingPageObject } from './user-billing.po';
test.describe('User Billing', () => {
test('user can subscribe to a plan', async ({ page }) => {
const po = new UserBillingPageObject(page);
const auth = new AuthPageObject(page);
const email = auth.createRandomEmail();
await auth.bootstrapUser({
email,
name: 'Test Billing User',
});
await auth.loginAsUser({
email,
next: '/home/billing',
});
await po.billing.selectPlan(0);
await po.billing.proceedToCheckout();
await po.billing.stripe.waitForForm();
await po.billing.stripe.fillForm();
await po.billing.stripe.submitForm();
await expect(po.billing.successStatus()).toBeVisible({
timeout: 25_000,
});
await po.billing.returnToBilling();
await expect(po.billing.getStatus()).toContainText('Active');
await expect(po.billing.manageBillingButton()).toBeVisible();
});
});