mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-10 10:25:03 +00:00
* feat(app): reveal streaming text as one continuous fade front Streaming assistant text is released by word and every character fades in over the same 150 ms envelope from a start time owned by the message. Start times never decrease in reading order, so a line paints as a single front moving left to right, however the text is chunked. Per-word envelopes with an internal stagger let the next word's first letter overtake the previous word's last letter, which read as holes and flashing words at the real frame rate; 100 ms frame strips hid it. Native renderers receive the fade ranges as a prop on a host view wrapping the root Text, so ranges and text land in the same Fabric mount transaction. The earlier binding sent ranges through a separate async module call keyed by view tag and had to reconcile them against the view's text; on a fast phone the UI thread lags JS by several commits, mounts and calls interleave, and every reconciliation heuristic guessed wrong. Native code no longer infers newness or creates start times. The mock load-test provider now separates cycles with a blank line so a cycle heading is not appended to the previous paragraph. * fix(ci): refresh streaming dependencies and isolate E2E setup * test(app): distinguish fade cleanup from Markdown replacement * test(app): detect restarted fades during Markdown updates * docs(app): keep streaming guidance focused on constraints and QA * test(app): control animation time in Android fade assertions Fixed wall-clock sleeps let emulator scheduling select the sampled animation frame. Inject the animator time source and drive paint at exact timestamps within one UI-thread operation; production keeps the system clock. Verify the mid-fade sample and the exact cleanup boundary without sleeps, polling, or retries. * fix(test): compile the desktop renderer before lifecycle checks The lifecycle fixture treated Metro /status as app readiness. Its first Settings click therefore spent its 90-second UI budget compiling the cold bundle. An isolated cold-cache run restricted to one CPU reproduced the click timeout before the app runtime had loaded. Reuse the browser suite's existing bundle warmup before launching Electron, and preserve Metro output in the lifecycle artifacts. The UI timeout, build-request timeout, lifecycle assertions and product behavior are unchanged. CI did not preserve Metro output, so its precise startup timing is not recoverable from the failed run. The retained log makes subsequent startup failures diagnosable without relying only on an empty renderer text dump. Validation: three complete lifecycle E2E runs under private Xvfb displays; existing Metro readiness tests; app typecheck; targeted lint; root format. * test(file-observer): await burst delivery through native recovery The deletion phase required every event within 10 seconds, but native coalescing recovery uses a 30-second safety audit followed by the existing reconciliation debounce. An idle diagnostic excludes that delayed audit and therefore cannot act as a completion barrier. Await the required delivered events instead, preserving every deletion assertion and the existing overall test watchdog. A real-filesystem test with controlled native notifications reproduces 95 outstanding paths at the old deadline and verifies completion when the safety audit delivers them. No production observer behavior changes. * test(file-observer): verify burst recovery through public events The controlled-clock regression constructed a private native backend, bypassing the interface used by consumers. Consolidate recovery coverage into the public observer integration test instead: drive real writes, deletes and directory renames, then await every required public event, including the 450 surviving files at their renamed paths. No public capability was added: subscribe callbacks already express completion. No production behavior or test timeout changes. * test(app): drive Android fade tests through the native host The instrumentation suite constructed TailFadeInAnimator directly, advanced its private clock, and counted FadeInSpan instances. It now mounts the WordFadeHost that React mounts, feeds it the ranges prop the bridge sends, and asserts rendered pixels: hidden before a start time, a monotone front inside and across words, settled frames equal to the baseline, and no frame callbacks left after settling. Span counts and internal timing state are no longer asserted. Choreographer cannot be advanced deterministically from a test and the fade epoch is the message's wall-clock start time, so the host takes a WordFadeFrameClock (time plus frame callbacks) as its smallest public seam; production keeps the Choreographer-backed default. Fixture text is sized in pixels so every sample stays on one line at any density; at 420 dpi the 32sp fixture wrapped and the column helper summed glyphs from the first line.
337 lines
12 KiB
TypeScript
337 lines
12 KiB
TypeScript
import { test, expect } from "../support/fixtures";
|
|
import {
|
|
awaitAssistantMessage,
|
|
expectAgentIdle,
|
|
expectInlineWorkingIndicator,
|
|
expectRunningAgentChrome,
|
|
expectTurnCopyButton,
|
|
expectScrollFollowsNewContent,
|
|
} from "../support/helpers/agent-stream";
|
|
import {
|
|
expectScrollStaysFixed,
|
|
clickToolCallBesideScrollToBottomButton,
|
|
readScrollMetrics,
|
|
scrollAgentChatToBottom,
|
|
scrollChatAwayFromBottom,
|
|
waitForScrollableChat,
|
|
} from "../support/helpers/agent-bottom-anchor";
|
|
import { delayCreatedAgentInitialTailResponse } from "../support/helpers/agent-timeline-gate";
|
|
import {
|
|
collapseSettledWord,
|
|
installMarkdownRootObserver,
|
|
mountObservedSyntheticBlock,
|
|
readMarkdownRootEvidence,
|
|
replaceParagraph,
|
|
replaceParagraphKeepingFadingWord,
|
|
restartFadingWord,
|
|
resumeFadingWord,
|
|
settleMarkdownRootObserver,
|
|
} from "../support/helpers/markdown-root-stability";
|
|
import { selectModel } from "../support/helpers/app";
|
|
import { clickNewChat } from "../support/helpers/launcher";
|
|
import { expectComposerVisible, startRunningMockAgent } from "../support/helpers/composer";
|
|
import {
|
|
openAgentRoute,
|
|
seedMockAgentWorkspace,
|
|
seedRunningMockAgentWorkspace,
|
|
} from "../support/helpers/mock-agent";
|
|
|
|
const SCROLL_AWAY_MIN_SCROLLABLE_DISTANCE = 360;
|
|
|
|
test.describe("Agent stream UI", () => {
|
|
test("keeps running agent chrome after page refresh", async ({ page }) => {
|
|
const title = "Running agent refresh";
|
|
const agent = await seedRunningMockAgentWorkspace({
|
|
repoPrefix: "stream-running-refresh-",
|
|
title,
|
|
model: "five-minute-stream",
|
|
initialPrompt: "Stay running while the page refreshes.",
|
|
});
|
|
try {
|
|
await openAgentRoute(page, agent);
|
|
await expectRunningAgentChrome(page, title);
|
|
|
|
await page.reload();
|
|
|
|
await expectRunningAgentChrome(page, title);
|
|
} finally {
|
|
await agent.cleanup();
|
|
}
|
|
});
|
|
|
|
test("auto-scroll sticks to bottom across token bursts", async ({ page }) => {
|
|
test.setTimeout(120_000);
|
|
const agent = await startRunningMockAgent(page, {
|
|
prefix: "stream-scroll-",
|
|
model: "one-minute-stream",
|
|
prompt: "Stream for auto-scroll test.",
|
|
});
|
|
try {
|
|
await awaitAssistantMessage(page);
|
|
await expectScrollFollowsNewContent(page);
|
|
} finally {
|
|
await agent.cleanup();
|
|
}
|
|
});
|
|
|
|
test("the Markdown root observer tells designed fade churn from replacements", async ({
|
|
page,
|
|
}) => {
|
|
await test.step("a word re-created with its start time resumes its fade", async () => {
|
|
await mountObservedSyntheticBlock(page);
|
|
await resumeFadingWord(page);
|
|
expect(await readMarkdownRootEvidence(page)).toEqual({
|
|
replacedElements: 0,
|
|
restartedFades: 0,
|
|
});
|
|
});
|
|
|
|
await test.step("a word re-created with a new start time is a restarted fade", async () => {
|
|
await mountObservedSyntheticBlock(page);
|
|
await restartFadingWord(page);
|
|
expect(await readMarkdownRootEvidence(page)).toEqual({
|
|
replacedElements: 0,
|
|
restartedFades: 1,
|
|
});
|
|
});
|
|
|
|
await test.step("a settled word collapsing into text is not a replacement", async () => {
|
|
await mountObservedSyntheticBlock(page);
|
|
await collapseSettledWord(page);
|
|
expect(await readMarkdownRootEvidence(page)).toEqual({
|
|
replacedElements: 0,
|
|
restartedFades: 0,
|
|
});
|
|
});
|
|
|
|
await test.step("a re-created paragraph is a replaced element", async () => {
|
|
await mountObservedSyntheticBlock(page);
|
|
await replaceParagraph(page);
|
|
expect(await readMarkdownRootEvidence(page)).toEqual({
|
|
replacedElements: 1,
|
|
restartedFades: 0,
|
|
});
|
|
});
|
|
|
|
await test.step("a re-created paragraph is still a replacement when it keeps its fading word", async () => {
|
|
await mountObservedSyntheticBlock(page);
|
|
await replaceParagraphKeepingFadingWord(page);
|
|
expect(await readMarkdownRootEvidence(page)).toEqual({
|
|
replacedElements: 1,
|
|
restartedFades: 0,
|
|
});
|
|
});
|
|
});
|
|
|
|
test("keeps the active Markdown root mounted across streamed text updates", async ({
|
|
page,
|
|
}, testInfo) => {
|
|
test.setTimeout(120_000);
|
|
const agent = await startRunningMockAgent(page, {
|
|
prefix: "stream-markdown-root-",
|
|
model: "one-minute-stream",
|
|
prompt: "Stream for Markdown root stability test.",
|
|
});
|
|
try {
|
|
const assistantMessage = page.getByTestId("assistant-message").last();
|
|
await expect(assistantMessage).toContainText("walking through", { timeout: 30_000 });
|
|
|
|
const activeBlock = assistantMessage.locator(":scope > *").last();
|
|
const initialText = (await activeBlock.textContent()) ?? "";
|
|
const activeBlockHandle = await activeBlock.elementHandle();
|
|
if (!activeBlockHandle) {
|
|
throw new Error("Expected the active assistant message to contain a block");
|
|
}
|
|
const markdownRoot = await activeBlock.locator(":scope > *").first().elementHandle();
|
|
if (!markdownRoot) {
|
|
throw new Error("Expected the active assistant block to contain a Markdown root");
|
|
}
|
|
|
|
await page.evaluate(installMarkdownRootObserver, activeBlockHandle);
|
|
|
|
await expect
|
|
.poll(async () => ((await activeBlock.textContent()) ?? "").length)
|
|
.toBeGreaterThan(initialText.length + 80);
|
|
|
|
const settled = await page.evaluate(settleMarkdownRootObserver);
|
|
const rootState = await page.evaluate((root) => {
|
|
const messages = document.querySelectorAll('[data-testid="assistant-message"]');
|
|
const message = messages.item(messages.length - 1);
|
|
const block = message?.lastElementChild;
|
|
return { connected: root.isConnected, sameRoot: block?.firstElementChild === root };
|
|
}, markdownRoot);
|
|
const evidence = { ...settled, ...rootState };
|
|
|
|
await testInfo.attach("markdown-root-stability", {
|
|
body: JSON.stringify(evidence, null, 2),
|
|
contentType: "application/json",
|
|
});
|
|
expect(evidence.connected).toBe(true);
|
|
expect(evidence.sameRoot).toBe(true);
|
|
expect(
|
|
evidence.replacedElements,
|
|
`Streaming Markdown replaced mounted descendants: ${JSON.stringify(evidence)}`,
|
|
).toBe(0);
|
|
expect(
|
|
evidence.restartedFades,
|
|
`Streaming Markdown re-created a fading word with a new start time: ${JSON.stringify(evidence)}`,
|
|
).toBe(0);
|
|
} finally {
|
|
await agent.cleanup();
|
|
}
|
|
});
|
|
|
|
test("keeps the viewport fixed after the user scrolls away during a stream", async ({ page }) => {
|
|
test.setTimeout(120_000);
|
|
const agent = await seedMockAgentWorkspace({
|
|
repoPrefix: "stream-scroll-away-",
|
|
title: "Scroll-away anchor",
|
|
model: "five-minute-stream",
|
|
initialPrompt: "emit 120 agent stream updates for scroll-away setup.",
|
|
});
|
|
try {
|
|
await agent.client.waitForFinish(agent.agentId, 30_000);
|
|
await openAgentRoute(page, {
|
|
workspaceId: agent.workspaceId,
|
|
agentId: agent.agentId,
|
|
});
|
|
await expectComposerVisible(page);
|
|
await agent.client.sendAgentMessage(agent.agentId, "Stream for scroll-away anchor test.");
|
|
await expect(page.getByRole("button", { name: /stop|cancel/i }).first()).toBeVisible({
|
|
timeout: 30_000,
|
|
});
|
|
await awaitAssistantMessage(page);
|
|
await waitForScrollableChat(page, {
|
|
minScrollableDistance: SCROLL_AWAY_MIN_SCROLLABLE_DISTANCE,
|
|
timeout: 30_000,
|
|
});
|
|
const baseline = await scrollChatAwayFromBottom(page, {
|
|
deltaY: -900,
|
|
minDistanceFromBottom: 300,
|
|
});
|
|
await expectScrollStaysFixed(page, baseline, { durationMs: 30_000 });
|
|
|
|
const finalMetrics = await readScrollMetrics(page);
|
|
expect(finalMetrics.contentHeight).toBeGreaterThan(baseline.contentHeight);
|
|
} finally {
|
|
await agent.cleanup();
|
|
}
|
|
});
|
|
|
|
test("keeps the viewport fixed when delayed authoritative history arrives after scroll-away", async ({
|
|
page,
|
|
withWorkspace,
|
|
}) => {
|
|
test.setTimeout(180_000);
|
|
const timelineGate = await delayCreatedAgentInitialTailResponse(page);
|
|
const workspace = await withWorkspace({
|
|
prefix: "stream-scroll-away-delayed-history-",
|
|
});
|
|
await workspace.navigateTo();
|
|
await clickNewChat(page);
|
|
await page.getByText("Model defaults are still loading").waitFor({
|
|
state: "hidden",
|
|
timeout: 30_000,
|
|
});
|
|
await expectComposerVisible(page);
|
|
await selectModel(page, "Five minute stream");
|
|
|
|
const prompt = "Stream for delayed authoritative history scroll-away test.";
|
|
const composer = page.getByRole("textbox", { name: "Message agent..." }).first();
|
|
await composer.fill(prompt);
|
|
await page.getByRole("button", { name: "Send message" }).click();
|
|
await page.getByText(prompt, { exact: true }).first().waitFor({
|
|
state: "visible",
|
|
timeout: 30_000,
|
|
});
|
|
await timelineGate.waitForCreatedAgent();
|
|
await timelineGate.waitForDelayedResponse();
|
|
await expect(page.getByRole("button", { name: /stop|cancel/i }).first()).toBeVisible({
|
|
timeout: 30_000,
|
|
});
|
|
// Reasoning rows collapse when the mock starts its next assistant response. Wait past
|
|
// that transition so their temporary height cannot satisfy the scroll-away setup.
|
|
await awaitAssistantMessage(page, "Now I have a clearer picture.");
|
|
await waitForScrollableChat(page, {
|
|
minScrollableDistance: SCROLL_AWAY_MIN_SCROLLABLE_DISTANCE,
|
|
timeout: 45_000,
|
|
});
|
|
const baseline = await scrollChatAwayFromBottom(page, {
|
|
deltaY: -900,
|
|
minDistanceFromBottom: 300,
|
|
});
|
|
|
|
timelineGate.release();
|
|
await timelineGate.waitForForwardedResponse();
|
|
await expectScrollStaysFixed(page, baseline);
|
|
});
|
|
|
|
test("keeps tool calls clickable beside the scroll-to-bottom button", async ({ page }) => {
|
|
test.setTimeout(60_000);
|
|
const agent = await seedMockAgentWorkspace({
|
|
repoPrefix: "stream-scroll-button-hit-area-",
|
|
title: "Scroll button hit area",
|
|
model: "ten-second-stream",
|
|
initialPrompt: "Stream enough content to exercise the scroll button hit area.",
|
|
});
|
|
try {
|
|
await agent.client.waitForFinish(agent.agentId, 30_000);
|
|
await openAgentRoute(page, {
|
|
workspaceId: agent.workspaceId,
|
|
agentId: agent.agentId,
|
|
});
|
|
await waitForScrollableChat(page, {
|
|
minScrollableDistance: SCROLL_AWAY_MIN_SCROLLABLE_DISTANCE,
|
|
timeout: 30_000,
|
|
});
|
|
|
|
const hitArea = await clickToolCallBesideScrollToBottomButton(page);
|
|
|
|
expect(hitArea).toEqual({
|
|
outsideButton: true,
|
|
toolCallReceivesPointer: true,
|
|
withinButtonBand: true,
|
|
});
|
|
} finally {
|
|
await agent.cleanup();
|
|
}
|
|
});
|
|
|
|
test("working-indicator transitions to copy-button when stream ends", async ({ page }) => {
|
|
test.setTimeout(60_000);
|
|
const agent = await startRunningMockAgent(page, {
|
|
prefix: "stream-indicator-",
|
|
model: "ten-second-stream",
|
|
prompt: "Stream briefly for indicator transition test.",
|
|
});
|
|
try {
|
|
await awaitAssistantMessage(page);
|
|
await expectInlineWorkingIndicator(page);
|
|
await expectAgentIdle(page, 30_000);
|
|
await scrollAgentChatToBottom(page);
|
|
await expectTurnCopyButton(page);
|
|
} finally {
|
|
await agent.cleanup();
|
|
}
|
|
});
|
|
|
|
test("shows elapsed timer on first app-created running turn", async ({ page, withWorkspace }) => {
|
|
test.setTimeout(90_000);
|
|
const workspace = await withWorkspace({ prefix: "stream-first-app-turn-timer-" });
|
|
await workspace.navigateTo();
|
|
await clickNewChat(page);
|
|
await page.getByText("Model defaults are still loading").waitFor({
|
|
state: "hidden",
|
|
timeout: 30_000,
|
|
});
|
|
const prompt = "Stream briefly for first app-created turn timer test.";
|
|
const composer = page.getByRole("textbox", { name: "Message agent..." }).first();
|
|
await composer.fill(prompt);
|
|
await page.getByRole("button", { name: "Send message" }).click();
|
|
await page.getByText(prompt, { exact: true }).first().waitFor({ state: "visible" });
|
|
await awaitAssistantMessage(page);
|
|
await expectInlineWorkingIndicator(page);
|
|
await page.getByTestId("turn-working-elapsed").waitFor({ state: "visible", timeout: 5_000 });
|
|
});
|
|
});
|