import fs from 'node:fs/promises'; import {chromium} from '@playwright/test'; import {bootPromoFixture,exercisePromoCreation} from './promo-entry-fixture.mjs'; const base=new URL(process.env.TIMEWEB_BASE_URL||'https://app.caterium.ru'); if(base.protocol!=='https:')throw new Error('HTTPS required'); 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 bootPromoFixture(page,base.href); await page.screenshot({path:`${output}/promo-entry-${width}.png`,animations:'disabled'}); await exercisePromoCreation(page); await page.locator('#ctmPromoPanel').screenshot({path:`${output}/promo-form-${width}.png`,animations:'disabled'}); results.push({width,loadedFromApp:true,headerEntry:true,threePlans:true,syntheticCreation:true}); console.log(`PASS published promo UI ${width}px: real loader, visible entry, three plans, selected duration, synthetic creation`); }finally{await context.close();} } await fs.writeFile(`${output}/promo-entry.json`,JSON.stringify({backend:'synthetic and network-blocked; no real codes created',results},null,2)); }finally{await browser.close();}