From 80e7f78a9bae19aebc1698d2bf5c2dfcd590fc5f Mon Sep 17 00:00:00 2001 From: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com> Date: Sat, 24 Oct 2026 19:15:00 -0400 Subject: [PATCH] test(frontend): wait for the picker's open focus before pressing Enter on the scope tab The dialog moves focus to the search input on the next animation frame after opening. The test focused the sessions tab before that frame, so Enter sometimes landed on the search input and the scope never toggled. It now waits for the open focus, asserts the tab has focus, and checks the persisted scope. --- .../components/session/SessionPickerDialog.test.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/session/SessionPickerDialog.test.tsx b/frontend/src/components/session/SessionPickerDialog.test.tsx index 2e733730..eedba48f 100644 --- a/frontend/src/components/session/SessionPickerDialog.test.tsx +++ b/frontend/src/components/session/SessionPickerDialog.test.tsx @@ -357,12 +357,18 @@ describe('SessionPickerDialog', () => { const user = userEvent.setup() renderPicker() + await waitFor(() => expect(combobox()).toHaveFocus()) + + const sessionsTab = screen.getByRole('tab', { name: 'This project' }) act(() => { - screen.getByRole('tab', { name: 'This project' }).focus() + sessionsTab.focus() }) + expect(sessionsTab).toHaveFocus() + await user.keyboard('{Enter}') - expect(screen.getByRole('tab', { name: 'All sessions', selected: true })).toBeInTheDocument() + expect(await screen.findByRole('tab', { name: 'All sessions', selected: true })).toBeInTheDocument() + expect(localStorage.getItem('oc:session-picker:all-projects')).toBe('true') }) it('labels the sessions tab Sessions and lists every project without a current repo', () => {