const { chromium } = require(process.env.REVIEW_PLAYWRIGHT); const fs = require('node:fs'); const assert = require('node:assert/strict'); (async () => { const browser = await chromium.launch({ headless: true }); try { const page = await browser.newPage(); const css = ['globals.css', 'ops-redesign.css', 'admin/config.css', 'account.css', 'workspace.css', 'portal/issue-flow.css'].map(p => fs.readFileSync(`frontend/app/${p}`, 'utf8')).join('\n'); for (const width of [320, 390, 1440]) { await page.setViewportSize({ width, height: 900 }); await page.setContent(`
${Array.from({length: 8}, (_, i) => ``).join('')}
`); const bounds = await page.locator('.portal-item-row').evaluateAll(rows => rows.map(row => { const r = row.getBoundingClientRect(), content = row.firstElementChild.getBoundingClientRect(); return {top:r.top,bottom:r.bottom,innerTop:content.top,innerBottom:content.bottom}; })); bounds.forEach((r,i) => { assert(r.innerTop >= r.top); assert(r.innerBottom <= r.bottom); if(i) assert(r.top >= bounds[i-1].bottom + 7); }); console.log(`Issue card content and spacing passed at ${width}px`); } } finally { await browser.close(); } })().catch(e => { console.error(e); process.exit(1); });