feat: implement drag gesture in GestureSimulator
This commit is contained in:
@@ -74,4 +74,26 @@ test.describe('GestureSimulator - Swipe', () => {
|
||||
|
||||
await expect(image).toBeVisible();
|
||||
});
|
||||
|
||||
test('should perform drag', async ({ page }) => {
|
||||
await page.goto('/products');
|
||||
const simulator = new GestureSimulator(page);
|
||||
|
||||
const firstCard = page.locator('.card').first();
|
||||
const secondCard = page.locator('.card').nth(1);
|
||||
|
||||
const firstCardInitialPosition = await firstCard.boundingBox();
|
||||
|
||||
await simulator.drag({
|
||||
source: firstCard,
|
||||
target: secondCard,
|
||||
duration: 500,
|
||||
});
|
||||
|
||||
const firstCardFinalPosition = await firstCard.boundingBox();
|
||||
|
||||
if (firstCardInitialPosition && firstCardFinalPosition) {
|
||||
expect(firstCardFinalPosition.y).toBeGreaterThan(firstCardInitialPosition.y);
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user