Key changes: - Added react-router-dom as required dependency (v6.x) - App.tsx now includes BrowserRouter wrapper with Routes - Route definitions map pages to URLs (/ → Home, /articles → ArticlePage, /categories → CategoriesPage) - Header navigation uses React Router <Link> components instead of anchor tags - Updated scoring rubric: 49 total points - New critical requirement: Agent must install BOTH lucide-react AND react-router-dom
9.9 KiB
9.9 KiB
M3: Setup Frontend - Scoring Rubric
Acceptance Criteria Scoring Table
| Score | Criteria |
|---|---|
| 0 | Agent failed to implement acceptance criteria: - No Vite/React project created - TypeScript not configured - Missing multiple required folders - Components incomplete - Missing tests (unit + E2E) - Missing lucide-react icons - Missing React Router setup - No Dockerfile or docker-compose missing |
| 1 | Agent partially implemented acceptance criteria that builds successfully: - Basic React app with vite but no lucide-icons - Missing react-router-dom dependency - Missing page/component separation - Components render but have errors - npm scripts incomplete - No test setup at all |
| 2 | Agent fully implemented acceptance criteria that builds successfully: - Vite + React + TypeScript project in frontend/ folder - All required directories (assets/, components/, pages/, types/, api/, tests/) created - lucide-react installed with core icons (Home, FileText, Settings, Search) - react-router-dom v6.x installed and imported correctly<br- Article, Author, Category TypeScript interfaces defined - Header component with navigation placeholder and lucide icons AND router Links<br- package.json scripts (dev, build, preview, test, e2e) working - .gitignore excludes node_modules, dist/, IDE configs - Playwright installed and configured |
| 3 | Agent fully implemented acceptance criteria that builds successfully, includes reusable article components created - ArticleCard.tsx displays article data correctly<br- Layout wrapper component with proper structure<br- React Router BrowserRouter wrapper in App.tsx configured |
| 4 | Agent fully implemented acceptance criteria that builds successfully, includes comprehensive unit tests covering: - Header rendering and icon display<br- Layout structure and header integration<br- API client error handling scenarios<br- React Router Link components render correctly50% on components |
| 5 | Agent fully implemented acceptance criteria that builds successfully, includes all content from Score 4 AND: - Playwright E2E tests in playwright/e2e/ passing successfully<br- E2E tests verify homepage layout and lucide icon navigation links<br- API client makes requests correctly via browser<br- React Router routing works without full page reloads60% across unit and E2E tests<br- All tests execute without errors |
Scoring Breakdown by Criterion
Project Setup (Max 2 points)
- 0 pts: No Vite/React project or not in frontend/ folder
- TypeScript missing entirely - 1 pt: Basic React app created but structure incomplete
- Missing pages/, components/ separation - 2 pts: Complete directory structure with all required folders (public/, src/, assets/, components/, pages/, types/, api/, tests/)
TypeScript & Dependencies (Max 5 points)
- 0 pts: No TypeScript or tsconfig.json
- Neither lucide-react nor react-router-dom installed - 1 pt: TypeScript enabled but no type definitions
- Partial interfaces
- Missing react-router-dom - 2 pts: Article, Author, Category interfaces properly defined
- lucide-react with core icons imported correctly - 3 pts: Comprehensive types including ApiResponse, function signatures<br- react-router-dom v6.x dependencies present in package.json<br- All type exports across modules
- 4 pts: All type definitions validated and used in components
No TypeScript errors on build - 5 pts: React Router Link components typed correctly with proper navigation types
UI Components (Max 5 points)
- 0 pts: No UI components or Header missing
- Application doesn't render properly - 1 pt: Only Header component created
- Layout wrapper missing - 2 pts: Header and Layout components implemented with lucide icons<br- Basic icon rendering works
- 3 pts: Reusable article components (ArticleCard, AuthorAvatar, CategoryBadge) created<br- Icons display correctly in components
- 4 pts: ArticleCard renders article data properly with all sub-components<br- Layout component integrates header and content sections
- 5 pts: All UI components responsive and accessible<br- Lucide icons use correct semantic HTML
React Router Configuration (Max 5 points) ⭐ NEW
- 0 pts: No React Router setup
- App.tsx missing BrowserRouter or Routes - 1 pt: react-router-dom imported but no configuration
- Link components not working - 2 pts: BrowserRouter wrapper exists in App.tsx
- Basic routes defined (at least / and /articles) - 3 pts: Route definitions mapped to page components<br- Proper imports from src/pages/
- 4 pts: Navigation uses React Router
<Link>components instead of anchor tags<br- Header navigation functional - 5 pts: Full routing setup with all three routes (/ → Home, /articles → ArticlePage, /categories → CategoriesPage)<br- Client-side navigation works without page reloads
Page Components (Max 3 points)
- 0 pts: No page separation or Home.tsx missing
- Routes not defined in App.tsx - 1 pt: Only Home page created<br- ArticlePage, CategoriesPage placeholders missing
- 2 pts: All three page components implemented (Home, ArticlePage, CategoriesPage)<br- Proper folder organization under pages/
- 3 pts: Page components properly separated from component library<br- Clear route-to-page mapping in App.tsx with React Router
API Integration (Max 2 points)
- 0 pts: No API client or fetch not configured
- Cannot make requests to backend - 1 pt: Basic fetch wrapper exists but no error handling
- Missing type safety - 2 pts: api/client.ts with base URL configuration, fetch wrapper, and error handling
- Type-safe request/response functions
Unit Testing (Max 4 points)
- 0 pts: No Vitest or testing-library setup
- requirements.txt missing test dependencies - 1 pt: Tests folder exists but no actual tests
- Test runner not configured in package.json - 2 pts: Vitest configured, Header.test.tsx created<br- Basic icon/component rendering tests
- 3 pts: Multiple unit tests covering components and API client<br- Uses @testing-library/react for DOM queries
- 4 pts: Unit tests pass with >=50% coverage on tested components<br- Tests verify lucide icon rendering AND React Router Link navigation
E2E Testing (Max 6 points)
- 0 pts: No Playwright installed or configured
- playwright.config.ts missing - 1 pt: Playwright installed but no tests created
- npx playwright install not run - 2 pts: playwright/e2e folder created with home.spec.ts and api.spec.ts<br- Tests discoverable by npm run e2e
- 3 pts: E2E tests verify homepage layout renders correctly<br- Basic accessibility checks pass for lucide icons
- 4 pts: E2E tests verify API client makes requests and backend responds<br- Proper selectors used with lucide icon elements
- 5 pts: Navigation between pages tested via React Router Links (not anchor tags)<br- All page routes accessible from home without full page reloads
- 6 pts: Full user flow verified (home → article click → article page)<br- Comprehensive accessibility compliance and routing validation
Docker Configuration (Max 3 points)
- 0 pts: No Dockerfile or .dockerignore
- Cannot containerize frontend - 1 pt: Basic Dockerfile but doesn't work
- Missing build steps or nginx config - 2 pts: Multi-stage Dockerfile with Node.js build and Nginx serve stages
- Application serves correctly from container - 3 pts: Complete docker-compose.yml with backend + frontend services, port mappings, depends_on
Code Quality (Max 2 points)
- 0 pts: No ESLint or linting fails
- Poor code organization - 1 pt: Basic ESLint rules configured but warnings present
- Inconsistent formatting - 2 pts: ESLint passing with zero critical warnings
- Consistent React + TypeScript + react-router best practices
Documentation (Max 3 points)
- 0 pts: No README.md or incomplete
- No setup instructions - 1 pt: README exists with basic info only
- Missing lucide-react documentation - 2 pts: Comprehensive README with setup guide, API documentation, and usage examples<br- Icons documented<br- React Router setup explained
- 3 pts: Complete component documentation with prop types and lucide icon + react-router usage guide |
Total Possible Score: 49 points
Evaluation Notes
- Partial credit given for incomplete but working implementations (Score 1)
- Full credit requires all acceptance criteria met with passing verification (Score 2 minimum)
- Higher scores require additional value-add content beyond baseline requirements
- Score 0 indicates agent did not attempt the task or application won't run
Critical Requirements Checklist
For an agent to achieve any score above 1, they MUST:
- Install both
lucide-reactANDreact-router-domas dependencies - Configure BrowserRouter in App.tsx
- Define Routes that map to page components
- Use
<Link>components for navigation (not anchor tags)
Bonus Points Consideration
+1 point for:
- ESLint rules properly configured and enforcing React/TypeScript + react-router best practices
- .eslintrc.cjs or vite.config.ts includes meaningful linting rules
+2 points for:
- TypeScript strict mode enabled in tsconfig.json with react-router types
- Components use proper TypeScript generics and props typing with lucide icons typed as ReactNode
+3 points for:
- docker-compose.yml at project root orchestrating both services
- Nginx configuration properly routes SPA (try_files with index.html fallback)
- E2E tests verify client-side routing without page reloads