feat: Add comprehensive frontend test coverage for Sprint 13 #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: E2E Tests | |
| on: | |
| push: | |
| branches: [main, develop] | |
| paths: | |
| - 'frontend/**' | |
| - 'e2e/**' | |
| - 'app/**' | |
| - '.github/workflows/e2e-tests.yml' | |
| pull_request: | |
| branches: [main, develop] | |
| workflow_dispatch: | |
| jobs: | |
| e2e: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| services: | |
| postgres: | |
| image: postgres:14 | |
| env: | |
| POSTGRES_USER: minky | |
| POSTGRES_PASSWORD: minky_password | |
| POSTGRES_DB: minky_test | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| cache-dependency-path: | | |
| frontend/package-lock.json | |
| e2e/package-lock.json | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y postgresql-client libpq-dev | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Install frontend dependencies | |
| run: npm ci --prefix frontend | |
| - name: Install E2E test dependencies | |
| run: npm ci --prefix e2e | |
| - name: Install Playwright browsers | |
| run: npx --prefix e2e playwright install --with-deps chromium | |
| - name: Build frontend | |
| run: npm run build --prefix frontend | |
| - name: Start backend server | |
| env: | |
| DATABASE_URL: postgresql://minky:minky_password@localhost:5432/minky_test | |
| SECRET_KEY: ${{ secrets.TEST_SECRET_KEY || 'test-secret-key-for-ci-only-do-not-use-in-prod' }} | |
| JWT_SECRET_KEY: ${{ secrets.TEST_JWT_SECRET_KEY || 'test-jwt-secret-key-for-ci-only-do-not-use-in-prod' }} | |
| FLASK_ENV: testing | |
| METRICS_ENABLED: 'false' | |
| run: | | |
| export FLASK_APP=run.py | |
| flask db upgrade || true | |
| python run.py & | |
| sleep 5 | |
| curl -f http://localhost:5000/api/health || exit 1 | |
| - name: Start frontend server | |
| run: | | |
| npx serve -s frontend/build -l 3000 & | |
| sleep 3 | |
| - name: Run Playwright tests | |
| env: | |
| CI: true | |
| run: npm test --prefix e2e -- --project=chromium | |
| - name: Upload Playwright report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: playwright-report | |
| path: e2e/playwright-report/ | |
| retention-days: 30 | |
| - name: Upload test screenshots | |
| uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: test-screenshots | |
| path: e2e/test-results/ | |
| retention-days: 7 |