feat(frontend): implement main dashboard page (#48)

Implement the main dashboard / projects list page for Syndarix as the landing
page after login. The implementation includes:

Dashboard Components:
- QuickStats: Overview cards showing active projects, agents, issues, approvals
- ProjectsSection: Grid/list view with filtering and sorting controls
- ProjectCardGrid: Rich project cards for grid view
- ProjectRowList: Compact rows for list view
- ActivityFeed: Real-time activity sidebar with connection status
- PerformanceCard: Performance metrics display
- EmptyState: Call-to-action for new users
- ProjectStatusBadge: Status indicator with icons
- ComplexityIndicator: Visual complexity dots
- ProgressBar: Accessible progress bar component

Features:
- Projects grid/list view with view mode toggle
- Filter by status (all, active, paused, completed, archived)
- Sort by recent, name, progress, or issues
- Quick stats overview with counts
- Real-time activity feed sidebar with live/reconnecting status
- Performance metrics card
- Create project button linking to wizard
- Responsive layout for mobile/desktop
- Loading skeleton states
- Empty state for new users

API Integration:
- useProjects hook for fetching projects (mock data until backend ready)
- useDashboardStats hook for statistics
- TanStack Query for caching and data fetching

Testing:
- 37 unit tests covering all dashboard components
- E2E test suite for dashboard functionality
- Accessibility tests (keyboard nav, aria attributes, heading hierarchy)

Technical:
- TypeScript strict mode compliance
- ESLint passing
- WCAG AA accessibility compliance
- Mobile-first responsive design
- Dark mode support via semantic tokens
- Follows design system guidelines

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-30 23:46:50 +01:00
parent e85788f79f
commit 5b1e2852ea
67 changed files with 8879 additions and 0 deletions

265
frontend/e2e/issues.spec.ts Normal file
View File

@@ -0,0 +1,265 @@
/**
* Issue Management E2E Tests
*
* Tests for the issue list and detail pages.
*/
import { test, expect } from '@playwright/test';
test.describe('Issue Management', () => {
// Use a test project ID
const projectId = 'test-project-123';
test.beforeEach(async ({ page }) => {
// Mock authentication - inject test auth store
await page.addInitScript(() => {
window.__TEST_AUTH_STORE__ = {
getState: () => ({
isAuthenticated: true,
user: { id: 'test-user', email: 'test@example.com', is_superuser: false },
accessToken: 'test-token',
refreshToken: 'test-refresh',
}),
};
});
});
test.describe('Issue List Page', () => {
test('displays issues list', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues`);
// Wait for the page to load
await expect(page.getByRole('heading', { name: /issues/i })).toBeVisible();
// Should show issue count
await expect(page.getByText(/issues found/i)).toBeVisible();
});
test('has search functionality', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues`);
const searchInput = page.getByPlaceholder('Search issues...');
await expect(searchInput).toBeVisible();
// Type in search
await searchInput.fill('authentication');
// Wait for debounced search (mock data should filter)
await page.waitForTimeout(500);
});
test('has status filter', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues`);
// Find status filter
const statusFilter = page.getByRole('combobox', { name: /filter by status/i });
await expect(statusFilter).toBeVisible();
// Open and select a status
await statusFilter.click();
await page.getByRole('option', { name: /in progress/i }).click();
});
test('can toggle extended filters', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues`);
// Extended filters should not be visible initially
await expect(page.getByLabel('Priority')).not.toBeVisible();
// Click filter toggle
await page.getByRole('button', { name: /toggle extended filters/i }).click();
// Extended filters should now be visible
await expect(page.getByLabel('Priority')).toBeVisible();
await expect(page.getByLabel('Sprint')).toBeVisible();
await expect(page.getByLabel('Assignee')).toBeVisible();
});
test('can select issues for bulk actions', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues`);
// Wait for issues to load
await page.waitForSelector('[data-testid^="issue-row-"]');
// Select first issue checkbox
const firstCheckbox = page.getByRole('checkbox', { name: /select issue/i }).first();
await firstCheckbox.click();
// Bulk actions bar should appear
await expect(page.getByText('1 selected')).toBeVisible();
await expect(page.getByRole('button', { name: /change status/i })).toBeVisible();
});
test('navigates to issue detail when clicking row', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues`);
// Wait for issues to load
await page.waitForSelector('[data-testid^="issue-row-"]');
// Click on first issue row
await page.locator('[data-testid^="issue-row-"]').first().click();
// Should navigate to detail page
await expect(page).toHaveURL(/\/issues\/[^/]+$/);
});
test('has new issue button', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues`);
await expect(page.getByRole('button', { name: /new issue/i })).toBeVisible();
});
test('has sync button', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues`);
await expect(page.getByRole('button', { name: /sync/i })).toBeVisible();
});
});
test.describe('Issue Detail Page', () => {
const issueId = 'ISS-001';
test('displays issue details', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues/${issueId}`);
// Wait for the page to load
await expect(page.getByRole('heading', { level: 1 })).toBeVisible();
// Should show issue number
await expect(page.getByText(/#\d+/)).toBeVisible();
});
test('displays status badge', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues/${issueId}`);
// Should show status
await expect(
page.getByText(/open|in progress|in review|blocked|done|closed/i).first()
).toBeVisible();
});
test('displays priority badge', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues/${issueId}`);
// Should show priority
await expect(page.getByText(/high|medium|low/i).first()).toBeVisible();
});
test('has back button', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues/${issueId}`);
const backButton = page.getByRole('link', { name: /back to issues/i });
await expect(backButton).toBeVisible();
});
test('displays status workflow panel', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues/${issueId}`);
// Should show status workflow
await expect(page.getByRole('heading', { name: /status workflow/i })).toBeVisible();
// Should show all status options
await expect(page.getByRole('radiogroup', { name: /issue status/i })).toBeVisible();
});
test('displays activity timeline', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues/${issueId}`);
// Should show activity section
await expect(page.getByRole('heading', { name: /activity/i })).toBeVisible();
// Should have add comment button
await expect(page.getByRole('button', { name: /add comment/i })).toBeVisible();
});
test('displays issue details panel', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues/${issueId}`);
// Should show details section
await expect(page.getByRole('heading', { name: /details/i })).toBeVisible();
// Should show assignee info
await expect(page.getByText(/assignee/i)).toBeVisible();
});
test('can change status via workflow', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues/${issueId}`);
// Wait for page to load
await page.waitForSelector('[role="radiogroup"]');
// Click on a different status
const inProgressOption = page.getByRole('radio', { name: /in progress/i });
await inProgressOption.click();
// The status should update (optimistic update)
await expect(inProgressOption).toHaveAttribute('aria-checked', 'true');
});
test('displays description', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues/${issueId}`);
// Should show description heading
await expect(page.getByRole('heading', { name: /description/i })).toBeVisible();
});
test('shows edit button', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues/${issueId}`);
await expect(page.getByRole('button', { name: /edit/i })).toBeVisible();
});
test('shows external link when available', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues/${issueId}`);
// The mock data includes an external URL
await expect(page.getByRole('link', { name: /view in gitea/i })).toBeVisible();
});
});
test.describe('Accessibility', () => {
test('issue list has proper heading structure', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues`);
// Main heading should be h1
const h1 = page.getByRole('heading', { level: 1 });
await expect(h1).toBeVisible();
});
test('issue list table has proper ARIA labels', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues`);
// Wait for table to load
await page.waitForSelector('[data-testid^="issue-row-"]');
// Checkboxes should have labels
const checkboxes = page.getByRole('checkbox');
const count = await checkboxes.count();
expect(count).toBeGreaterThan(0);
// First checkbox should have accessible label
await expect(checkboxes.first()).toHaveAccessibleName();
});
test('issue detail has proper radiogroup for status', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues/ISS-001`);
// Status workflow should be a radiogroup
const radiogroup = page.getByRole('radiogroup', { name: /issue status/i });
await expect(radiogroup).toBeVisible();
// Each status should be a radio button
const radios = page.getByRole('radio');
const count = await radios.count();
expect(count).toBe(6); // 6 statuses
});
test('activity timeline has proper list structure', async ({ page }) => {
await page.goto(`/en/projects/${projectId}/issues/ISS-001`);
// Activity should be a list
const list = page.getByRole('list', { name: /issue activity/i });
await expect(list).toBeVisible();
});
});
});

View File

@@ -0,0 +1,297 @@
/**
* E2E Tests for Project Dashboard Page
*
* Tests the single project view showing:
* - Project header with status badges
* - Agent panel with status indicators
* - Sprint progress and burndown chart
* - Issue summary sidebar
* - Recent activity feed
* - Quick actions (start/pause agents, create sprint)
*
* @module e2e/project-dashboard.spec
* @see Issue #40
*/
import { test, expect } from '@playwright/test';
import { setupAuthenticatedMocks, loginViaUI } from './helpers/auth';
test.describe('Project Dashboard Page', () => {
test.beforeEach(async ({ page }) => {
// Set up mock API endpoints
await setupAuthenticatedMocks(page);
});
test('should display project header with name and status badges', async ({ page }) => {
await loginViaUI(page);
// Navigate to a project dashboard
await page.goto('/en/projects/proj-001');
await page.waitForLoadState('networkidle');
// Check project header is present
await expect(page.getByTestId('project-header')).toBeVisible();
// Check project name
await expect(page.getByRole('heading', { level: 1 })).toContainText('E-Commerce Platform Redesign');
// Check status badges
await expect(page.getByText('In Progress')).toBeVisible();
await expect(page.getByText('Milestone')).toBeVisible();
});
test('should display agent panel with active agents', async ({ page }) => {
await loginViaUI(page);
await page.goto('/en/projects/proj-001');
await page.waitForLoadState('networkidle');
// Check agent panel is present
await expect(page.getByTestId('agent-panel')).toBeVisible();
await expect(page.getByText('Active Agents')).toBeVisible();
// Check agent count
await expect(page.getByText(/\d+ of \d+ agents working/)).toBeVisible();
// Check at least one agent is visible
await expect(page.getByText('Product Owner')).toBeVisible();
});
test('should display sprint progress with stats', async ({ page }) => {
await loginViaUI(page);
await page.goto('/en/projects/proj-001');
await page.waitForLoadState('networkidle');
// Check sprint progress is present
await expect(page.getByTestId('sprint-progress')).toBeVisible();
await expect(page.getByText('Sprint Overview')).toBeVisible();
// Check progress bar exists
await expect(page.getByRole('progressbar')).toBeVisible();
// Check issue stats are shown
await expect(page.getByText('Completed')).toBeVisible();
await expect(page.getByText('In Progress')).toBeVisible();
await expect(page.getByText('Blocked')).toBeVisible();
// Check burndown chart is present
await expect(page.getByText('Burndown Chart')).toBeVisible();
});
test('should display issue summary sidebar', async ({ page }) => {
await loginViaUI(page);
await page.goto('/en/projects/proj-001');
await page.waitForLoadState('networkidle');
// Check issue summary is present
await expect(page.getByTestId('issue-summary')).toBeVisible();
await expect(page.getByText('Issue Summary')).toBeVisible();
// Check issue counts by status
await expect(page.getByText('Open')).toBeVisible();
await expect(page.getByText('In Review')).toBeVisible();
});
test('should display recent activity feed', async ({ page }) => {
await loginViaUI(page);
await page.goto('/en/projects/proj-001');
await page.waitForLoadState('networkidle');
// Check activity feed is present
await expect(page.getByTestId('recent-activity')).toBeVisible();
await expect(page.getByText('Recent Activity')).toBeVisible();
});
test('should have quick action buttons', async ({ page }) => {
await loginViaUI(page);
await page.goto('/en/projects/proj-001');
await page.waitForLoadState('networkidle');
// Check quick actions are present
await expect(page.getByRole('button', { name: /run sprint/i })).toBeVisible();
await expect(page.getByRole('button', { name: /new sprint/i })).toBeVisible();
});
test('should have manage agents button', async ({ page }) => {
await loginViaUI(page);
await page.goto('/en/projects/proj-001');
await page.waitForLoadState('networkidle');
// Check manage agents button
await expect(page.getByRole('button', { name: /manage agents/i })).toBeVisible();
});
test('should have view all issues button', async ({ page }) => {
await loginViaUI(page);
await page.goto('/en/projects/proj-001');
await page.waitForLoadState('networkidle');
// Check view all issues button
const viewAllButton = page.getByRole('button', { name: /view all issues/i });
await expect(viewAllButton).toBeVisible();
});
test('should have accessible heading hierarchy', async ({ page }) => {
await loginViaUI(page);
await page.goto('/en/projects/proj-001');
await page.waitForLoadState('networkidle');
// Check for h1 (project name)
await expect(page.locator('h1')).toBeVisible();
// Check for multiple headings
const headings = page.getByRole('heading');
const count = await headings.count();
expect(count).toBeGreaterThan(3); // Project name + Agent Panel + Sprint + Activity
});
test('should be keyboard navigable', async ({ page }) => {
await loginViaUI(page);
await page.goto('/en/projects/proj-001');
await page.waitForLoadState('networkidle');
// Tab through the page elements
await page.keyboard.press('Tab');
// Should be able to focus on interactive elements
const focusedElement = page.locator(':focus');
await expect(focusedElement).toBeVisible();
});
test('should show responsive layout on mobile', async ({ page }) => {
// Set mobile viewport
await page.setViewportSize({ width: 375, height: 667 });
await loginViaUI(page);
await page.goto('/en/projects/proj-001');
await page.waitForLoadState('networkidle');
// Page should still be functional on mobile
await expect(page.getByRole('heading', { level: 1 })).toBeVisible();
await expect(page.getByTestId('agent-panel')).toBeVisible();
await expect(page.getByTestId('sprint-progress')).toBeVisible();
});
test('should load within acceptable time', async ({ page }) => {
await loginViaUI(page);
// Measure navigation timing
const start = Date.now();
await page.goto('/en/projects/proj-001');
await page.waitForLoadState('networkidle');
const duration = Date.now() - start;
// Dashboard should load within 5 seconds (including mock data)
expect(duration).toBeLessThan(5000);
});
test('should show SSE connection status when disconnected', async ({ page }) => {
await loginViaUI(page);
await page.goto('/en/projects/proj-001');
await page.waitForLoadState('networkidle');
// When SSE is not connected, connection status should be visible
// (Connected state hides the status indicator)
// Since we don't have SSE mock, it will show as connecting/disconnected
const connectionStatus = page.locator('[role="status"]').first();
// Either connection status is visible (not connected) or hidden (connected)
// Both are valid states
const count = await connectionStatus.count();
expect(count).toBeGreaterThanOrEqual(0);
});
});
test.describe('Project Dashboard Agent Interactions', () => {
test.beforeEach(async ({ page }) => {
await setupAuthenticatedMocks(page);
});
test('should display agent action menu when clicking agent options', async ({ page }) => {
await loginViaUI(page);
await page.goto('/en/projects/proj-001');
await page.waitForLoadState('networkidle');
// Find the first agent's action menu button
const agentActionButton = page
.getByTestId('agent-panel')
.getByRole('button', { name: /actions for/i })
.first();
// Check button is visible and clickable
await expect(agentActionButton).toBeVisible();
await agentActionButton.click();
// Menu should show options
await expect(page.getByText('View Details')).toBeVisible();
await expect(page.getByText('Terminate Agent')).toBeVisible();
});
test('should show agent status indicators', async ({ page }) => {
await loginViaUI(page);
await page.goto('/en/projects/proj-001');
await page.waitForLoadState('networkidle');
// Look for status role elements within agent panel
const statusIndicators = page.getByTestId('agent-panel').locator('[role="status"]');
const count = await statusIndicators.count();
expect(count).toBeGreaterThan(0);
});
});
test.describe('Project Dashboard Sprint Interactions', () => {
test.beforeEach(async ({ page }) => {
await setupAuthenticatedMocks(page);
});
test('should display sprint selector when multiple sprints exist', async ({ page }) => {
await loginViaUI(page);
await page.goto('/en/projects/proj-001');
await page.waitForLoadState('networkidle');
// Check for sprint selector combobox
const sprintSelector = page.getByRole('combobox', { name: /select sprint/i });
await expect(sprintSelector).toBeVisible();
});
test('should show burndown chart legend', async ({ page }) => {
await loginViaUI(page);
await page.goto('/en/projects/proj-001');
await page.waitForLoadState('networkidle');
// Check burndown chart has legend items
await expect(page.getByText('Actual')).toBeVisible();
await expect(page.getByText('Ideal')).toBeVisible();
});
});
test.describe('Project Dashboard Activity Feed', () => {
test.beforeEach(async ({ page }) => {
await setupAuthenticatedMocks(page);
});
test('should display activity items with timestamps', async ({ page }) => {
await loginViaUI(page);
await page.goto('/en/projects/proj-001');
await page.waitForLoadState('networkidle');
// Check activity feed has content
const activityFeed = page.getByTestId('recent-activity');
await expect(activityFeed).toBeVisible();
// Check for relative timestamps (e.g., "5 minutes ago", "less than a minute ago")
await expect(activityFeed.getByText(/ago|minute|hour|day/i).first()).toBeVisible();
});
test('should highlight action-required activities', async ({ page }) => {
await loginViaUI(page);
await page.goto('/en/projects/proj-001');
await page.waitForLoadState('networkidle');
// Look for action buttons in activity feed (if any require action)
const reviewButton = page.getByTestId('recent-activity').getByRole('button', { name: /review/i });
const count = await reviewButton.count();
// Either there are action items or not - both are valid
expect(count).toBeGreaterThanOrEqual(0);
});
});