Skip to content

Commit a271c72

Browse files
committed
fix(react-ui/e2e): scope backendTrigger to <main> so it skips LanguageSwitcher
The LanguageSwitcher added in the i18n PR (mudler#9642) lives in the sidebar and also uses aria-haspopup="listbox" — same attribute the import-form SearchableSelect uses. The Batch D / E tests' helper resolved the trigger with `page.locator('button[aria-haspopup="listbox"]').first()`, which now returns the language switcher (rendered first in DOM order, in the sidebar) instead of the backend dropdown. After clicking the wrong button, getByRole('option', { name: 'llama-cpp' }) naturally never resolves — language options aren't backend names — and the test times out at 30s. Scope the locator to the <main className="main-content"> wrapper so only buttons inside the route's main content area match. The page layout has the Sidebar outside <main>, so this cleanly excludes it. Assisted-by: Claude:claude-opus-4-7[1m] [Claude Code] Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
1 parent ade5fd4 commit a271c72

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

core/http/react-ui/e2e/import-form-ux-batch-d.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ async function enterPowerPreferences(page) {
5252
}
5353

5454
// Backend dropdown trigger — the SearchableSelect button has
55-
// `aria-haspopup="listbox"`. There's exactly one on the Power/Preferences
56-
// page so the first match is stable.
55+
// `aria-haspopup="listbox"`. The LanguageSwitcher in the sidebar uses the
56+
// same attribute, so scope to the <main> content area to skip it.
5757
function backendTrigger(page) {
58-
return page.locator('button[aria-haspopup="listbox"]').first()
58+
return page.locator('main button[aria-haspopup="listbox"]').first()
5959
}
6060

6161
async function selectBackend(page, name) {

core/http/react-ui/e2e/import-form-ux-batch-e.spec.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ function chip(page, key) {
5959
}
6060

6161
function backendTrigger(page) {
62-
return page.locator('button[aria-haspopup="listbox"]').first()
62+
// Scope to <main>: the LanguageSwitcher in the sidebar also uses
63+
// aria-haspopup="listbox", so an unscoped .first() selector picks it
64+
// instead of the backend dropdown.
65+
return page.locator('main button[aria-haspopup="listbox"]').first()
6366
}
6467

6568
test.describe('Import form UX — Batch E (modality chip row)', () => {

0 commit comments

Comments
 (0)