Fix mouse tests for chromium

This commit is contained in:
Jon Bockhorst
2020-02-11 13:13:03 -06:00
parent 520918348e
commit 8fb6ded506
+20 -3
View File
@@ -90,7 +90,7 @@ async function wheelUp(): Promise<void> {
y: self._y,
deltaX: 0,
deltaY: -10,
modifiers: self._keyboard._modifiers
modifiers: toModifiersMask(page.keyboard._modifiers())
});
}
async function wheelDown(): Promise<void> {
@@ -101,10 +101,27 @@ async function wheelDown(): Promise<void> {
y: self._y,
deltaX: 0,
deltaY: 10,
modifiers: self._keyboard._modifiers
modifiers: toModifiersMask(page.keyboard._modifiers())
});
}
function toModifiersMask(modifiers: Set<String>): number {
let mask = 0;
if (modifiers.has('Alt')) {
mask |= 1;
}
if (modifiers.has('Control')) {
mask |= 2;
}
if (modifiers.has('Meta')) {
mask |= 4;
}
if (modifiers.has('Shift')) {
mask |= 8;
}
return mask;
}
// button definitions
const buttons: { [key: string]: number } = {
'<none>': -1,
@@ -199,7 +216,7 @@ function parseReport(encoding: string, msg: number[]): { state: any; row: number
* Mouse tracking tests.
*/
describe('Mouse Tracking Tests', () => {
before(async function (): Promise<void> {
before(async function(): Promise<void> {
browser = await getBrowserType().launch({
headless: process.argv.indexOf('--headless') !== -1,
args: [`--window-size=${width},${height}`, `--no-sandbox`]