import { test, expect } from '@playwright/test'; test.describe('Timer CRUD & Error States', () => { test.beforeEach(async ({ page }) => { // Mock any external API calls so tests don't need a running backend await page.route('**/api/**', route => route.fulfill({ status: 200, contentType: 'application/json', body: '{}' }) ); }); test('dashboard shows empty state when no timers exist', async ({ page }) => { await page.goto('/'); await page.waitForLoadState('domcontentloaded'); // Dashboard should render even with no timers await expect(page.locator('body')).toBeVisible(); await expect(page).toHaveTitle(/chronomind/i, { timeout: 15_000 }); }); test('404 page renders for unknown routes', async ({ page }) => { const res = await page.goto('/nonexistent-route-abc'); // Next.js returns 404 for unmatched routes if (res) { expect([200, 404]).toContain(res.status()); } await page.waitForLoadState('domcontentloaded'); await expect(page.locator('body')).toBeVisible(); }); test('settings page sections are interactive', async ({ page }) => { await page.goto('/settings'); await page.waitForLoadState('domcontentloaded'); // Verify settings sections render const body = await page.locator('body').textContent(); expect(body).toBeTruthy(); }); });