Merge branch 'fix/unify-e2e-home-tab' into unify/skills-20261112-night
This commit is contained in:
commit
74d9feed87
3 files changed
+23
-13
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
|
||||||
|
|
||||||
@@ -107,8 +108,9 @@ STARS = """(async () => {@HELPERS@@HOME@
|
|||||||
const missing = [];
|
const missing = [];
|
||||||
const covered = [];
|
const covered = [];
|
||||||
const CONTROLS = 'button, a[href], input, select, textarea, summary, [role="button"], [role="tab"], [tabindex]:not([tabindex="-1"])';
|
const CONTROLS = 'button, a[href], input, select, textarea, summary, [role="button"], [role="tab"], [tabindex]:not([tabindex="-1"])';
|
||||||
const shown = (node) => node.getClientRects().length > 0 && getComputedStyle(node).visibility !== "hidden";
|
const shown = (node) => node.getClientRects().length > 0 && getComputedStyle(node).visibility !== "hidden" && !node.closest("details:not([open]) > :not(summary)");
|
||||||
const overlap = (a, b) => Math.max(0, Math.min(a.right, b.right) - Math.max(a.left, b.left)) * Math.max(0, Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top));
|
const overlap = (a, b) => Math.max(0, Math.min(a.right, b.right) - Math.max(a.left, b.left)) * Math.max(0, Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top));
|
||||||
|
const layer = (node) => node.closest("dialog[open]");
|
||||||
const count = (where) => {
|
const count = (where) => {
|
||||||
const owners = all("[data-panel], [data-item]").filter((node) => node.namespaceURI === "http://www.w3.org/1999/xhtml");
|
const owners = all("[data-panel], [data-item]").filter((node) => node.namespaceURI === "http://www.w3.org/1999/xhtml");
|
||||||
seen.push([where, owners.length]);
|
seen.push([where, owners.length]);
|
||||||
@@ -117,7 +119,7 @@ STARS = """(async () => {@HELPERS@@HOME@
|
|||||||
for (const star of all(".star").filter(shown)) {
|
for (const star of all(".star").filter(shown)) {
|
||||||
const box = star.getBoundingClientRect();
|
const box = star.getBoundingClientRect();
|
||||||
for (const other of controls) {
|
for (const other of controls) {
|
||||||
if (other !== star && !other.contains(star) && !star.contains(other) && overlap(box, other.getBoundingClientRect()) > 1) {
|
if (other !== star && !other.contains(star) && !star.contains(other) && layer(other) === layer(star) && overlap(box, other.getBoundingClientRect()) > 1) {
|
||||||
covered.push(`${where}: ${star.title} over ${other.outerHTML.slice(0, 100)}`);
|
covered.push(`${where}: ${star.title} over ${other.outerHTML.slice(0, 100)}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -182,7 +184,8 @@ RESIZE = """(async () => {@HELPERS@@HOME@
|
|||||||
}
|
}
|
||||||
const keyed = sizeOf(key);
|
const keyed = sizeOf(key);
|
||||||
await dragBy(handle(), column * 5, row * 3);
|
await dragBy(handle(), column * 5, row * 3);
|
||||||
const span = getComputedStyle(tile(key)).gridColumnEnd;
|
const look = getComputedStyle(tile(key));
|
||||||
|
const span = [look.gridColumnStart, look.gridColumnEnd];
|
||||||
return {before, grown, most, wide, least, keyed, final: sizeOf(key), span, stored: (ViewStore.get("home.pins") || []).find((pin) => pin.id === "tasks/gantt")};
|
return {before, grown, most, wide, least, keyed, final: sizeOf(key), span, stored: (ViewStore.get("home.pins") || []).find((pin) => pin.id === "tasks/gantt")};
|
||||||
})()"""
|
})()"""
|
||||||
REORDER = """(async () => {@HELPERS@@HOME@
|
REORDER = """(async () => {@HELPERS@@HOME@
|
||||||
@@ -259,15 +262,19 @@ def probe(template: str) -> str:
|
|||||||
|
|
||||||
@unittest.skipUnless(shutil.which(os.environ.get("CHROMIUM", "chromium")), "no Chromium")
|
@unittest.skipUnless(shutil.which(os.environ.get("CHROMIUM", "chromium")), "no Chromium")
|
||||||
class TestHomeDashboard(HubCase):
|
class TestHomeDashboard(HubCase):
|
||||||
setUp = base.TestOrchestratorE2E.setUp
|
seed = base.TestOrchestratorE2E.seed
|
||||||
subagents = base.TestOrchestratorE2E.subagents
|
subagents = base.TestOrchestratorE2E.subagents
|
||||||
drive = base.TestOrchestratorE2E.drive
|
drive = base.TestOrchestratorE2E.drive
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super().setUp()
|
||||||
|
self.seed()
|
||||||
|
|
||||||
def cue(self) -> None:
|
def cue(self) -> None:
|
||||||
hub = self.httpd.hub
|
hub = self.httpd.hub
|
||||||
spoken = base.tone(1, 8000)
|
spoken = base.tone(1, 8000)
|
||||||
|
|
||||||
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:
|
||||||
path = self.council / "rasci.json"
|
path = self.council / "rasci.json"
|
||||||
register = json.loads(path.read_text(encoding="utf-8"))
|
register = json.loads(path.read_text(encoding="utf-8"))
|
||||||
@@ -296,7 +303,7 @@ class TestHomeDashboard(HubCase):
|
|||||||
{"width": width, "height": height, "url": None, "wait": 0, "probe": probe(REORDER), "shot": f"{shot}-reordered.png"},
|
{"width": width, "height": height, "url": None, "wait": 0, "probe": probe(REORDER), "shot": f"{shot}-reordered.png"},
|
||||||
{"width": width, "height": height, "url": f"{page}-reloaded", "wait": 1500, "probe": probe(RELOADED), "shot": f"{shot}-reloaded.png"},
|
{"width": width, "height": height, "url": f"{page}-reloaded", "wait": 1500, "probe": probe(RELOADED), "shot": f"{shot}-reloaded.png"},
|
||||||
]
|
]
|
||||||
if index == 0:
|
if index == len(base.WIDTHS) - 1:
|
||||||
steps += [
|
steps += [
|
||||||
{"width": width, "height": height, "url": None, "wait": 0, "probe": probe(CHANGE), "shot": f"{shot}-gone.png"},
|
{"width": width, "height": height, "url": None, "wait": 0, "probe": probe(CHANGE), "shot": f"{shot}-gone.png"},
|
||||||
{"width": width, "height": height, "url": None, "wait": 0, "probe": probe(GONE_UNPIN), "shot": None},
|
{"width": width, "height": height, "url": None, "wait": 0, "probe": probe(GONE_UNPIN), "shot": None},
|
||||||
@@ -328,7 +335,7 @@ class TestHomeDashboard(HubCase):
|
|||||||
resized = next(results)
|
resized = next(results)
|
||||||
self.assertEqual((resized["before"], resized["grown"], resized["most"], resized["least"], resized["keyed"], resized["final"]), ([6, 4], [9, 6], [12, 12], [1, 1], [3, 2], [8, 5]), resized)
|
self.assertEqual((resized["before"], resized["grown"], resized["most"], resized["least"], resized["keyed"], resized["final"]), ([6, 4], [9, 6], [12, 12], [1, 1], [3, 2], [8, 5]), resized)
|
||||||
self.assertEqual(resized["wide"][0], resized["wide"][1], resized)
|
self.assertEqual(resized["wide"][0], resized["wide"][1], resized)
|
||||||
self.assertEqual(resized["span"], "-1" if width == 390 else "span 8", resized)
|
self.assertEqual(resized["span"], ["1", "-1"] if width == 390 else ["span 8", "auto"], resized)
|
||||||
self.assertEqual((resized["stored"]["w"], resized["stored"]["h"]), (8, 5))
|
self.assertEqual((resized["stored"]["w"], resized["stored"]["h"]), (8, 5))
|
||||||
order = next(results)
|
order = next(results)
|
||||||
start = ["task:work/feature", "task:work/docs", "panel:stream", "panel:tasks/gantt"]
|
start = ["task:work/feature", "task:work/docs", "panel:stream", "panel:tasks/gantt"]
|
||||||
@@ -344,7 +351,7 @@ class TestHomeDashboard(HubCase):
|
|||||||
self.assertEqual(reloaded["widths"], [reloaded["grid"]], reloaded)
|
self.assertEqual(reloaded["widths"], [reloaded["grid"]], reloaded)
|
||||||
else:
|
else:
|
||||||
self.assertGreater(len(reloaded["widths"]), 1, reloaded)
|
self.assertGreater(len(reloaded["widths"]), 1, reloaded)
|
||||||
if index == 0:
|
if index == len(base.WIDTHS) - 1:
|
||||||
change = next(results)
|
change = next(results)
|
||||||
self.assertTrue(change["grown"], change)
|
self.assertTrue(change["grown"], change)
|
||||||
self.assertNotIn("work/new", change["before"])
|
self.assertNotIn("work/new", change["before"])
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ OUT = Path(os.environ.get("E2E_OUT", "/tmp/orchestrator-phase4-shots"))
|
|||||||
WIDTHS = ((1920, 1080), (1366, 768), (390, 844))
|
WIDTHS = ((1920, 1080), (1366, 768), (390, 844))
|
||||||
VIEWS = ("orbit", "chord", "swimlane", "tree", "3d")
|
VIEWS = ("orbit", "chord", "swimlane", "tree", "3d")
|
||||||
TASK_VIEWS = ("list", "board", "rasci", "gantt", "burn", "3d")
|
TASK_VIEWS = ("list", "board", "rasci", "gantt", "burn", "3d")
|
||||||
SCREENS = ["stream", "tasks/operator", "stream/rules", *(f"{tab}/{view}" for tab in ("agents", "artifacts") for view in VIEWS), "agents/hierarchy", *(f"tasks/{view}" for view in TASK_VIEWS), "resources"]
|
SCREENS = ["home", "stream", "tasks/operator", "stream/rules", *(f"{tab}/{view}" for tab in ("agents", "artifacts") for view in VIEWS), "agents/hierarchy", *(f"tasks/{view}" for view in TASK_VIEWS), "resources"]
|
||||||
SUBS = ["Firewall"]
|
SUBS = ["Firewall"]
|
||||||
TABS = ["Home", "Stream", "Agents", "Artifacts", "Tasks", "Resources"]
|
TABS = ["Home", "Stream", "Agents", "Artifacts", "Tasks", "Resources"]
|
||||||
HELPERS = """
|
HELPERS = """
|
||||||
@@ -217,7 +217,7 @@ ACTIONS = """(async () => {@HELPERS@
|
|||||||
await sleep(300);
|
await sleep(300);
|
||||||
return location.hash;
|
return location.hash;
|
||||||
};
|
};
|
||||||
const found = {keys: [await press("2"), await press("3"), await press("4"), await press("1")]};
|
const found = {keys: [await press("3"), await press("4"), await press("5"), await press("1"), await press("2")]};
|
||||||
document.getElementById("settings-open").click();
|
document.getElementById("settings-open").click();
|
||||||
await sleep(300);
|
await sleep(300);
|
||||||
found.ambience = all(".sheet-box form > section:first-child button").map((button) => button.id);
|
found.ambience = all(".sheet-box form > section:first-child button").map((button) => button.id);
|
||||||
@@ -1551,6 +1551,9 @@ class TestOrchestratorE2E(HubCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
OUT.mkdir(parents=True, exist_ok=True)
|
OUT.mkdir(parents=True, exist_ok=True)
|
||||||
|
self.seed()
|
||||||
|
|
||||||
|
def seed(self) -> None:
|
||||||
now = time.time()
|
now = time.time()
|
||||||
self.root = self.write_tree()
|
self.root = self.write_tree()
|
||||||
feature = f"{self.root}/worktrees/github.com/me/demo/feature"
|
feature = f"{self.root}/worktrees/github.com/me/demo/feature"
|
||||||
@@ -1845,7 +1848,7 @@ class TestOrchestratorE2E(HubCase):
|
|||||||
self.assertEqual((probe["title"], probe["h1"]), ("(2) Agent Orchestrator", "Agent Orchestrator"))
|
self.assertEqual((probe["title"], probe["h1"]), ("(2) Agent Orchestrator", "Agent Orchestrator"))
|
||||||
self.assertEqual(probe["header"], ["radio-open", "bubbles-toggle", "palette-open", "settings-open"])
|
self.assertEqual(probe["header"], ["radio-open", "bubbles-toggle", "palette-open", "settings-open"])
|
||||||
self.assertEqual((probe["tabs"], probe["subs"]), (TABS, SUBS))
|
self.assertEqual((probe["tabs"], probe["subs"]), (TABS, SUBS))
|
||||||
self.assertEqual(probe["badges"], {"tab-stream": None, "tab-rules": None, "tab-agents": "1", "tab-artifacts": None, "tab-tasks": "2", "tab-resources": None})
|
self.assertEqual(probe["badges"], {"tab-home": None, "tab-stream": None, "tab-rules": None, "tab-agents": "1", "tab-artifacts": None, "tab-tasks": "2", "tab-resources": None})
|
||||||
self.assertEqual(probe["banner"], "MAYDAY · Docs: disk full")
|
self.assertEqual(probe["banner"], "MAYDAY · Docs: disk full")
|
||||||
self.assertFalse(probe["rail"])
|
self.assertFalse(probe["rail"])
|
||||||
self.assertEqual((probe["time"], probe["replay"]), ("24 h ▾", True))
|
self.assertEqual((probe["time"], probe["replay"]), ("24 h ▾", True))
|
||||||
@@ -1906,7 +1909,7 @@ class TestOrchestratorE2E(HubCase):
|
|||||||
self.assertEqual([probe["hash"] for probe in extra[:3]], ["#agents/orbit", "#agents/chord", "#artifacts/tree"])
|
self.assertEqual([probe["hash"] for probe in extra[:3]], ["#agents/orbit", "#agents/chord", "#artifacts/tree"])
|
||||||
actions = extra[3]
|
actions = extra[3]
|
||||||
self.assertNotIn("error", actions)
|
self.assertNotIn("error", actions)
|
||||||
self.assertEqual(actions["keys"], ["#agents/chord", "#artifacts/tree", "#tasks/3d", "#stream"])
|
self.assertEqual(actions["keys"], ["#agents/chord", "#artifacts/tree", "#tasks/3d", "#home", "#stream"])
|
||||||
self.assertEqual(actions["ambience"], ["sky-look", "music-toggle", "leitstand", "notify"])
|
self.assertEqual(actions["ambience"], ["sky-look", "music-toggle", "leitstand", "notify"])
|
||||||
self.assertEqual((actions["settingsUnlabelled"], actions["popupUnlabelled"]), (0, 0))
|
self.assertEqual((actions["settingsUnlabelled"], actions["popupUnlabelled"]), (0, 0))
|
||||||
self.assertEqual((actions["sections"], actions["radioFields"]), (["Ambience", "Location", "Appearance", "Music", "Notifications", "Passkey"], 0))
|
self.assertEqual((actions["sections"], actions["radioFields"]), (["Ambience", "Location", "Appearance", "Music", "Notifications", "Passkey"], 0))
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ CHARTS = """(async () => {@HELPERS@
|
|||||||
};
|
};
|
||||||
})()"""
|
})()"""
|
||||||
KEY = """(async () => {@HELPERS@
|
KEY = """(async () => {@HELPERS@
|
||||||
document.body.dispatchEvent(new KeyboardEvent("keydown", {key: "5", bubbles: true}));
|
document.body.dispatchEvent(new KeyboardEvent("keydown", {key: "6", bubbles: true}));
|
||||||
const opened = Boolean(await until(() => location.hash === "#resources" && document.querySelector("#main svg.res-chart"), 8000));
|
const opened = Boolean(await until(() => location.hash === "#resources" && document.querySelector("#main svg.res-chart"), 8000));
|
||||||
return {opened, current: document.getElementById("tab-resources").getAttribute("aria-current")};
|
return {opened, current: document.getElementById("tab-resources").getAttribute("aria-current")};
|
||||||
})()"""
|
})()"""
|
||||||
|
|||||||
Reference in new issue
Block a user