Backend (@backend-dev): - Add ReportService with PDF/CSV generation (reportlab, pandas) - Implement Report API endpoints (POST, GET, DELETE, download) - Add ReportRepository and schemas - Configure storage with auto-cleanup (30 days) - Rate limiting: 10 downloads/minute - Professional PDF templates with charts support Frontend (@frontend-dev): - Integrate Recharts for data visualization - Add CostBreakdown, TimeSeries, ComparisonBar charts - Implement scenario comparison page with multi-select - Add dark/light mode toggle with ThemeProvider - Create Reports page with generation form and list - Add new UI components: checkbox, dialog, tabs, label, skeleton - Implement useComparison and useReports hooks QA (@qa-engineer): - Setup Playwright E2E testing framework - Create 7 test spec files with 94 test cases - Add visual regression testing with baselines - Configure multi-browser testing (Chrome, Firefox, WebKit) - Add mobile responsive tests - Create test fixtures and helpers - Setup GitHub Actions CI workflow Documentation (@spec-architect): - Create detailed kanban-v0.4.0.md with 27 tasks - Update progress.md with v0.4.0 tracking - Create v0.4.0 planning prompt Features: ✅ PDF/CSV Report Generation ✅ Interactive Charts (Pie, Area, Bar) ✅ Scenario Comparison (2-4 scenarios) ✅ Dark/Light Mode Toggle ✅ E2E Test Suite (94 tests) Dependencies added: - Backend: reportlab, pandas, slowapi - Frontend: recharts, date-fns, @radix-ui/react-checkbox/dialog/tabs - Testing: @playwright/test 27 tasks completed, 100% v0.4.0 implementation
7.7 KiB
E2E Testing Setup Summary for mockupAWS v0.4.0
Overview
End-to-End testing has been successfully set up with Playwright for mockupAWS v0.4.0. This setup includes comprehensive test coverage for all major user flows, visual regression testing, and CI/CD integration.
Files Created
Configuration Files
| File | Path | Description |
|---|---|---|
playwright.config.ts |
/frontend/playwright.config.ts |
Main Playwright configuration with multi-browser support |
package.json (updated) |
/frontend/package.json |
Added Playwright dependency and npm scripts |
tsconfig.json |
/frontend/e2e/tsconfig.json |
TypeScript configuration for E2E tests |
.gitignore (updated) |
/frontend/.gitignore |
Excludes test artifacts from git |
e2e.yml |
/.github/workflows/e2e.yml |
GitHub Actions workflow for CI |
Test Files
| Test File | Description | Test Count |
|---|---|---|
setup-verification.spec.ts |
Verifies E2E environment setup | 9 tests |
scenario-crud.spec.ts |
Scenario create, read, update, delete | 11 tests |
ingest-logs.spec.ts |
Log ingestion and metrics updates | 9 tests |
reports.spec.ts |
Report generation and download | 10 tests |
comparison.spec.ts |
Scenario comparison features | 16 tests |
navigation.spec.ts |
Routing, 404, mobile responsive | 21 tests |
visual-regression.spec.ts |
Visual regression testing | 18 tests |
Total: 94 test cases across 7 test files
Supporting Files
| File | Path | Description |
|---|---|---|
test-scenarios.ts |
/e2e/fixtures/test-scenarios.ts |
Sample scenario data for tests |
test-logs.ts |
/e2e/fixtures/test-logs.ts |
Sample log data for tests |
test-helpers.ts |
/e2e/utils/test-helpers.ts |
Shared test utilities |
global-setup.ts |
/e2e/global-setup.ts |
Global test setup (runs once) |
global-teardown.ts |
/e2e/global-teardown.ts |
Global test teardown (runs once) |
README.md |
/e2e/README.md |
Comprehensive testing guide |
NPM Scripts Added
{
"test:e2e": "playwright test",
"test:e2e:ui": "playwright test --ui",
"test:e2e:debug": "playwright test --debug",
"test:e2e:headed": "playwright test --headed",
"test:e2e:ci": "playwright test --reporter=dot,html"
}
Playwright Configuration Highlights
Browsers Configured
- Chromium (Desktop Chrome)
- Firefox (Desktop Firefox)
- Webkit (Desktop Safari)
- Mobile Chrome (Pixel 5)
- Mobile Safari (iPhone 12)
- Tablet (iPad Pro 11)
Features Enabled
- ✅ Screenshot capture on failure
- ✅ Video recording for debugging
- ✅ Trace collection on retry
- ✅ HTML, list, and JUnit reporters
- ✅ Parallel execution (disabled in CI)
- ✅ Automatic test server startup
- ✅ Global setup and teardown hooks
Timeouts
- Test timeout: 60 seconds
- Action timeout: 15 seconds
- Navigation timeout: 30 seconds
- Expect timeout: 10 seconds
Test Coverage
QA-E2E-001: Playwright Setup ✅
@playwright/testinstalledplaywright.config.tscreated- Test directory:
frontend/e2e/ - Base URL: http://localhost:5173
- Multiple browsers configured
- Screenshot on failure
- Video recording for debugging
- NPM scripts added
QA-E2E-002: Test Scenarios ✅
scenario-crud.spec.ts- Create, edit, delete scenariosingest-logs.spec.ts- Log ingestion and metricsreports.spec.ts- PDF/CSV report generationcomparison.spec.ts- Multi-scenario comparisonnavigation.spec.ts- All routes and responsive design
QA-E2E-003: Test Data & Fixtures ✅
test-scenarios.ts- Sample scenario datatest-logs.ts- Sample log data- Database seeding via API helpers
- Cleanup mechanism after tests
- Parallel execution configured
QA-E2E-004: Visual Regression Testing ✅
- Visual regression setup with Playwright
- Baseline screenshots directory
- 20% threshold for differences
- Tests for critical UI pages
- Dark mode testing support
- Cross-browser visual testing
How to Run Tests
Local Development
# Install dependencies
cd frontend
npm install
# Install Playwright browsers
npx playwright install
# Run all tests
npm run test:e2e
# Run with UI mode (interactive)
npm run test:e2e:ui
# Run specific test file
npx playwright test scenario-crud.spec.ts
# Run in debug mode
npm run test:e2e:debug
# Run with visible browser
npm run test:e2e:headed
CI Mode
# Run tests as in CI
npm run test:e2e:ci
Visual Regression
# Run visual tests
npx playwright test visual-regression.spec.ts
# Update baseline screenshots
UPDATE_BASELINE=true npx playwright test visual-regression.spec.ts
Prerequisites
- Backend running on http://localhost:8000
- Frontend dev server will be started automatically by Playwright
- PostgreSQL database (if using full backend)
Coverage Report Strategy
Current Setup
- HTML reporter generates
e2e-report/directory - JUnit XML output for CI integration
- Screenshots and videos on failure
- Trace files for debugging
Future Enhancements
To add code coverage:
-
Frontend Coverage:
npm install -D @playwright/test istanbul-lib-coverage nycInstrument code with Istanbul and collect coverage during tests.
-
Backend Coverage: Use pytest-cov with Playwright tests to measure API coverage.
-
Coverage Reporting:
- Upload coverage reports to codecov.io
- Block PRs if coverage drops below threshold
- Generate coverage badges
GitHub Actions Workflow
The workflow (/.github/workflows/e2e.yml) includes:
- E2E Tests Job: Runs all tests on every push/PR
- Visual Regression Job: Compares screenshots on PRs
- Smoke Tests Job: Quick sanity checks on pushes
Workflow Features
- PostgreSQL service container
- Backend server startup
- Artifact upload for reports
- Parallel job execution
- Conditional visual regression on PRs
Test Architecture
Design Principles
- Deterministic: Tests use unique names and clean up after themselves
- Isolated: Each test creates its own data
- Fast: Parallel execution where possible
- Reliable: Retry logic for flaky operations
- Maintainable: Shared utilities and fixtures
Data Flow
Global Setup → Test Suite → Individual Tests → Global Teardown
↓ ↓ ↓ ↓
Create dirs Create data Run assertions Cleanup data
API Helpers
All test files use shared API helpers for:
- Creating/deleting scenarios
- Starting/stopping scenarios
- Sending logs
- Generating unique names
Next Steps
-
Run setup verification:
npx playwright test setup-verification.spec.ts -
Generate baseline screenshots (for visual regression):
UPDATE_BASELINE=true npx playwright test visual-regression.spec.ts -
Add data-testid attributes to frontend components for more robust selectors
-
Configure environment variables in
.envfile if needed -
Start backend and run full test suite:
npm run test:e2e
Troubleshooting
Common Issues
-
Browsers not installed:
npx playwright install -
Backend not accessible:
- Ensure backend is running on port 8000
- Check CORS configuration
-
Tests timeout:
- Increase timeout in
playwright.config.ts - Check if dev server starts correctly
- Increase timeout in
-
Visual regression failures:
- Review diff images in
e2e/screenshots/diff/ - Update baselines if UI intentionally changed
- Review diff images in
Support
- Playwright Docs: https://playwright.dev/
- Test Examples: See
e2e/README.md - GitHub Actions: Workflow in
.github/workflows/e2e.yml