Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

test(e2e): align the transcript probes with the settled folding defaults

v_wyxgwanged147aa98bbf
diff --git a/apps/desktop/src/styles/messages.css b/apps/desktop/src/styles/messages.css
index 0c618cea8..292a119cb 100644
--- a/apps/desktop/src/styles/messages.css
+++ b/apps/desktop/src/styles/messages.css
@@ -2348,33 +2348,6 @@
flex: none;
}
-/*
- * Issue counts are inline metadata in an activity-group header, never a second
- * line of the row. The icon and its localized count stay on one centered line
- * and truncate together when the band runs out of width.
- */
-.activity-issue-count {
- display: inline-flex;
- flex: 0 1 auto;
- align-items: center;
- gap: 4px;
- min-width: 0;
- color: var(--ds-error);
- font-size: var(--text-xs-plus);
- white-space: nowrap;
-}
-
-.activity-issue-count > svg {
- flex: none;
-}
-
-.activity-issue-count > span {
- min-width: 0;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
/* The caret closes the row, so a short label keeps it at the trailing edge. */
.tool-activity-caret {
display: inline-flex;
diff --git a/scripts/e2e/transcript-auto-collapse.tsx b/scripts/e2e/transcript-auto-collapse.tsx
index 1d20b4920..516083522 100644
--- a/scripts/e2e/transcript-auto-collapse.tsx
+++ b/scripts/e2e/transcript-auto-collapse.tsx
@@ -223,7 +223,7 @@ export async function transcriptAutoCollapseProbe() {
);
check(
[...container.querySelectorAll(".tool-row.thinking .tool-row-header")].every(expanded),
- `${mode}: Show thinking keeps reasoning expanded`,
+ `${mode}: reasoning the turn is still streaming stays expanded`,
);
// A manual close is authoritative while the turn keeps streaming.
@@ -236,19 +236,43 @@ export async function transcriptAutoCollapseProbe() {
click(header());
focusOutside();
- // Settled: plain tool rows fall back to the size rule, while reasoning the
- // reader asked to see is never folded away.
+ // Settled: both nested levels fold, whatever the group's size.
render(`settled-${mode}`, [...reads, answer], false);
check(
mode === "flat" || !expanded(groupHeader()),
- `${mode}: a settled group of plain tool rows folds when it is large`,
+ `${mode}: a settled group of plain tool rows folds`,
);
+ click(header());
+ check(
+ mode === "flat" || !expanded(groupHeader()),
+ `${mode}: opening the process leaves the settled group folded`,
+ );
+ configure({ transcriptDisplayMode: mode, autoCollapseSettledGroups: false });
+ render(`settled-open-${mode}`, [...reads, answer], false);
+ click(header());
+ check(
+ mode === "flat" || expanded(groupHeader()),
+ `${mode}: turning auto-collapse off opens the settled group`,
+ );
+ configure({ transcriptDisplayMode: mode });
render(`reasoning-${mode}`, [thoughtDone, ...reads, answer], false);
click(header());
check(
- (mode === "flat" || expanded(groupHeader())) && expanded(thoughtHeader()),
- `${mode}: settled reasoning stays visible under Show thinking`,
+ (mode === "flat" || !expanded(groupHeader())) && !expanded(thoughtHeader()),
+ `${mode}: a settled group and the reasoning inside it both fold`,
);
+ // Opening the group exposes the reasoning header, still folded; the row
+ // opens only on its own request.
+ configure({ transcriptDisplayMode: mode, autoCollapseSettledGroups: false });
+ render(`reasoning-open-${mode}`, [thoughtDone, ...reads, answer], false);
+ click(header());
+ check(
+ !expanded(thoughtHeader()),
+ `${mode}: an opened group does not open the reasoning inside it`,
+ );
+ click(thoughtHeader());
+ check(expanded(thoughtHeader()), `${mode}: the reasoning row opens on request`);
+ configure({ transcriptDisplayMode: mode });
configure({ transcriptDisplayMode: mode, showThinking: false });
check(
@@ -257,49 +281,26 @@ export async function transcriptAutoCollapseProbe() {
);
configure({ transcriptDisplayMode: mode });
check(
- expanded(thoughtHeader()),
- `${mode}: re-enabling Show thinking restores expanded reasoning`,
+ container.querySelector(".tool-row.thinking .tool-row-header") !== null,
+ `${mode}: re-enabling Show thinking restores the reasoning row`,
);
focusOutside();
}
configure();
- // The issue counter is real header metadata with the app stylesheet: icon
- // and localized count stay on one centered line at both locale widths.
- for (const locale of ["en", "zh-CN"]) {
- await i18n.changeLanguage(locale);
- render(`issues-${locale}`, [thoughtLive, ...reads], true);
- for (const width of [320, 800]) {
- host.style.width = `${width}px`;
- for (const zoom of [1, 1.5]) {
- host.style.zoom = String(zoom);
- const issue = container.querySelector<HTMLElement>(".activity-issue-count");
- const icon = issue?.querySelector("svg");
- if (!issue || !icon) throw new Error("Missing activity issue counter");
- const text = document.createRange();
- text.selectNodeContents(issue);
- text.setStartAfter(icon);
- const iconRect = icon.getBoundingClientRect();
- const textRect = text.getBoundingClientRect();
- const issueRect = issue.getBoundingClientRect();
- const parentRect = issue.parentElement?.getBoundingClientRect();
- check(
- textRect.width > 0 &&
- textRect.left >= iconRect.right &&
- Math.abs(
- (textRect.top + textRect.bottom - iconRect.top - iconRect.bottom) / 2,
- ) < 3 * zoom,
- `${locale}/${width}/${zoom}: issue icon and count share one centered line`,
- );
- check(
- Boolean(parentRect) &&
- issueRect.right <= (parentRect as DOMRect).right + 1 &&
- issueRect.height <= (parentRect as DOMRect).height + 1,
- `${locale}/${width}/${zoom}: the issue counter stays inside its header row`,
- );
- }
- }
+ // The group header no longer renders an issue counter: a failed call is
+ // reported by the tool row that failed, not repeated on the group.
+ for (const mode of ["flat", "command-first", "fully-folded"] as const) {
+ configure({ transcriptDisplayMode: mode });
+ render(`no-issue-${mode}`, [thoughtLive, ...reads], true);
+ check(
+ container.querySelector(".activity-issue-count") === null,
+ `${mode}: the group header carries no issue counter`,
+ );
}
+ configure();
+ host.style.width = "800px";
+ host.style.zoom = "1";
check(
errors.length === 0,
`React rendering has no errors: ${errors.map(String).join("; ")}`,
diff --git a/scripts/e2e/turn-process.tsx b/scripts/e2e/turn-process.tsx
index 4aac1304e..6c363ebea 100644
--- a/scripts/e2e/turn-process.tsx
+++ b/scripts/e2e/turn-process.tsx
@@ -249,9 +249,18 @@ export async function turnProcessProbe() {
visible(bash1Row) && visible(bash2Row),
"opening the process reveals the Bash rows",
);
+ const foldedGroupLabel =
+ completedGroupHeader?.querySelector(".tool-activity-label")?.textContent ?? "";
check(
- visible(row("read")) && completedGroupHeader?.getAttribute("aria-expanded") === "true",
- "opening the process reveals the already-open activity group with its tool rows",
+ !visible(row("read")) && completedGroupHeader?.getAttribute("aria-expanded") === "false",
+ "opening the process reveals the folded activity group, not its tool rows",
+ );
+ check(
+ foldedGroupLabel.includes(i18n.t("chat.activityBucket.search")) &&
+ foldedGroupLabel.includes(i18n.t("chat.activityBucket.read")) &&
+ completedGroupHeader?.querySelector(".tool-activity-ops")?.textContent ===
+ i18n.t("chat.activityOps", { count: 2 }),
+ "a folded group header names the actions it contains and the operation count",
);
// Real geometry and hit testing: the turn title, a nested group title and a
@@ -666,8 +675,24 @@ export async function turnProcessProbe() {
];
check(
liveThinkingHeaders.length === 2 &&
- liveThinkingHeaders.every((header) => header.getAttribute("aria-expanded") === "true"),
- "fully folded expands each visible thinking row by default",
+ liveThinkingHeaders.every((header) => header.getAttribute("aria-expanded") === "false"),
+ "reasoning that is no longer the live tail stays folded",
+ );
+ // The row the turn is still producing is the only one that starts expanded.
+ render(
+ [earlierThinking, read, liveThinking],
+ true,
+ null,
+ "fully-folded-thinking-live-tail",
+ );
+ const tailThinkingHeaders = [
+ ...container.querySelectorAll<HTMLElement>(".tool-row.thinking .tool-row-header"),
+ ];
+ check(
+ tailThinkingHeaders.length === 2 &&
+ tailThinkingHeaders[0]?.getAttribute("aria-expanded") === "false" &&
+ tailThinkingHeaders[1]?.getAttribute("aria-expanded") === "true",
+ "the reasoning row the live turn is still streaming starts expanded",
);
render(
[earlierThinking, read, completedThinking, thinkingAnswer],
@@ -687,13 +712,29 @@ export async function turnProcessProbe() {
".process-activity-group.grouped",
)?.querySelector<HTMLElement>(".tool-activity-header");
check(
- settledThinkingGroupHeader?.getAttribute("aria-expanded") === "true" &&
+ settledThinkingGroupHeader?.getAttribute("aria-expanded") === "false" &&
settledThinkingHeaders.length === 2 &&
- settledThinkingHeaders.every((header) => header.getAttribute("aria-expanded") === "true") &&
- container.textContent?.includes("Earlier reasoning remains available.") === true &&
- container.textContent?.includes("Latest reasoning remains available.") === true &&
- row("read")?.querySelector<HTMLElement>(".tool-row-header")?.getAttribute("aria-expanded") === "false",
- "reopening the process reveals the open group and reasoning while tool payloads stay collapsed",
+ settledThinkingHeaders.every((header) => header.getAttribute("aria-expanded") === "false") &&
+ container.textContent?.includes("Earlier reasoning remains available.") === false &&
+ !visible(row("read")),
+ "a settled process settles both its group and its reasoning",
+ );
+ // Opening the group restores each reasoning row's own answer: the rows stay
+ // folded until the reader opens them, and tool payloads stay folded too.
+ click(settledThinkingGroupHeader ?? null);
+ check(
+ settledThinkingGroupHeader?.getAttribute("aria-expanded") === "true" &&
+ settledThinkingHeaders.every((header) => header.getAttribute("aria-expanded") === "false"),
+ "opening the group does not expand the reasoning inside it",
+ );
+ click(settledThinkingHeaders[0] ?? null);
+ check(
+ container.textContent?.includes("Earlier reasoning remains available.") === true,
+ "a folded reasoning row opens on request",
+ );
+ check(
+ row("read")?.querySelector<HTMLElement>(".tool-row-header")?.getAttribute("aria-expanded") === "false",
+ "tool payloads stay collapsed inside an opened group",
);
const largeGroup = Array.from({ length: 5 }, (_, index) =>
@@ -711,7 +752,24 @@ export async function turnProcessProbe() {
click(processHeaders()[0] ?? null);
check(
largeGroupHeader?.getAttribute("aria-expanded") === "false",
- "large activity groups remain collapsed by default",
+ "a settled group folds whatever its size",
+ );
+ // The switch is the only tier: turning auto-collapse off opens every settled
+ // group, including a five-row one.
+ setSettings({ autoCollapseSettledGroups: false });
+ render(
+ [...largeGroup, thinkingAnswer],
+ false,
+ null,
+ "large-completed-activity-group-open",
+ );
+ click(processHeaders()[0] ?? null);
+ const openedLargeGroupHeader = row("large-group-0")?.closest<HTMLElement>(
+ ".process-activity-group.grouped",
+ )?.querySelector<HTMLElement>(".tool-activity-header");
+ check(
+ openedLargeGroupHeader?.getAttribute("aria-expanded") === "true",
+ "turning auto-collapse off leaves settled groups open",
);
setSettings();