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.
This commit is contained in:
@@ -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()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user