Merge branch 'feature/hub-radio-redesign' into unify/skills-20261114
# Conflicts: # orchestrator/templates/panels.js # tests/test_hub_home.py
This commit is contained in:
commit
1c8e5845ac
19 files changed
+2119
-228
No files matched your search
@@ -10,6 +10,7 @@ import {join} from "node:path";
|
||||
const [binary, planFile] = process.argv.slice(2);
|
||||
const plan = JSON.parse(readFileSync(planFile, "utf8"));
|
||||
const profile = mkdtempSync(join(tmpdir(), "bidi-"));
|
||||
writeFileSync(join(profile, "user.js"), ['user_pref("media.navigator.streams.fake", true);', 'user_pref("media.navigator.permission.disabled", true);', ""].join("\n"));
|
||||
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
const port = await new Promise((resolve) => {
|
||||
const probe = createServer().listen(0, "127.0.0.1", () => {
|
||||
|
||||
@@ -437,7 +437,8 @@ OVERLAP = """
|
||||
found.push(`${called(a.node)} × ${called(b.node)}`);
|
||||
}
|
||||
}));
|
||||
const outside = boxes.filter(({box}) => box.right > root.getBoundingClientRect().right + 0.5).map(({node}) => called(node));
|
||||
const framed = (node) => (getComputedStyle(node).display === "contents" ? framed(node.parentElement) : node);
|
||||
const outside = boxes.filter(({box}) => box.right > framed(root).getBoundingClientRect().right + 0.5).map(({node}) => called(node));
|
||||
return {found, outside};
|
||||
};
|
||||
"""
|
||||
@@ -503,6 +504,8 @@ MEDIA = """
|
||||
ADD_STATION = """(async () => {@HELPERS@
|
||||
const clock = (date) => `${String(date.getHours()).padStart(2, "0")}:${String(date.getMinutes()).padStart(2, "0")}`;
|
||||
location.hash = "#stream/radio";
|
||||
const fold = await until(() => document.querySelector("#radio-spot details.radio-station"), 8000);
|
||||
fold.open = true;
|
||||
const edit = await until(() => all("#radio-spot button").find((button) => text(button) === "Edit stations" && button.getClientRects().length), 8000);
|
||||
edit.click();
|
||||
const form = await until(() => document.querySelector('.sheet-box form[aria-label="Stations"]'), 8000);
|
||||
@@ -534,6 +537,8 @@ RADIO_STATE = """(async () => {@HELPERS@@MEDIA@
|
||||
})()""".replace("@HELPERS@", HELPERS).replace("@MEDIA@", MEDIA)
|
||||
RADIO_VIEW = """(async () => {@HELPERS@@MEDIA@
|
||||
location.hash = "#stream/radio";
|
||||
const fold = await until(() => document.querySelector("#radio-spot details.radio-station"), 8000);
|
||||
fold.open = true;
|
||||
const row = await until(() => all('#radio-spot [data-station="0"]').find((item) => item.getClientRects().length), 8000);
|
||||
if (!row) {
|
||||
const initial = JSON.parse(document.getElementById("state").textContent);
|
||||
@@ -2109,7 +2114,7 @@ class TestOrchestratorE2E(HubCase):
|
||||
self.assertEqual(sent["inline"], ["static", True, True])
|
||||
self.assertEqual((sent["toolbar"], sent["channels"], sent["record"]), (["Priority", "Day/Night", "Status"], CHOICE_CHANNELS, ["Record"]))
|
||||
self.assertEqual(sent["heads"], [["Read aloud", "Read aloud: the classes and agents the radio sounds for"], ["Cancel mayday", "Cancel mayday: lift the radio silence so the agents write again; your passkey signs it"]])
|
||||
self.assertEqual((sent["tall"], sent["wide"]), (False, False))
|
||||
self.assertEqual((sent["tall"], sent["wide"]), (width == 390, False))
|
||||
self.assertEqual([run["cls"] for run in sent["runs"]], CHOICE_CHANNELS)
|
||||
for run in sent["runs"]:
|
||||
direct = run["cls"] in ("post", "call")
|
||||
@@ -2121,8 +2126,8 @@ class TestOrchestratorE2E(HubCase):
|
||||
self.assertEqual([entry[1:] for entry in saved["classes"] if entry[0] == "MAYDAY"], [["true", True]])
|
||||
self.assertEqual((saved["kept"], saved["after"]), ([float(squelch), tone == "true", post == "true"], ["false", False]))
|
||||
self.assertEqual(saved["general"], {"sections": ["Ambience", "Location", "Appearance", "Music", "Notifications", "Passkey"], "radio": 0})
|
||||
self.assertEqual((saved["tall"], saved["wide"]), (False, False))
|
||||
self.assertEqual(read, {"squelch": float(squelch), "tone": tone == "true", "post": post == "true", "tall": False, "wide": False})
|
||||
self.assertEqual((saved["tall"], saved["wide"]), (width == 390, False))
|
||||
self.assertEqual(read, {"squelch": float(squelch), "tone": tone == "true", "post": post == "true", "tall": width == 390, "wide": False})
|
||||
heads = {"post": ["post", "--to", "Stage"], "call": ["send", "call", "--to", "Stage"], "newsletter": ["post"]}
|
||||
radio = [args for script, args in self.scripts.calls if script == skill_scripts.RADIO]
|
||||
sends = [(width, cls) for width, _ in WIDTHS for cls in CHOICE_CHANNELS]
|
||||
@@ -2161,7 +2166,7 @@ class TestOrchestratorE2E(HubCase):
|
||||
self.assertEqual((sent["closed"], sent["open"], sent["inline"]), ([True, "false"], [False, "true", True], ["static", True, True]))
|
||||
self.assertEqual((sent["toolbar"], sent["channels"], sent["record"]), (["Priority", "Day/Night", "Status"], CHOICE_CHANNELS, ["Record"]))
|
||||
self.assertEqual(sent["heads"], [["Read aloud", "Read aloud: the classes and agents the radio sounds for"], ["Cancel mayday", hint]])
|
||||
self.assertEqual((sent["tall"], sent["wide"]), (False, False))
|
||||
self.assertEqual((sent["tall"], sent["wide"]), (width == 390, False))
|
||||
self.assertEqual([run["cls"] for run in sent["runs"]], CHOICE_CHANNELS)
|
||||
for run in sent["runs"]:
|
||||
direct = run["cls"] in ("post", "call")
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -127,7 +127,7 @@ RADIO = """
|
||||
await sleep(150);
|
||||
};
|
||||
const chips = () => Object.fromEntries(all(".chip-select", spot).map((box) => [box.dataset.chip, box.querySelector("select").value]));
|
||||
const search = () => spot.querySelector('.radio-filters input[type="search"]');
|
||||
const search = () => spot.querySelector('.radio-logbox input[type="search"]');
|
||||
const tab = async (id) => {
|
||||
spot.querySelector(`.radio-tabs [data-tab="${id}"]`).click();
|
||||
await sleep(150);
|
||||
@@ -187,10 +187,11 @@ LOG = """(async () => {@HELPERS@@RADIO@
|
||||
all(".radio-filters button", spot).find((button) => name(button) === "Clear filters").click();
|
||||
await sleep(150);
|
||||
const clearedChips = [chips(), search().value, rows().length];
|
||||
const summary = spot.querySelector(".radio-row summary");
|
||||
summary.click();
|
||||
spot.querySelector(".radio-row .radio-pick").click();
|
||||
const full = await until(() => document.getElementById("popup").open && document.querySelector("#popup .radio-full"), 4000);
|
||||
const opened = [document.getElementById("popup").open, text(full)];
|
||||
all("#popup .popup-head button").find((button) => name(button) === "Close").click();
|
||||
await sleep(150);
|
||||
const opened = [summary.parentElement.open, text(summary.parentElement.querySelector(".radio-full"))];
|
||||
await tab("received");
|
||||
await chip("agent", "Stage");
|
||||
search().value = "gate";
|
||||
|
||||
Reference in new issue
Block a user