/
githubmirror
/
ionic
Обзор
Документация
Войти
/
githubmirror
/
ionic
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
core/src/components/refresher/test/test.utils.ts
25 строк
886 B
Maria Hutt
test(many): replace waitForSelector with waitFor (#28888)
26 янв 2024, 19:32
Не верифицирован
26 янв 2024, 19:32
2a3c26e
Код
Авторство
О чём код?
import type { E2EPage } from '@utils/test/playwright'; import { dragElementByYAxis } from '@utils/test/playwright'; /** * Emulates a pull-to-refresh drag gesture (pulls down and releases). * * You will need to manually dispatch an event called `ionRefreshComplete` * in your `complete()` handler for the refresh event. Otherwise the `waitForEvent` * will complete when the timeout completes (5000ms). * * @param page The E2E Page object. * @param selector The element selector to center the drag gesture on. Defaults to `body`. */ const pullToRefresh = async (page: E2EPage, selector = 'body') => { const target = page.locator(selector); await page.locator('ion-refresher.hydrated').waitFor({ state: 'attached' }); const ev = await page.spyOnEvent('ionRefreshComplete'); await dragElementByYAxis(target, page, 320); await ev.next(); }; export { pullToRefresh };