diff --git a/e2e/image-input.spec.ts b/e2e/image-input.spec.ts index 1cc76764..2a6e3203 100644 --- a/e2e/image-input.spec.ts +++ b/e2e/image-input.spec.ts @@ -63,6 +63,8 @@ async function assertBottomCropHandle(page: Page) { const selection = cropper.locator('.ReactCrop__crop-selection'); const handle = cropper.locator('.ReactCrop__drag-handle.ord-se'); await expect(selection).toBeVisible(); + // 等进入动画结束再量位置与拖动,避免 zoom-in-95 缩放期间坐标与高度偏移 + await expect.poll(() => cropper.evaluate((el) => el.getAnimations().length)).toBe(0); const viewportBox = await viewport.boundingBox(); const selectionBox = await selection.boundingBox(); const handleBox = await handle.boundingBox(); @@ -72,7 +74,7 @@ async function assertBottomCropHandle(page: Page) { const before = selectionBox.height; await page.mouse.move(handleBox.x + handleBox.width / 2, handleBox.y + handleBox.height / 2); await page.mouse.down(); - await page.mouse.move(handleBox.x + handleBox.width / 2, handleBox.y + handleBox.height / 2 - 40); + await page.mouse.move(handleBox.x + handleBox.width / 2, handleBox.y + handleBox.height / 2 - 40, { steps: 5 }); await page.mouse.up(); await expect.poll(async () => (await selection.boundingBox())?.height ?? 0).toBeLessThan(before - 10); }