feat(manager): every settings tab on v2 (platform-v2 step 6.14a)

- Settings: tabs in the address (?tab=), Fiscal only with the fiscal app, Appearance only with the waiter app
- General: version / update / license / state / uptime, the local network (address by hand or found, the pairing QR),
  what is set up, export / import of the catalogue and the tables (a wrong file refused, two confirmations), support lock
- Sign-in & security: idle lock / sign-out (seconds..hours, warning when sign-out comes first), recovery codes
- Operation: role permissions, waiters' own shifts and takings, card payments, tables and orders, courses (add, rename,
  colour, order), quick notes, table flags (emoji, colour, white/black text, on/off), quick messages, send the QR menu now
- Appearance: the waiter app's table-card colours per state, light and dark, flash, colour picker with opacity, reset
- Fiscal: on/off, driver, folders with a reachability check, clerk / card terminal numbers, receipt end lines, VAT groups
- Development: pretend printing
- dropped: the v1 'automatic store schedule' switches (kept in the browser only, nothing read them) and the second time-zone card
- backend: JSON settings must be JSON (validation.setting_value); fiscal folders are plain paths (were typed json)
- venue colour data in sections/venueColours.js (guard DATA); store/tableColourStore and Settings/tabs deleted
- tests: settings.test.mjs (5), test_settings_json.py, e2e manager.mjs 'settings v2' (12 checks)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 19:41:14 +02:00
co-authored by Claude Opus 5.5
parent bde125bf09
commit f6fcfb7736
27 changed files with 1935 additions and 2819 deletions
+81 -8
View File
@@ -610,7 +610,7 @@ try {
// 3.4: the customer display's idle screen, the venue's choice
await api('PUT', '/api/platform/modules/customer_display', { token: boss, body: { enabled: true } }).catch(() => {})
await page.goto(`${APP}/settings`)
await page.getByText('Customer display', { exact: true }).click()
await page.getByTestId('settings-tab-customer-display').click()
await page.getByTestId('display-style-qr').click()
await page.getByTestId('display-qr-caption').fill('Order online')
await page.getByTestId('display-save').click()
@@ -625,7 +625,7 @@ try {
// 4.3: Settings → Operation → "What each role may do" replaces the three waiter switches
await page.goto(`${APP}/settings`)
await page.getByRole('button', { name: 'Operation', exact: true }).click()
await page.getByTestId('settings-tab-operation').click()
await page.getByTestId('settings-role-permissions').waitFor({ timeout: 10_000 })
r.check('settings: Operation has "What each role may do", the old waiter switches are gone',
await page.getByText('Ακυρώσεις Παραγγελιών από Σερβιτόρους').count() === 0 && await page.getByText('Αναίρεση Πληρωμής από Σερβιτόρους').count() === 0)
@@ -645,7 +645,7 @@ try {
r.check('settings: back to the role defaults → Maria takes payments again', (await mariaPerms()).keys.includes('ordering.orders.close'))
await page.goto(`${APP}/settings`)
await page.getByText('Sign-in & security', { exact: true }).click()
await page.getByTestId('settings-tab-security').click()
const waiterMode = page.getByTestId('setting-auth.waiter_login_mode')
await waiterMode.waitFor({ timeout: 10_000 })
await waiterMode.selectOption('tap')
@@ -671,7 +671,7 @@ try {
r.check('settings: sign out after 14 days by default; 30 days is saved', idleDefault === '14' && await settingValue('auth.idle_days') === '30', idleDefault)
await idleSel.selectOption('14')
await page.getByText('Venue & language', { exact: true }).click()
await page.getByTestId('settings-tab-venue').click()
const tzSelect = page.getByTestId('setting-venue.timezone')
await tzSelect.waitFor({ timeout: 10_000 })
await tzSelect.selectOption('Europe/London')
@@ -686,7 +686,7 @@ try {
await tzSelect.selectOption('Europe/Athens')
await sleep(800)
await page.getByText('Printing', { exact: true }).click()
await page.getByTestId('settings-tab-print-fonts').click()
const alertSel = page.getByTestId('setting-print.alert_after_failures')
await alertSel.waitFor({ timeout: 10_000 })
await alertSel.selectOption('5')
@@ -695,6 +695,81 @@ try {
await alertSel.selectOption('2')
await sleep(500)
// ── 6.14a: every settings tab on v2 ───────────────────────────────────────────
const st6 = 'settings v2:'
const waitSetting = async (key, want) => { let v; for (let i = 0; i < 30 && (v = await settingValue2(key)) !== want; i++) await sleep(150); return v }
const settingValue2 = async key => (await api('GET', '/api/settings/', { token: boss }))[key]?.value
await page.goto(`${APP}/settings`)
r.check(`${st6} General: the version, the local network, what is set up`, await page.getByTestId('system-version').waitFor({ timeout: 10_000 }).then(() => true).catch(() => false)
&& await page.getByTestId('settings-lan').count() === 1 && (await page.getByTestId('system-stats').textContent()).includes('Categories'))
const [catFile] = await Promise.all([page.waitForEvent('download', { timeout: 10_000 }), page.getByTestId('export-catalog').click()])
const catPath = await catFile.path()
await page.getByTestId('import-tables').setInputFiles(catPath)
r.check(`${st6} importing the catalogue file as tables is refused`, await page.getByText("This isn't a Tables and zones file.").waitFor({ timeout: 5000 }).then(() => true).catch(() => false))
await page.getByTestId('import-catalog').setInputFiles(catPath)
r.check(`${st6} the exported catalogue reads back: the import asks first, with what it adds`, await page.getByTestId('import-next').waitFor({ timeout: 5000 }).then(() => true).catch(() => false))
await page.keyboard.press('Escape')
await page.screenshot({ path: path.join(OUT, 'manager-settings-general.png'), fullPage: true })
await page.getByTestId('settings-tab-security').click()
await page.getByTestId('setting-security.auto_lock').click()
r.check(`${st6} Security: lock after a while is saved`, await waitSetting('security.auto_lock', 'true') === 'true' && await page.getByTestId('settings-recovery').count() === 1)
await page.getByTestId('setting-security.auto_lock').click()
await waitSetting('security.auto_lock', 'false')
await page.getByTestId('settings-tab-operation').click()
const coursesOn = page.getByTestId('setting-orders.courses_enabled')
await coursesOn.waitFor({ timeout: 10_000 })
if (await coursesOn.getAttribute('aria-checked') !== 'true') { await coursesOn.click(); await waitSetting('orders.courses_enabled', 'true') }
const coursesBefore = JSON.parse(await settingValue2('orders.courses') || '[]').length
await page.getByTestId('course-add').click()
let coursesNow = coursesBefore
for (let i = 0; i < 30 && coursesNow === coursesBefore; i++) { await sleep(150); coursesNow = JSON.parse(await settingValue2('orders.courses') || '[]').length }
r.check(`${st6} Operation: a course added`, coursesNow === coursesBefore + 1, `${coursesBefore} → ${coursesNow}`)
await page.getByTestId('quick-note-new').fill('E2E: well done')
await page.getByTestId('quick-note-add').click()
let notesNow = []
for (let i = 0; i < 30 && !notesNow.includes('E2E: well done'); i++) { await sleep(150); notesNow = JSON.parse(await settingValue2('orders.quick_notes') || '[]') }
r.check(`${st6} Operation: a quick note added`, notesNow.includes('E2E: well done'), JSON.stringify(notesNow))
await page.getByTestId('flag-new').click()
await page.getByTestId('flag-save').click()
r.check(`${st6} a table flag needs a name`, (await page.getByTestId('flag-dialog').textContent()).includes('Enter a name'))
await page.getByTestId('flag-name').fill('E2E VIP')
await page.getByTestId('flag-save').click()
await page.locator('[data-testid="flag-row"]', { hasText: 'E2E VIP' }).waitFor({ timeout: 8000 }).catch(() => {})
r.check(`${st6} a table flag added`, (await api('GET', '/api/flags/defs?include_inactive=true', { token: boss })).some(f => f.name === 'E2E VIP'))
await page.screenshot({ path: path.join(OUT, 'manager-settings-operation.png'), fullPage: true })
await page.getByTestId('settings-tab-colours').click()
await page.getByTestId('colours-free').first().locator('button').first().click()
await page.getByTestId('colour-hex').fill('#123456')
await page.getByTestId('colour-save').click()
let tc = null
for (let i = 0; i < 30 && tc?.light?.free?.cardBg !== '#123456'; i++) { await sleep(150); tc = JSON.parse(await settingValue2('ui.table_colours') || '{}') }
r.check(`${st6} Appearance: a table colour for the waiter app saved`, tc?.light?.free?.cardBg === '#123456', JSON.stringify(tc?.light?.free))
await page.screenshot({ path: path.join(OUT, 'manager-settings-colours.png'), fullPage: true })
await page.getByText('Back to the default colours', { exact: true }).click()
await page.getByRole('button', { name: 'Reset', exact: true }).click()
for (let i = 0; i < 30 && tc?.light?.free?.cardBg === '#123456'; i++) { await sleep(150); tc = JSON.parse(await settingValue2('ui.table_colours') || '{}') }
await page.getByTestId('settings-tab-development').click()
await page.getByTestId('setting-dev.spoof_printing').click()
r.check(`${st6} Development: pretend printing is saved`, await waitSetting('dev.spoof_printing', 'true') === 'true')
await page.getByTestId('setting-dev.spoof_printing').click()
await waitSetting('dev.spoof_printing', 'false')
await api('PUT', '/api/platform/modules/fiscal', { token: boss, body: { enabled: true } }).catch(() => {})
await page.goto(`${APP}/settings?tab=fiscal`)
if (await page.getByTestId('settings-fiscal').waitFor({ timeout: 8000 }).then(() => true).catch(() => false)) {
await page.getByTestId('fiscal-out').fill('/tmp/e2e-fiscal-out')
await page.getByTestId('fiscal-in').fill('/tmp/e2e-fiscal-in')
await page.getByTestId('fiscal-save-folders').click()
r.check(`${st6} Fiscal: the folders saved as plain paths`, await waitSetting('fiscal.out_folder', '/tmp/e2e-fiscal-out') === '/tmp/e2e-fiscal-out')
await api('PUT', '/api/platform/modules/fiscal', { token: boss, body: { enabled: false } }).catch(() => {})
}
await page.getByTestId('user-menu').click()
await page.getByRole('menuitemradio', { name: 'Ελληνικά' }).click()
await page.goto(`${APP}/settings?tab=operation`)
r.check(`${st6} Settings in Greek`, await page.getByTestId('settings-tab-operation').filter({ hasText: 'Λειτουργία' }).waitFor({ timeout: 8000 }).then(() => true).catch(() => false)
&& await page.getByTestId('settings-flags').filter({ hasText: 'Σημάνσεις τραπεζιών' }).count() === 1)
await page.getByTestId('user-menu').click()
await page.getByRole('menuitemradio', { name: 'English' }).click()
await page.goto(`${APP}/reports/technical`)
await page.getByText('Log files', { exact: true }).click()
const today = new Date().toISOString().slice(0, 10)
@@ -1060,9 +1135,7 @@ try {
// ── 6.10: printers, the ticket's look and prep zones on v2 ───────────────────
const pz = 'printing:'
const settingValue2 = async key => (await api('GET', '/api/settings/', { token: boss }))[key]?.value
await page.goto(`${APP}/settings`)
await page.getByText('Printing', { exact: true }).click()
await page.goto(`${APP}/settings?tab=print-fonts`)
await page.getByTestId('printers-card').waitFor({ timeout: 10_000 }).catch(() => {})
await page.getByTestId('printer-new').click()
await page.getByTestId('printer-save').click()