diff --git a/web/test/ui-smoke.mjs b/web/test/ui-smoke.mjs index f0700e26..f861994b 100644 --- a/web/test/ui-smoke.mjs +++ b/web/test/ui-smoke.mjs @@ -3152,6 +3152,21 @@ try { // frames replayed below are synthetic, and this log says so explicitly. step("C5: the live stream — subscribe, replayed chat_event frames, stream state"); await ensureConnected(); + // The composer section above closes its throwaway session and returns to the + // list, so no conversation is open here. Re-open the operator's own session to + // observe its live stream — read-only: the `chat_subscribe` and every history + // fetch are real, and the frames below are injected into the page's own socket + // handler rather than sent to the server. + const chatOpen = await page.evaluate(`!!document.querySelector("#chatInput")`); + if (!chatOpen) { + await page.waitForSelector(`#chatRows .chat-row[data-session="${openedId}"]`, { timeout: 15000 }); + await page.click(`#chatRows .chat-row[data-session="${openedId}"]`); + await page.waitForSelector("#chatInput", { timeout: 15000 }); + // The newest history page arrives asynchronously and its render replaces the + // held messages, so wait for it to land (`#chatTranscript` is rendered only + // once the thread is loaded) before replaying frames into the page. + await page.waitForSelector("#chatTranscript", { timeout: 20000 }); + } await page.evaluate(`document.querySelector("#chatJump")?.click()`); const chatBadge = () =>