import { chromium } from '@playwright/test' import { mkdirSync } from 'node:fs' import { resolve } from 'node:path' const BASE = process.env.SITE_URL ?? 'https://test.food-market.kz' const OUT = resolve('/home/nns/food-market', 'docs/site-fixes-2026-10-11') mkdirSync(OUT, { recursive: true }) const results = [] const ok = (n, c, d = '') => { results.push({ n, c: !!c, d }); console.log(`${c ? '✓' : '✗'} ${n} ${d}`) } const b = await chromium.launch({ args: ['--ignore-certificate-errors'] }) for (const [w, h, tag] of [[1280, 900, '1280'], [390, 844, '390']]) { const ctx = await b.newContext({ viewport: { width: w, height: h }, deviceScaleFactor: 2, ignoreHTTPSErrors: true, isMobile: w < 500, hasTouch: w < 500 }) const p = await ctx.newPage() // pricing — конструктор, «₸» не переносится await p.goto(`${BASE}/pricing`, { waitUntil: 'networkidle' }); await p.waitForTimeout(1200) // «₸» в большой сумме и «5 000 ₸/мес» в одной строке (проверяем перенос по высоте строки) const priceBox = await p.locator('#configurator .font-extrabold').first().boundingBox().catch(() => null) ok(`pricing@${tag}: цена конструктора в одну строку`, priceBox && priceBox.height < 60, priceBox ? `h=${Math.round(priceBox.height)}` : 'нет') await p.locator('#configurator').scrollIntoViewIfNeeded().catch(() => {}) await p.screenshot({ path: resolve(OUT, `k3-pricing-${tag}.png`) }) // главная — касса «скоро» await p.goto(`${BASE}/`, { waitUntil: 'networkidle' }); await p.waitForTimeout(600) const homeTxt = await p.locator('body').innerText() ok(`главная@${tag}: касса «скачивание — скоро»`, /скачивани[ея].{0,3}—.{0,3}скоро/i.test(homeTxt)) await ctx.close() } // about — касса «скоро» (один раз) { const ctx = await b.newContext({ viewport: { width: 1280, height: 900 }, deviceScaleFactor: 2, ignoreHTTPSErrors: true }) const p = await ctx.newPage() await p.goto(`${BASE}/about`, { waitUntil: 'networkidle' }); await p.waitForTimeout(500) const t = await p.locator('body').innerText() ok('about: касса «скачивание — скоро»', /приложение для скачивания.{0,3}—.{0,3}скоро/i.test(t)) await p.screenshot({ path: resolve(OUT, 'k3-about-1280.png'), fullPage: true }) await ctx.close() } await b.close() console.log(`\n[site-verify-3] ${results.filter(r => r.c).length}/${results.length} passed → ${OUT}`)