From f1d36a0e25e9763c48abb53361cc2f446d3e6e87 Mon Sep 17 00:00:00 2001 From: mudler-agent Date: Sun, 25 Oct 2026 21:29:36 +0100 Subject: [PATCH] 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 Co-authored-by: Ettore Di Giacinto --- core/http/react-ui/e2e/settings-fixtures.js | 2 +- core/http/react-ui/e2e/settings-page.spec.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/core/http/react-ui/e2e/settings-fixtures.js b/core/http/react-ui/e2e/settings-fixtures.js index f25b2b4f9..b66f09d9a 100644 --- a/core/http/react-ui/e2e/settings-fixtures.js +++ b/core/http/react-ui/e2e/settings-fixtures.js @@ -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', diff --git a/core/http/react-ui/e2e/settings-page.spec.js b/core/http/react-ui/e2e/settings-page.spec.js index 985f4c119..61120179a 100644 --- a/core/http/react-ui/e2e/settings-page.spec.js +++ b/core/http/react-ui/e2e/settings-page.spec.js @@ -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 }) => {