Compare commits

...
Author SHA1 Message Date
Kit Langton dca3a4fe32 test(tui): wait for tab layout before scrolling
The transcript can render before asynchronous tab registration adds its layout row. Wait for the tab title as well as the final message so the one-line scroll assertion starts with a stable viewport.
2026-09-01 12:35:32 -04:00
Kit Langton b7ac4a9865 test(tui): isolate scroll fixture session
Use a non-placeholder session ID so the retention policy keeps the transcript. Give the fixture its own state directory so its persisted tab cannot leak into later tests.
2026-09-01 11:59:38 -04:00
+10 -7
View File
@@ -922,8 +922,9 @@ test("error investigations repeatedly seed editable home drafts without creating
})
test("shows jump to latest after scrolling one line above the final message", async () => {
await using state = await tmpdir()
const session = {
id: "dummy",
id: "ses_scroll",
title: "Demo session",
projectID: "project",
location: { directory },
@@ -942,18 +943,20 @@ test("shows jump to latest after scrolling one line above the final message", as
await using setup = await createAppFixture({
width: 80,
height: 20,
state: state.path,
config: { animations: false, keybinds: { "session.line.up": "f6", "session.line.down": "f7" } },
args: { sessionID: "dummy" },
args: { sessionID: "ses_scroll" },
fetch: (url) => {
if (url.pathname === "/api/session") return json({ data: [session], cursor: {} })
if (url.pathname === "/api/session/dummy") return json({ data: session })
if (url.pathname === "/api/session/dummy/message") return json({ data: messages.toReversed(), cursor: {} })
if (url.pathname === "/api/session/dummy/inbox") return json({ data: [] })
if (url.pathname === "/api/session/dummy/permission") return json({ data: [] })
if (url.pathname === "/api/session/ses_scroll") return json({ data: session })
if (url.pathname === "/api/session/ses_scroll/message") return json({ data: messages.toReversed(), cursor: {} })
if (url.pathname === "/api/session/ses_scroll/inbox") return json({ data: [] })
if (url.pathname === "/api/session/ses_scroll/permission") return json({ data: [] })
},
})
await setup.waitForFrame((frame) => frame.includes("Final visible message"))
// Persisting the tab adds a layout row, so wait for it before measuring the transcript.
await setup.waitForFrame((frame) => frame.includes(session.title) && frame.includes("Final visible message"))
const findScrollBox = (root: Renderable): ScrollBoxRenderable | undefined =>
root instanceof ScrollBoxRenderable && root.getRenderable("message-7")
? root