Files
stack/apps/web/e2e/projects.spec.ts
Jason Woltje a7804e689d
Some checks failed
ci/woodpecker/push/ci Pipeline failed
feat(web): add Playwright E2E test suite for critical paths (#55)
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>
2026-03-15 14:34:31 -05:00

45 lines
1.5 KiB
TypeScript

import { test, expect } from '@playwright/test';
import { loginAs, TEST_USER } from './helpers/auth.js';
test.describe('Projects page', () => {
test.beforeEach(async ({ page }) => {
await loginAs(page, TEST_USER.email, TEST_USER.password);
const url = page.url();
test.skip(!url.includes('/chat'), 'No seeded test user — skipping authenticated tests');
});
test('projects page loads with heading', async ({ page }) => {
await page.goto('/projects');
await expect(page.getByRole('heading', { name: /projects/i })).toBeVisible({ timeout: 10_000 });
});
test('shows empty state or project cards when loaded', async ({ page }) => {
await page.goto('/projects');
// Wait for loading state to clear
await expect(page.getByText(/loading projects/i)).not.toBeVisible({ timeout: 10_000 });
const hasProjects = await page
.locator('[class*="grid"]')
.isVisible()
.catch(() => false);
const hasEmpty = await page
.getByText(/no projects yet/i)
.isVisible()
.catch(() => false);
expect(hasProjects || hasEmpty).toBe(true);
});
test('shows Active Mission section', async ({ page }) => {
await page.goto('/projects');
await expect(page.getByRole('heading', { name: /active mission/i })).toBeVisible({
timeout: 10_000,
});
});
test('sidebar navigation is present', async ({ page }) => {
await page.goto('/projects');
await expect(page.getByRole('link', { name: /projects/i }).first()).toBeVisible();
});
});