add test suite #9
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: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| e2e: | |
| name: E2E tests (Playwright) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install API dependencies | |
| working-directory: api | |
| run: composer install --no-interaction --prefer-dist --ignore-platform-reqs | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and start the E2E stack | |
| run: docker compose -f docker-compose.e2e.yml up -d --build | |
| - name: Wait for the frontend to be ready | |
| run: | | |
| for i in $(seq 1 30); do | |
| curl -sf http://localhost:4200 && break | |
| echo "Waiting for frontend… ($i/30)" | |
| sleep 5 | |
| done | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: frontend/e2e/package-lock.json | |
| - name: Install dependencies | |
| working-directory: frontend/e2e | |
| run: npm ci | |
| - name: Install Playwright browsers | |
| working-directory: frontend/e2e | |
| run: npx playwright install --with-deps chromium | |
| - name: Run E2E tests | |
| working-directory: frontend/e2e | |
| env: | |
| E2E_BASE_URL: http://localhost:4200 | |
| run: npx playwright test | |
| - name: Upload test report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report | |
| path: frontend/e2e/playwright-report/ | |
| retention-days: 7 | |
| - name: Tear down | |
| if: always() | |
| run: docker compose -f docker-compose.e2e.yml down -v |