From 9b3a7e21c062683d167aaa7e3ac78d3b1edc2650 Mon Sep 17 00:00:00 2001 From: yuneng-berri Date: Sat, 10 Oct 2026 09:11:55 +0000 Subject: [PATCH] test(ui): match the Add Model provider option by its label element The Provider dropdown's options now carry a second line, "Decision models: ...", for every provider whose litellm_provider owns a decision entry in the cost map, so an anchored regex over the whole option no longer matches the display name. Match the name on the option's own label element instead, which keeps the exact string pinned and tolerates the sublabel. --- tests/e2e/ui/tests/modelsPage/addModel.spec.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/e2e/ui/tests/modelsPage/addModel.spec.ts b/tests/e2e/ui/tests/modelsPage/addModel.spec.ts index a99fb937b83..12d13fa4682 100644 --- a/tests/e2e/ui/tests/modelsPage/addModel.spec.ts +++ b/tests/e2e/ui/tests/modelsPage/addModel.spec.ts @@ -34,7 +34,9 @@ const exactly = (text: string): RegExp => new RegExp(`^${text.replace(/[.*+?^${} * searchable combobox: it only opens on click, typing filters the list, and the * option has to be picked explicitly because nothing is highlighted by default. * Options are matched on their visible text, not their accessible name, which - * also carries the provider logo's alt text ("Anthropic logo Anthropic"). + * also carries the provider logo's alt text ("Anthropic logo Anthropic"). The + * name is matched on the option's own label element, because an option can also + * carry a sublabel line, and matching the whole option would read both. */ async function selectProvider(page: PlaywrightPage, providerName: string) { const providerDropdown = page.getByRole("combobox", { name: "Provider", exact: true }); @@ -42,7 +44,7 @@ async function selectProvider(page: PlaywrightPage, providerName: string) { await providerDropdown.fill(providerName); await page .getByRole("option") - .filter({ hasText: exactly(providerName) }) + .filter({ has: page.getByText(exactly(providerName)) }) .click(); await expect(providerDropdown).toHaveValue(providerName); }