feat: implement swipe gesture in GestureSimulator
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { GestureSimulator } from '../../utils/GestureSimulator';
|
||||
|
||||
test.describe('GestureSimulator - Swipe', () => {
|
||||
test('should perform swipe up', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
const simulator = new GestureSimulator(page);
|
||||
|
||||
const initialScrollY = await page.evaluate(() => window.scrollY);
|
||||
expect(initialScrollY).toBe(0);
|
||||
|
||||
await simulator.slowSwipeUp();
|
||||
|
||||
const afterScrollY = await page.evaluate(() => window.scrollY);
|
||||
expect(afterScrollY).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
test('should perform swipe down', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
const simulator = new GestureSimulator(page);
|
||||
|
||||
await page.evaluate(() => {
|
||||
window.scrollTo(0, 1000);
|
||||
});
|
||||
|
||||
const initialScrollY = await page.evaluate(() => window.scrollY);
|
||||
expect(initialScrollY).toBeGreaterThan(0);
|
||||
|
||||
await simulator.quickSwipeDown();
|
||||
|
||||
const afterScrollY = await page.evaluate(() => window.scrollY);
|
||||
expect(afterScrollY).toBeLessThan(initialScrollY);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user