Skip to content

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

ci: run dashboard playwright tests in a dedicated job (#921)

Focused Instabilityb7350aa29c96
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 9e463aca6..1ce2b8f67 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -278,6 +278,48 @@ jobs:
- name: Run agno tests
run: pytest tests/test_integrations/agno/ -v
+ test-dashboard-ui:
+ needs: [changes, build-wheel]
+ if: needs.changes.outputs.code == 'true'
+ runs-on: ubuntu-latest
+ timeout-minutes: 20
+ steps:
+ - uses: actions/checkout@v6
+ - uses: actions/setup-python@v6
+ with:
+ python-version: ${{ env.PY_VERSION }}
+ - name: Download prebuilt wheel
+ uses: actions/download-artifact@v8
+ with:
+ name: headroom-wheel
+ path: dist
+ - name: Install (CPU torch + wheel[dev] + playwright)
+ run: |
+ python -m pip install --upgrade pip
+ pip install torch --index-url https://download.pytorch.org/whl/cpu
+ WHEEL="$(ls dist/*.whl)"
+ pip install "${WHEEL}[dev]" playwright
+ SITE="$(python -c 'import sysconfig; print(sysconfig.get_path("platlib"))')"
+ cp "${SITE}/headroom/"_core*.so headroom/
+ - name: Install chromium
+ run: playwright install --with-deps chromium
+ - name: Run dashboard playwright tests
+ # Stub-based dashboard tests only (routes fully mocked, no network).
+ # tests/test_dashboard/test_live_feed.py needs a live proxy on
+ # localhost:8787 and stays excluded; the main shards keep skipping
+ # these via importorskip since playwright is not installed there.
+ env:
+ HEADROOM_PLAYWRIGHT_ARTIFACT_DIR: ${{ runner.temp }}/playwright-artifacts
+ run: pytest tests/test_dashboard_*_playwright.py -v
+ - name: Upload dashboard screenshots
+ if: always()
+ uses: actions/upload-artifact@v7
+ with:
+ name: dashboard-playwright-artifacts
+ path: ${{ runner.temp }}/playwright-artifacts
+ if-no-files-found: ignore
+ retention-days: 7
+
commitlint:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
diff --git a/tests/test_dashboard_cache_ttl_playwright.py b/tests/test_dashboard_cache_ttl_playwright.py
index 09b398dc3..7144aa55b 100644
--- a/tests/test_dashboard_cache_ttl_playwright.py
+++ b/tests/test_dashboard_cache_ttl_playwright.py
@@ -5,6 +5,7 @@ from __future__ import annotations
import json
import os
from pathlib import Path
+from urllib.parse import urlsplit
import pytest
@@ -161,21 +162,24 @@ def _install_dashboard_routes(page: Page) -> None:
dashboard_html = get_dashboard_html()
def handler(route) -> None: # type: ignore[no-untyped-def]
- url = route.request.url
- if url.endswith("/dashboard") or url == "http://headroom.local/":
+ # Match on the URL path only: the dashboard fetches /stats?cached=1,
+ # so suffix checks against the full URL miss it and the request
+ # escapes the harness to the real network.
+ path = urlsplit(route.request.url).path
+ if path in ("/dashboard", "/"):
route.fulfill(status=200, content_type="text/html", body=dashboard_html)
return
- if url.endswith("/stats"):
- route.fulfill(status=200, content_type="application/json", body=json.dumps(stats))
- return
- if "/stats-history" in url:
+ if "/stats-history" in path:
route.fulfill(
status=200,
content_type="application/json",
body=json.dumps(history),
)
return
- if url.endswith("/health"):
+ if path.endswith("/stats"):
+ route.fulfill(status=200, content_type="application/json", body=json.dumps(stats))
+ return
+ if path.endswith("/health"):
route.fulfill(status=200, content_type="application/json", body=json.dumps(health))
return
route.continue_()