Skip to content

Commit 373dc44

Browse files
localai-botmudler
andauthored
fix(react-ui): force .check() on hidden Toggle input in fits-filter e2e (#10031)
* fix(react-ui): force .check() on hidden Toggle input in fits-filter e2e The polish PR (#10030) swapped the raw <input type=checkbox> for the shared <Toggle> component, which visually hides its native input via opacity:0;width:0;height:0. Playwright's .check() waits for visibility before clicking and times out after 30 s, breaking two UI E2E tests: - enabling fits filter hides models that exceed available VRAM - fits filter state persists after reload Pass { force: true } to skip the visibility check; the input is still the real focusable checkbox and toggles state on click. The companion .toBeChecked() assertion only reads state and works unchanged. Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Assisted-by: Claude:claude-opus-4-7 * fix(react-ui): click visible Toggle track in fits-filter e2e force:true skips the actionability checks but not the viewport check, and the Toggle's hidden input has width:0;height:0 so Playwright still reports "Element is outside of the viewport". Click the visible .toggle__track inside the filter-bar-group__toggle wrapper instead — that's what a real user clicks, and label-input association toggles the wrapped checkbox naturally. Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Assisted-by: Claude:claude-opus-4-7 --------- Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
1 parent 02a0e70 commit 373dc44

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

core/http/react-ui/e2e/models-gallery.spec.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,9 @@ test.describe('Models Gallery - Fits In GPU Filter', () => {
289289
test('enabling fits filter hides models that exceed available VRAM', async ({ page }) => {
290290
await expect(page.locator('tr', { hasText: 'stablediffusion-model' })).toBeVisible()
291291

292-
await page.getByLabel('Fits in GPU').check()
292+
// The shared <Toggle> visually hides its native input (opacity:0;w:0;h:0),
293+
// so .check() can't interact with it directly — click the visible track.
294+
await page.locator('label.filter-bar-group__toggle', { hasText: 'Fits in GPU' }).locator('.toggle__track').click()
293295

294296
await expect(page.locator('tr', { hasText: 'stablediffusion-model' })).toHaveCount(0)
295297
await expect(page.locator('tr', { hasText: 'llama-model' })).toBeVisible()
@@ -298,7 +300,7 @@ test.describe('Models Gallery - Fits In GPU Filter', () => {
298300
})
299301

300302
test('fits filter state persists after reload', async ({ page }) => {
301-
await page.getByLabel('Fits in GPU').check()
303+
await page.locator('label.filter-bar-group__toggle', { hasText: 'Fits in GPU' }).locator('.toggle__track').click()
302304
await page.reload()
303305
await expect(page.getByLabel('Fits in GPU')).toBeChecked()
304306
})

0 commit comments

Comments
 (0)