test(app): match the turn collapse reply by its last streamed chunk

Back-to-back text chunks from the mock stream merge into one message depending
on delivery timing, so the final reply and the folded message count vary run
to run.
This commit is contained in:
Mohamed Boudra
2026-10-24 08:28:49 +02:00
parent 953b448774
commit e39f914a82
@@ -46,9 +46,11 @@ test.describe("Turn collapse", () => {
await expectComposerVisible(page);
const summary = page.getByTestId("turn-summary").last().getByRole("button");
await expect(summary).toHaveText(/^Wrote \d+ messages, edited 1 file/);
await expect(summary).toHaveText(/^Wrote \d+ messages?, edited 1 file/);
// Text chunks that stream back to back merge into one message, so the reply holds
// at least the stream's last chunk.
await expect(page.getByTestId("assistant-message").last()).toHaveText(
"(end of synthetic stream)",
/\(end of synthetic stream\)$/,
);
await expect.poll(() => rowsBetweenLatestSummaryAndReply(page)).toBe(0);