feat: update M2/M3 milestones to include testing infrastructure
M2 (Backend): - Add tests/ folder with pytest test files - Add pytest.ini for test configuration and coverage - Update scoring to require unit tests (Score 4+) M3 (Frontend): - Add tests/ folder with Vitest component unit tests - Add playwright/e2e/ folder with E2E Playwright tests - Add @playwright/test dependency and configuration - Update scoring to require both unit and E2E tests (Score 5) README.md updated with all milestone links and test requirements
This commit is contained in:
1 parent
d66fe178c3
commit
85490bc0a2
5 files changed
+216
-65
No files matched your search
@@ -27,6 +27,22 @@ The model performing the benchmark will be scored against the acceptance criteri
|
||||
|
||||
This benchmark consists of multiple milestones, each representing a separate task:
|
||||
|
||||
### M1: Git Repository Setup
|
||||
## Milestones
|
||||
|
||||
This benchmark consists of multiple milestones, each representing a separate task:
|
||||
|
||||
### M1: Git Repository Setup
|
||||
- [M1 - Setup Git Project](milestone/m1-setup-git-project-prompt.md)
|
||||
- [M1 - Setup Git Project Scoring](milestone/m1-setup-git-project-scoring.md)
|
||||
|
||||
### M2: Backend Infrastructure
|
||||
- [M2 - Setup Backend](milestone/m2-setup-backend-prompt.md)
|
||||
- [M2 - Setup Backend Scoring](milestone/m2-setup-backend-scoring.md)
|
||||
|
||||
### M3: Frontend Application
|
||||
This benchmark consists of multiple milestones, each representing a separate task:
|
||||
|
||||
### M1: Git Repository Setup
|
||||
- [M1 - Setup Git Project](milestone/m1-setup-git-project-prompt.md)
|
||||
- [M1 - Setup Git Project Scoring](milestone/m1-setup-git-project-scoring.md)
|
||||
@@ -49,4 +65,4 @@ After each milestone the agents context MUST be cleared. This test the models re
|
||||
### Python
|
||||
- **Backend:** Python, FastAPI, SQLAlchemy, SQLite (data persisted in a Docker volume)
|
||||
- **Frontend:** React + TypeScript (Vite), lucide-react icons, served by nginx
|
||||
- **Compose:** two services, frontend proxies /api to the backend
|
||||
- **Compose:** two services, frontend proxies /api to the backend
|
||||
@@ -19,11 +19,17 @@ Create the backend infrastructure for **newzy** news web application using Pytho
|
||||
│ │ └── __init__.py
|
||||
│ ├── schemas/
|
||||
│ │ └── __init__.py
|
||||
│ ├── tests/
|
||||
│ │ ├── conftest.py
|
||||
│ │ ├── test_health.py
|
||||
│ │ ├── test_version.py
|
||||
│ │ └── test_models.py
|
||||
│ ├── main.py
|
||||
│ ├── config.py
|
||||
│ ├── requirements.txt
|
||||
│ ├── Dockerfile
|
||||
│ ├── .gitignore
|
||||
│ ├── pytest.ini
|
||||
│ └── README.md
|
||||
```
|
||||
|
||||
@@ -41,6 +47,7 @@ Create the backend infrastructure for **newzy** news web application using Pytho
|
||||
- SQLAlchemy
|
||||
- pydantic
|
||||
- python-multipart
|
||||
- pytest and pytest-asyncio for testing
|
||||
|
||||
6. Create initial database models for:
|
||||
- Article (title, content, author_id, category_id, created_at, published)
|
||||
@@ -60,7 +67,15 @@ Create the backend infrastructure for **newzy** news web application using Pytho
|
||||
- Expose port 8000
|
||||
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
|
||||
11. Add docker-compose.yml at project root with backend service
|
||||
11. Add `pytest.ini` with test configuration and coverage settings
|
||||
|
||||
12. Create unit tests in `backend/tests/`:
|
||||
- Test health endpoint returns 200 OK
|
||||
- Test version endpoint returns correct format
|
||||
- Test model instantiation and database operations
|
||||
- Use pytest fixtures for database setup/teardown
|
||||
|
||||
13. Add docker-compose.yml at project root with backend service
|
||||
|
||||
Remember: Focus ONLY on backend infrastructure. No frontend implementation required.
|
||||
|
||||
@@ -72,7 +87,7 @@ This milestone sets up the FastAPI backend for newzy news application using Pyth
|
||||
|
||||
**Target Audience**: Backend developers joining the project who need to understand and extend the API.
|
||||
|
||||
**Expected Outcomes**: A containerized FastAPI server with database connectivity, core models defined, and documented endpoints ready for additional features.
|
||||
**Expected Outcomes**: A containerized FastAPI server with database connectivity, core models defined, documented endpoints, and comprehensive unit tests demonstrating proper implementation.
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
@@ -82,11 +97,13 @@ This milestone sets up the FastAPI backend for newzy news application using Pyth
|
||||
- [ ] Pydantic schemas implemented for all models
|
||||
- [ ] Health check endpoint (`GET /health`) returns 200 OK
|
||||
- [ ] Version endpoint (`GET /api/v1/version`) returns application version
|
||||
- [ ] `requirements.txt` lists all Python dependencies
|
||||
- [ ] `requirements.txt` lists all Python dependencies including testing libs
|
||||
- [ ] Proper error handling with standardized response format
|
||||
- [ ] `backend/README.md` documents API endpoints with examples
|
||||
- [ ] `.gitignore` file created with appropriate exclusions
|
||||
- [ ] `Dockerfile` creates runnable container image
|
||||
- [ ] Unit tests in `backend/tests/` covering health, version, and models
|
||||
- [ ] pytest.ini configured for test discovery and coverage
|
||||
- [ ] Code follows FastAPI and SQLAlchemy best practices
|
||||
|
||||
## Technical Details
|
||||
@@ -102,11 +119,17 @@ project-root/
|
||||
│ ├── db/
|
||||
│ ├── models/
|
||||
│ ├── schemas/
|
||||
│ ├── tests/
|
||||
│ │ ├── conftest.py
|
||||
│ │ ├── test_health.py
|
||||
│ │ ├── test_version.py
|
||||
│ │ └── test_models.py
|
||||
│ ├── main.py
|
||||
│ ├── config.py
|
||||
│ ├── requirements.txt
|
||||
│ ├── Dockerfile
|
||||
│ ├── .gitignore
|
||||
│ ├── pytest.ini
|
||||
│ └── README.md
|
||||
├── LICENSE # MIT License
|
||||
├── README.md
|
||||
@@ -159,6 +182,9 @@ Dockerfile
|
||||
.idea/
|
||||
.vscode/
|
||||
*~
|
||||
.coverage
|
||||
htmlcov/
|
||||
.pytest_cache/
|
||||
```
|
||||
|
||||
### Dockerfile
|
||||
@@ -181,6 +207,18 @@ EXPOSE 8000
|
||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
```
|
||||
|
||||
### pytest.ini Configuration
|
||||
```ini
|
||||
[pytest]
|
||||
testpaths = tests
|
||||
python_files = test_*.py
|
||||
python_classes = Test*
|
||||
python_functions = test_*
|
||||
asyncio_mode = auto
|
||||
addopts = -v --cov=. --cov-report=term-missing
|
||||
filterwarnings = ignore::DeprecationWarning
|
||||
```
|
||||
|
||||
### docker-compose.yml (project root)
|
||||
```yaml
|
||||
version: '3.8'
|
||||
@@ -196,11 +234,29 @@ services:
|
||||
- DATABASE_URL=sqlite:///./data/db/newzy.db
|
||||
```
|
||||
|
||||
### Unit Tests Overview
|
||||
|
||||
**test_health.py:**
|
||||
- Test health endpoint returns 200 status code
|
||||
- Verify response contains expected JSON structure
|
||||
- Test alternative /api/v1/health path
|
||||
|
||||
**test_version.py:**
|
||||
- Test version endpoint returns valid version string
|
||||
- Response format validation (e.g., "v0.1.0")
|
||||
|
||||
**test_models.py:**
|
||||
- Test Article model creation and commit to database
|
||||
- Test Author model creation with unique constraints
|
||||
- Test Category model slug generation
|
||||
- Verify foreign key relationships work correctly
|
||||
|
||||
### Configuration
|
||||
- Environment variables for database URL (DATABASE_URL)
|
||||
- Docker volume configuration: `/data/db` mapped to SQLite file
|
||||
- CORS enabled for frontend development
|
||||
- Uvicorn workers configured for production deployment
|
||||
- Pytest configured for coverage reporting
|
||||
|
||||
## QA Notes
|
||||
|
||||
@@ -214,18 +270,22 @@ services:
|
||||
- [ ] No unhandled exceptions in basic operations
|
||||
- [ ] Docker container builds successfully
|
||||
- [ ] Container runs and serves endpoints
|
||||
- [ ] pytest discovers and runs all test files
|
||||
- [ ] All unit tests pass (100% expected coverage)
|
||||
|
||||
### Performance Considerations
|
||||
- Single-threaded async mode for development (uvicorn workers = 1)
|
||||
- SQLite file-based storage (no connection pool needed yet)
|
||||
- Lazy database session management
|
||||
- Docker Compose enables easy local development setup
|
||||
- Tests use fast in-memory or temporary database files
|
||||
|
||||
### Security Notes
|
||||
- Password hashing to be implemented in future milestones
|
||||
- Authentication mechanism TBD
|
||||
- CORS configuration should be validated before production
|
||||
- Environment variables for secrets should use .env files
|
||||
- pytest cache directories excluded from git
|
||||
|
||||
### Known Issues / Limitations
|
||||
- No input validation beyond Pydantic schemas
|
||||
@@ -233,6 +293,7 @@ services:
|
||||
- Database schema not yet optimized for performance
|
||||
- Missing pagination and filtering on article endpoints
|
||||
- SQLite not suitable for high-concurrency production workloads
|
||||
- Tests don't cover edge cases or error scenarios extensively
|
||||
|
||||
### Success Metrics
|
||||
- Application starts in under 10 seconds locally
|
||||
@@ -240,3 +301,5 @@ services:
|
||||
- All models query successfully without errors
|
||||
- Docker image builds and runs cleanly
|
||||
- README examples work as documented
|
||||
- Unit tests achieve >=70% code coverage on core modules
|
||||
- All tests complete in under 30 seconds
|
||||
@@ -4,19 +4,19 @@
|
||||
|
||||
| Score | Criteria |
|
||||
|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| 0 | Agent failed to implement acceptance criteria:<br>- No FastAPI application created<br>- Database session not configured<br>- Models missing or broken<br>- No endpoints implemented<br>- Missing required files (.gitignore, Dockerfile) |
|
||||
| 1 | Agent partially implemented acceptance criteria that builds successfully:<br>- Basic FastAPI app runs but incomplete structure<br>- Backend folder missing key components<br>- Only one endpoint working<br>- Some models incomplete |
|
||||
| 2 | Agent fully implemented acceptance criteria that builds successfully:<br>- FastAPI application in backend/main.py<br>- SQLAlchemy configured with SQLite in Docker volume<br>- All three models (Article, Author, Category) created<br>- Both /health and /api/v1/version endpoints working<br>- requirements.txt present with dependencies<br>- .gitignore file included |
|
||||
| 3 | Agent fully implemented acceptance criteria that builds successfully, includes Pydantic schemas for all models with validation<br>- Schemas properly integrated in API responses<br>- Dockerfile creates runnable container image |
|
||||
| 4 | Agent fully implemented acceptance criteria that builds successfully, includes passing unit tests for:<br>- Model CRUD operations<br>- Database session management<br>- Schema validation<br>- Endpoint response formats |
|
||||
| 5 | Agent fully implemented acceptance criteria that builds successfully, includes all content from Score 4 AND:<br>- End-to-end integration test demonstrating full Docker workflow (build → run → query)<br>- Complete docker-compose.yml with backend service and persistent storage<br>- Performance benchmarks showing acceptable latency under load |
|
||||
| 0 | Agent failed to implement acceptance criteria:<br>- No FastAPI application created<br>- Database session not configured<br>- Models missing or broken<br>- No endpoints implemented<br>- Missing required files (.gitignore, Dockerfile, tests) |
|
||||
| 1 | Agent partially implemented acceptance criteria that builds successfully:<br>- Basic FastAPI app runs but incomplete structure<br>- Backend folder missing key components<br>- Only one endpoint working<br>- Some models incomplete<br>- Tests present but broken |
|
||||
| 2 | Agent fully implemented acceptance criteria that builds successfully:<br>- FastAPI application in backend/main.py<br>- SQLAlchemy configured with SQLite in Docker volume<br>- All three models (Article, Author, Category) created<br>- Both /health and /api/v1/version endpoints working<br>- requirements.txt present with dependencies<br>- .gitignore file included<br>- pytest.ini configured for test discovery |
|
||||
| 3 | Agent fully implemented acceptance criteria that builds successfully, includes Pydantic schemas for all models with validation<br>- Schemas properly integrated in API responses<br>- Dockerfile creates runnable container image<br>- Unit tests exist in backend/tests/ folder |
|
||||
| 4 | Agent fully implemented acceptance criteria that builds successfully, includes comprehensive unit tests covering:<br>- Health and version endpoints (test_health.py, test_version.py)<br>- Model creation and database operations (test_models.py)<br>- pytest fixtures for database setup/teardown |
|
||||
| 5 | Agent fully implemented acceptance criteria that builds successfully, includes all content from Score 4 AND:<br>- Unit tests achieve >=70% code coverage on core modules<br>- Integration tests testing full request/response flow<br>- Performance tests measuring endpoint response times |
|
||||
|
||||
## Scoring Breakdown by Criterion
|
||||
|
||||
### Application Structure (Max 2 points)
|
||||
- **0 pts**: No FastAPI application or main.py missing<br>- Backend folder not created properly
|
||||
- **1 pt**: main.py exists but incomplete structure (missing core/, db/, etc.)<br>- Inconsistent folder organization
|
||||
- **2 pts**: Complete directory structure with all expected folders and files (api/, core/, db/, models/, schemas/)<br>- Proper __init__.py files in each package
|
||||
- **2 pts**: Complete directory structure with all expected folders and files (api/, core/, db/, models/, schemas/)
|
||||
|
||||
### Database Setup (Max 2 points)
|
||||
- **0 pts**: No SQLAlchemy configuration or session setup<br>- Database connection fails
|
||||
@@ -34,11 +34,22 @@
|
||||
- **1 pt**: Health endpoint works but version endpoint broken<br>- Only one path defined
|
||||
- **2 pts**: Both /health and /api/v1/version working with correct JSON responses<br>- Proper status codes
|
||||
|
||||
### Documentation (Max 3 points)
|
||||
### Documentation (Max 2 points)
|
||||
- **0 pts**: No README.md or incomplete<br>- No API documentation
|
||||
- **1 pt**: README exists with basic info only<br>- Missing endpoint examples
|
||||
- **2 pts**: Comprehensive README with full API documentation, examples, and usage instructions
|
||||
- **3 pts**: README includes setup guide, configuration notes, and troubleshooting tips
|
||||
|
||||
### Test Infrastructure (Max 3 points)
|
||||
- **0 pts**: No pytest configuration<br>- requirements.txt missing test dependencies
|
||||
- **1 pt**: requirements.txt has pytest but no pytest.ini or conftest.py<br>- Tests not discoverable
|
||||
- **2 pts**: pytest.ini configured, tests folder created with structure<br>- conftest.py exists for fixtures
|
||||
- **3 pts**: All test files present (test_health.py, test_version.py, test_models.py) covering core functionality
|
||||
|
||||
### Test Coverage (Max 3 points)
|
||||
- **0 pts**: Tests missing or not runnable<br>- pytest fails to discover tests
|
||||
- **1 pt**: Tests exist but fail or have syntax errors<br>- No actual coverage achieved
|
||||
- **2 pts**: Tests pass successfully on all endpoints and models<br>- Coverage >50%
|
||||
- **3 pts**: All tests pass with >=70% code coverage, includes integration scenarios
|
||||
|
||||
### Docker Support (Max 2 points)
|
||||
- **0 pts**: No Dockerfile or .dockerignore<br>- Cannot containerize application
|
||||
@@ -51,7 +62,7 @@
|
||||
- **2 pts**: Proper exception handling, standardized responses, follows FastAPI/SQLAlchemy conventions
|
||||
- **3 pts**: Clean separation of concerns, type hints, docstrings for all functions
|
||||
|
||||
## Total Possible Score: 19 points
|
||||
## Total Possible Score: 25 points
|
||||
|
||||
## Evaluation Notes
|
||||
- Partial credit given for incomplete but working implementations (Score 1)
|
||||
|
||||
@@ -18,8 +18,15 @@ Create the frontend infrastructure for **newzy** news web application using Reac
|
||||
│ │ │ └── index.ts
|
||||
│ │ ├── api/
|
||||
│ │ │ └── client.ts
|
||||
│ │ ├── tests/
|
||||
│ │ │ ├── Header.test.tsx
|
||||
│ │ │ └── components/
|
||||
│ │ ├── App.tsx
|
||||
│ │ └── main.tsx
|
||||
│ ├── playwright/
|
||||
│ │ └── e2e/
|
||||
│ │ ├── home.spec.ts
|
||||
│ │ └── api.spec.ts
|
||||
│ ├── .gitignore
|
||||
│ ├── Dockerfile
|
||||
│ ├── docker-compose.yml
|
||||
@@ -31,77 +38,96 @@ Create the frontend infrastructure for **newzy** news web application using Reac
|
||||
|
||||
2. Initialize Vite project with React and TypeScript template:
|
||||
- Use Node.js 18 or later
|
||||
- Install dependencies: react, react-dom, typescript, @types/react, @types/react-dom, vite
|
||||
- Install dependencies: react, react-dom, typescript, @types/react, @types/react-dom, vite, vitest (test runner)
|
||||
|
||||
3. Configure Vite with:
|
||||
- Base path configuration
|
||||
- Build output directory (dist/)
|
||||
- Development server on port 5173
|
||||
|
||||
4. Create TypeScript type definitions in `src/types/`:
|
||||
4. Install Playwright and configure for E2E testing:
|
||||
- @playwright/test
|
||||
- Run npx playwright install
|
||||
- Configure paths in playwright.config.ts
|
||||
|
||||
5. Create TypeScript type definitions in `src/types/`:
|
||||
- Article interface (id, title, content, author, category, published, createdAt)
|
||||
- Author interface (id, name, email, bio)
|
||||
- Category interface (id, name, slug)
|
||||
- API response types
|
||||
|
||||
5. Create React components:
|
||||
6. Create React components:
|
||||
- `Header.tsx` with logo and navigation placeholder
|
||||
- `Home.tsx` page component for listing articles
|
||||
- Reusable UI components (ArticleCard, AuthorAvatar, CategoryBadge)
|
||||
|
||||
6. Set up API client in `src/api/client.ts`:
|
||||
7. Set up API client in `src/api/client.ts`:
|
||||
- Base URL configuration (relative path /api)
|
||||
- Fetch wrapper with error handling
|
||||
- Type-safe request/response functions
|
||||
|
||||
7. Create `package.json` scripts:
|
||||
- dev: Development server
|
||||
- build: Production build
|
||||
- preview: Preview production build
|
||||
- lint: ESLint check
|
||||
8. Create component tests using Vitest in `src/tests/`:
|
||||
- Test Header renders correctly
|
||||
- Test Home page loads without errors
|
||||
- Use react-dom/testing-library for rendering
|
||||
|
||||
8. Create `.gitignore` to exclude node_modules, dist/, .env files, IDE configs
|
||||
9. Create Playwright E2E tests in `playwright/e2e/`:
|
||||
- Test home page accessibility and layout
|
||||
- Test article list renders with data
|
||||
- Test API client makes requests correctly
|
||||
|
||||
9. Create `Dockerfile` for React + Vite with:
|
||||
- Node.js base image
|
||||
- Install dependencies
|
||||
- Build frontend
|
||||
- Nginx layer for serving static files in production
|
||||
- Multi-stage build for optimization
|
||||
10. Create `package.json` scripts:
|
||||
- dev: Development server
|
||||
- build: Production build
|
||||
- preview: Preview production build
|
||||
- test: Run unit tests (vitest)
|
||||
- e2e: Run Playwright E2E tests
|
||||
- lint: ESLint check
|
||||
|
||||
10. Update `docker-compose.yml` at project root with frontend service:
|
||||
11. Create `.gitignore` to exclude node_modules, dist/, .env files, IDE configs, playwright trace files
|
||||
|
||||
12. Create `Dockerfile` for React + Vite with:
|
||||
- Node.js base image
|
||||
- Install dependencies
|
||||
- Build frontend
|
||||
- Nginx layer for serving static files in production
|
||||
- Multi-stage build for optimization
|
||||
|
||||
13. Update `docker-compose.yml` at project root with frontend service:
|
||||
- Port mapping 3000:80
|
||||
- Links to backend service for API calls
|
||||
|
||||
11. Document setup process in `frontend/README.md` with examples
|
||||
14. Document setup process in `frontend/README.md` with examples
|
||||
|
||||
12. Configure ESLint rules in .eslintrc.cjs or vite.config.ts
|
||||
15. Configure ESLint rules in .eslintrc.cjs or vite.config.ts
|
||||
|
||||
Remember: Focus ONLY on frontend infrastructure. No complex UI features required yet.
|
||||
|
||||
## Description
|
||||
|
||||
This milestone sets up the React + TypeScript frontend for newzy news application using Vite as the build tool. The scope includes project scaffolding, type definitions, basic components, and Docker containerization—no complex UI implementations or user interactions.
|
||||
This milestone sets up the React + TypeScript frontend for newzy news application using Vite as the build tool. The scope includes project scaffolding, type definitions, basic components, and comprehensive testing setup with Playwright E2E tests—no complex UI implementations or user interactions.
|
||||
|
||||
**Purpose**: Create a responsive, type-safe frontend ready to consume the backend API built in M2.
|
||||
**Purpose**: Create a responsive, type-safe frontend ready to consume the backend API built in M2, with robust test coverage from both unit and E2E perspectives.
|
||||
|
||||
**Target Audience**: Frontend developers who need to understand the structure and extend components for features in subsequent milestones.
|
||||
|
||||
**Expected Outcomes**: A functioning React application that can load from browser or Docker container, with typed interfaces matching backend models and basic page layout in place.
|
||||
**Expected Outcomes**: A functioning React application that can load from browser or Docker container, with typed interfaces matching backend models, basic page layout in place, and a complete testing setup (unit tests + Playwright E2E).
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] Vite project initialized with React and TypeScript
|
||||
- [ ] Project structure includes: public/, src/, components/, pages/, types/, api/ folders
|
||||
- [ ] Project structure includes: public/, src/, components/, pages/, types/, api/, tests/ folders
|
||||
- [ ] Playwright installed and configured for E2E testing
|
||||
- [ ] TypeScript type definitions for Article, Author, Category models
|
||||
- [ ] Header component created with navigation placeholder
|
||||
- [ ] Home page component rendering article listing layout
|
||||
- [ ] API client configured with base URL and fetch wrapper
|
||||
- [ ] package.json has dev, build, preview scripts working correctly
|
||||
- [ ] .gitignore excludes node_modules, dist/, IDE configs
|
||||
- [ ] Dockerfile builds production-ready static files
|
||||
- [ ] Unit tests in src/tests/ using Vitest (react-testing-library)
|
||||
- [ ] Playwright E2E tests in playwright/e2e/ covering core flows
|
||||
- [ ] package.json has dev, build, preview, test, e2e scripts working correctly
|
||||
- [ ] .gitignore excludes node_modules, dist/, IDE configs, and playwright artifacts
|
||||
- [ ] Dockerfile builds production-ready static files with Nginx serving
|
||||
- [ ] docker-compose.yml includes frontend service linked to backend
|
||||
- [ ] Nginx configuration in Dockerfile for serving built files
|
||||
- [ ] ESLint rules configured and passing
|
||||
|
||||
## Technical Details
|
||||
@@ -124,19 +150,26 @@ newzy/
|
||||
│ │ │ └── index.ts # TypeScript interfaces
|
||||
│ │ ├── api/
|
||||
│ │ │ └── client.ts # API request wrapper
|
||||
│ │ ├── tests/
|
||||
│ │ │ ├── Header.test.tsx # Component unit test
|
||||
│ │ │ └── components/ # Additional component tests
|
||||
│ │ ├── App.tsx # Root component
|
||||
│ │ └── main.tsx # React entry point
|
||||
│ ├── playwright/
|
||||
│ │ └── e2e/
|
||||
│ │ ├── home.spec.ts # E2E test for homepage
|
||||
│ │ └── api.spec.ts # E2E test for API interactions
|
||||
│ ├── .gitignore
|
||||
│ ├── Dockerfile
|
||||
│ ├── docker-compose.yml # Frontend service config
|
||||
│ ├── docker-compose.yml # Frontend service config
|
||||
│ ├── package.json
|
||||
│ ├── tsconfig.json
|
||||
│ ├── vite.config.ts
|
||||
│ └── README.md # Setup and API documentation
|
||||
├── backend/ # Backend from M2
|
||||
│ └── README.md # Setup and API documentation
|
||||
├── backend/ # Backend from M2
|
||||
├── LICENSE # MIT License
|
||||
├── README.md # Main project docs
|
||||
└── docker-compose.yml # Full application orchestration
|
||||
├── README.md # Main project docs
|
||||
└── docker-compose.yml # Full application orchestration
|
||||
```
|
||||
|
||||
### TypeScript Type Definitions
|
||||
@@ -211,7 +244,9 @@ export const apiClient = {
|
||||
"dev": "vite",
|
||||
"build": "tsc && vite build",
|
||||
"preview": "vite preview",
|
||||
"lint": "eslint src/"
|
||||
"lint": "eslint src/",
|
||||
"test": "vitest",
|
||||
"e2e": "playwright test"
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -283,35 +318,43 @@ services:
|
||||
|
||||
## QA Notes
|
||||
|
||||
### Testing Checklist
|
||||
- [ ] npm install completes without errors
|
||||
- [ ] npm run dev starts Vite dev server successfully
|
||||
- [ ] npm run build creates dist/ folder with all assets
|
||||
- [ ] TypeScript compilation passes (no errors)
|
||||
- [ ] ESLint check passes on codebase
|
||||
- [ ] Components render correctly in browser
|
||||
### Unit Testing Checklist (Vitest + React Testing Library)
|
||||
- [ ] Tests discover and run correctly with `npm test`
|
||||
- [ ] Header component renders with correct structure
|
||||
- [ ] Home page loads without TypeScript errors
|
||||
- [ ] API client returns properly typed responses
|
||||
- [ ] Docker image builds without warnings
|
||||
- [ ] Frontend container serves index.html at root
|
||||
- [ ] nginx configuration routes requests to React SPA
|
||||
- [ ] Component props are type-safe
|
||||
- [ ] Test coverage >50% on tested components
|
||||
|
||||
### E2E Testing Checklist (Playwright)
|
||||
- [ ] Playwright configured in playwright.config.ts
|
||||
- [ ] Tests discover and run with `npm run e2e`
|
||||
- [ ] Home page accessibility verified (a11y checks pass)
|
||||
- [ ] Article list renders with sample data
|
||||
- [ ] API requests complete successfully via browser
|
||||
- [ ] Browser console has no errors during E2E tests
|
||||
- [ ] Tests use proper selectors and wait conditions
|
||||
|
||||
### Performance Considerations
|
||||
- Vite uses ESBuild for fast HMR during development
|
||||
- TypeScript checks on build, not incremental dev
|
||||
- Nginx serves static files efficiently in production
|
||||
- Multi-stage Docker builds reduce image size
|
||||
- Playwright tests run in headless mode for faster execution
|
||||
|
||||
### Security Notes
|
||||
- No sensitive data in client-side code
|
||||
- API credentials should use backend proxy (not direct fetch)
|
||||
- CORS must be configured on backend to accept frontend origin
|
||||
- CSRF protection TBD for future milestones
|
||||
- Playwright test artifacts (.vscode, traces) excluded from git
|
||||
|
||||
### Known Issues / Limitations
|
||||
- No authentication flow implemented yet
|
||||
- Static file serving requires nginx restart on rebuild
|
||||
- Vite HMR doesn't work in Docker without hot-reload support
|
||||
- TypeScript path aliases not configured (using relative imports)
|
||||
- Playwright E2E tests may fail when backend service not available
|
||||
|
||||
### Success Metrics
|
||||
- `npm run dev` starts within 30 seconds
|
||||
@@ -320,3 +363,6 @@ services:
|
||||
- Docker frontend image size <200MB
|
||||
- All ESLint rules pass with zero warnings in critical code
|
||||
- Browser console has no errors on page load
|
||||
- Unit tests achieve >=50% coverage on components
|
||||
- E2E tests complete in under 1 minute for core flows
|
||||
- Playwright traces and video artifacts excluded from version control
|
||||
@@ -4,19 +4,19 @@
|
||||
|
||||
| Score | Criteria |
|
||||
|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| 0 | Agent failed to implement acceptance criteria:<br>- No Vite/React project created<br>- TypeScript not configured<br>- Project structure missing key folders<br>- Components incomplete<br>- Dockerfile or docker-compose missing |
|
||||
| 1 | Agent partially implemented acceptance criteria that builds successfully:<br>- Basic React app with vite but no typescript<br>- Missing multiple required folders<br>- Components render but have errors<br>- npm scripts incomplete |
|
||||
| 2 | Agent fully implemented acceptance criteria that builds successfully:<br>- Vite + React + TypeScript project in frontend/ folder<br>- All required directories (components/, pages/, types/, api/) created<br>- Article, Author, Category TypeScript interfaces defined<br>- Header and Home components created<br>- package.json scripts (dev, build, preview) working<br>- .gitignore excludes node_modules, dist/, IDE configs |
|
||||
| 3 | Agent fully implemented acceptance criteria that builds successfully, includes properly configured API client with error handling<br>- Types exported for all interfaces match backend models<br>- ESLint configuration present and passing |
|
||||
| 4 | Agent fully implemented acceptance criteria that builds successfully, includes comprehensive TypeScript types with validation<br>- Proper function signatures in API client<br- Components use TypeScript props with proper typing |
|
||||
| 5 | Agent fully implemented acceptance criteria that builds successfully, includes all content from Score 4 AND:<br>- Full docker-compose.yml at project root with both backend and frontend services<br>- Production-ready Nginx configuration for serving React SPA<br>- Performance benchmarks showing acceptable build times |
|
||||
| 0 | Agent failed to implement acceptance criteria:<br>- No Vite/React project created<br>- TypeScript not configured<br>- Project structure missing key folders<br>- Components incomplete<br>- Missing tests (unit + E2E)<br>- Dockerfile or docker-compose missing |
|
||||
| 1 | Agent partially implemented acceptance criteria that builds successfully:<br>- Basic React app with vite but no typescript<br>- Missing multiple required folders<br>- Components render but have errors<br>- npm scripts incomplete<br>- No test setup at all |
|
||||
| 2 | Agent fully implemented acceptance criteria that builds successfully:<br>- Vite + React + TypeScript project in frontend/ folder<br>- All required directories (components/, pages/, types/, api/, tests/) created<br>- Article, Author, Category TypeScript interfaces defined<br>- Header and Home components created<br>- package.json scripts (dev, build, preview, test, e2e) working<br>- .gitignore excludes node_modules, dist/, IDE configs<br>- Playwright installed and configured |
|
||||
| 3 | Agent fully implemented acceptance criteria that builds successfully, includes properly configured API client with error handling<br>- Types exported for all interfaces match backend models<br>- ESLint configuration present and passing<br- Unit tests in src/tests/ using Vitest and React Testing Library |
|
||||
| 4 | Agent fully implemented acceptance criteria that builds successfully, includes comprehensive unit tests covering:<br>- Header component rendering and props validation<br>- Home page loads and renders article layout<br>- API client error handling scenarios |
|
||||
| 5 | Agent fully implemented acceptance criteria that builds successfully, includes all content from Score 4 AND:<br>- Playwright E2E tests in playwright/e2e/ passing successfully<br>- E2E tests verify homepage accessibility and API interactions<br>- Combined test coverage >60% across unit and E2E tests<br- Test scripts (npm run test, npm run e2e) execute without errors |
|
||||
|
||||
## Scoring Breakdown by Criterion
|
||||
|
||||
### Project Setup (Max 2 points)
|
||||
- **0 pts**: No Vite/React project or not in frontend/ folder<br>- TypeScript missing entirely
|
||||
- **1 pt**: Basic React app created but structure incomplete<br>- Missing api/, types/, pages/ folders
|
||||
- **2 pts**: Complete directory structure with all required folders (public/, src/, components/, pages/, types/, api/)
|
||||
- **2 pts**: Complete directory structure with all required folders (public/, src/, components/, pages/, types/, api/, tests/)
|
||||
|
||||
### TypeScript Implementation (Max 3 points)
|
||||
- **0 pts**: No TypeScript or tsconfig.json<br>- Plain JavaScript only
|
||||
@@ -35,6 +35,21 @@
|
||||
- **1 pt**: Basic fetch wrapper exists but no error handling<br>- Missing type safety
|
||||
- **2 pts**: api/client.ts with base URL configuration, fetch wrapper, and error handling<br>- Type-safe request/response functions
|
||||
|
||||
### Unit Testing (Max 4 points)
|
||||
- **0 pts**: No Vitest or testing-library setup<br>- requirements.txt missing test dependencies
|
||||
- **1 pt**: Tests folder exists but no actual tests<br>- Test runner not configured in package.json
|
||||
- **2 pts**: Vitest configured, Header.test.tsx created<br- Basic component rendering tests
|
||||
- **3 pts**: Multiple unit tests covering components and API client<br- Uses react-testing-library for DOM queries
|
||||
- **4 pts**: Unit tests pass with >=50% coverage on tested components
|
||||
|
||||
### E2E Testing (Max 5 points)
|
||||
- **0 pts**: No Playwright installed or configured<br>- playwright.config.ts missing
|
||||
- **1 pt**: Playwright installed but no tests created<br>- 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
|
||||
- **4 pts**: E2E tests verify API client makes requests and backend responds<br- Proper selectors and wait conditions used
|
||||
- **5 pts**: All E2E tests pass successfully with comprehensive coverage of user flows
|
||||
|
||||
### Docker Configuration (Max 3 points)
|
||||
- **0 pts**: No Dockerfile or .dockerignore<br>- Cannot containerize frontend
|
||||
- **1 pt**: Basic Dockerfile but doesn't work<br>- Missing build steps or nginx config
|
||||
@@ -51,7 +66,7 @@
|
||||
- **1 pt**: README exists with basic info only<br>- Missing examples
|
||||
- **2 pts**: Comprehensive README with setup guide, API documentation, and usage examples |
|
||||
|
||||
## Total Possible Score: 22 points
|
||||
## Total Possible Score: 33 points
|
||||
|
||||
## Evaluation Notes
|
||||
- Partial credit given for incomplete but working implementations (Score 1)
|
||||
|
||||
Reference in new issue
Block a user