40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
import { loginAs, REQUIRE_SEEDED_AUTH, 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(
|
|
!REQUIRE_SEEDED_AUTH && !url.includes('/chat'),
|
|
'No seeded test user — skipping authenticated tests',
|
|
);
|
|
});
|
|
|
|
test('projects page loads with heading', async ({ page }) => {
|
|
await page.goto('/projects');
|
|
// level: 1 — the "No projects yet" empty-state h2 also matches /projects/i
|
|
// and a two-element match is a strict-mode violation.
|
|
await expect(page.getByRole('heading', { level: 1, 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 cardsOrEmpty = page
|
|
.locator('[class*="grid"]')
|
|
.or(page.getByText(/no projects yet/i))
|
|
.first();
|
|
await expect(cardsOrEmpty).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();
|
|
});
|
|
});
|