feat: the table map (platform-v2 step 6.8, D-31)
- floor_plans / floor_items (0035), tables' plan_id + width/height/rotation/shape; /api/floor-plans (set-up, catalog.tables.manage, floor_plans.changed) and /api/floor-plans/live (each table's state, guests, waiters, time; zone rule) - @xenia/floorplan: the drawing (Floor, Item, TableShape, FloorView) and its geometry (grid snap in whole cells, outlines, chairs), tested - manager: Management -> Tables -> Floor plans (editor: drag, grid, irregular floor, walls/bar/labels/areas, background picture), Tables page List / Map - counter POS: Tables List / Map; waiter: Map mode, the list stays the default - tests: test_floor_plans.py, floor + geometry unit tests, manager/waiter/terminal e2e Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -358,6 +358,30 @@ try {
|
||||
await api('PUT', '/api/waiters/roles/waiter/permissions', { token: boss, body: { keys: waiterRole.default_keys } })
|
||||
await a.goto(`${APP}/tables`)
|
||||
|
||||
// ── 6.8: the floor plan on the phone; the list stays the default (D-31) ──
|
||||
const liveNow = (await api('GET', '/api/floor-plans/live', { token: tokenA })).tables
|
||||
const [fA, fB] = liveNow.filter(t => t.state === 'free')
|
||||
const fp = await api('POST', '/api/floor-plans', { token: boss, body: { name: 'E2E floor', group_id: fA.group_id, width: 800, height: 500 } })
|
||||
await api('PUT', `/api/floor-plans/${fp.id}/layout`, { token: boss, body: {
|
||||
tables: [fA, fB].map((t, i) => ({ id: t.id, x: 200 + i * 300, y: 250, width: 120, height: 90, shape: 'long', seats: 6 })) } })
|
||||
await a.getByTestId('tables-map-toggle').waitFor({ timeout: 10_000 })
|
||||
r.check('6.8: the Tables page opens on the list', await a.getByTestId('tables-map-toggle').getAttribute('aria-pressed') === 'false' && await a.getByTestId('waiter-floor').count() === 0)
|
||||
await a.getByTestId('tables-map-toggle').click()
|
||||
const onMap = id => a.locator(`[data-testid="waiter-floor"] [data-testid="floor-table"][data-table="${id}"]`)
|
||||
r.check('6.8: Map shows the floor plan with the tables free', await onMap(fA.id).waitFor({ timeout: 10_000 }).then(() => true).catch(() => false)
|
||||
&& await onMap(fA.id).getAttribute('data-state') === 'free')
|
||||
const oF = await api('POST', '/api/orders/', { token: tokenA, body: { table_id: fA.id } })
|
||||
await api('POST', `/api/orders/${oF.id}/items`, { token: tokenA, body: { lines: [{ product_id: plain.id, quantity: 1 }] } })
|
||||
r.check('6.8: the waiter opens a table → it turns "yours" on the map at once', await a.waitForFunction(id =>
|
||||
document.querySelector(`[data-testid="waiter-floor"] [data-testid="floor-table"][data-table="${id}"]`)?.dataset.state === 'mine', fA.id, { timeout: 8000 }).then(() => true).catch(() => false))
|
||||
await a.screenshot({ path: path.join(OUT, 'waiter-floor.png') })
|
||||
await onMap(fA.id).click()
|
||||
r.check('6.8: a tap opens the table', await a.waitForURL(new RegExp(`/tables/${fA.id}$`), { timeout: 8000 }).then(() => true).catch(() => false))
|
||||
await api('DELETE', `/api/orders/${oF.id}`, { token: boss }).catch(() => {})
|
||||
await a.goto(`${APP}/tables`)
|
||||
await a.getByTestId('tables-map-toggle').waitFor({ timeout: 10_000 })
|
||||
r.check("6.8: back on Tables: the list again (the map isn't remembered)", await a.getByTestId('tables-map-toggle').getAttribute('aria-pressed') === 'false')
|
||||
|
||||
// ── 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')
|
||||
|
||||
Reference in New Issue
Block a user