caterium-app/tests/production-mobile-menu.mjs
pavlov346346-source 5ce7d8d353
Mobile menu editor above boxes with a matching return arrow (#34)
On phones place the existing menu editor above the catalog and add the same return-to-top control used by New Order. Preserve form nodes, unsaved values and active input focus; keep desktop/tablet layout and read-only permissions. Full QA passed, including iPhone WebKit and existing promotion focus regression. Extend real-asset production verification with a backend-blocked mobile-menu scenario.
2026-09-19 20:02:43 +03:00

20 lines
1.2 KiB
JavaScript

import fs from 'node:fs/promises';
import {chromium} from '@playwright/test';
import {bootMenuFixture,exerciseMenuNavigation} from './mobile-menu-scenario.mjs';
const base=new URL(process.env.TIMEWEB_BASE_URL||'https://app.caterium.ru');
if(base.protocol!=='https:')throw new Error('Production UI verification requires HTTPS');
const output='production-ui-results';await fs.mkdir(output,{recursive:true});
const browser=await chromium.launch(),results=[];
try{
for(const width of [390,1440]){
const context=await browser.newContext({viewport:{width,height:900},serviceWorkers:'block'});
try{
const page=await context.newPage();
await bootMenuFixture(page,base.href);
const result=await exerciseMenuNavigation(page,{screenshot:async name=>{await page.screenshot({path:`${output}/${name}-${width}.png`,animations:'disabled'});}});
results.push({width,...result});console.log(`PASS published menu ${width}px: form placement, arrow, unsaved values, save, unchanged orders`);
}finally{await context.close();}
}
await fs.writeFile(`${output}/mobile-menu-result.json`,JSON.stringify({base:base.href,checkedAt:new Date().toISOString(),backend:'synthetic, network-blocked',results},null,2));
}finally{await browser.close();}