test(eosdash): run EOSdash in a headless Chromium browser

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>
This commit is contained in:
Bobby Noelte
2026-11-09 12:39:30 +01:00
co-authored by Claude Opus 5.5
parent 2245976de4
commit 4475774c06
8 changed files with 479 additions and 11 deletions
+10 -1
View File
@@ -1,5 +1,5 @@
# Define the targets
.PHONY: help install dist test test-system test-ci test-profile \
.PHONY: help install dist test test-system test-ci test-browser test-profile \
docker-run docker-build docs read-docs clean format gitlint mypy \
run run-dev run-dash run-dash-dev prepare-version test-version uv-update
@@ -41,6 +41,7 @@ help:
@echo " test-finalize - Run all tests (e.g. to finalize a commit)."
@echo " test-system - Run tests with system tests enabled."
@echo " test-ci - Run tests as CI does. No user config file allowed."
@echo " test-browser - Run the EOSdash browser tests in headless Chromium (installs Chromium)."
@echo " test-profile - Run single test optimization with profiling."
@echo " dist - Create distribution (in dist/)."
@echo " clean - Remove generated documentation, distribution and virtual environment."
@@ -139,6 +140,14 @@ test-ci:
@echo "Running tests as CI..."
$(PYTEST) --finalize --check-config-side-effect -vs --cov src --cov-report term-missing
# Target to run the EOSdash browser tests in headless Chromium.
# The browser is installed for the user (~/.cache/ms-playwright), not in the virtual environment.
# --extra dev installs playwright even if the environment was synced without it.
test-browser:
@echo "Running EOSdash browser tests..."
$(UV) run --extra dev playwright install chromium
$(UV) run --extra dev pytest --browser-test -m browser -vs
# Target to run tests including the system tests.
test-system:
@echo "Running tests incl. system tests..."