Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions frontend/src/components/Scenarios/ScenarioRunPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,22 @@ describe('ScenarioRunPage', () => {
await waitFor(() => expect(details).toHaveFocus())
})

it('restores focus to the technique opener when attack details are closed with the Close button', async () => {
const user = userEvent.setup()
render(<Wrapper path={scenarioRunRoutePath(RUN_ID)} />)
await expand(user)
const details = screen.getAllByRole('button', { name: /^Open details for PromptSendingAttack:/ })[0]
details.focus()
await user.keyboard('{Enter}')
const dialog = within(await screen.findByRole('dialog'))
await user.click(dialog.getByRole('button', { name: 'Close', exact: true }))
await waitFor(() => expect(details).toHaveFocus())
await user.click(details)
await screen.findByRole('dialog')
await user.keyboard('{Escape}')
await waitFor(() => expect(details).toHaveFocus())
})

it('keeps canonical conversation navigation separate from row details', async () => {
const user = userEvent.setup()
render(<Wrapper path={scenarioRunRoutePath(RUN_ID)} />)
Expand Down