feat: implement v0.4.0 - Reports, Charts, Comparison, Dark Mode, E2E Testing
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
This commit is contained in:
327
.github/workflows/e2e.yml
vendored
Normal file
327
.github/workflows/e2e.yml
vendored
Normal file
@@ -0,0 +1,327 @@
|
||||
name: E2E Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, develop]
|
||||
paths:
|
||||
- 'frontend/**'
|
||||
- 'src/**'
|
||||
- '.github/workflows/e2e.yml'
|
||||
pull_request:
|
||||
branches: [main, develop]
|
||||
paths:
|
||||
- 'frontend/**'
|
||||
- 'src/**'
|
||||
- '.github/workflows/e2e.yml'
|
||||
|
||||
jobs:
|
||||
e2e-tests:
|
||||
name: Run E2E Tests
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: frontend
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:15
|
||||
env:
|
||||
POSTGRES_USER: mockupaws
|
||||
POSTGRES_PASSWORD: mockupaws
|
||||
POSTGRES_DB: mockupaws
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
ports:
|
||||
- 5432:5432
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install Python dependencies
|
||||
run: |
|
||||
pip install -r requirements.txt
|
||||
working-directory: .
|
||||
|
||||
- name: Install Node.js dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Install Playwright browsers
|
||||
run: npx playwright install --with-deps chromium firefox webkit
|
||||
|
||||
- name: Wait for PostgreSQL
|
||||
run: |
|
||||
until pg_isready -h localhost -p 5432 -U mockupaws; do
|
||||
echo "Waiting for PostgreSQL..."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
- name: Run database migrations
|
||||
run: |
|
||||
alembic upgrade head
|
||||
env:
|
||||
DATABASE_URL: postgresql://mockupaws:mockupaws@localhost:5432/mockupaws
|
||||
|
||||
- name: Start backend server
|
||||
run: |
|
||||
uvicorn src.main:app --host 0.0.0.0 --port 8000 &
|
||||
echo $! > /tmp/backend.pid
|
||||
# Wait for backend to be ready
|
||||
npx wait-on http://localhost:8000/health --timeout 60000
|
||||
env:
|
||||
DATABASE_URL: postgresql://mockupaws:mockupaws@localhost:5432/mockupaws
|
||||
CORS_ORIGINS: "[\"http://localhost:5173\"]"
|
||||
|
||||
- name: Run E2E tests
|
||||
run: npm run test:e2e:ci
|
||||
env:
|
||||
VITE_API_URL: http://localhost:8000/api/v1
|
||||
CI: true
|
||||
|
||||
- name: Stop backend server
|
||||
if: always()
|
||||
run: |
|
||||
if [ -f /tmp/backend.pid ]; then
|
||||
kill $(cat /tmp/backend.pid) || true
|
||||
fi
|
||||
|
||||
- name: Upload Playwright report
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: playwright-report
|
||||
path: frontend/e2e-report/
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload test results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test-results
|
||||
path: frontend/e2e-results/
|
||||
retention-days: 7
|
||||
|
||||
- name: Upload screenshots
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: screenshots
|
||||
path: frontend/e2e/screenshots/
|
||||
retention-days: 7
|
||||
|
||||
visual-regression:
|
||||
name: Visual Regression Tests
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
needs: e2e-tests
|
||||
if: github.event_name == 'pull_request'
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: frontend
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:15
|
||||
env:
|
||||
POSTGRES_USER: mockupaws
|
||||
POSTGRES_PASSWORD: mockupaws
|
||||
POSTGRES_DB: mockupaws
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
ports:
|
||||
- 5432:5432
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Checkout baseline screenshots
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.base_ref }}
|
||||
path: baseline
|
||||
sparse-checkout: |
|
||||
frontend/e2e/screenshots/baseline/
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install Python dependencies
|
||||
run: |
|
||||
pip install -r requirements.txt
|
||||
working-directory: .
|
||||
|
||||
- name: Install Node.js dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Install Playwright browsers
|
||||
run: npx playwright install --with-deps chromium
|
||||
|
||||
- name: Wait for PostgreSQL
|
||||
run: |
|
||||
until pg_isready -h localhost -p 5432 -U mockupaws; do
|
||||
echo "Waiting for PostgreSQL..."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
- name: Run database migrations
|
||||
run: |
|
||||
alembic upgrade head
|
||||
env:
|
||||
DATABASE_URL: postgresql://mockupaws:mockupaws@localhost:5432/mockupaws
|
||||
|
||||
- name: Start backend server
|
||||
run: |
|
||||
uvicorn src.main:app --host 0.0.0.0 --port 8000 &
|
||||
echo $! > /tmp/backend.pid
|
||||
npx wait-on http://localhost:8000/health --timeout 60000
|
||||
env:
|
||||
DATABASE_URL: postgresql://mockupaws:mockupaws@localhost:5432/mockupaws
|
||||
CORS_ORIGINS: "[\"http://localhost:5173\"]"
|
||||
|
||||
- name: Copy baseline screenshots
|
||||
run: |
|
||||
if [ -d "../baseline/frontend/e2e/screenshots/baseline" ]; then
|
||||
mkdir -p e2e/screenshots/baseline
|
||||
cp -r ../baseline/frontend/e2e/screenshots/baseline/* e2e/screenshots/baseline/
|
||||
fi
|
||||
|
||||
- name: Run visual regression tests
|
||||
run: npx playwright test visual-regression.spec.ts --project=chromium
|
||||
env:
|
||||
VITE_API_URL: http://localhost:8000/api/v1
|
||||
CI: true
|
||||
|
||||
- name: Stop backend server
|
||||
if: always()
|
||||
run: |
|
||||
if [ -f /tmp/backend.pid ]; then
|
||||
kill $(cat /tmp/backend.pid) || true
|
||||
fi
|
||||
|
||||
- name: Upload visual regression results
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: visual-regression-diff
|
||||
path: |
|
||||
frontend/e2e/screenshots/actual/
|
||||
frontend/e2e/screenshots/diff/
|
||||
retention-days: 7
|
||||
|
||||
smoke-tests:
|
||||
name: Smoke Tests
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
if: github.event_name == 'push'
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: frontend
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:15
|
||||
env:
|
||||
POSTGRES_USER: mockupaws
|
||||
POSTGRES_PASSWORD: mockupaws
|
||||
POSTGRES_DB: mockupaws
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
ports:
|
||||
- 5432:5432
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install Python dependencies
|
||||
run: |
|
||||
pip install -r requirements.txt
|
||||
working-directory: .
|
||||
|
||||
- name: Install Node.js dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Install Playwright browsers
|
||||
run: npx playwright install --with-deps chromium
|
||||
|
||||
- name: Wait for PostgreSQL
|
||||
run: |
|
||||
until pg_isready -h localhost -p 5432 -U mockupaws; do
|
||||
echo "Waiting for PostgreSQL..."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
- name: Run database migrations
|
||||
run: |
|
||||
alembic upgrade head
|
||||
env:
|
||||
DATABASE_URL: postgresql://mockupaws:mockupaws@localhost:5432/mockupaws
|
||||
|
||||
- name: Start backend server
|
||||
run: |
|
||||
uvicorn src.main:app --host 0.0.0.0 --port 8000 &
|
||||
echo $! > /tmp/backend.pid
|
||||
npx wait-on http://localhost:8000/health --timeout 60000
|
||||
env:
|
||||
DATABASE_URL: postgresql://mockupaws:mockupaws@localhost:5432/mockupaws
|
||||
CORS_ORIGINS: "[\"http://localhost:5173\"]"
|
||||
|
||||
- name: Run smoke tests
|
||||
run: npx playwright test navigation.spec.ts --grep "dashboard\|scenarios" --project=chromium
|
||||
env:
|
||||
VITE_API_URL: http://localhost:8000/api/v1
|
||||
CI: true
|
||||
|
||||
- name: Stop backend server
|
||||
if: always()
|
||||
run: |
|
||||
if [ -f /tmp/backend.pid ]; then
|
||||
kill $(cat /tmp/backend.pid) || true
|
||||
fi
|
||||
Reference in New Issue
Block a user