web: settle a leftover replayed turn before the composer checks
The previous section can leave the operator's thread marked running from a replayed frame; C8 tests the composer's default state, so it settles once through the page's own fold instead of asserting against leftover state. Found by the post-split gate (the split itself was correct: a fresh open shows Send, no Stop).
This commit is contained in:
@@ -4193,6 +4193,28 @@ try {
|
||||
step("C8/C9: the composer, slash commands and attachments");
|
||||
await ensureConnected();
|
||||
await page.waitForSelector("#chatInput", { timeout: 15000 });
|
||||
// The previous sections may have left a replayed turn marked running for the
|
||||
// operator's session. This section tests the composer's default state, so settle
|
||||
// any such turn once (a real pushed "ended" frame, through the page's own fold)
|
||||
// rather than asserting against leftover state.
|
||||
if (await page.evaluate(`!!document.querySelector("#chatStop")`)) {
|
||||
const settled = await page.evaluate(`(() => {
|
||||
const ws = window.__pipelinesSocket;
|
||||
const sessionId = document.querySelector(".chat-row.selected")?.dataset.session ?? "";
|
||||
if (!ws || typeof ws.onmessage !== "function" || !sessionId) return false;
|
||||
ws.onmessage({ data: JSON.stringify({
|
||||
type: "chat_event",
|
||||
chat_event: { session_id: sessionId, kind: "step", step: { status: "ended" } },
|
||||
}) });
|
||||
return true;
|
||||
})()`);
|
||||
if (!settled) throw new Error("C8: could not settle the leftover running turn");
|
||||
await eventually(() => page.evaluate(`!document.querySelector("#chatStop")`), {
|
||||
timeout: 10000,
|
||||
what: "the leftover turn to settle before the composer checks",
|
||||
});
|
||||
console.log(" settled a leftover running turn before the composer checks");
|
||||
}
|
||||
|
||||
// (a) A draft: the placeholder, Send present and enabled, Stop absent.
|
||||
await page.fill("#chatInput", "A draft from the smoke");
|
||||
|
||||
Reference in New Issue
Block a user