Skip to content

Commit 7ba10ea

Browse files
committed
fix(tests): update combobox tests to wait for listbox visibility
Replace getByRole with findByRole to properly wait for the listbox element to become visible after the CSS transition completes
1 parent 2dd8fda commit 7ba10ea

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/lib/holocene/combobox/combobox.stories.svelte

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@
140140
const canvas = within(canvasElement);
141141
const combobox = canvas.getByTestId(id);
142142
await userEvent.type(combobox, 'E');
143-
const menu = canvas.getByRole('listbox');
143+
// Wait for the listbox to appear since it may have a transition
144+
const menu = await canvas.findByRole('listbox');
144145
expect(menu).toBeInTheDocument();
145146
}}
146147
/>
@@ -153,7 +154,8 @@
153154

154155
await userEvent.type(combobox, 'one');
155156

156-
const menu = canvas.getByRole('listbox');
157+
// Wait for the listbox to appear since it may have a transition
158+
const menu = await canvas.findByRole('listbox');
157159

158160
expect(menu).toBeInTheDocument();
159161

0 commit comments

Comments
 (0)