fix(tests): resolve flakey selectOption helper race condition (#36719)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Joe Li
2025-12-17 21:27:17 -08:00
committed by GitHub
parent 2f4f64dfe8
commit f51f7f3307

View File

@@ -135,7 +135,8 @@ export { customRender as render };
export { default as userEvent } from '@testing-library/user-event';
export async function selectOption(option: string, selectName?: string) {
const select = screen.getByRole(
// Use findByRole (async) to wait for element to be ready, preventing race conditions on slow CI
const select = await screen.findByRole(
'combobox',
selectName ? { name: selectName } : {},
);