diff --git a/e2e/specs/mock/scenarios/model-selector-search.spec.ts b/e2e/specs/mock/scenarios/model-selector-search.spec.ts index a46c4cdf4e..772618991f 100644 --- a/e2e/specs/mock/scenarios/model-selector-search.spec.ts +++ b/e2e/specs/mock/scenarios/model-selector-search.spec.ts @@ -4,11 +4,17 @@ import { NEW_CHAT_PATH } from '../helpers'; import { resetPinnedState } from './pinned.helpers'; const modelTrigger = (page: Page) => page.getByRole('button', { name: 'Select a model' }).first(); +/** + * The query reaches the list after a debounce, and until then the unfiltered menu is still + * rendered, so its options would pass for results. Only the search results render the + * results announcement, so waiting on it waits for the list the query produced. + */ async function openModelSearch(page: Page, query: string) { await modelTrigger(page).click(); const search = page.locator('#model-search'); await expect(search).toBeVisible(); await search.fill(query); + await expect(page.getByRole('listbox').getByRole('alert')).toHaveText(/results? found/i); await expect(page.getByRole('option').first()).toBeVisible(); return search; }