feat(dashboard): Enhance dashboard with PageHeader, StatCard, and auth fixes

- Create PageHeader component with title, description, and action slots
- Create StatCard component with trend indicators and icons
- Update dashboard with KPI cards, Quick Actions, and Allocation Preview
- Polish login page with branding and centered layout
- Fix auth redirect: authenticated users accessing /login go to dashboard
- Fix page refresh: auth state persists, no blank page
- Fix sidebar: visible after login, toggle works, state persists
- Fix CSS import: add app.css to layout, fix DaisyUI import path
- Fix breadcrumbs: home icon links to /dashboard
- Add comprehensive E2E and unit tests

Refs: openspec/changes/p03-dashboard-enhancement
Closes: p03-dashboard-enhancement
This commit is contained in:
2026-02-18 18:14:57 -05:00
parent 493cb78173
commit 96f1d0a6e5
22 changed files with 770 additions and 138 deletions

View File

@@ -232,6 +232,26 @@ test.describe('Authentication E2E', () => {
});
});
test.describe('Already Authenticated Redirects', () => {
test('authenticated user accessing login redirects to dashboard @auth', async ({ page }) => {
// Login first
await page.goto('/login');
await page.fill('input[type="email"]', 'superuser@headroom.test');
await page.fill('input[type="password"]', 'password');
await page.click('button[type="submit"]');
await page.waitForURL('/dashboard');
// Now try to access login page while authenticated
await page.goto('/login');
// Should redirect to dashboard, not show login page
await page.waitForURL('/dashboard');
// Verify we're on dashboard
await expect(page).toHaveURL('/dashboard');
});
});
test.describe('Token Auto-refresh', () => {
test('token auto-refresh on 401 response @auth', async ({ page }) => {
// Login first