feat: implement pinch gesture in GestureSimulator

This commit is contained in:
张翔
2026-03-05 14:58:28 +08:00
parent 656480a95d
commit 302fafef49
2 changed files with 51 additions and 0 deletions
@@ -31,4 +31,27 @@ test.describe('GestureSimulator - Swipe', () => {
const afterScrollY = await page.evaluate(() => window.scrollY);
expect(afterScrollY).toBeLessThan(initialScrollY);
});
test('should perform pinch zoom', async ({ page }) => {
await page.goto('/products');
const simulator = new GestureSimulator(page);
const image = page.locator('.product-image').first();
await image.click();
await simulator.pinch({
centerX: 200,
centerY: 300,
startDistance: 100,
endDistance: 50,
duration: 300,
});
const transform = await image.evaluate((el) => {
const style = window.getComputedStyle(el);
return style.transform;
});
expect(transform).toBeTruthy();
});
});