🧪 test: Wait for Debounced Model Search Results Before Navigating Them (#18088)
Some checks failed
Publish `@librechat/data-schemas` to NPM / pack (push) Has been cancelled
Docker Dev Images Build / publish (push) Has been cancelled
Sync Helm Chart Tags / Ignore non-main push (push) Has been cancelled
Sync Helm Chart Tags / Sync chart tags (push) Has been cancelled
Publish `@librechat/data-schemas` to NPM / publish-npm (push) Has been cancelled

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.
This commit is contained in:
Danny Avila 2026-11-12 09:48:42 -05:00 • committed by GitHub
parent cbd4cbb5fb
commit 2e6b23cb08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;
}