test(ui): derive the settings field count from the schema (#12901)

The settings page spec hard-coded 58 fields. Each new setting broke it,
most recently max_concurrent_backend_operations, which made the page
list 59. Compare the grouped keys with the schema keys instead, so a
failure names the field that is in no group or shown twice. Add the
new setting to the mocked settings payload.

Assisted-by: Claude:claude-sonnet-5-5

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
mudler-agentandEttore Di Giacinto authored and GitHub committed 2026-10-25 21:29:36 +01:00
1 parent 64912200a7
commit f1d36a0e25
2 files changed
+10 -4

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ export function settingsFixture(overrides = {}) {
return {
watchdog_enabled: true, watchdog_idle_enabled: true, watchdog_busy_enabled: false,
watchdog_idle_timeout: '15m0s', watchdog_busy_timeout: '5m0s', watchdog_interval: '500ms',
max_active_backends: 0, official_libraries: true, auto_upgrade_backends: false, auto_upgrade_addons: false, prefer_development_backends: false,
max_active_backends: 0, max_concurrent_backend_operations: 1, official_libraries: true, auto_upgrade_backends: false, auto_upgrade_addons: false, prefer_development_backends: false,
memory_reclaimer_enabled: true, memory_reclaimer_threshold: 0.9,
force_eviction_when_busy: false, size_aware_eviction: false,
lru_eviction_max_retries: 50, lru_eviction_retry_interval: '1s',
+9 -3
View File
@@ -1,5 +1,6 @@
import { test, expect } from './coverage-fixtures.js'
import { mockSettings } from './settings-fixtures.js'
import { FIELDS } from '../src/utils/settingsSchema.js'
const row = (page, key) => page.locator(`[data-field="${key}"]`)
const group = (page, name) => page.getByRole('button', { name: new RegExp(`^${name}`) })
@@ -34,9 +35,14 @@ test.describe('Settings: groups and search', () => {
seen.add(key)
}
}
// 55 settings plus the three branding images.
expect(seen.size).toBe(58)
await expect(page.getByLabel(/Search all 58 settings/)).toBeVisible()
// The schema is the list of settings the page owns (the three branding
// images included). Compare by name so a failure says which one is
// missing from every group or shown twice, not just a count.
const expected = FIELDS.map(f => f.key)
expect([...seen].filter(k => !expected.includes(k)), 'shown but not in the schema').toEqual([])
expect(expected.filter(k => !seen.has(k)), 'in the schema but in no group').toEqual([])
expect(seen.size).toBe(expected.length)
await expect(page.getByLabel(new RegExp(`Search all ${expected.length} settings`))).toBeVisible()
})
test('a group lists its settings, and the memory group shows memory use now', async ({ page }) => {