| name: Run Integration and E2E Tests in Webapp |
| |
| on: |
| workflow_dispatch: |
| |
| permissions: |
| contents: read |
| |
| jobs: |
| test: |
| runs-on: ubuntu-latest |
| |
| steps: |
| - name: Checkout repository |
| uses: actions/checkout@v4 |
| |
| - name: Set up Node.js and pnpm |
| uses: pnpm/action-setup@v4 |
| with: |
| version: 10.34.4 |
| - uses: actions/setup-node@v4 |
| with: |
| node-version: '20' |
| cache: 'pnpm' |
| cache-dependency-path: 'webapp/pnpm-lock.yaml' |
| |
| - name: Set up Python |
| uses: actions/setup-python@v5 |
| with: |
| python-version: '3.10' |
| |
| - name: Install Node.js dependencies |
| working-directory: ./webapp |
| run: pnpm install |
| |
| - name: Install Python dependencies |
| working-directory: ./webapp/packages/api/user-service |
| run: pip install -r requirements.txt |
| |
| - name: Install Playwright Browsers |
| working-directory: ./webapp |
| run: pnpm exec playwright install --with-deps chromium |
| |
| - name: Create .env file for Docker Compose |
| working-directory: ./webapp/infra/docker |
| run: | |
| echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> .env |
| echo "GEMINI_API_KEY=${{ secrets.GEMINI_API_KEY }}" >> .env |
| env: |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} |
| |
| - name: Start services with Docker Compose |
| working-directory: ./webapp/infra/docker |
| run: docker compose up -d --build |
| |
| - name: Wait for services to be healthy |
| run: | |
| echo "Waiting for API server to be ready..." |
| timeout 60s bash -c 'until curl -s http://localhost:8000/health | grep -q "healthy"; do sleep 2; done' |
| echo "API server is up." |
| |
| echo "Waiting for Web UI to be ready..." |
| timeout 60s bash -c 'until curl -s -o /dev/null http://localhost:3000; do sleep 2; done' |
| echo "Web UI is up." |
| |
| - name: Run Python API Integration Tests |
| working-directory: ./webapp |
| run: pnpm test:integration:backend |
| |
| - name: Run Playwright E2E Tests |
| working-directory: ./webapp |
| run: pnpm test:e2e |
| |
| - name: Upload Playwright report |
| if: always() |
| uses: actions/upload-artifact@v4 |
| with: |
| name: playwright-report |
| path: webapp/playwright-report/ |
| retention-days: 30 |
| |
| - name: Stop services |
| if: always() |
| working-directory: ./webapp/infra/docker |
| run: docker compose down |