No-AI desktop path: PyQt bot wired to the page
- templates/bot_runner.py (new, no Qt): runs the bot as a child process (unbuffered, UTF-8), tails its output, keeps raw lines in bot_raw.log, and turns lines into step/log/status events. Step markers and friendly rules use specific substrings, first match wins; unmatched error lines are always shown, other unmatched lines hidden. Dry run: python dashboard/bot_runner.py prints the events the page would get. - bridge.py: delegates to bot_runner, one run at a time, restores the saved dark mode on every page load (fixes sample-data mode in PyQt), adds load_latest_report / download_report slots the page calls. - SKILL.md: skip the stack question for a PyQt project; desktop wiring steps from the bot's real output; verify steps for the host. - tests: assert-based self-check for the line logic and run loop; Seam 1 run replay (status dot, Run button, steps, log) and wired-page mode; fixture b-pyqt-bot and its Seam 2 eval (all 14 checks pass). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3eb3fdf00e
commit
162edd41df
17 files changed
+753
-47
No files matched your search
@@ -4,6 +4,8 @@ through window.__pyMsg, and assert on what is visible.
|
||||
Page under test: set PAGE_CHECK_HTML to a generated dashboard.html. Without it, the
|
||||
no-AI template is filled with TEST_FILL. Every test runs in light, dark and narrow mode.
|
||||
The page sees a fake Qt bridge: each slot call lands in window.__calls as [slot, ...args].
|
||||
PAGE_CHECK_WIRED=1: the page is wired to a bot (SAMPLE_DATA off), so sample-data cases skip.
|
||||
PAGE_CHECK_REPLAY: a JSON-lines file of envelopes a real bot run produced (bot_runner.py's dry run).
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
@@ -32,6 +34,14 @@ window.QWebChannel = function (_transport, ready) {
|
||||
};
|
||||
"""
|
||||
MODES = {"light": (1280, 820, False), "dark": (1280, 820, True), "narrow": (800, 900, False)}
|
||||
WIRED = os.environ.get("PAGE_CHECK_WIRED") == "1"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def sample_data():
|
||||
"""Use on cases that need the built-in sample data; they skip on a bot-wired page."""
|
||||
if WIRED:
|
||||
pytest.skip("page is wired to a bot, so it has no sample data")
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
@@ -39,6 +49,8 @@ def page_url(tmp_path_factory):
|
||||
if os.environ.get("PAGE_CHECK_HTML"):
|
||||
return Path(os.environ["PAGE_CHECK_HTML"]).resolve().as_uri()
|
||||
html = re.sub(r"\{\{(\w+)\}\}", lambda m: TEST_FILL[m[1]], TEMPLATE.read_text(encoding="utf-8"))
|
||||
if WIRED:
|
||||
html = html.replace("const SAMPLE_DATA = true", "const SAMPLE_DATA = false")
|
||||
out = tmp_path_factory.mktemp("page") / "dashboard.html"
|
||||
out.write_text(html, encoding="utf-8")
|
||||
return out.as_uri()
|
||||
|
||||
Reference in new issue
Block a user