From 26cbf46e2c8858b248ee2e30fc3265fa757890b6 Mon Sep 17 00:00:00 2001 From: Marco Beretta <81851188+berry-13@users.noreply.github.com> Date: Fri, 6 Nov 2026 18:24:05 +0100 Subject: [PATCH] test: Wait for the Reply Tab's Seen Write Before Restoring the Unread Baseline The withheld-reply scenario restored the unread baseline in Mongo right after the reply tab finished, while that tab was still posting its own seen acknowledgement. When the acknowledgement landed second it overwrote the baseline, the first tab polled a conversation the server considered read, and its dot never appeared. The sibling scenario already waits for the acknowledgement; this one now does too. --- e2e/specs/mock/scenarios/unseen-replies.spec.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/e2e/specs/mock/scenarios/unseen-replies.spec.ts b/e2e/specs/mock/scenarios/unseen-replies.spec.ts index 25cfea4c7b8..2e394626afe 100644 --- a/e2e/specs/mock/scenarios/unseen-replies.spec.ts +++ b/e2e/specs/mock/scenarios/unseen-replies.spec.ts @@ -569,7 +569,16 @@ test.describe('unseen replies', () => { await selectMockEndpoint(second, MOCK_ENDPOINTS[0]); await second.bringToFront(); await unfocus(page); + const acknowledged = second.waitForResponse( + (response) => + new URL(response.url()).pathname === '/api/convos/seen' && + response.request().method() === 'POST', + ); await sendMessageAndWaitForCompletion(second, `E2E_REPLY:withheld-${id.slice(0, 8)}`); + /* The reply tab acknowledges the reply it just rendered. Restoring the unread baseline + * before that write lands is overwritten by it, and the first tab then polls a + * conversation the server considers read, so its dot never appears. */ + await acknowledged; const completed = await readConversation(id); if (completed?.lastResponseAt == null) throw new Error('Reply timestamp was not saved'); completedReplyAt = new Date(completed.lastResponseAt);