From b299895730783d1ec30f8a578289e411334b39e2 Mon Sep 17 00:00:00 2001 From: qiqi Date: Mon, 9 Nov 2026 18:41:36 +0800 Subject: [PATCH] =?UTF-8?q?test(image-vectorize):=20=E7=9C=9F=E7=AB=99=20e?= =?UTF-8?q?2e=20=E8=A1=A5=E7=BC=A9=E6=94=BE/=E5=B9=B3=E7=A7=BB=E6=96=AD?= =?UTF-8?q?=E8=A8=80=EF=BC=88=E6=AF=94=E6=8D=A2=E7=AE=97=E6=AF=94=E4=BE=8B?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E6=AF=94=E5=AE=B9=E5=99=A8=E5=AE=BD=E5=BA=A6?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- image-vectorize/tools/e2e-site.mjs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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)