From 2e6b23cb08b99b2b682ad83d92148c64e40e53f7 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Thu, 12 Nov 2026 09:48:42 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20test:=20Wait=20for=20Debounced?= =?UTF-8?q?=20Model=20Search=20Results=20Before=20Navigating=20Them=20(#18?= =?UTF-8?q?088)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The model selector applies its search query after a 200 ms debounce, and until then the unfiltered menu is still rendered. openModelSearch waited only for a visible option, which that unfiltered list satisfies, so the pin test counted and arrowed through it. When the results replaced it mid-loop, the active row unmounted and the remaining presses often ran out before reaching a mock-model row. Wait for the results announcement, which only the search results render, before navigating. --- e2e/specs/mock/scenarios/model-selector-search.spec.ts | 6 ++++++ 1 file changed, 6 insertions(+) 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; }