From 21a2185f86f64be10d28bec1ecc576d89230f761 Mon Sep 17 00:00:00 2001 From: Hermes Agent <127238744+teknium1@users.noreply.github.com> Date: Sun, 26 Jul 2026 00:03:03 -0700 Subject: [PATCH] fix(desktop-e2e): poll for the finished-unread dot instead of sampling once MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sentinel-released processes exposed a second bare-sample assertion in the same file. The unread-dot check ran a synchronous .count() 140ms after the running dot cleared: 15.91s poll "dot should disappear" -> 2 16.05s ... -> 0 (running dot gone) 16.05s bare .count() for unread dot -> 0 FAIL "Finished — unread" is an event-driven transition that lands just after the running dot clears. The old fixed `sleep 5` happened to leave enough slack between the two that a single sample usually caught it; releasing the process deterministically removed that incidental slack and made the latent race deterministic instead. Poll for it, matching how sidebar-states.spec.ts already asserts this exact dot. The split-tile assertion at line 234 stays a bare sample on purpose — it asserts an absence (toBe(0)), where polling would only wait for something that must never appear. --- apps/desktop/e2e/tile-unread-bug.spec.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/desktop/e2e/tile-unread-bug.spec.ts b/apps/desktop/e2e/tile-unread-bug.spec.ts index fe87b63f38907..fa614a21d2f02 100644 --- a/apps/desktop/e2e/tile-unread-bug.spec.ts +++ b/apps/desktop/e2e/tile-unread-bug.spec.ts @@ -143,8 +143,17 @@ test.describe('sidebar states — tab (hidden) unread is correct', () => { // A tab that's not the active tab IS hidden — the unread dot is correct. // The user is NOT looking at it, so marking it "unread" is right. - const unreadCount = await page.locator(`[aria-label="${UNREAD_DOT_LABEL}"]`).count() - expect(unreadCount, 'hidden tab should be marked unread').toBeGreaterThan(0) + // + // Poll rather than sampling once: "finished-unread" is an event-driven + // transition that lands slightly after the running dot clears, and with a + // released (rather than slowly-expiring) process there is no incidental + // slack between the two. Same reasoning as the cross-session spec. + await expect + .poll( + () => page.locator(`[aria-label="${UNREAD_DOT_LABEL}"]`).count(), + { timeout: 30_000, message: 'hidden tab should be marked unread' }, + ) + .toBeGreaterThan(0) await page.screenshot({ path: 'test-results/tile-bug-tab-unread-correct.png' }) })