From 8cdc4935b3b48b3fb41a366de24615fcb17a4bff Mon Sep 17 00:00:00 2001 From: Patrick O'Reilly Date: Sat, 19 Sep 2026 20:08:28 -0700 Subject: [PATCH] test(debates): route the last two device-menu opens through the connection guard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #2477 moved the device tests onto `openDeviceSettings`, which waits for the intro connection to settle before opening a settings menu. Two bare `fireEvent.click` opens were left in the file. `ignores stale device enumeration results during rapid hardware changes` opens Audio settings as its first interaction and waits on nothing that tracks `roomState`, so a connection landing mid-test closes the menu underneath it and the radios vanish — the same `Unable to find role="radio"` this file has been failing with. With `roomConnect` resolving after 200ms it fails through the bare click and passes through the helper. The switch to Video settings at line 1149 follows a guarded open, so `devicesLocked` is already false and it could not be made to fail; changed for consistency. 181/181 idle, 10/10 under CPU contention. --- .../debates/[debateId]/debate-room-page-client.test.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/web/app/space/[id]/(space)/debates/[debateId]/debate-room-page-client.test.tsx b/apps/web/app/space/[id]/(space)/debates/[debateId]/debate-room-page-client.test.tsx index 95c1862d70..750574adc8 100644 --- a/apps/web/app/space/[id]/(space)/debates/[debateId]/debate-room-page-client.test.tsx +++ b/apps/web/app/space/[id]/(space)/debates/[debateId]/debate-room-page-client.test.tsx @@ -1146,7 +1146,7 @@ describe('DebateRoomPageClient', () => { }); expect(screen.getByRole('dialog', { name: 'Audio settings' })).toBeInTheDocument(); - fireEvent.click(screen.getByRole('button', { name: 'Video settings' })); + await openDeviceSettings('Video settings'); expect(screen.queryByRole('dialog', { name: 'Audio settings' })).not.toBeInTheDocument(); expect(screen.getByRole('dialog', { name: 'Video settings' })).toBeInTheDocument(); fireEvent.click(screen.getByRole('radio', { name: 'Desk Camera' })); @@ -1518,7 +1518,7 @@ describe('DebateRoomPageClient', () => { ] as MediaDeviceInfo[]) ); - fireEvent.click(screen.getByRole('button', { name: 'Audio settings' })); + await openDeviceSettings('Audio settings'); await waitFor(() => expect(screen.getByRole('radio', { name: 'Studio Mic' })).toBeChecked()); });