Files
syndarix/frontend/tests/components/projects/wizard/StepIndicator.test.tsx
Felipe Cardoso 5b1e2852ea 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>
2025-12-30 23:46:50 +01:00

82 lines
3.3 KiB
TypeScript

/**
* Tests for StepIndicator component
*/
import { render, screen } from '@testing-library/react';
import { StepIndicator } from '@/components/projects/wizard/StepIndicator';
describe('StepIndicator', () => {
describe('non-script mode (6 steps)', () => {
it('renders correct step count', () => {
render(<StepIndicator currentStep={1} isScriptMode={false} />);
expect(screen.getByText('Step 1 of 6')).toBeInTheDocument();
});
it('shows correct step label for each step', () => {
const { rerender } = render(<StepIndicator currentStep={1} isScriptMode={false} />);
expect(screen.getByText('Basic Info')).toBeInTheDocument();
rerender(<StepIndicator currentStep={2} isScriptMode={false} />);
expect(screen.getByText('Complexity')).toBeInTheDocument();
rerender(<StepIndicator currentStep={3} isScriptMode={false} />);
expect(screen.getByText('Client Mode')).toBeInTheDocument();
rerender(<StepIndicator currentStep={4} isScriptMode={false} />);
expect(screen.getByText('Autonomy')).toBeInTheDocument();
rerender(<StepIndicator currentStep={5} isScriptMode={false} />);
expect(screen.getByText('Agent Chat')).toBeInTheDocument();
rerender(<StepIndicator currentStep={6} isScriptMode={false} />);
expect(screen.getByText('Review')).toBeInTheDocument();
});
it('renders 6 progress segments', () => {
render(<StepIndicator currentStep={3} isScriptMode={false} />);
const progressbar = screen.getByRole('progressbar');
expect(progressbar).toBeInTheDocument();
expect(progressbar).toHaveAttribute('aria-valuenow', '3');
expect(progressbar).toHaveAttribute('aria-valuemax', '6');
});
});
describe('script mode (4 steps)', () => {
it('renders correct step count', () => {
render(<StepIndicator currentStep={1} isScriptMode={true} />);
expect(screen.getByText('Step 1 of 4')).toBeInTheDocument();
});
it('shows correct step labels (no Client Mode or Autonomy)', () => {
const { rerender } = render(<StepIndicator currentStep={1} isScriptMode={true} />);
expect(screen.getByText('Basic Info')).toBeInTheDocument();
rerender(<StepIndicator currentStep={2} isScriptMode={true} />);
expect(screen.getByText('Complexity')).toBeInTheDocument();
// Step 5 (Agent Chat) maps to display step 3
rerender(<StepIndicator currentStep={5} isScriptMode={true} />);
expect(screen.getByText('Step 3 of 4')).toBeInTheDocument();
expect(screen.getByText('Agent Chat')).toBeInTheDocument();
// Step 6 (Review) maps to display step 4
rerender(<StepIndicator currentStep={6} isScriptMode={true} />);
expect(screen.getByText('Step 4 of 4')).toBeInTheDocument();
expect(screen.getByText('Review')).toBeInTheDocument();
});
it('renders 4 progress segments', () => {
render(<StepIndicator currentStep={5} isScriptMode={true} />);
const progressbar = screen.getByRole('progressbar');
expect(progressbar).toHaveAttribute('aria-valuemax', '4');
});
});
it('applies custom className', () => {
const { container } = render(
<StepIndicator currentStep={1} isScriptMode={false} className="my-custom-class" />
);
expect(container.firstChild).toHaveClass('my-custom-class');
});
});