fix(desktop-e2e): poll for the finished-unread dot instead of sampling once
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.
This commit is contained in:
parent
3a3bc41c7e
commit
21a2185f86
|
|
@ -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' })
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue