- 探针 docs/acceptance/2026-10-17-final/probe-logo.mjs 实测加载期无双字标可见窗口 (390x844 与 1280x800 各 60 次采样,双可见 0;唯一零可见是 t≈43ms header 尚未进 DOM) ⇒ 产品不闪,红来自辅助函数:expect.poll 等到非空后再单独读一次 boundingBox, hydration 亚 60ms 的重挂让第二次读取返回 null,被误报成「元素在断言瞬间消失」。 - 改为在同一次读取里既判非空又产出值;超时才 throw,且 throw 文案带轮询次数。 判据不降:仍要求非空 box + 原几何断言,没有 catch、没有静默通过。 - website-acceptance × 4 project 连跑两次各 56 passed。 - §14.2 表逐条登记:fail-open 修复 / 触摸目标与 region 命名 / 限流真因与双向用例 / 锚点重锚 / 引擎差异取证法(我上一个假设被自己的读数否掉)/ 本条竞态。
32 lines
1.6 KiB
JavaScript
32 lines
1.6 KiB
JavaScript
import { chromium } from 'playwright';
|
|
const b = await chromium.launch();
|
|
for (const vp of [{ width: 390, height: 844 }, { width: 1280, height: 800 }]) {
|
|
const ctx = await b.newContext({ viewport: vp });
|
|
const p = await ctx.newPage();
|
|
const samples = [];
|
|
await p.goto('http://localhost:3299/', { waitUntil: 'commit' }).catch(() => {});
|
|
for (let i = 0; i < 60; i++) {
|
|
const s = await p.evaluate(() => {
|
|
const imgs = [...document.querySelectorAll('header a[aria-label="返回首页"] img')];
|
|
const vis = imgs.filter((im) => { const r = im.getBoundingClientRect(); return r.width > 0 && r.height > 0; });
|
|
return {
|
|
t: Math.round(performance.now()),
|
|
total: imgs.length,
|
|
vis: vis.length,
|
|
visCls: vis.map((im) => (im.getAttribute('class') || '').split(' ')[0]).join('|'),
|
|
theme: document.documentElement.getAttribute('data-theme') ?? '-',
|
|
firstVisibleBoxH: vis[0] ? Math.round(vis[0].getBoundingClientRect().height) : null,
|
|
};
|
|
}).catch(() => null);
|
|
if (s) samples.push(s);
|
|
await p.waitForTimeout(60);
|
|
}
|
|
const multi = samples.filter((s) => s.vis > 1);
|
|
const zero = samples.filter((s) => s.vis === 0);
|
|
console.log(`viewport ${vp.width}x${vp.height}: 采样 ${samples.length} · 双可见 ${multi.length} · 零可见 ${zero.length} · 首次 data-theme=${samples.find((s) => s.theme !== '-')?.t ?? '未出现'}ms`);
|
|
if (multi.length) console.log(' 双可见样本:', JSON.stringify(multi.slice(0, 3)));
|
|
if (zero.length) console.log(' 零可见样本:', JSON.stringify(zero.slice(0, 3)));
|
|
await ctx.close();
|
|
}
|
|
await b.close();
|