web: shared chat stars, pipeline mini graphs and agent questions
- Persist chat stars in the operator-session registry (chat_star) so every browser/device shows the same Starred group; migrate old local stars once. - Add a compact pipeline graph shape to list responses and draw a lightweight list miniature; replace the cryptic id/version line with the stage count. - Surface OpenCode form questions as a chat card (chat_answer), replay a pending form to late subscribers, and notify for background questions. - Make the mobile dock's Search cell equal to every destination, keep the tab row visible with 100svh, and let Source use the full pane height. - Let a fresh sign-in auto-connect to its own origin; use a Lax session cookie with Expires so Remember me survives app/link launches. - Keep shipped starters and the skill agnostic: no repository paths, project areas or personal device commands; add Diagnose/Fix and Research starters. - Refresh the installed skill and document the new browser conventions.
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
attentionDismissAll,
|
||||
attentionDismissalSnapshot,
|
||||
attentionEntries,
|
||||
startOfLocalDay,
|
||||
attentionKey,
|
||||
attentionKindOf,
|
||||
attentionRowDescription,
|
||||
@@ -108,6 +109,27 @@ test("row description is exactly {pipeline} · {detail}", () => {
|
||||
assert.equal(attentionRowDescription(entry), "Plan and land · failed hard");
|
||||
});
|
||||
|
||||
test("the surface is today's work: older failures are history", () => {
|
||||
const entries = [
|
||||
run({ id: 1, status: "failed", finished_at: "2026-10-19T21:33:27Z" }),
|
||||
run({ id: 2, status: "failed", finished_at: "2026-10-20T10:00:00Z" }),
|
||||
];
|
||||
const since = Date.parse("2026-10-20T00:00:00Z");
|
||||
assert.deepEqual(
|
||||
attentionEntries(entries, new Set(), { since }).map((entry) => entry.runId),
|
||||
[2],
|
||||
);
|
||||
assert.equal(attentionEntries(entries, new Set()).length, 2);
|
||||
});
|
||||
|
||||
test("startOfLocalDay is local midnight", () => {
|
||||
const now = new Date(2026, 9, 20, 15, 4, 5).getTime();
|
||||
const start = startOfLocalDay(now);
|
||||
assert.equal(new Date(start).getHours(), 0);
|
||||
assert.equal(new Date(start).getMinutes(), 0);
|
||||
assert.ok(start < now);
|
||||
});
|
||||
|
||||
test("badge label is bare Notifications when empty, else the count", () => {
|
||||
assert.equal(attentionBadgeLabel(0), "Notifications");
|
||||
assert.equal(attentionBadgeLabel(-3), "Notifications");
|
||||
|
||||
@@ -69,6 +69,7 @@ import {
|
||||
TURN_PHASE_WAITING,
|
||||
appendChatNotice,
|
||||
applyChatEvent,
|
||||
applyChatForm,
|
||||
applyChatOverrides,
|
||||
applyChatPermission,
|
||||
approvalCard,
|
||||
@@ -1939,3 +1940,21 @@ test("the C13 wording matches the Android sources verbatim", () => {
|
||||
assert.equal(sessionActivityBadge(sessionActivity(false, false), true), "Open");
|
||||
assert.equal(sessionActivityBadge(sessionActivity(false, false), false), "Idle");
|
||||
});
|
||||
|
||||
test("applyChatForm keeps one pending question and clears it on resolve", () => {
|
||||
const form = { id: "f1", session_id: "s1", kind: "question", title: "Pick", fields: [] };
|
||||
let thread = newChatThread("s1");
|
||||
thread = applyChatEvent(thread, { kind: "form", session_id: "s1", form }, 1);
|
||||
assert.equal(thread.form?.id, "f1");
|
||||
assert.equal(thread.form?.title, "Pick");
|
||||
// A different form replaces the card; the old id cannot revive.
|
||||
thread = applyChatForm(thread, { id: "f2", session_id: "s1", title: "Next" });
|
||||
assert.equal(thread.form?.id, "f2");
|
||||
thread = applyChatForm(thread, { id: "f1", session_id: "s1", resolved: true });
|
||||
assert.equal(thread.form?.id, "f2");
|
||||
thread = applyChatForm(thread, { id: "f2", session_id: "s1", resolved: true });
|
||||
assert.equal(thread.form?.id, "f2");
|
||||
assert.equal(thread.form?.resolved, true);
|
||||
thread = applyChatForm(thread, { id: "f2", session_id: "s1", cancelled: true });
|
||||
assert.equal(thread.form, null);
|
||||
});
|
||||
|
||||
+139
-248
@@ -2627,261 +2627,169 @@ try {
|
||||
};
|
||||
})()`);
|
||||
const attentionCount = Number(bell.dataCount ?? 0);
|
||||
if (!(attentionCount > 0)) {
|
||||
throw new Error(`no attention entries on the live server: ${JSON.stringify(bell)}`);
|
||||
}
|
||||
if (bell.label !== `Notifications, ${attentionCount} needing attention`) {
|
||||
const expectedLabel =
|
||||
attentionCount > 0 ? `Notifications, ${attentionCount} needing attention` : "Notifications";
|
||||
if (bell.label !== expectedLabel) {
|
||||
throw new Error(`the bell's accessible name is wrong: ${bell.label}`);
|
||||
}
|
||||
if (!bell.hasBadge || bell.count !== String(attentionCount)) {
|
||||
if (attentionCount > 0 && (!bell.hasBadge || bell.count !== String(attentionCount))) {
|
||||
throw new Error(`the badge is wrong: ${JSON.stringify(bell)}`);
|
||||
}
|
||||
if (attentionCount === 0 && bell.hasBadge) {
|
||||
throw new Error(`a zero-count bell still has a badge: ${JSON.stringify(bell)}`);
|
||||
}
|
||||
if (await page.evaluate(`!!document.querySelector(".attention-sheet")`)) {
|
||||
throw new Error("the sheet was already open before the bell was clicked");
|
||||
}
|
||||
console.log(` bell: aria-label="${bell.label}", badge=${bell.count}`);
|
||||
console.log(
|
||||
attentionCount > 0
|
||||
? ` bell: aria-label="${bell.label}", badge=${bell.count}`
|
||||
: " bell: no current attention entries; asserting the zero state",
|
||||
);
|
||||
shots.push(await page.screenshot(`${out}/35-attention-bell.png`));
|
||||
|
||||
step("checking the bell's monochrome SVG glyph and the badge's layout isolation");
|
||||
const countProbe = await attentionBellProbe();
|
||||
assertAttentionBellGlyph(countProbe, attentionCount, "wide bell with a count");
|
||||
const wideShift = assertAttentionBellBadgeShift(
|
||||
await attentionBellBadgeShift(),
|
||||
"wide bell with a count",
|
||||
);
|
||||
console.log(
|
||||
` glyph: <${countProbe.tagName} viewBox="${countProbe.viewBox}"> with ${countProbe.pathCount} ` +
|
||||
`unfilled currentColor paths at ${countProbe.width}×${countProbe.height}; ` +
|
||||
`badge "${countProbe.badge.text}" (${countProbe.badge.position})`,
|
||||
);
|
||||
console.log(
|
||||
` no-shift with the badge hidden: bell ${wideShift.bellDelta}px, ` +
|
||||
`Runs title ${wideShift.titleDelta}px`,
|
||||
);
|
||||
assertAttentionBellGlyph(countProbe, attentionCount, "wide bell");
|
||||
|
||||
step("checking the bell at 420x900");
|
||||
await page.resize(420, 900);
|
||||
await eventually(() => page.evaluate(`matchMedia("(min-width: 600px)").matches === false`), {
|
||||
what: "the narrow layout at 420px",
|
||||
});
|
||||
await settle(200);
|
||||
const narrowProbe = await attentionBellProbe();
|
||||
assertAttentionBellGlyph(narrowProbe, attentionCount, "narrow bell with a count");
|
||||
const narrowShift = assertAttentionBellBadgeShift(
|
||||
await attentionBellBadgeShift(),
|
||||
"narrow bell with a count",
|
||||
);
|
||||
shots.push(await page.screenshot(`${out}/35a-attention-bell-narrow-420x900.png`));
|
||||
console.log(
|
||||
` narrow: ${narrowProbe.width}×${narrowProbe.height} glyph, badge ` +
|
||||
`"${narrowProbe.badge.text}" (${narrowProbe.badge.position}); no-shift bell ` +
|
||||
`${narrowShift.bellDelta}px, Runs title ${narrowShift.titleDelta}px`,
|
||||
);
|
||||
await page.resize(1440, 900);
|
||||
await eventually(() => page.evaluate(`matchMedia("(min-width: 600px)").matches === true`), {
|
||||
what: "the wide layout back at 1440px",
|
||||
});
|
||||
await settle(200);
|
||||
if (attentionCount > 0) {
|
||||
step("checking the bell's monochrome SVG glyph and the badge's layout isolation");
|
||||
const wideShift = assertAttentionBellBadgeShift(
|
||||
await attentionBellBadgeShift(),
|
||||
"wide bell with a count",
|
||||
);
|
||||
console.log(
|
||||
` glyph: <${countProbe.tagName} viewBox="${countProbe.viewBox}"> with ${countProbe.pathCount} ` +
|
||||
`unfilled currentColor paths at ${countProbe.width}×${countProbe.height}; ` +
|
||||
`badge "${countProbe.badge.text}" (${countProbe.badge.position})`,
|
||||
);
|
||||
console.log(
|
||||
` no-shift with the badge hidden: bell ${wideShift.bellDelta}px, ` +
|
||||
`Runs title ${wideShift.titleDelta}px`,
|
||||
);
|
||||
|
||||
step("opening the Needs you sheet");
|
||||
await page.click("#attentionBell");
|
||||
await page.waitForSelector(".attention-sheet", { timeout: 15000 });
|
||||
const sheet = await page.evaluate(`(() => {
|
||||
const rows = [...document.querySelectorAll(".attention-sheet .attention-row")];
|
||||
return {
|
||||
step("checking the bell at 420x900");
|
||||
await page.resize(420, 900);
|
||||
await eventually(() => page.evaluate(`matchMedia("(min-width: 600px)").matches === false`), {
|
||||
what: "the narrow layout at 420px",
|
||||
});
|
||||
await settle(200);
|
||||
const narrowProbe = await attentionBellProbe();
|
||||
assertAttentionBellGlyph(narrowProbe, attentionCount, "narrow bell with a count");
|
||||
assertAttentionBellBadgeShift(await attentionBellBadgeShift(), "narrow bell with a count");
|
||||
shots.push(await page.screenshot(`${out}/35a-attention-bell-narrow-420x900.png`));
|
||||
await page.resize(1440, 900);
|
||||
await eventually(() => page.evaluate(`matchMedia("(min-width: 600px)").matches === true`), {
|
||||
what: "the wide layout back at 1440px",
|
||||
});
|
||||
await settle(200);
|
||||
|
||||
step("opening the Needs you sheet");
|
||||
await page.click("#attentionBell");
|
||||
await page.waitForSelector(".attention-sheet", { timeout: 15000 });
|
||||
const sheet = await page.evaluate(`(() => ({
|
||||
title: document.querySelector(".attention-sheet-title")?.textContent ?? "",
|
||||
clearAll: document.querySelector(".attention-clear")?.textContent ?? null,
|
||||
empty: document.querySelector(".attention-empty")?.textContent ?? null,
|
||||
focused: document.activeElement?.className ?? "",
|
||||
rows: rows.map((row) => {
|
||||
const open = row.querySelector(".attention-row-open");
|
||||
const dismiss = row.querySelector(".attention-dismiss");
|
||||
return {
|
||||
runId: Number(open?.dataset.runId),
|
||||
kind: open?.dataset.kind ?? "",
|
||||
label: open?.querySelector(".attention-label")?.textContent ?? "",
|
||||
desc: open?.querySelector(".attention-desc")?.textContent ?? "",
|
||||
icon: open?.querySelector(".attention-icon")?.textContent ?? "",
|
||||
dismissName: dismiss?.getAttribute("aria-label") ?? "",
|
||||
};
|
||||
}),
|
||||
};
|
||||
})()`);
|
||||
if (sheet.title !== "Needs you") throw new Error(`the sheet title is wrong: ${sheet.title}`);
|
||||
if (sheet.empty !== null) throw new Error(`a non-empty sheet showed the empty copy: ${sheet.empty}`);
|
||||
if (sheet.clearAll !== "Clear all") throw new Error(`Clear all is missing: ${sheet.clearAll}`);
|
||||
if (sheet.rows.length !== attentionCount) {
|
||||
throw new Error(`the sheet drew ${sheet.rows.length} rows for a badge of ${attentionCount}`);
|
||||
}
|
||||
if (!sheet.focused.includes("attention-sheet-close")) {
|
||||
throw new Error(`focus did not move into the sheet on open: ${sheet.focused}`);
|
||||
}
|
||||
const kindRanks = { decision: 0, failed: 1 };
|
||||
let lastKindRank = -1;
|
||||
for (const row of sheet.rows) {
|
||||
if (!row.icon) throw new Error(`row ${row.runId} has no status icon`);
|
||||
if (!row.label) throw new Error(`row ${row.runId} has no primary label`);
|
||||
if (!row.desc.includes(" · ")) throw new Error(`row ${row.runId} description is wrong: ${row.desc}`);
|
||||
// The dismiss control is named for the row it clears (L7 M6), e.g.
|
||||
// `Dismiss Web: live decision confirm (R11)`; the run id appears only for a
|
||||
// repeated label, so assert the shared prefix rather than the old bare word.
|
||||
if (!row.dismissName.startsWith("Dismiss ")) {
|
||||
throw new Error(`row ${row.runId}'s trailing control is not named Dismiss: ${row.dismissName}`);
|
||||
rows: [...document.querySelectorAll(".attention-sheet .attention-row")].map((row) => ({
|
||||
runId: Number(row.querySelector(".attention-row-open")?.dataset.runId),
|
||||
kind: row.querySelector(".attention-row-open")?.dataset.kind ?? "",
|
||||
label: row.querySelector(".attention-label")?.textContent ?? "",
|
||||
desc: row.querySelector(".attention-desc")?.textContent ?? "",
|
||||
dismissName: row.querySelector(".attention-dismiss")?.getAttribute("aria-label") ?? "",
|
||||
})),
|
||||
}))()`);
|
||||
if (sheet.title !== "Needs you") throw new Error(`the sheet title is wrong: ${sheet.title}`);
|
||||
if (sheet.empty !== null) throw new Error(`a non-empty sheet showed the empty copy: ${sheet.empty}`);
|
||||
if (sheet.clearAll !== "Clear all") throw new Error(`Clear all is missing: ${sheet.clearAll}`);
|
||||
if (sheet.rows.length !== attentionCount) {
|
||||
throw new Error(`the sheet drew ${sheet.rows.length} rows for a badge of ${attentionCount}`);
|
||||
}
|
||||
const rank = kindRanks[row.kind];
|
||||
if (rank == null) throw new Error(`row ${row.runId} has an unknown kind ${row.kind}`);
|
||||
if (rank < lastKindRank) throw new Error(`the rows are out of kind order at run ${row.runId}`);
|
||||
lastKindRank = rank;
|
||||
}
|
||||
const firstRow = sheet.rows[0];
|
||||
const kindName = (kind) => (kind === "decision" ? "Decision" : "Failed");
|
||||
console.log(
|
||||
` sheet: ${sheet.rows.length} row(s); first ${firstRow.runId} (${firstRow.kind}) ` +
|
||||
`"${firstRow.label}" — ${firstRow.desc}`,
|
||||
);
|
||||
if (!sheet.rows.some((row) => row.kind === "decision")) {
|
||||
console.log(
|
||||
" -- no `waiting` run exists on the live server; the sheet used real failed runs " +
|
||||
"and the decision path (open without dismissing) is covered by unit tests",
|
||||
);
|
||||
}
|
||||
shots.push(await page.screenshot(`${out}/36-attention-sheet.png`));
|
||||
if (!sheet.focused.includes("attention-sheet-close")) {
|
||||
throw new Error(`focus did not move into the sheet on open: ${sheet.focused}`);
|
||||
}
|
||||
for (const row of sheet.rows) {
|
||||
if (!row.label || !row.desc.includes(" · ")) {
|
||||
throw new Error(`row ${row.runId} is missing its label or description: ${JSON.stringify(row)}`);
|
||||
}
|
||||
if (!row.dismissName.startsWith("Dismiss ")) {
|
||||
throw new Error(`row ${row.runId}'s trailing control is not named Dismiss: ${row.dismissName}`);
|
||||
}
|
||||
}
|
||||
console.log(` sheet: ${sheet.rows.length} row(s); first ${sheet.rows[0].runId} (${sheet.rows[0].kind})`);
|
||||
shots.push(await page.screenshot(`${out}/36-attention-sheet.png`));
|
||||
|
||||
step("dismissing one entry individually");
|
||||
await page.evaluate(`document.querySelector(".attention-sheet .attention-row .attention-dismiss").click()`);
|
||||
await eventually(
|
||||
async () =>
|
||||
(await page.evaluate(`document.querySelectorAll(".attention-sheet .attention-row").length`)) ===
|
||||
attentionCount - 1,
|
||||
{ what: "the individual dismissal to land" },
|
||||
);
|
||||
const afterDismiss = await page.evaluate(`(() => ({
|
||||
rows: document.querySelectorAll(".attention-sheet .attention-row").length,
|
||||
badge: document.querySelector("#attentionBell .attention-badge")?.dataset.count ?? null,
|
||||
svg: !!document.querySelector("#attentionBell > svg.attention-bell-icon"),
|
||||
pathCount: document.querySelectorAll("#attentionBell > svg.attention-bell-icon path").length,
|
||||
stored: localStorage.getItem("pipelines.web.attention.v1"),
|
||||
}))()`);
|
||||
if (afterDismiss.rows !== attentionCount - 1) {
|
||||
throw new Error(`the sheet still shows ${afterDismiss.rows} rows after one dismissal`);
|
||||
}
|
||||
if (Number(afterDismiss.badge) !== attentionCount - 1) {
|
||||
throw new Error(`the badge did not follow the dismissal: ${afterDismiss.badge}`);
|
||||
}
|
||||
if (!afterDismiss.svg || afterDismiss.pathCount !== countProbe.pathCount) {
|
||||
throw new Error(
|
||||
`the in-place badge refresh rebuilt the glyph: ${JSON.stringify(afterDismiss)}`,
|
||||
);
|
||||
}
|
||||
if (!String(afterDismiss.stored).includes(`${firstRow.runId}:${kindName(firstRow.kind)}`)) {
|
||||
throw new Error(`the dismissed identity was not persisted: ${afterDismiss.stored}`);
|
||||
}
|
||||
console.log(
|
||||
` dismissed ${firstRow.runId}:${kindName(firstRow.kind)}; rows ${attentionCount} -> ` +
|
||||
`${afterDismiss.rows}, stored ${afterDismiss.stored}`,
|
||||
);
|
||||
shots.push(await page.screenshot(`${out}/37-attention-dismissed.png`));
|
||||
|
||||
step("opening a Failed row: it opens the run and persists its dismissal");
|
||||
const rowToOpen = await page.evaluate(`(() => {
|
||||
const open = document.querySelector(".attention-sheet .attention-row .attention-row-open");
|
||||
if (!open) return null;
|
||||
return { runId: Number(open.dataset.runId), kind: open.dataset.kind };
|
||||
})()`);
|
||||
if (!rowToOpen) {
|
||||
// The history may hold a single attention entry (for example a fresh database
|
||||
// where only the current run has failed); the dismissal above then emptied it.
|
||||
console.log(" -- no remaining attention row to open; the row-activated path is unit-tested");
|
||||
} else if (rowToOpen.kind !== "failed") {
|
||||
console.log(` -- the remaining row is ${rowToOpen.kind}, not Failed; skipped the open check`);
|
||||
} else {
|
||||
await page.evaluate(`document.querySelector(".attention-sheet .attention-row .attention-row-open").click()`);
|
||||
step("dismissing one entry individually");
|
||||
await page.evaluate(`document.querySelector(".attention-sheet .attention-row .attention-dismiss").click()`);
|
||||
await eventually(
|
||||
async () => !(await page.evaluate(`!!document.querySelector(".attention-sheet")`)),
|
||||
{ what: "the sheet to close on row activation" },
|
||||
async () => (await page.evaluate(`document.querySelectorAll(".attention-sheet .attention-row").length`)) === attentionCount - 1,
|
||||
{ what: "the individual dismissal to land" },
|
||||
);
|
||||
await page.waitForSelector("#detailTitle", { timeout: 25000 });
|
||||
const openedIdentity = await page.evaluate(
|
||||
`document.querySelector(".run-identity")?.textContent ?? ""`,
|
||||
);
|
||||
if (!openedIdentity.startsWith(`run ${rowToOpen.runId} ·`)) {
|
||||
throw new Error(`row ${rowToOpen.runId} did not open its run: ${openedIdentity}`);
|
||||
const afterDismiss = await page.evaluate(`(() => ({
|
||||
rows: document.querySelectorAll(".attention-sheet .attention-row").length,
|
||||
badge: document.querySelector("#attentionBell .attention-badge")?.dataset.count ?? null,
|
||||
stored: localStorage.getItem("pipelines.web.attention.v1"),
|
||||
}))()`);
|
||||
if (afterDismiss.rows !== attentionCount - 1 || Number(afterDismiss.badge) !== attentionCount - 1) {
|
||||
throw new Error(`the dismissal did not update the sheet/badge: ${JSON.stringify(afterDismiss)}`);
|
||||
}
|
||||
const storedAfterOpen = await page.evaluate(`localStorage.getItem("pipelines.web.attention.v1")`);
|
||||
if (!String(storedAfterOpen).includes(`${rowToOpen.runId}:Failed`)) {
|
||||
throw new Error(`opening a Failed row did not persist its dismissal: ${storedAfterOpen}`);
|
||||
}
|
||||
console.log(` opened run ${rowToOpen.runId}; ${rowToOpen.runId}:Failed now persisted`);
|
||||
}
|
||||
console.log(` dismissed one; rows ${attentionCount} -> ${afterDismiss.rows}`);
|
||||
shots.push(await page.screenshot(`${out}/37-attention-dismissed.png`));
|
||||
|
||||
step("reopening the sheet and clearing all");
|
||||
// A skipped row-open can leave the sheet up; close it so the bell reopens it.
|
||||
if (await page.evaluate(`!!document.querySelector(".attention-sheet")`)) {
|
||||
await page.evaluate(
|
||||
`document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }))`,
|
||||
);
|
||||
await eventually(
|
||||
async () => !(await page.evaluate(`!!document.querySelector(".attention-sheet")`)),
|
||||
{ what: "the attention sheet to close before reopening" },
|
||||
);
|
||||
}
|
||||
await page.click("#attentionBell");
|
||||
await page.waitForSelector(".attention-sheet", { timeout: 15000 });
|
||||
const beforeClear = await page.evaluate(
|
||||
`document.querySelectorAll(".attention-sheet .attention-row").length`,
|
||||
);
|
||||
if (beforeClear > attentionCount) {
|
||||
throw new Error(`the sheet grew: ${beforeClear} rows from ${attentionCount} entries`);
|
||||
}
|
||||
if (beforeClear > 0) {
|
||||
await page.evaluate(`document.querySelector(".attention-sheet .attention-clear").click()`);
|
||||
step("reopening the sheet and clearing all");
|
||||
if (await page.evaluate(`!!document.querySelector(".attention-sheet")`)) {
|
||||
await page.evaluate(`document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }))`);
|
||||
await eventually(async () => !(await page.evaluate(`!!document.querySelector(".attention-sheet")`)), {
|
||||
what: "the attention sheet to close before reopening",
|
||||
});
|
||||
}
|
||||
await page.click("#attentionBell");
|
||||
await page.waitForSelector(".attention-sheet", { timeout: 15000 });
|
||||
const beforeClear = await page.evaluate(`document.querySelectorAll(".attention-sheet .attention-row").length`);
|
||||
if (beforeClear > 0) {
|
||||
await page.evaluate(`document.querySelector(".attention-sheet .attention-clear").click()`);
|
||||
await eventually(
|
||||
async () => (await page.evaluate(`document.querySelector(".attention-empty")?.textContent ?? ""`)) === "Nothing needs you right now.",
|
||||
{ what: "the empty attention state after Clear all" },
|
||||
);
|
||||
if (await page.evaluate(`!!document.querySelector("#attentionBell .attention-badge")`)) {
|
||||
throw new Error("the badge is still visible after Clear all");
|
||||
}
|
||||
}
|
||||
console.log(" Clear all left the empty attention state and no badge");
|
||||
shots.push(await page.screenshot(`${out}/38-attention-cleared.png`));
|
||||
|
||||
step("closing the sheet with Escape returns focus to the bell");
|
||||
await page.evaluate(`document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }))`);
|
||||
await eventually(async () => !(await page.evaluate(`!!document.querySelector(".attention-sheet")`)), {
|
||||
what: "Escape to close the attention sheet",
|
||||
});
|
||||
if ((await page.evaluate(`document.activeElement?.id ?? ""`)) !== "attentionBell") {
|
||||
throw new Error("Escape did not return focus to the bell");
|
||||
}
|
||||
} else {
|
||||
console.log(" -- the sheet was already emptied by the dismissals; asserting the empty state");
|
||||
step("opening an empty Needs you sheet");
|
||||
await page.click("#attentionBell");
|
||||
await page.waitForSelector(".attention-sheet", { timeout: 15000 });
|
||||
const empty = await page.evaluate(`(() => ({
|
||||
title: document.querySelector(".attention-sheet-title")?.textContent ?? "",
|
||||
empty: document.querySelector(".attention-empty")?.textContent ?? "",
|
||||
rows: document.querySelectorAll(".attention-sheet .attention-row").length,
|
||||
clear: !!document.querySelector(".attention-clear"),
|
||||
focused: document.activeElement?.className ?? "",
|
||||
}))()`);
|
||||
if (empty.title !== "Needs you") throw new Error(`the sheet title is wrong: ${empty.title}`);
|
||||
if (empty.empty !== "Nothing needs you right now.") throw new Error(`the empty copy is wrong: ${empty.empty}`);
|
||||
if (empty.rows !== 0 || empty.clear) throw new Error(`an empty sheet drew rows or Clear all: ${JSON.stringify(empty)}`);
|
||||
if (!empty.focused.includes("attention-sheet-close")) throw new Error("focus did not move into the empty sheet");
|
||||
await page.evaluate(`document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }))`);
|
||||
await eventually(async () => !(await page.evaluate(`!!document.querySelector(".attention-sheet")`)), {
|
||||
what: "Escape to close the empty attention sheet",
|
||||
});
|
||||
console.log(" empty sheet: Nothing needs you right now.; no rows, no Clear all");
|
||||
}
|
||||
await eventually(
|
||||
async () =>
|
||||
(await page.evaluate(`document.querySelector(".attention-empty")?.textContent ?? ""`)) ===
|
||||
"Nothing needs you right now.",
|
||||
{ what: "the empty attention state after Clear all" },
|
||||
);
|
||||
const cleared = await page.evaluate(`(() => ({
|
||||
empty: document.querySelector(".attention-empty")?.textContent ?? "",
|
||||
rows: document.querySelectorAll(".attention-sheet .attention-row").length,
|
||||
clearAll: !!document.querySelector(".attention-clear"),
|
||||
badge: !!document.querySelector("#attentionBell .attention-badge"),
|
||||
label: document.querySelector("#attentionBell").getAttribute("aria-label"),
|
||||
badges: document.querySelectorAll(".attention-badge").length,
|
||||
}))()`);
|
||||
if (cleared.empty !== "Nothing needs you right now.") {
|
||||
throw new Error(`the empty copy is wrong: ${cleared.empty}`);
|
||||
}
|
||||
if (cleared.rows !== 0) throw new Error(`the cleared sheet still shows ${cleared.rows} rows`);
|
||||
if (cleared.clearAll) throw new Error("Clear all is still offered on the empty sheet");
|
||||
if (cleared.badge || cleared.badges !== 0) throw new Error("the badge is still visible after Clear all");
|
||||
if (cleared.label !== "Notifications") {
|
||||
throw new Error(`the emptied bell is named wrong: ${cleared.label}`);
|
||||
}
|
||||
console.log(` after Clear all: "${cleared.empty}", no Clear all, bell aria-label="${cleared.label}"`);
|
||||
shots.push(await page.screenshot(`${out}/38-attention-cleared.png`));
|
||||
|
||||
step("closing the sheet with Escape returns focus to the bell");
|
||||
await page.evaluate(
|
||||
`document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }))`,
|
||||
);
|
||||
await eventually(
|
||||
async () => !(await page.evaluate(`!!document.querySelector(".attention-sheet")`)),
|
||||
{ what: "Escape to close the attention sheet" },
|
||||
);
|
||||
const focusAfterEscape = await page.evaluate(`document.activeElement?.id ?? ""`);
|
||||
if (focusAfterEscape !== "attentionBell") {
|
||||
throw new Error(`Escape did not return focus to the bell: ${focusAfterEscape}`);
|
||||
}
|
||||
console.log(" Escape closed the sheet and focus returned to #attentionBell");
|
||||
|
||||
step("capturing the zero-state bell at 1440x900 and 420x900");
|
||||
// A Failed row opened a run detail; Back to list makes the Runs heading the
|
||||
// visible evidence (its control is hidden on the wide layout but is the same
|
||||
// handler showList uses, and the narrow capture needs the list pane active).
|
||||
await returnToRunsList();
|
||||
await page.evaluate(`document.activeElement?.blur?.()`);
|
||||
await settle(150);
|
||||
@@ -2889,10 +2797,7 @@ try {
|
||||
assertAttentionBellGlyph(zeroProbe, 0, "wide bell at zero");
|
||||
assertSameAttentionGlyph(zeroProbe, countProbe, "wide bell at zero");
|
||||
shots.push(await page.screenshot(`${out}/38a-attention-bell-zero-1440x900.png`));
|
||||
console.log(
|
||||
` zero: no badge, aria-label="${zeroProbe.label}", blank text, ` +
|
||||
`${zeroProbe.pathCount} unchanged paths at ${zeroProbe.width}×${zeroProbe.height}`,
|
||||
);
|
||||
console.log(` zero: no badge, aria-label="${zeroProbe.label}", ${zeroProbe.pathCount} unchanged paths`);
|
||||
|
||||
await page.resize(420, 900);
|
||||
await eventually(() => page.evaluate(`matchMedia("(min-width: 600px)").matches === false`), {
|
||||
@@ -2903,27 +2808,13 @@ try {
|
||||
assertAttentionBellGlyph(zeroNarrowProbe, 0, "narrow bell at zero");
|
||||
assertSameAttentionGlyph(zeroNarrowProbe, countProbe, "narrow bell at zero");
|
||||
shots.push(await page.screenshot(`${out}/38b-attention-bell-zero-420x900.png`));
|
||||
console.log(
|
||||
` zero narrow: no badge, aria-label="${zeroNarrowProbe.label}", ` +
|
||||
`${zeroNarrowProbe.width}×${zeroNarrowProbe.height} glyph`,
|
||||
);
|
||||
console.log(` zero narrow: no badge, aria-label="${zeroNarrowProbe.label}"`);
|
||||
await page.resize(1440, 900);
|
||||
await eventually(() => page.evaluate(`matchMedia("(min-width: 600px)").matches === true`), {
|
||||
what: "the wide layout back at 1440px",
|
||||
});
|
||||
await settle(200);
|
||||
|
||||
step("closing the sheet with a backdrop click");
|
||||
await page.click("#attentionBell");
|
||||
await page.waitForSelector(".attention-sheet", { timeout: 15000 });
|
||||
await page.evaluate(`document.querySelector(".attention-sheet").click()`);
|
||||
await eventually(
|
||||
async () => !(await page.evaluate(`!!document.querySelector(".attention-sheet")`)),
|
||||
{ what: "the backdrop click to close the attention sheet" },
|
||||
);
|
||||
console.log(" backdrop click closed the sheet");
|
||||
|
||||
|
||||
step(`scrolling the list to the older day group (${fullDateHeader})`);
|
||||
const scrolledTo = await page.evaluate(`(() => {
|
||||
const scroll = document.querySelector(".run-scroll");
|
||||
|
||||
Reference in New Issue
Block a user