From d3a9e00752f1f7657f84a09480a0a3e8849ef9de Mon Sep 17 00:00:00 2001 From: Maurice Date: Mon, 21 Sep 2026 22:32:16 +0000 Subject: [PATCH] test(help): find the fold toggle inside its own row in the switcher '2 sub-screens' stopped identifying one button the moment a second screen had two of them, and the trip is about to have a dozen. The toggle is looked up within the row it belongs to instead, which says what the assertion means. --- client/src/components/Help/HelpPanel.test.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client/src/components/Help/HelpPanel.test.tsx b/client/src/components/Help/HelpPanel.test.tsx index 2e330290c..4fc78dae4 100644 --- a/client/src/components/Help/HelpPanel.test.tsx +++ b/client/src/components/Help/HelpPanel.test.tsx @@ -221,12 +221,15 @@ describe('HelpPanel', () => { expect(list).toBeInTheDocument() expect(screen.getByRole('option', { name: /Journal/ })).toHaveAttribute('aria-selected', 'true') expect(screen.getByRole('option', { name: /Studio/ })).toBeInTheDocument() - // Folding the group hides the sub-screens; the top-level screens stay. - fireEvent.click(screen.getByRole('button', { name: '2 sub-screens' })) + // Folding the group hides the sub-screens; the top-level screens stay. The + // toggle is looked up inside its own row: every screen with sub-screens has + // one, and the trip has as many as the plan has columns, panels and tabs. + const journeyFold = () => within(screen.getByRole('option', { name: /^Journey/ })).getByRole('button', { name: /sub-screens/ }) + fireEvent.click(journeyFold()) expect(screen.queryByRole('option', { name: /Studio/ })).toBeNull() expect(screen.getByRole('option', { name: /Atlas/ })).toBeInTheDocument() // Picking a sub-screen browses to it; the breadcrumb on the overview shows the trail. - fireEvent.click(screen.getByRole('button', { name: '2 sub-screens' })) + fireEvent.click(journeyFold()) fireEvent.click(screen.getByRole('option', { name: /Studio/ }).querySelector('button')!) expect(useHelpStore.getState().browseId).toBe('journey-studio') expect(screen.getByRole('heading', { level: 1, name: 'Studio' })).toBeInTheDocument()