mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-21 07:23:11 +00:00
🧪 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
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:
parent
cbd4cbb5fb
commit
2e6b23cb08
1 changed files with 6 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue