fix E2E tests and add instructions to README for running tests locally #4
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] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| e2e: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout Janeway | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: BirkbeckCTP/janeway | |
| ref: master | |
| - name: Checkout geometadata plugin | |
| uses: actions/checkout@v4 | |
| with: | |
| path: src/plugins/geometadata/ | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: "pip" | |
| cache-dependency-path: | | |
| requirements.txt | |
| dev-requirements.txt | |
| src/plugins/geometadata/requirements.txt | |
| src/plugins/geometadata/requirements-e2e.txt | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install -r dev-requirements.txt | |
| pip install -r src/plugins/geometadata/requirements.txt | |
| pip install -r src/plugins/geometadata/requirements-e2e.txt | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@v4 | |
| id: playwright-cache | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-${{ runner.os }}-${{ hashFiles('src/plugins/geometadata/requirements-e2e.txt') }} | |
| - name: Install Playwright browsers | |
| if: steps.playwright-cache.outputs.cache-hit != 'true' | |
| run: playwright install --with-deps chromium | |
| - name: Install Playwright browser deps (if cached) | |
| if: steps.playwright-cache.outputs.cache-hit == 'true' | |
| run: playwright install-deps chromium | |
| - name: Set environment variables | |
| run: | | |
| echo "DB_VENDOR=sqlite" >> "$GITHUB_ENV" | |
| echo "JANEWAY_SETTINGS_MODULE=core.janeway_global_settings" >> "$GITHUB_ENV" | |
| echo "DJANGO_ALLOW_ASYNC_UNSAFE=1" >> "$GITHUB_ENV" | |
| - name: Run E2E tests | |
| working-directory: src | |
| run: pytest plugins/geometadata/tests/e2e/ -v | |
| - name: Upload test artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: playwright-traces | |
| path: src/plugins/geometadata/tests/e2e/test-results/ | |
| retention-days: 7 |