test(ui): filter the Default model pin combobox by typing, not by virtualized index

The 'default model pin' tests picked the pin out of the antd Select by title, which
only works while the pin is inside the (virtualized) options list's visible viewport.
Adding a third bundled preset in #37068 grew the mocked model set, pushed the pin
below the viewport, and reddened the tests on staging even though nothing about the
production pin behaviour changed. Typing filters the Select down to the pin so the
match is not sensitive to where the pin lands in the list.

Co-authored-by: Krrish Dholakia <krrish-berri-2@users.noreply.github.com>
This commit is contained in:
Cursor Agent 2026-08-17 18:16:33 +00:00
parent 9d40cd4df7
commit 98fae6845a
No known key found for this signature in database

View file

@ -616,7 +616,12 @@ describe("AddAutoRouterTab", () => {
// Applying a preset collapses Detailed Configuration, so the default model row is behind it.
expandDetailedConfiguration();
await user.click(screen.getByRole("combobox", { name: "Default model" }));
const defaultModelCombobox = screen.getByRole("combobox", { name: "Default model" });
await user.click(defaultModelCombobox);
// Typing filters the antd Select down to the pin so the match does not depend on where the
// pin lands in the (virtualized) options list; adding another preset to the bundled JSON has
// in the past pushed the pin below the visible viewport and reddened this test.
await user.type(defaultModelCombobox, PINNED_MODEL);
await user.click((await screen.findAllByTitle(PINNED_MODEL)).slice(-1)[0]);
};