test(e2e): follow 004's browser-side speech settings in the bubble tests
Requirement 004 (acf3925) moved speech on, classes and muted into each browser's localStorage and gave the speech tool a second argument admit; the bubble-faces fixture still saved the old hub settings and stubbed the one-argument tool, which settings.py now refuses. The fixture saves only bubbles, stubs (body, admit) and sets the radio to Silence with mayday and security through a start-up script. W6's long row moves from security to broadcast, the class 004 switched W6 to, so the browser picks it again.
🎯 Fix: 95 %
💥 Break: 2 %
💸 Cost: –
⏱️ Time: –
🛡️ Security: 100 %
🏆 Score: 93
🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 %
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1e5aac8a37
commit
1f8f17b182
2 files changed
+12
-4
No files matched your search
@@ -6,6 +6,7 @@ import shutil
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
|
from collections.abc import Callable
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
@@ -21,6 +22,13 @@ WIDTH, HEIGHT = 1366, 768
|
|||||||
CUE = "front"
|
CUE = "front"
|
||||||
SPEAKERS = ("Skills session", "Stage", "Docs")
|
SPEAKERS = ("Skills session", "Stage", "Docs")
|
||||||
SAID = "disk almost full on the build host so rotate the logs and retry the gate before the next push"
|
SAID = "disk almost full on the build host so rotate the logs and retry the gate before the next push"
|
||||||
|
SILENT = """() => {
|
||||||
|
try {
|
||||||
|
localStorage.setItem("kvb-orchestrator.radio", JSON.stringify({mode: "silence", classes: ["mayday", "security"], muted: []}));
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}"""
|
||||||
SPAWN = """
|
SPAWN = """
|
||||||
const agentChart = () => document.querySelector('#main svg.ancestry[aria-label="Ancestry: operator, chair, sessions, subagents"]');
|
const agentChart = () => document.querySelector('#main svg.ancestry[aria-label="Ancestry: operator, chair, sessions, subagents"]');
|
||||||
const agentNodes = () => all("g.ancestry-node", agentChart()).map((node) => {
|
const agentNodes = () => all("g.ancestry-node", agentChart()).map((node) => {
|
||||||
@@ -166,9 +174,9 @@ class TestHubBubbleFrontAndSpawnFaces(HubCase):
|
|||||||
})
|
})
|
||||||
self.subagents(now)
|
self.subagents(now)
|
||||||
hub = self.httpd.hub
|
hub = self.httpd.hub
|
||||||
hub.settings.put({**hub.settings.get(), "bubbles": True, "speech": {"on": False, "classes": ["mayday", "security"], "muted": []}}, hub.settings.get())
|
hub.settings.put({**hub.settings.get(), "bubbles": True}, hub.settings.get())
|
||||||
|
|
||||||
def synthesize(body: bytes) -> bytes:
|
def synthesize(body: bytes, admit: Callable[[str], None]) -> bytes:
|
||||||
if json.loads(body)["text"] == CUE:
|
if json.loads(body)["text"] == CUE:
|
||||||
rows = [{"ts": time.time(), "from": name, "to": [], "text": f"{name}: {SAID}, {SAID}", "class": "security", "v": 2} for name in SPEAKERS]
|
rows = [{"ts": time.time(), "from": name, "to": [], "text": f"{name}: {SAID}, {SAID}", "class": "security", "v": 2} for name in SPEAKERS]
|
||||||
with (self.council / "news.jsonl").open("a", encoding="utf-8") as handle:
|
with (self.council / "news.jsonl").open("a", encoding="utf-8") as handle:
|
||||||
@@ -222,7 +230,7 @@ class TestHubBubbleFrontAndSpawnFaces(HubCase):
|
|||||||
self.assertNotEqual(following["speaker"], following["first"])
|
self.assertNotEqual(following["speaker"], following["first"])
|
||||||
|
|
||||||
def test_chromium_keeps_the_speaking_bubble_in_front_and_draws_faces_in_the_spawn_ancestry(self):
|
def test_chromium_keeps_the_speaking_bubble_in_front_and_draws_faces_in_the_spawn_ancestry(self):
|
||||||
data = self.drive(self.steps(), None)
|
data = self.drive(self.steps(), None, init=SILENT)
|
||||||
(OUT / "chromium-bubble-faces.json").write_text(json.dumps(data, indent=1), encoding="utf-8")
|
(OUT / "chromium-bubble-faces.json").write_text(json.dumps(data, indent=1), encoding="utf-8")
|
||||||
self.assertEqual([error for error in data["errors"] if "/favicon.ico" not in error], [])
|
self.assertEqual([error for error in data["errors"] if "/favicon.ico" not in error], [])
|
||||||
self.check(data)
|
self.check(data)
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ class TestWorkbenchBubbles(HubCase):
|
|||||||
word = json.loads(body)["text"]
|
word = json.loads(body)["text"]
|
||||||
if word == f"{CUE}-long":
|
if word == f"{CUE}-long":
|
||||||
with (self.council / "news.jsonl").open("a", encoding="utf-8") as handle:
|
with (self.council / "news.jsonl").open("a", encoding="utf-8") as handle:
|
||||||
handle.write(self.jsonl([{"ts": time.time(), "from": "Stage", "to": [], "text": LONG, "class": "security", "v": 2}]))
|
handle.write(self.jsonl([{"ts": time.time(), "from": "Stage", "to": [], "text": LONG, "class": "broadcast", "v": 2}]))
|
||||||
elif word.startswith(CUE):
|
elif word.startswith(CUE):
|
||||||
now = time.time()
|
now = time.time()
|
||||||
rows = [
|
rows = [
|
||||||
|
|||||||
Reference in new issue
Block a user