Files
skills/tests/e2e/test_match_stamp_e2e.py
T
Kevin Veen-BirkenbachandClaude Opus 5.5 f356083a24 feat(orchestrator): hub requirements 066 to 082 and 084
Radio footer, rules page, schedules editor (System timers and Claude
tasks through signed runner jobs), account usage bar, usage explorer
with a streamed usage.jsonl, queue Controls tab and override, running
tasks on the board, stale task prune with the generic dial, greyed card
stamps, commit-tree diffs from the runner preview, VS Code path links,
expired asks and decisions that stay as EXPIRED cards (asks keyed by a
call digest; an async PostToolUse hook closes those answered in the
terminal), the Match refresh hourglass, attachments by paste, drop and
paperclip in every text field (page CSP gains img-src blob: for the
thumbnails) and the limits board with profiles and a passkey to loosen.
Fixes: one red accept on a red-gate commit and no release while a risk
is open, the send bar footer segments share one height, the mic button
survives a redraw, new Match cards queue before the release card.

E2E specs were still running at commit time (operator order); their
failures follow as separate fixes.

🎯 Fix: 88 %
💥 Break: 8 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 81
🚦 Gate: ⛔ fix 88 % < 90, break 8 % > 5 (committed on the operator's word)

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 19:05:38 +00:00

90 lines
5.0 KiB
Python

from __future__ import annotations
import json
import os
import shutil
import sys
import tempfile
import time
import unittest
from pathlib import Path
HERE = Path(__file__).resolve().parent
sys.path[:0] = [str(HERE.parent), str(HERE)]
import hub_e2e_kit as base
from hub_case import HubCase
OUT = Path(os.environ.get("E2E_OUT", "/tmp/hub-077-stamp-shots"))
FLOW = """(async () => {@HELPERS@
const card = () => document.querySelector("#main .match-card.front");
if (!(await until(card, 8000))) {
return {error: text(document.getElementById("main"))};
}
const looked = () => {
const stamp = card().querySelector(".match-stamp");
if (!stamp) {
return {card: card().dataset.card, stamp: null};
}
const style = getComputedStyle(stamp);
const body = getComputedStyle(card().querySelector(".match-body"));
return {card: card().dataset.card, stamp: text(stamp), kind: stamp.dataset.stamp, color: style.color, opacity: style.opacity, filter: style.filter, body: body.filter};
};
const first = looked();
const head = card().querySelector(".match-head");
const box = head.getBoundingClientRect();
const at = (x) => ({bubbles: true, cancelable: true, pointerId: 7, pointerType: "touch", isPrimary: true, button: 0, clientX: x, clientY: box.top + 20});
head.dispatchEvent(new PointerEvent("pointerdown", at(box.left + box.width / 2)));
window.dispatchEvent(new PointerEvent("pointermove", at(box.left + box.width * 0.8)));
const during = card().querySelector(".match-stamp") ? text(card().querySelector(".match-stamp")) : null;
window.dispatchEvent(new PointerEvent("pointerup", at(box.left + box.width * 0.9)));
await sleep(300);
const swiped = looked();
document.body.dispatchEvent(new KeyboardEvent("keydown", {key: "ArrowUp", bubbles: true, cancelable: true}));
await until(() => card() && card().dataset.card !== first.card, 3000);
return {first, during, swiped, second: looked(), wide: document.documentElement.scrollWidth > window.innerWidth + 1};
})()"""
@unittest.skipUnless(shutil.which(os.environ.get("CHROMIUM", "chromium")), "no Chromium")
class TestMatchStamp(HubCase):
drive = base.OrchestratorE2ECase.drive
def setUp(self):
super().setUp()
work = tempfile.TemporaryDirectory()
self.addCleanup(work.cleanup)
row = {"title": "true", "workdir": work.name, "description": "ship it", "check": "done", "roles": {"Skills": "A", "Operator": "R"}}
self.write_council({"rasci.json": {"operator/runs": row, "operator/waits": row}})
now = time.time()
job = {"command": "true", "directory": work.name, "sha256": "0" * 64, "proof": None, "output": "", "finished": None, "dismissed": False, "code": None}
self.httpd.hub.jobs.add({**job, "task": "operator/runs", "status": "running", "created_ts": now - 900, "started": now - 900})
self.httpd.hub.jobs.add({**job, "task": "operator/waits", "status": "queued", "created_ts": now - 60, "started": None})
def test_chromium_stamps_every_greyed_card_with_its_reason_in_colour(self):
OUT.mkdir(parents=True, exist_ok=True)
flow = FLOW.replace("@HELPERS@", base.HELPERS)
steps = [{"width": width, "height": height, "url": f"http://localhost:{self.port}/?{width}#tasks/match", "wait": 1500, "probe": flow, "shot": str(OUT / f"chromium-{width}-stamp.png")} for width, height in base.WIDTHS]
data = self.drive(steps, None, "cdp.mjs", os.environ.get("CHROMIUM", "chromium"))
(OUT / "chromium-stamp.json").write_text(json.dumps(data, indent=1), encoding="utf-8")
self.assertEqual([error for error in data["errors"] if "(style-src-elem)" not in error and "/favicon.ico" not in error], [])
self.assertEqual(len(data["results"]), len(base.WIDTHS), data)
for found in data["results"]:
with self.subTest(width=found.get("first", {}).get("card")):
self.assertNotIn("error", found, found)
stamps = {found["first"]["card"]: found["first"]["kind"], found["second"]["card"]: found["second"]["kind"]}
self.assertEqual(stamps, {"operator:operator/runs": "running", "operator:operator/waits": "queued"}, found)
for looked in (found["first"], found["second"]):
self.assertIn(looked["stamp"], ("RUNNING", "QUEUED"), found)
self.assertEqual((looked["opacity"], looked["filter"]), ("1", "none"), found)
self.assertNotIn("grayscale", looked["filter"], found)
self.assertIn("grayscale", looked["body"], found)
channels = [int(part) for part in looked["color"].removeprefix("rgb(").removesuffix(")").split(",")[:3]]
self.assertGreater(max(channels) - min(channels), 20, found)
self.assertEqual((found["during"], found["swiped"]["stamp"], found["swiped"]["card"]), (found["first"]["stamp"], found["first"]["stamp"], found["first"]["card"]), found)
self.assertFalse(found["wide"], found)
if __name__ == "__main__":
unittest.main()