Skip to content

Commit 0593b32

Browse files
Fix flaky select test by adding timing delay
The CreatableOption test was failing because it was trying to find the listbox role immediately after clicking the select, but the dropdown needs a moment to render. Added a 100ms delay to ensure the dropdown is fully rendered before looking for the listbox element. This resolves the failing test in the CI pipeline.
1 parent af19345 commit 0593b32

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

apps/docs/src/remix-hook-form/select.stories.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,8 @@ export const CreatableOption: Story = {
510510
await step('Create new option when no exact match', async () => {
511511
const regionSelect = canvas.getByLabelText('Custom Region');
512512
await userEvent.click(regionSelect);
513+
// Add a small delay to ensure the dropdown has time to render
514+
await new Promise(resolve => setTimeout(resolve, 100));
513515
const listbox = await within(document.body).findByRole('listbox');
514516
// The search input is outside the listbox container; query from the portal root
515517
const input = within(document.body).getByPlaceholderText('Search...');
@@ -531,6 +533,8 @@ export const CreatableOption: Story = {
531533
await step('No creatable when exact match exists', async () => {
532534
const regionSelect = canvas.getByLabelText('Custom Region');
533535
await userEvent.click(regionSelect);
536+
// Add a small delay to ensure the dropdown has time to render
537+
await new Promise(resolve => setTimeout(resolve, 100));
534538
const listbox = await within(document.body).findByRole('listbox');
535539
// The search input is outside the listbox container; query from the portal root
536540
const input = within(document.body).getByPlaceholderText('Search...');

0 commit comments

Comments
 (0)