chore(playwright): dragElementByYAxis util (#25346)

This commit is contained in:
Sean Perkins
2022-05-31 09:27:49 -04:00
committed by GitHub
parent ca224d2a37
commit 982909017b
2 changed files with 37 additions and 16 deletions

View File

@ -1,4 +1,5 @@
import type { E2EPage } from '@utils/test/playwright';
import { dragElementByYAxis } from '@utils/test/playwright';
/**
* Emulates a pull-to-refresh drag gesture (pulls down and releases).
@ -16,23 +17,8 @@ const pullToRefresh = async (page: E2EPage, selector = 'body') => {
await page.waitForSelector('ion-refresher.hydrated', { state: 'attached' });
const ev = await page.spyOnEvent('ionRefreshComplete');
const boundingBox = await target.boundingBox();
if (!boundingBox) {
return;
}
const startX = boundingBox.x + boundingBox.width / 2;
const startY = boundingBox.y + boundingBox.height / 2;
await page.mouse.move(startX, startY);
await page.mouse.down();
for (let i = 0; i < 400; i += 20) {
await page.mouse.move(startX, startY + i);
}
await page.mouse.up();
await dragElementByYAxis(target, page, 400);
await ev.next();
};