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
This commit is contained in:
Giancarlo Buomprisco
2025-09-21 12:28:42 +08:00
committed by GitHub
parent f157cc7f3e
commit 02e2502dcc
27 changed files with 661 additions and 407 deletions

View File

@@ -29,7 +29,9 @@ test.describe('Auth flow', () => {
await auth.visitConfirmEmailLink(email);
await page.waitForURL('**/home');
await page.waitForURL('**/home', {
timeout: 5_000,
});
});
test('will sign-in with the correct credentials', async ({ page }) => {
@@ -43,7 +45,9 @@ test.describe('Auth flow', () => {
password: 'password',
});
await page.waitForURL('**/home');
await page.waitForURL('**/home', {
timeout: 5_000,
});
expect(page.url()).toContain('/home');
@@ -62,7 +66,9 @@ test.describe('Auth flow', () => {
password: 'testingpassword',
});
await page.waitForURL('/home/settings');
await page.waitForURL('/home/settings', {
timeout: 5_000,
});
await auth.signOut();
@@ -75,17 +81,14 @@ test.describe('Protected routes', () => {
page,
}) => {
const auth = new AuthPageObject(page);
const path = '/home/settings';
await page.goto('/home/settings');
await page.goto(path);
await auth.signIn({
await auth.loginAsUser({
email: 'test@makerkit.dev',
password: 'testingpassword',
next: path,
});
await page.waitForURL('/home/settings');
expect(page.url()).toContain('/home/settings');
});
test('will redirect to the sign-in page if not authenticated', async ({
@@ -115,7 +118,9 @@ test.describe('Last auth method tracking', () => {
});
await auth.visitConfirmEmailLink(testEmail);
await page.waitForURL('**/home');
await page.waitForURL('**/home', {
timeout: 5_000,
});
// Sign out
await auth.signOut();
@@ -169,7 +174,9 @@ test.describe('Last auth method tracking', () => {
password: 'password123',
});
await page.waitForURL('**/home');
await page.waitForURL('**/home', {
timeout: 5_000,
});
// Sign out and check the method is still tracked
await auth.signOut();