test: add ci pl for ui tests #10
Workflow file for this run
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: UI Tests | |
| on: | |
| push: | |
| #branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: application/CohortManager/src/Web | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: application/CohortManager/src/Web/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Install Playwright browsers | |
| run: npx playwright install --with-deps | |
| - name: Start application | |
| env: | |
| AUTH_SECRET: ${{ secrets.AUTH_SECRET }} | |
| run: | | |
| npm run dev:secure & | |
| # Wait for the app to be ready | |
| while ! curl -s https://localhost:3000 > /dev/null; do | |
| echo "Waiting for app to start..." | |
| sleep 5 | |
| done | |
| - name: Run Playwright tests | |
| run: | | |
| npx bddgen | |
| npx playwright test | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: application/CohortManager/src/Web/test-results/ | |
| retention-days: 30 |