Bug 1672141 - Part 3: Add touchstart logging to tocuh_action_helpers r=edgar

This is to check whether the intermittent failure is missing only touchend or missing the whole touch event sequences.

Differential Revision: https://phabricator.services.mozilla.com/D109482
This commit is contained in:
Kagami Sascha Rosylight 2021-03-23 14:18:03 +00:00
Родитель d2f0e414a7
Коммит 710889efe3
1 изменённых файлов: 21 добавлений и 6 удалений

Просмотреть файл

@ -6,21 +6,36 @@ function promiseTimeout(delay) {
});
}
function promiseTouchStart(element) {
return new Promise(resolve => {
element.addEventListener("touchstart", resolve, {
passive: true,
once: true,
});
});
}
async function touchScrollRight(aSelector = "#target0", aX = 20, aY = 20) {
var target = document.querySelector(aSelector);
let dragDonePromise = promiseTouchEnd(document.body);
const target = document.querySelector(aSelector);
const touchStartPromise = promiseTouchStart(document.body);
const touchEndPromise = promiseTouchEnd(document.body);
dump("Synthesizing horizontal drag\n");
await promiseNativePointerDrag(target, "touch", aX + 40, aY, -40, 0);
await dragDonePromise;
await touchStartPromise;
dump("Got touchstart from the horizontal drag\n");
await touchEndPromise;
dump("Got touchend from the horizontal drag\n");
}
async function touchScrollDown(aSelector = "#target0", aX = 20, aY = 20) {
var target = document.querySelector(aSelector);
let dragDonePromise = promiseTouchEnd(document.body);
const target = document.querySelector(aSelector);
const touchStartPromise = promiseTouchStart(document.body);
const touchEndPromise = promiseTouchEnd(document.body);
dump("Synthesizing vertical drag\n");
await promiseNativePointerDrag(target, "touch", aX, aY + 40, 0, -40);
await dragDonePromise;
await touchStartPromise;
dump("Got touchstart from the vertical drag\n");
await touchEndPromise;
dump("Got touchend from the vertical drag\n");
}