feat(menu): the menu in English and Greek (platform-v2 step 6.4, D-29)
- products.translations / categories.translations (Alembic 0033, core/menu_languages.py: el + en,
name / description / quick options by their base name; catalog.translation). Empty = the text
as typed; no machine translation (owner).
- In the manager's product editor ("In English" / "In Greek", quick extras), the category dialog,
and a menu board's Language (signage MenuContent.language).
- Customer screens only: cloud snapshot names / descriptions per language (C-2), the menu tablet's
EL / EN switch the names (localize), signage boards; tickets, KDS, counter, phones keep the base.
- Catalogue bundles carry translations; @xenia/access menuLanguages.js (a backend test compares).
- e2e: manager (the other language saved), menu tablet (EN / EL names), QR table (English on
the menu, the base name on the kitchen's order, Greek page as typed).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -36,7 +36,8 @@ try {
|
||||
await api('PUT', '/api/platform/modules/menu_tablet', { token: boss, body: { enabled: true } }).catch(() => {})
|
||||
const products = (await api('GET', '/api/products/?sold_at=in_store', { token: boss })).filter(p => !p.is_service_item && p.lifecycle_status === 'active')
|
||||
const souvlaki = products.find(p => /Σουβλάκι/.test(p.name)) || products[0]
|
||||
await api('PUT', `/api/products/${souvlaki.id}`, { token: boss, body: { allergens: { gluten: 'contains', mustard: 'may_contain' } } })
|
||||
await api('PUT', `/api/products/${souvlaki.id}`, { token: boss, body: { allergens: { gluten: 'contains', mustard: 'may_contain' },
|
||||
translations: { en: { name: 'Pork skewer (en)' } } } })
|
||||
|
||||
const tab = await (await browser.newContext({ viewport: { width: 1180, height: 820 }, hasTouch: true })).newPage()
|
||||
tab.on('pageerror', e => errors.push(e.message))
|
||||
@@ -59,6 +60,16 @@ try {
|
||||
r.check('6.3: …with its allergens', await tab.getByTestId('menu-details').locator('[data-allergen="gluten"][data-level="contains"]').count() === 1
|
||||
&& await tab.getByTestId('menu-details').locator('[data-allergen="mustard"][data-level="may_contain"]').count() === 1)
|
||||
await tab.keyboard.press('Escape')
|
||||
// 6.4: the language buttons switch the products' names too
|
||||
await tab.getByTestId('menu-search').fill('')
|
||||
const item = () => tab.locator(`[data-testid="menu-item"][data-id="${souvlaki.id}"]`).first()
|
||||
const wasEnglish = await tab.getByTestId('menu-lang-en').getAttribute('aria-pressed') === 'true'
|
||||
await tab.getByTestId('menu-lang-en').click()
|
||||
const inEnglish = await tab.waitForFunction(id => document.querySelector(`[data-testid="menu-item"][data-id="${id}"]`)?.textContent.includes('Pork skewer (en)'), souvlaki.id, { timeout: 5000 }).then(() => true).catch(() => false)
|
||||
await tab.getByTestId('menu-lang-el').click()
|
||||
await sleep(300)
|
||||
r.check('6.4: EN shows the English name, EL the name as typed', inEnglish && (await item().textContent()).includes(souvlaki.name))
|
||||
if (wasEnglish) await tab.getByTestId('menu-lang-en').click() // as it was (prices below are read in its format)
|
||||
await tab.getByTestId('menu-search').fill('zzzz')
|
||||
r.check('nothing found: says so', await shown(tab, 'menu-no-results', 5000))
|
||||
await tab.getByTestId('menu-search').fill('')
|
||||
|
||||
Reference in New Issue
Block a user