diff --git a/image-vectorize/tools/e2e-site.mjs b/image-vectorize/tools/e2e-site.mjs index e168464..8d0cda4 100644 --- a/image-vectorize/tools/e2e-site.mjs +++ b/image-vectorize/tools/e2e-site.mjs @@ -189,12 +189,15 @@ const pvBox = await page.locator('.vz-preview').boundingBox() await page.mouse.move(pvBox.x + pvBox.width / 2 + 40, pvBox.y + pvBox.height / 2 - 20) await page.mouse.wheel(0, -300) await sleep(220) +// 断言「换算比例」而不是「比容器大」:正方形图 fit 进宽屏预览后本来就比容器窄, +// 拿 rect.width > clientWidth 会比较,放大了也可能不成立(实测真站 549 vs 1011) check('滚轮放大预览、倍率胶囊出现', await page.evaluate(() => { const p = document.querySelector('.vz-preview') + const v = document.querySelector('[data-stage="vector"]') const z = Number(p.style.getPropertyValue('--vz-zoom') || 1) const chip = document.querySelector('[data-zoom-chip]') - const rect = document.querySelector('[data-stage="vector"]').getBoundingClientRect() - return z > 1.1 && Boolean(chip) && !chip.hidden && rect.width > p.clientWidth + const ratio = v.getBoundingClientRect().width / v.clientWidth + return z > 1.1 && Boolean(chip) && !chip.hidden && Math.abs(ratio - z) < 0.02 })) await page.mouse.dblclick(pvBox.x + pvBox.width / 2, pvBox.y + pvBox.height / 2) await sleep(220)