feat(web): add Playwright E2E test suite for critical paths (#55)
Some checks failed
ci/woodpecker/push/ci Pipeline failed
Some checks failed
ci/woodpecker/push/ci Pipeline failed
Sets up @playwright/test in apps/web with playwright.config.ts targeting localhost:3000. Adds E2E test coverage for all critical paths: auth (login/register/validation), chat (page load, new conversation), projects (list, empty state), settings (4 tab switches), admin (tab switching, role guard), and navigation (sidebar links, route transitions). Includes auth helper, separate tsconfig.e2e.json, and allowDefaultProject ESLint config so e2e files pass the pre-commit hook. Adds pnpm test:e2e script. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
23
apps/web/e2e/helpers/auth.ts
Normal file
23
apps/web/e2e/helpers/auth.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
export const TEST_USER = {
|
||||
email: process.env['E2E_USER_EMAIL'] ?? 'e2e@example.com',
|
||||
password: process.env['E2E_USER_PASSWORD'] ?? 'password123',
|
||||
name: 'E2E Test User',
|
||||
};
|
||||
|
||||
export const ADMIN_USER = {
|
||||
email: process.env['E2E_ADMIN_EMAIL'] ?? 'admin@example.com',
|
||||
password: process.env['E2E_ADMIN_PASSWORD'] ?? 'adminpass123',
|
||||
name: 'E2E Admin User',
|
||||
};
|
||||
|
||||
/**
|
||||
* Fill the login form and submit. Waits for navigation after success.
|
||||
*/
|
||||
export async function loginAs(page: Page, email: string, password: string): Promise<void> {
|
||||
await page.goto('/login');
|
||||
await page.getByLabel('Email').fill(email);
|
||||
await page.getByLabel('Password').fill(password);
|
||||
await page.getByRole('button', { name: /sign in/i }).click();
|
||||
}
|
||||
Reference in New Issue
Block a user