test: establish Playwright E2E UI testing foundation (#426) #17
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| name: Lint (ruff) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install ruff | |
| run: pip install ruff | |
| - name: Run ruff | |
| run: ruff check API/ tests/ | |
| test: | |
| name: Test (pytest) | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Fix requirements encoding | |
| run: | | |
| python - <<'EOF' | |
| import pathlib | |
| data = pathlib.Path("requirements.txt").read_bytes() | |
| if b"\x00" in data: | |
| text = data.decode("utf-16") | |
| pathlib.Path("requirements.txt").write_text(text, encoding="utf-8") | |
| print("Converted requirements.txt from UTF-16 to UTF-8") | |
| else: | |
| print("requirements.txt encoding OK") | |
| EOF | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Install test tools | |
| run: pip install "pytest>=7" pytest-cov | |
| - name: Run tests | |
| run: pytest --cov=API --cov-report=term-missing --cov-fail-under=5 | |
| ui-test: | |
| name: UI E2E (Playwright) | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Fix requirements encoding | |
| run: | | |
| python - <<'EOF' | |
| import pathlib | |
| data = pathlib.Path("requirements.txt").read_bytes() | |
| if b"\x00" in data: | |
| text = data.decode("utf-16") | |
| pathlib.Path("requirements.txt").write_text(text, encoding="utf-8") | |
| print("Converted requirements.txt from UTF-16 to UTF-8") | |
| else: | |
| print("requirements.txt encoding OK") | |
| EOF | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Install Playwright | |
| run: | | |
| pip install "pytest>=7" pytest-playwright requests | |
| playwright install chromium | |
| - name: Run UI Tests | |
| run: pytest ui_tests/ -v |