feat(manager): signage screens, schedules, the message of the day and the weather's town (platform-v2 step 5.6c)

Signage gets tabs:
- Screens: every paired signage TV with what it plays (a playlist, or a
  schedule that wins over it), its shape and rotation, a warning when a
  playlist was made for the other shape; a link to pair one in Devices.
- Schedules: lines (a playlist on days / between hours that may pass midnight /
  between dates, with a priority) and the playlist for the rest of the time;
  "now: …" per schedule; the screens on it.
- Message and weather: the message of the day for every screen; the
  weather's town from a search (°C / °F), now / fetched at, "no forecast"
  when the server can't reach the service, fetch now, remove; says the
  weather needs internet and the widget hides without it.
- e2e signage.mjs +6 (message saved, weather section, choosing a playlist and
  turning the picture move the TV, a schedule built in the manager plays what
  it picks now); a crash is reported as a failed check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 23:20:44 +02:00
co-authored by Claude Opus 5.5
parent 5f6b51fb8b
commit 6c982e3139
9 changed files with 518 additions and 8 deletions
+49 -3
View File
@@ -1,4 +1,4 @@
// Signage suite (plan steps 5.5a, 5.5b, 5.6a, 5.6b): a TV paired as a signage screen plays its playlist (picture,
// Signage suite (plan steps 5.5a, 5.5b, 5.6a-c): a TV paired as a signage screen plays its playlist (picture,
// text, video to its end, menu board) in order with transitions, turns for a TV mounted sideways,
// keeps playing with the server stopped (a quiet mark, no banner), and catches up when it is back.
// Starts its own backend (:8065) and the terminal (:5193).
@@ -22,7 +22,7 @@ const managerVite = spawn('npx', ['vite', '--port', String(MPORT), '--strictPort
stdio: ['ignore', mlog, mlog], env: { ...process.env, XENIA_BACKEND: backend.url },
})
const browser = await chromium.launch(BROWSER_CHANNEL ? { channel: BROWSER_CHANNEL } : {})
const r = reporter('signage: the player on a TV (5.5a), menu boards and widgets (5.5b), the editor (5.6a, 5.6b)')
const r = reporter('signage: the player on a TV (5.5a), menu boards and widgets (5.5b), the editor (5.6a-c)')
const errors = []
let failures = 0
@@ -277,6 +277,51 @@ try {
&& !menuSlide.menu.groups.flatMap(g => g.items).some(i => i.id === hiddenId) && menuSlide.menu.groups[0].category?.id === catB.id,
JSON.stringify({ select: mc.select, cats: mc.category_ids, prods: mc.product_ids, ex: mc.exclude_ids, order: mc.category_order, badges: mc.badges }))
await mgr.screenshot({ path: path.join(OUT, 'signage-menu-editor.png') })
// ── 5.6c: screens, schedules, the message of the day ─────────────────────
await api('PUT', `/api/signage/screens/${dev.id}`, { token: boss, body: { playlist_id: pl.id } })
await mgr.getByTestId('signage-tab-settings').click()
await mgr.getByTestId('signage-weather').waitFor({ timeout: 10_000 }) // loaded: the message field holds the saved text
await mgr.getByTestId('signage-message').fill('Kalimera from the manager')
await mgr.getByTestId('signage-message-save').click()
await sleep(700)
r.check('5.6c: the message of the day is saved from the manager', (await api('GET', '/api/signage/message', { token: boss })).text === 'Kalimera from the manager')
r.check('5.6c: the weather section says what it needs (no town yet)', await shown(mgr, 'signage-weather', 5000)
&& (await mgr.getByTestId('signage-weather').textContent()).includes('internet'))
await mgr.getByTestId('signage-tab-screens').click()
const card = mgr.locator('[data-testid="signage-screen"][data-name="Window TV"]')
await card.waitFor({ timeout: 10_000 })
await card.getByTestId('signage-screen-playlist').selectOption({ label: 'Opening' })
const opId = (await api('GET', '/api/signage/playlists', { token: boss })).find(x => x.name === 'Opening').id
r.check('5.6c: Screens: choosing the playlist switches the TV', !!(await waitFor(async () => (await tv.getByTestId('app-signage').getAttribute('data-playlist')) === String(opId), 15_000, 300)))
await card.getByTestId('signage-screen-rotation').selectOption('180')
r.check('5.6c: …and turning its picture', !!(await waitFor(async () => (await tv.getByTestId('signage-frame').getAttribute('data-rotation')) === '180', 15_000, 300)))
await card.getByTestId('signage-screen-rotation').selectOption('0')
// a schedule: "Opening" around now, "Window" the rest of the time
const nowAthens = new Intl.DateTimeFormat('en-GB', { timeZone: 'Europe/Athens', hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }).format(new Date())
const [hh] = nowAthens.split(':').map(Number)
const from = `${String(Math.max(0, hh - 1)).padStart(2, '0')}:00`
const to = `${String(Math.min(23, hh + 1)).padStart(2, '0')}:59`
await mgr.getByTestId('signage-tab-schedules').click()
await mgr.getByTestId('signage-new-schedule').click()
await mgr.getByTestId('signage-schedule-editor').waitFor({ timeout: 10_000 })
await mgr.getByTestId('signage-schedule-name').fill('Opening hours')
await mgr.getByTestId('signage-add-entry').click()
await mgr.getByTestId('signage-entry-playlist').selectOption({ label: 'Opening' })
await mgr.getByTestId('signage-entry-from').fill(from)
await mgr.getByTestId('signage-entry-to').fill(to)
await mgr.getByTestId('signage-schedule-fallback').selectOption({ label: 'Window' })
await mgr.getByTestId('signage-schedule-save').click()
await sleep(900)
const sch = (await api('GET', '/api/signage/schedules', { token: boss })).find(x => x.name === 'Opening hours')
r.check('5.6c: a schedule built in the manager: "Opening" now, "Window" the rest of the time',
sch?.entries?.[0]?.time_from === from && sch.playing_now?.name === 'Opening' && sch.fallback_playlist_id === pl.id, JSON.stringify(sch))
await mgr.getByTestId('signage-tab-screens').click()
await card.getByTestId('signage-screen-playlist').selectOption({ label: 'Window' })
await sleep(500)
await card.getByTestId('signage-screen-schedule').selectOption({ label: 'Opening hours' })
r.check('5.6c: the TV on the schedule plays what it picks now', !!(await waitFor(async () => (await tv.getByTestId('app-signage').getAttribute('data-playlist')) === String(opId), 15_000, 300)))
await mgr.screenshot({ path: path.join(OUT, 'signage-screens.png'), fullPage: true })
await card.getByTestId('signage-screen-schedule').selectOption('')
await mgr.context().close()
await api('PUT', `/api/signage/screens/${dev.id}`, { token: boss, body: { playlist_id: pl.id } })
await waitFor(async () => (await tv.getByTestId('app-signage').getAttribute('data-playlist')) === String(pl.id), 15_000, 300)
@@ -304,7 +349,8 @@ try {
failures += r.done()
} catch (e) {
console.error(e)
failures += 1 + r.done()
r.check('the suite ran to the end', false, String(e.message).split(/\r?\n/)[0]) // never "all passed" after a crash
failures += r.done()
} finally {
await browser.close()
term.stop()