Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(test): align transcript checks with current rendering
new-Beginnerb3acaae97b25
diff --git a/apps/desktop/test/gen-ui-card.test.mjs b/apps/desktop/test/gen-ui-card.test.mjsindex 3a9f2a55c..660691027 100644--- a/apps/desktop/test/gen-ui-card.test.mjs+++ b/apps/desktop/test/gen-ui-card.test.mjs@@ -32,7 +32,9 @@ test("the assistant bubble renders split content and cards; Markdown stays gen-u// The feature is opt-in, so the bubble passes the setting into the split.assert.match(bubble, /s\.settings\?\.inlineVisualizations === true/);assert.match(bubble, /const genUi = useGenUiSplit\(displayContent, streaming, inlineVisualizations\);/);- assert.match(bubble, /<Markdown source=\{genUi\.content\} streaming=\{streaming\} \/>/);+ assert.match(bubble, /<TranscriptProse source=\{genUi\.content\} streaming=\{streaming\} \/>/);+ const prose = await read("../src/features/chat/transcript/TranscriptProse.tsx");+ assert.match(prose, /<Markdown source=\{source\} streaming=\{streaming\} \/>/);assert.match(bubble, /<GenUiCards references=\{genUi\.references\} sessionId=\{sessionId\} remote=\{remote\} \/>/);assert.match(bubble, /const sessionId = useSlotSessionId\(\);/);const markdown = await read("../src/components/Markdown.tsx");diff --git a/apps/desktop/test/session-switch-performance.test.mjs b/apps/desktop/test/session-switch-performance.test.mjsindex 6c925c109..0e309bde3 100644--- a/apps/desktop/test/session-switch-performance.test.mjs+++ b/apps/desktop/test/session-switch-performance.test.mjs@@ -162,7 +162,7 @@ test("a hidden pane does no reading work off screen", () => {assert.match(transcript, /if \(!paneVisible\) return;\n\s*let frame = 0;/);assert.match(transcript,- /const loadOlder = useCallback\(\(background = false\) => \{[\s\S]*?if \(!paneVisibleRef\.current\) return;/,+ /const loadOlder = useCallback\(\(\) => \{[\s\S]*?if \(!paneVisibleRef\.current\) return;/,);assert.match(transcript, /\{paneVisible && !veilCovering \? \(\s*<ConversationMinimap/);});diff --git a/scripts/e2e/transcript-long-history.tsx b/scripts/e2e/transcript-long-history.tsxindex 16a260556..d24929db2 100644--- a/scripts/e2e/transcript-long-history.tsx+++ b/scripts/e2e/transcript-long-history.tsx@@ -275,13 +275,35 @@ export async function transcriptLongHistoryProbe() {scroller.scrollTop = Math.max(0, scroller.scrollHeight - scroller.clientHeight - 240);scroller.dispatchEvent(new Event("scroll", { bubbles: true }));await settled();+ const afterLayout = () => new Promise<void>((resolve) => {+ const observer = new ResizeObserver(() => { observer.disconnect(); resolve(); });+ observer.observe(element(".thread-content"));+ });+ await afterLayout();+ const viewport = scroller.getBoundingClientRect();+ const proseSelector = ".prose-chat p, .message-user-text";+ const readingPoint = [...scroller.querySelectorAll<HTMLElement>(proseSelector)].find((node) => {+ const rect = node.getBoundingClientRect();+ return rect.height > 0 && rect.bottom > viewport.top && rect.top < viewport.bottom;+ });+ const readingMessageId = readingPoint?.closest<HTMLElement>("[data-message-id]")?.dataset.messageId;+ const readingText = readingPoint?.textContent?.slice(0, 80);+ assert(readingPoint && readingMessageId && readingText, "visible reading content missing");+ const readingOffset = readingPoint.getBoundingClientRect().top - viewport.top;const readingTop = scroller.scrollTop;const readingHeight = scroller.scrollHeight;await stream(largest, " reader-stays");- assert(Math.abs(scroller.scrollTop - readingTop) < 2,+ // Layout compensation may move scrollTop; the same readable text must stay put.+ await afterLayout();+ const readingRow = scroller.querySelector<HTMLElement>(`[data-message-id="${CSS.escape(readingMessageId)}"]`);+ const currentPoint = [...(readingRow?.querySelectorAll<HTMLElement>(proseSelector) ?? [])]+ .find((node) => node.textContent?.startsWith(readingText));+ assert(currentPoint, "stream removed the visible reading content");+ const currentOffset = currentPoint.getBoundingClientRect().top - scroller.getBoundingClientRect().top;+ assert(Math.abs(currentOffset - readingOffset) < 2,`stream stole the reader's scroll position: ${JSON.stringify({- before: { top: readingTop, height: readingHeight },- after: { top: scroller.scrollTop, height: scroller.scrollHeight },+ before: { top: readingTop, height: readingHeight, offset: readingOffset },+ after: { top: scroller.scrollTop, height: scroller.scrollHeight, offset: currentOffset },viewport: scroller.clientHeight,reducedMotion: window.matchMedia("(prefers-reduced-motion: reduce)").matches,})}`);