Add end-to-end tests for user and team billing features
This commit introduces end-to-end tests for the user and team billing features. It also enhances existing billing configurations, logging, and error handling mechanisms. Refactoring has been done to simplify the code and make it more readable. Adjustments have also been made in the visual aspects of some components. The addition of these tests will help ensure the reliability of the billing features.
This commit is contained in:
17
apps/e2e/tests/user-billing/user-billing.po.ts
Normal file
17
apps/e2e/tests/user-billing/user-billing.po.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Page } from '@playwright/test';
|
||||
import { AuthPageObject } from '../authentication/auth.po';
|
||||
import { StripePageObject } from '../utils/stripe.po';
|
||||
|
||||
export class UserBillingPageObject {
|
||||
private readonly auth: AuthPageObject;
|
||||
public readonly stripe: StripePageObject;
|
||||
|
||||
constructor(page: Page) {
|
||||
this.auth = new AuthPageObject(page);
|
||||
this.stripe = new StripePageObject(page);
|
||||
}
|
||||
|
||||
async setup() {
|
||||
await this.auth.signUpFlow('/home/billing');
|
||||
}
|
||||
}
|
||||
24
apps/e2e/tests/user-billing/user-billing.spec.ts
Normal file
24
apps/e2e/tests/user-billing/user-billing.spec.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { expect, Page, test } from '@playwright/test';
|
||||
import { UserBillingPageObject } from './user-billing.po';
|
||||
|
||||
test.describe('User Billing', () => {
|
||||
let page: Page;
|
||||
let billing: UserBillingPageObject;
|
||||
|
||||
test.beforeAll(async ({ browser }) => {
|
||||
page = await browser.newPage();
|
||||
billing = new UserBillingPageObject(page);
|
||||
|
||||
await billing.setup();
|
||||
});
|
||||
|
||||
test('user can subscribe to a plan', async () => {
|
||||
await billing.stripe.selectPlan(0);
|
||||
await billing.stripe.proceedToCheckout();
|
||||
|
||||
await billing.stripe.fillForm();
|
||||
await billing.stripe.submitForm();
|
||||
|
||||
await expect(billing.stripe.successStatus()).toBeVisible();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user