import { chromium } from 'playwright'; const b = await chromium.launch({ executablePath: 'C:/Program Files/Google/Chrome/Application/chrome.exe' }); const p = await (await b.newContext({ viewport: { width: 1440, height: 900 } })).newPage(); const clear = () => p.evaluate(() => document.querySelectorAll('vite-error-overlay').forEach(e=>e.remove())); await p.goto('http://localhost:4200/login', { waitUntil: 'networkidle' }); await clear(); await p.waitForTimeout(600); await p.fill('input[type="tel"]', '13800138000'); await p.fill('input[type="text"][maxlength="6"]', '123456'); await p.click('button[type="submit"]'); await p.waitForTimeout(3000); await p.goto('http://localhost:4200/desktop/contacts', { waitUntil: 'networkidle' }); await clear(); await p.waitForTimeout(2000); // 检查「全部」Tab 下方是否有异常空元素 const probe = await p.evaluate(() => { const out = []; document.querySelectorAll('section, h2.section-title, .grid, ul.rows').forEach(el => { const r = el.getBoundingClientRect(); out.push({ tag: el.tagName + (el.className ? '.' + String(el.className).split(' ')[0] : ''), h: Math.round(r.height), text: (el.textContent || '').trim().slice(0, 20), }); }); return out; }); console.log('=== 「全部」Tab 下的区块 ==='); probe.forEach(x => console.log(` ${x.tag.padEnd(24)} h=${String(x.h).padStart(4)} "${x.text}"`)); await p.screenshot({ path: '../../.shots/dk-contacts-all.png' }); await b.close();