Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
test(webui): respect history top-edge tolerance (#6362)
chengyongrud617b723aaf0
diff --git a/webui/browser/history-boundary.spec.ts b/webui/browser/history-boundary.spec.tsindex 18420d6df..2bbade887 100644--- a/webui/browser/history-boundary.spec.ts+++ b/webui/browser/history-boundary.spec.ts@@ -199,9 +199,16 @@ async function expectHeaderInsideSlot(body: Locator) {async function expectHeld(body: Locator, text: string) {await expect(body.locator(".thread-history-slot")).toHaveCSS("height", "48px");await expect.poll(() => displacement(body)).toBe(0);- await expect.poll(async () => (await historyGeometry(body, text)).visibleHeight).toBeCloseTo(48, 0);+ let held = await historyGeometry(body, text);+ // The runtime accepts <=1px as the top; account for that actual scroll, not extra clipping.+ await expect.poll(async () => {+ held = await historyGeometry(body, text);+ return held.visibleHeight + held.scrollTop;+ }).toBeCloseTo(48, 0);+ expect(held.scrollTop).toBeGreaterThanOrEqual(0);+ expect(held.scrollTop).toBeLessThanOrEqual(1);await expectHeaderInsideSlot(body);- return historyGeometry(body, text);+ return held;}function expectSameScroll(before: HistoryGeometry, after: HistoryGeometry, delta: number) {@@ -921,6 +928,25 @@ test("cross-path older errors never float after latest or a loaded rail jump, bu});+test("loading retains its slot and reading anchor at the tolerated top pixel", async ({ page }) => {+ const history = await installHistory(page);+ const { body, header } = await openSettledHistory(page);+ // Home can reach the existing <=1px boundary before its native scroll reaches zero.+ await body.evaluate((node) => {+ node.dispatchEvent(new PointerEvent("pointerdown", { bubbles: true, button: 0 }));+ node.scrollTop = 1;+ node.dispatchEvent(new Event("scroll"));+ });+ await expect.poll(() => history.reads.length).toBe(1);+ await expect(header).toHaveAttribute("data-state", "loading");+ const held = await expectHeld(body, "Question 40");+ expect(held.scrollTop).toBe(1);+ expect(held.visibleHeight).toBeCloseTo(47, 0);+ expect(held.headerTop).toBeCloseTo(held.frameTop - 1, 0);+ await completePrepend(history, body, "Question 28", "Question 40", held.anchorTop);+});++test("bounded navigation retains three pages and reclaims each completed wheel or keyboard boundary slot", async ({ page }) => {const history = await installHistory(page);await page.setViewportSize({ width: 1440, height: 900 });@@ -1022,7 +1048,7 @@ test("bounded navigation retains three pages and reclaims each completed wheel oawait expect(header).toHaveAttribute("data-state", "loading");const keyboardHeld = await expectHeld(body, "Question 2");expect(keyboardHeld.slotBeforeKey).toBe("u2");- expect(keyboardHeld.anchorTop - atKeyboardHead.anchorTop - atKeyboardHead.scrollTop).toBeCloseTo(48, 0);+ expect(keyboardHeld.anchorTop - atKeyboardHead.anchorTop - atKeyboardHead.scrollTop + keyboardHeld.scrollTop).toBeCloseTo(48, 0);history.complete();await expect(body.getByText("Question 0", { exact: true })).toBeAttached();await stableLayout(body);