feat(waiter): the look on the shared tokens; the venue's colour (platform-v2 step 4.6)
- The waiter's --bg/--text/--accent… are made of @xenia/ui tokens: light / dark (user menu) and the venue's accent reach every screen; the 751 colour literals in waiter_pwa/src became tokens (by hue family and lightness), hex-alpha suffixes became fade() (color-mix), fixing 'var(--accent)18' tints that never showed. - @xenia/ui: new `special` (violet: offers, discounts, deals; contrast-tested) and `on-colour` tokens. - Setting venue.theme (teal | amber | blue | violet | rose, default amber), bootstrap venue.theme, manager Settings → Venue → Colour; the waiter sets data-venue-theme and the theme before the first render. - Guard tests/no-colours.test.mjs; tests/e2e/waiter_look.mjs (every page light + dark, side-by-side compare page); waiter e2e +3; backend test_venue_theme.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+19
-1
@@ -15,7 +15,7 @@ const vite = await startViteNative({ port: 5181, backendUrl: backend.url })
|
||||
const APP = 'http://localhost:5181'
|
||||
const TOKEN_KEY = 'xenia:dev:token'
|
||||
const browser = await chromium.launch(BROWSER_CHANNEL ? { channel: BROWSER_CHANNEL } : {})
|
||||
const r = reporter('waiter: sign-in v2, lock, approvals (4.2), keys (4.3), server prices (4.4), languages (4.5), table history (4.7)')
|
||||
const r = reporter('waiter: sign-in v2, lock, approvals (4.2), keys (4.3), server prices (4.4), languages (4.5), table history (4.7), look (4.6)')
|
||||
const errors = []
|
||||
let failures = 0
|
||||
|
||||
@@ -274,6 +274,24 @@ try {
|
||||
await a.getByTestId('menu-language-en').click()
|
||||
await waitFor(async () => (await navText()).includes('Tables'), 8000, 300)
|
||||
|
||||
// ── 4.6: the look on the shared tokens: the venue's colour and light / dark reach the phone ──
|
||||
const accentOf = () => a.evaluate(() => getComputedStyle(document.documentElement).getPropertyValue('--x-accent-rgb').trim())
|
||||
r.check('4.6: the venue colour (default amber) is on the phone', await a.evaluate(() => document.documentElement.dataset.venueTheme) === 'amber')
|
||||
await api('PUT', '/api/settings/venue.theme', { token: boss, body: { value: 'blue' } })
|
||||
await a.reload()
|
||||
await waitFor(async () => (await a.evaluate(() => document.documentElement.dataset.venueTheme)) === 'blue', 10_000, 300)
|
||||
r.check('4.6: Settings → Venue → Colour: blue reaches the phone (its accent turns blue)',
|
||||
await a.evaluate(() => document.documentElement.dataset.venueTheme) === 'blue' && (await accentOf()) === '96 165 250', await accentOf())
|
||||
await api('PUT', '/api/settings/venue.theme', { token: boss, body: { value: 'amber' } })
|
||||
await a.getByRole('button', { name: 'demo_maria' }).first().click({ timeout: 10_000 })
|
||||
await a.getByRole('button', { name: /Light theme/ }).click()
|
||||
const bg = await a.evaluate(() => getComputedStyle(document.body).backgroundColor)
|
||||
r.check('4.6: light theme from the menu: the page turns light (tokens)', await a.evaluate(() => document.documentElement.dataset.theme) === 'light' && bg === 'rgb(248, 250, 252)', bg)
|
||||
await a.screenshot({ path: path.join(OUT, 'waiter-light.png') })
|
||||
await a.getByRole('button', { name: 'demo_maria' }).first().click({ timeout: 10_000 })
|
||||
await a.getByRole('button', { name: /Dark theme/ }).click()
|
||||
await a.reload()
|
||||
|
||||
// ── Signing out ends the session on the server: the second phone can sign in ─
|
||||
await a.getByRole('button', { name: 'demo_maria' }).first().click({ timeout: 10_000 })
|
||||
await a.getByRole('button', { name: /Sign out/ }).last().click()
|
||||
|
||||
Reference in New Issue
Block a user