From 90a7cccb1a243af60c5dfdf44868803d9da8ebec Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Tue, 6 Oct 2026 11:53:18 -0700 Subject: [PATCH] test(desktop): press Escape until the failed-install listener is bound The overlay binds its Escape handler in a passive effect keyed on the failed state, which can flush after "Installation failed" is already painted. The test pressed Escape once right after findByText, so on a loaded runner the key landed before the listener existed and the overlay (correctly) stayed up for the whole waitFor. Proof: delaying the listener by 80 ms reproduces the CI red on the old test and passes the new one. --- .../src/components/desktop-install-overlay.test.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/desktop/src/components/desktop-install-overlay.test.tsx b/apps/desktop/src/components/desktop-install-overlay.test.tsx index 1039e6e4ac..db67e72b6a 100644 --- a/apps/desktop/src/components/desktop-install-overlay.test.tsx +++ b/apps/desktop/src/components/desktop-install-overlay.test.tsx @@ -567,9 +567,12 @@ describe('DesktopInstallOverlay first-run setup', () => { expect(await screen.findByText('Installation failed')).toBeTruthy() - fireEvent.keyDown(window, { key: 'Escape' }) - - await waitFor(() => expect(screen.queryByText('Installation failed')).toBeNull()) + // The Escape listener is bound in a passive effect that can flush after the failed state is + // already painted; a key landing in that gap is (correctly) ignored, so press until it is heard. + await waitFor(() => { + fireEvent.keyDown(window, { key: 'Escape' }) + expect(screen.queryByText('Installation failed')).toBeNull() + }) }) })