mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-11-13 09:13:30 +01:00
Run EOSdash in a headless Chromium browser for testing. Every menu tab must load with HTTP 200 and render content, in light and dark mode, without JavaScript errors. Additional changes Enable the browser tests by --browser-test (marker browser), skip them otherwise Add the CI job browser-test that installs Chromium and runs them Add the make target test-browser, run with --extra dev so playwright is installed Add playwright to the dev dependencies Document how to run the browser tests with --extra dev, incl. the browser system libraries on Linux Accept a child PID of the started server in the server startup checks, on Windows only: there the venv python.exe runs the real interpreter as a child process Share one Chromium per test class, so Playwright stops before other tests run Request chromium before servers so a missing browser fails before EOS starts Make the missing-browser hint platform neutral (Linux: add --with-deps) Set PYTHONIOENCODING=utf-8 for the test server to avoid encoding errors on Windows Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
74 lines
1.6 KiB
YAML
74 lines
1.6 KiB
YAML
name: Run Pytest on Pull Request
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v7
|
|
with:
|
|
python-version: "3.13.15"
|
|
|
|
- name: Install uv
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install uv
|
|
|
|
- name: Sync environment with uv
|
|
run: |
|
|
uv sync --extra dev
|
|
|
|
- name: Run tests
|
|
run: |
|
|
uv run pytest --finalize --check-config-side-effect -vs --cov src --cov-report term-missing
|
|
|
|
- name: Upload test artifacts
|
|
if: failure()
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: optimize-results
|
|
path: tests/testdata/**/new_optimize_result*
|
|
if-no-files-found: ignore
|
|
|
|
browser-test:
|
|
# EOSdash in headless Chromium (tests marked 'browser', enabled by --browser-test).
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v7
|
|
with:
|
|
python-version: "3.13.15"
|
|
|
|
- name: Install uv
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install uv
|
|
|
|
- name: Sync environment with uv
|
|
run: |
|
|
uv sync --extra dev
|
|
|
|
- name: Install Chromium with its system libraries
|
|
run: |
|
|
uv run playwright install --with-deps chromium
|
|
|
|
- name: Run browser tests
|
|
run: |
|
|
uv run pytest --browser-test -m browser -vs
|