diff --git a/tests/e2e/test_orchestrator_e2e.py b/tests/e2e/test_orchestrator_e2e.py index 61e2b78..79bbaa4 100644 --- a/tests/e2e/test_orchestrator_e2e.py +++ b/tests/e2e/test_orchestrator_e2e.py @@ -1010,6 +1010,7 @@ LABELS = """ const unlabelled = (root) => all("svg.bi", root).filter((svg) => !svg.closest(".sprite")).map((svg) => svg.parentElement).filter((owner) => !text(owner) && !(owner.getAttribute("title") && owner.getAttribute("aria-label"))).map((owner) => owner.outerHTML.slice(0, 160)); const wide = () => document.documentElement.scrollWidth > window.innerWidth + 1; const rowOf = (words) => all("#main .inbox-list > li").find((li) => li.textContent.includes(words)); + const askOf = (command) => all("#main .inbox-list > li.k-ask").find((li) => text(li.querySelector(".command code")) === command); const press = (root, label) => all("button", root).find((button) => name(button) === label).click(); const out = () => document.querySelector("#main .console .console-out"); const atEnd = () => out().scrollTop + out().clientHeight >= out().scrollHeight - 12; @@ -1112,7 +1113,10 @@ DENY_SHEET = """(async () => {@HELPERS@@LABELS@ }; })()""".replace("@HELPERS@", HELPERS).replace("@LABELS@", LABELS) DENY = """(async () => {@HELPERS@@LABELS@ - const row = await until(() => rowOf("Bash: make deploy"), 8000); + const row = await until(() => askOf("make deploy"), 8000); + if (!row) { + return {error: text(document.getElementById("main"))}; + } press(row, "Deny via …"); const box = await until(() => document.querySelector(".sheet-box"), 4000); box.querySelector('input[value="call"]').click(); @@ -1122,7 +1126,7 @@ DENY = """(async () => {@HELPERS@@LABELS@ return {undo: text(undo), sheet: !document.getElementById("sheet").hidden}; })()""".replace("@HELPERS@", HELPERS).replace("@LABELS@", LABELS) DENIED = """(async () => {@HELPERS@@LABELS@ - return {gone: Boolean(await until(() => !rowOf("Bash: make deploy"), 20000))}; + return {gone: Boolean(await until(() => !askOf("make deploy"), 20000))}; })()""".replace("@HELPERS@", HELPERS).replace("@LABELS@", LABELS) ACCEPT = """(async () => {@HELPERS@@LABELS@ press(rowOf("Rule request"), "Accept"); @@ -2279,6 +2283,7 @@ class TestOrchestratorE2E(HubCase): self.assertEqual(sheet["hints"][:3], ["to Skills, when its turn ends", "to Skills, at once, wakes it", "to all, when their turn ends"]) self.assertEqual((sheet["reason"], sheet["unlabelled"], sheet["wide"]), (True, [], False)) denied, gone, accepted = rest[6:] + self.assertNotIn("error", denied, denied) self.assertTrue(denied["undo"].startswith("Denial (Call): Bash: make deploy"), denied) self.assertFalse(denied["sheet"]) self.assertTrue(gone["gone"]) diff --git a/tests/e2e/test_workbench_w1_e2e.py b/tests/e2e/test_workbench_w1_e2e.py index 31424cc..0e6de93 100644 --- a/tests/e2e/test_workbench_w1_e2e.py +++ b/tests/e2e/test_workbench_w1_e2e.py @@ -57,7 +57,7 @@ OPERATOR = """(async () => {@HELPERS@ operator: operator ? {command: text(operator.querySelector(".command code")), place: operator.querySelector(".command").dataset.path, text: text(operator), buttons: all("button", operator).map(name)} : null, files, wide: document.documentElement.scrollWidth > window.innerWidth + 1, }; - cards.forEach((card) => card.querySelector('input[type="checkbox"]').click()); + ["@TAG@ review", "@TAG@ ship", "@TAG@ commit"].forEach((words) => mine(words).querySelector('input[type="checkbox"]').click()); await sleep(300); const grant = all("#main .inbox-actions button").find((button) => name(button).startsWith("Grant selection")); found.grant = name(grant); @@ -86,11 +86,11 @@ FEEDBACK = """(async () => {@HELPERS@ selection.addRange(range); return range.getBoundingClientRect(); }; - window.e2ePosted = []; + window.e2eFeedback = []; const send = window.fetch.bind(window); window.fetch = (path, init) => { if (String(path).startsWith("/api/messages")) { - window.e2ePosted.push([String(path), JSON.parse(init.body).text]); + window.e2eFeedback.push([String(path), JSON.parse(init.body).text]); } return send(path, init); }; @@ -109,7 +109,7 @@ FEEDBACK = """(async () => {@HELPERS@ const range = text(document.querySelector(".sheet-box .who code")); sheet.value = "right-click note"; all(".sheet-box button").find((button) => name(button) === "Send feedback").click(); - await until(() => window.e2ePosted.length >= (@SIGNS@ ? 2 : 1), 8000); + await until(() => window.e2eFeedback.length >= (@SIGNS@ ? 2 : 1), 8000); await sleep(600); const fresh = () => all("#main .inbox-list > li").find((li) => li.textContent.includes("@TAG@ second")); const shown = @SIGNS@ ? await until(() => fresh() && all(".feedback-list li", fresh()).map(text).find((entry) => entry.includes("right-click note")), 15000) : null; @@ -126,7 +126,7 @@ FEEDBACK = """(async () => {@HELPERS@ keyed.value = "key f note"; all(".sheet-box button").find((button) => name(button) === "Send feedback").click(); await sleep(1500); - return {nearby, menu, title, range, keyRange, shown: shown || "", posted: window.e2ePosted, wide: document.documentElement.scrollWidth > window.innerWidth + 1}; + return {nearby, menu, title, range, keyRange, shown: shown || "", posted: window.e2eFeedback, wide: document.documentElement.scrollWidth > window.innerWidth + 1}; })()""" @@ -202,7 +202,7 @@ class TestWorkbenchOperatorTasks(HubCase): self.assertTrue(any(text and text.endswith(" key f note") for _, text in feedback["posted"]), feedback["posted"]) self.assertFalse(feedback["wide"]) radio = [" ".join(args) for script, args in self.scripts.calls if script == skill_scripts.RADIO] - reached = [entry for entry in radio if "Feedback on review:" in entry] + reached = [entry for entry in radio if "] Feedback on review:" in entry or "] Feedback on ask:" in entry] self.assertEqual(len(reached), 2 * len(base.WIDTHS) if signs else 0, radio) def test_chromium_shows_operator_tasks_with_a_badge_diffs_bulk_grants_and_sends_feedback_at_three_widths(self): diff --git a/tests/e2e/test_workbench_w2_e2e.py b/tests/e2e/test_workbench_w2_e2e.py index 65f95ec..c93e773 100644 --- a/tests/e2e/test_workbench_w2_e2e.py +++ b/tests/e2e/test_workbench_w2_e2e.py @@ -197,7 +197,7 @@ class TestWorkbenchKanban(HubCase): "work/b": {"title": "Bravo", "status": "running", "worker": "Docs", "prio": 2, "start": iso(now - 3.9 * DAY), "after": ["work/a"], "updated": fresh}, "work/blocked": {"title": "Blocked one", "status": "blocked", "worker": "Stage", "prio": 3, "updated": fresh}, "work/p5": {"title": "Five", "status": "queued", "worker": "Stage", "prio": 5, "updated": fresh}, - "work/c": {"title": "Charlie", "status": "queued", "worker": "Stage", "estimates": {"Stage": {"value": 4, "complexity": 2}}, "updated": fresh}, + "work/c": {"title": "Charlie", "status": "queued", "worker": "Stage", "estimates": {"Stage": {"value": 3, "complexity": 2}}, "updated": fresh}, "work/d": {"title": "Delta", "status": "queued", "worker": "Skills", "estimates": {"Skills": {"value": 5, "complexity": 1}}, "updated": fresh}, "work/stale": {"title": "Stale one", "status": "running", "worker": "Stage", "start": iso(now - 5 * DAY), "updated": iso(now - 4 * DAY)}, "work/stopped": {"title": "Stopped one", "status": "stopped", "worker": "Stage", "start": iso(now - 3.7 * DAY), "end": iso(now - 3600)}, diff --git a/tests/e2e/test_workbench_w3_e2e.py b/tests/e2e/test_workbench_w3_e2e.py index 75e994f..c0a29a6 100644 --- a/tests/e2e/test_workbench_w3_e2e.py +++ b/tests/e2e/test_workbench_w3_e2e.py @@ -52,6 +52,11 @@ ANCESTRY = """(async () => {@HELPERS@ })()""" STAGE = """(async () => {@HELPERS@ const svg = await until(() => document.querySelector("#main svg.ancestry"), 8000); + const repo = svg.closest("details.repo"); + if (!repo.open) { + repo.querySelector("summary").click(); + await sleep(300); + } svg.scrollIntoView({block: "center", inline: "center"}); await sleep(200); const center = (branch) => { @@ -126,7 +131,7 @@ class TestWorkbenchArtifacts(HubCase): "chair/claim.json": {"office": "chair", "session": "s1", "runtime": "claude", "name": "Skills session", "since": iso(now - 7200), "beat": now, "work": "allocate"}, }) self.subagents(now) - self.base = f"http://{self.host}/" + self.base = f"http://localhost:{self.port}/" def steps(self, browser: str) -> list[dict]: steps = []