Fix timing issues in mouse tracking tests

This commit is contained in:
Daniel Imms
2019-11-09 14:16:57 -08:00
parent 2aaa997d39
commit 17677568f9
+122 -127
View File
@@ -4,8 +4,8 @@
*/
import * as puppeteer from 'puppeteer';
import { assert } from 'chai';
import { ITerminalOptions } from 'xterm';
import { pollFor } from './TestUtils';
const APP = 'http://127.0.0.1:3000/test';
@@ -199,21 +199,16 @@ function parseReport(encoding: string, msg: number[]): {state: any; row: number;
* Mouse tracking tests.
*/
describe('Mouse Tracking Tests', function(): void {
this.timeout(60000);
before(async function(): Promise<any> {
browser = await puppeteer.launch({
headless: process.argv.indexOf('--headless') !== -1,
slowMo: 0,
args: [`--window-size=${width},${height}`, `--no-sandbox`]
});
page = (await browser.pages())[0];
await page.setViewport({ width, height });
});
after(() => {
browser.close();
});
after(async () => browser.close());
beforeEach(async () => {
await page.goto(APP);
@@ -246,18 +241,18 @@ describe('Mouse Tracking Tests', function(): void {
// test at 0,0
await mouseDown('left');
assert.deepEqual(await getReports(encoding), [{col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
// mouseup should not report
await mouseUp('left');
assert.deepEqual(await getReports(encoding), []);
await pollFor(page, () => getReports(encoding), []);
// mousemove should not report
await mouseMove(50, 10);
assert.deepEqual(await getReports(encoding), []);
await pollFor(page, () => getReports(encoding), []);
await mouseDown('left');
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [{col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
// test at max rows/cols
// bug: we are capped at col 95 currently
@@ -265,7 +260,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseMove(cols - 1, rows - 1);
await mouseDown('left');
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [{col: 95, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 95, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
// button press/move/release tests
// left button
@@ -274,7 +269,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseDown('left');
await mouseMove(44, 24);
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
// middle button
// bug: default action not cancelled (adds data to getReports from clipboard under X11)
// await mouseMove(43, 24);
@@ -282,7 +277,7 @@ describe('Mouse Tracking Tests', function(): void {
// await mouseDown('middle');
// await mouseMove(44, 24);
// await mouseUp('middle');
// assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]);
// await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]);
// right button
// bug: default action not cancelled (popup shown)
await mouseMove(43, 24);
@@ -290,15 +285,15 @@ describe('Mouse Tracking Tests', function(): void {
await mouseDown('right');
await mouseMove(44, 24);
await mouseUp('right');
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}}]);
// wheel
await mouseMove(43, 24);
await getReports(encoding); // clear reports
await wheelUp();
assert.deepEqual(await getReports(encoding), []);
await pollFor(page, () => getReports(encoding), []);
await wheelDown();
assert.deepEqual(await getReports(encoding), []);
await pollFor(page, () => getReports(encoding), []);
// modifiers
// CTRL
@@ -310,7 +305,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseUp('left');
await wheelDown();
await page.keyboard.up('Control');
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
// ALT
@@ -322,7 +317,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseUp('left');
await wheelDown();
await page.keyboard.up('Alt');
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
// SHIFT
// note: caught by selection manager
@@ -337,9 +332,9 @@ describe('Mouse Tracking Tests', function(): void {
await wheelDown();
await page.keyboard.up('Shift');
if (noShift) {
assert.deepEqual(await getReports(encoding), []);
await pollFor(page, () => getReports(encoding), []);
} else {
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}
]);
}
@@ -358,7 +353,7 @@ describe('Mouse Tracking Tests', function(): void {
await page.keyboard.up('Control');
await page.keyboard.up('Alt');
// await page.keyboard.up('Shift');
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
});
it('SGR encoding', async () => {
const encoding = 'SGR';
@@ -368,24 +363,24 @@ describe('Mouse Tracking Tests', function(): void {
// test at 0,0
await mouseDown('left');
assert.deepEqual(await getReports(encoding), [{col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
// mouseup should not report
await mouseUp('left');
assert.deepEqual(await getReports(encoding), []);
await pollFor(page, () => getReports(encoding), []);
// mousemove should not report
await mouseMove(50, 10);
assert.deepEqual(await getReports(encoding), []);
await pollFor(page, () => getReports(encoding), []);
await mouseDown('left');
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [{col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
// test at max rows/cols
await mouseMove(cols - 1, rows - 1);
await mouseDown('left');
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [{col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
// button press/move/release tests
// left button
@@ -394,7 +389,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseDown('left');
await mouseMove(44, 24);
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
// middle button
// bug: default action not cancelled (adds data to getReports from clipboard under X11)
// await mouseMove(43, 24);
@@ -402,7 +397,7 @@ describe('Mouse Tracking Tests', function(): void {
// await mouseDown('middle');
// await mouseMove(44, 24);
// await mouseUp('middle');
// assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]);
// await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]);
// right button
// bug: default action not cancelled (popup shown)
await mouseMove(43, 24);
@@ -410,15 +405,15 @@ describe('Mouse Tracking Tests', function(): void {
await mouseDown('right');
await mouseMove(44, 24);
await mouseUp('right');
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}}]);
// wheel
await mouseMove(43, 24);
await getReports(encoding); // clear reports
await wheelUp();
assert.deepEqual(await getReports(encoding), []);
await pollFor(page, () => getReports(encoding), []);
await wheelDown();
assert.deepEqual(await getReports(encoding), []);
await pollFor(page, () => getReports(encoding), []);
// modifiers
// CTRL
@@ -430,7 +425,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseUp('left');
await wheelDown();
await page.keyboard.up('Control');
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
// ALT
@@ -442,7 +437,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseUp('left');
await wheelDown();
await page.keyboard.up('Alt');
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
// SHIFT
// note: caught by selection manager
@@ -455,9 +450,9 @@ describe('Mouse Tracking Tests', function(): void {
await wheelDown();
await page.keyboard.up('Shift');
if (noShift) {
assert.deepEqual(await getReports(encoding), []);
await pollFor(page, () => getReports(encoding), []);
} else {
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}
]);
}
@@ -476,7 +471,7 @@ describe('Mouse Tracking Tests', function(): void {
await page.keyboard.up('Control');
await page.keyboard.up('Alt');
// await page.keyboard.up('Shift');
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]);
});
});
describe('DECSET 1000 (VT200 mouse)', () => {
@@ -495,22 +490,22 @@ describe('Mouse Tracking Tests', function(): void {
// test at 0,0
await mouseDown('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}
]);
// mouseup should report, encoding cannot report released button
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 1, row: 1, state: {action: 'release', button: '<none>', modifier: {control: false, shift: false, meta: false}}}
]);
// mousemove should not report
await mouseMove(50, 10);
assert.deepEqual(await getReports(encoding), []);
await pollFor(page, () => getReports(encoding), []);
await mouseDown('left');
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}},
{col: 51, row: 11, state: {action: 'release', button: '<none>', modifier: {control: false, shift: false, meta: false}}}
]);
@@ -521,7 +516,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseMove(cols - 1, rows - 1);
await mouseDown('left');
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 95, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}},
{col: 95, row: rows, state: {action: 'release', button: '<none>', modifier: {control: false, shift: false, meta: false}}}
]);
@@ -533,7 +528,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseDown('left');
await mouseMove(44, 24);
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'release', button: '<none>', modifier: {control: false, shift: false, meta: false}}}
]);
@@ -544,7 +539,7 @@ describe('Mouse Tracking Tests', function(): void {
// await mouseDown('middle');
// await mouseMove(44, 24);
// await mouseUp('middle');
// assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]);
// await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]);
// right button
// bug: default action not cancelled (popup shown)
await mouseMove(43, 24);
@@ -552,7 +547,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseDown('right');
await mouseMove(44, 24);
await mouseUp('right');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'release', button: '<none>', modifier: {control: false, shift: false, meta: false}}}
]);
@@ -561,9 +556,9 @@ describe('Mouse Tracking Tests', function(): void {
await mouseMove(43, 24);
await getReports(encoding); // clear reports
await wheelUp();
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
await wheelDown();
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
// modifiers
// CTRL
@@ -575,7 +570,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseUp('left');
await wheelDown();
await page.keyboard.up('Control');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'release', button: '<none>', modifier: {control: true, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}}
@@ -590,7 +585,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseUp('left');
await wheelDown();
await page.keyboard.up('Alt');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}},
{col: 45, row: 25, state: {action: 'release', button: '<none>', modifier: {control: false, shift: false, meta: true}}},
{col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}}
@@ -608,11 +603,11 @@ describe('Mouse Tracking Tests', function(): void {
await wheelDown();
await page.keyboard.up('Shift');
if (noShift) {
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}}
]);
} else {
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: true, meta: false}}},
{col: 45, row: 25, state: {action: 'release', button: '<none>', modifier: {control: false, shift: true, meta: false}}},
{col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}}
@@ -633,7 +628,7 @@ describe('Mouse Tracking Tests', function(): void {
await page.keyboard.up('Control');
await page.keyboard.up('Alt');
// await page.keyboard.up('Shift');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: true}}},
{col: 45, row: 25, state: {action: 'release', button: '<none>', modifier: {control: true, shift: false, meta: true}}},
{col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}}
@@ -647,22 +642,22 @@ describe('Mouse Tracking Tests', function(): void {
// test at 0,0
await mouseDown('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}
]);
// mouseup should report
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 1, row: 1, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}}
]);
// mousemove should not report
await mouseMove(50, 10);
assert.deepEqual(await getReports(encoding), []);
await pollFor(page, () => getReports(encoding), []);
await mouseDown('left');
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}},
{col: 51, row: 11, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}}
]);
@@ -671,7 +666,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseMove(cols - 1, rows - 1);
await mouseDown('left');
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}},
{col: cols, row: rows, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}}
]);
@@ -683,7 +678,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseDown('left');
await mouseMove(44, 24);
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}}
]);
@@ -694,7 +689,7 @@ describe('Mouse Tracking Tests', function(): void {
// await mouseDown('middle');
// await mouseMove(44, 24);
// await mouseUp('middle');
// assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]);
// await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]);
// right button
// bug: default action not cancelled (popup shown)
await mouseMove(43, 24);
@@ -702,7 +697,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseDown('right');
await mouseMove(44, 24);
await mouseUp('right');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'release', button: 'right', modifier: {control: false, shift: false, meta: false}}}
]);
@@ -711,9 +706,9 @@ describe('Mouse Tracking Tests', function(): void {
await mouseMove(43, 24);
await getReports(encoding); // clear reports
await wheelUp();
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
await wheelDown();
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
// modifiers
// CTRL
@@ -725,7 +720,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseUp('left');
await wheelDown();
await page.keyboard.up('Control');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: true, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}}
@@ -740,7 +735,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseUp('left');
await wheelDown();
await page.keyboard.up('Alt');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}},
{col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: true}}},
{col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}}
@@ -757,11 +752,11 @@ describe('Mouse Tracking Tests', function(): void {
await wheelDown();
await page.keyboard.up('Shift');
if (noShift) {
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}}
]);
} else {
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: true, meta: false}}},
{col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: true, meta: false}}},
{col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}}
@@ -782,7 +777,7 @@ describe('Mouse Tracking Tests', function(): void {
await page.keyboard.up('Control');
await page.keyboard.up('Alt');
// await page.keyboard.up('Shift');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: true}}},
{col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: true, shift: false, meta: true}}},
{col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}}
@@ -805,22 +800,22 @@ describe('Mouse Tracking Tests', function(): void {
// test at 0,0
await mouseDown('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}
]);
// mouseup should report, encoding cannot report released button
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 1, row: 1, state: {action: 'release', button: '<none>', modifier: {control: false, shift: false, meta: false}}}
]);
// mousemove should not report
await mouseMove(50, 10);
assert.deepEqual(await getReports(encoding), []);
await pollFor(page, () => getReports(encoding), []);
await mouseDown('left');
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}},
{col: 51, row: 11, state: {action: 'release', button: '<none>', modifier: {control: false, shift: false, meta: false}}}
]);
@@ -831,7 +826,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseMove(cols - 1, rows - 1);
await mouseDown('left');
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 95, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}},
{col: 95, row: rows, state: {action: 'release', button: '<none>', modifier: {control: false, shift: false, meta: false}}}
]);
@@ -843,7 +838,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseDown('left');
await mouseMove(44, 24);
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'release', button: '<none>', modifier: {control: false, shift: false, meta: false}}}
@@ -855,7 +850,7 @@ describe('Mouse Tracking Tests', function(): void {
// await mouseDown('middle');
// await mouseMove(44, 24);
// await mouseUp('middle');
// assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]);
// await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]);
// right button
// bug: default action not cancelled (popup shown)
await mouseMove(43, 24);
@@ -863,7 +858,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseDown('right');
await mouseMove(44, 24);
await mouseUp('right');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'move', button: 'right', modifier: {control: false, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'release', button: '<none>', modifier: {control: false, shift: false, meta: false}}}
@@ -873,9 +868,9 @@ describe('Mouse Tracking Tests', function(): void {
await mouseMove(43, 24);
await getReports(encoding); // clear reports
await wheelUp();
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
await wheelDown();
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
// modifiers
// CTRL
@@ -887,7 +882,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseUp('left');
await wheelDown();
await page.keyboard.up('Control');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'release', button: '<none>', modifier: {control: true, shift: false, meta: false}}},
@@ -903,7 +898,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseUp('left');
await wheelDown();
await page.keyboard.up('Alt');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}},
{col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: true}}},
{col: 45, row: 25, state: {action: 'release', button: '<none>', modifier: {control: false, shift: false, meta: true}}},
@@ -921,11 +916,11 @@ describe('Mouse Tracking Tests', function(): void {
await wheelDown();
await page.keyboard.up('Shift');
if (noShift) {
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}}
]);
} else {
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: true, meta: false}}},
{col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: true, meta: false}}},
{col: 45, row: 25, state: {action: 'release', button: '<none>', modifier: {control: false, shift: true, meta: false}}},
@@ -947,7 +942,7 @@ describe('Mouse Tracking Tests', function(): void {
await page.keyboard.up('Control');
await page.keyboard.up('Alt');
// await page.keyboard.up('Shift');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: true}}},
{col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: true}}},
{col: 45, row: 25, state: {action: 'release', button: '<none>', modifier: {control: true, shift: false, meta: true}}},
@@ -963,22 +958,22 @@ describe('Mouse Tracking Tests', function(): void {
// test at 0,0
// bug: release is fired immediately
await mouseDown('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}
]);
// mouseup should report, encoding cannot report released button
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 1, row: 1, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}}
]);
// mousemove should not report
await mouseMove(50, 10);
assert.deepEqual(await getReports(encoding), []);
await pollFor(page, () => getReports(encoding), []);
await mouseDown('left');
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}},
{col: 51, row: 11, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}}
]);
@@ -987,7 +982,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseMove(cols - 1, rows - 1);
await mouseDown('left');
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}},
{col: cols, row: rows, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}}
]);
@@ -999,7 +994,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseDown('left');
await mouseMove(44, 24);
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}}
@@ -1011,7 +1006,7 @@ describe('Mouse Tracking Tests', function(): void {
// await mouseDown('middle');
// await mouseMove(44, 24);
// await mouseUp('middle');
// assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]);
// await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]);
// right button
// bug: default action not cancelled (popup shown)
await mouseMove(43, 24);
@@ -1019,7 +1014,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseDown('right');
await mouseMove(44, 24);
await mouseUp('right');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'move', button: 'right', modifier: {control: false, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'release', button: 'right', modifier: {control: false, shift: false, meta: false}}}
@@ -1029,9 +1024,9 @@ describe('Mouse Tracking Tests', function(): void {
await mouseMove(43, 24);
await getReports(encoding); // clear reports
await wheelUp();
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
await wheelDown();
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
// modifiers
// CTRL
@@ -1043,7 +1038,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseUp('left');
await wheelDown();
await page.keyboard.up('Control');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: true, shift: false, meta: false}}},
@@ -1059,7 +1054,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseUp('left');
await wheelDown();
await page.keyboard.up('Alt');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}},
{col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: true}}},
{col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: true}}},
@@ -1077,11 +1072,11 @@ describe('Mouse Tracking Tests', function(): void {
await wheelDown();
await page.keyboard.up('Shift');
if (noShift) {
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}}
]);
} else {
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: true, meta: false}}},
{col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: true, meta: false}}},
{col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: true, meta: false}}},
@@ -1103,7 +1098,7 @@ describe('Mouse Tracking Tests', function(): void {
await page.keyboard.up('Control');
await page.keyboard.up('Alt');
// await page.keyboard.up('Shift');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: true}}},
{col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: true}}},
{col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: true, shift: false, meta: true}}},
@@ -1124,24 +1119,24 @@ describe('Mouse Tracking Tests', function(): void {
// test at 0,0
await mouseDown('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}
]);
// mouseup should report, encoding cannot report released button
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 1, row: 1, state: {action: 'release', button: '<none>', modifier: {control: false, shift: false, meta: false}}}
]);
// mousemove should report
await mouseMove(50, 10);
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 51, row: 11, state: {action: 'move', button: '<none>', modifier: {control: false, shift: false, meta: false}}}
]);
await mouseDown('left');
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}},
{col: 51, row: 11, state: {action: 'release', button: '<none>', modifier: {control: false, shift: false, meta: false}}}
]);
@@ -1152,7 +1147,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseMove(cols - 1, rows - 1);
await mouseDown('left');
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 95, row: rows, state: {action: 'move', button: '<none>', modifier: {control: false, shift: false, meta: false}}},
{col: 95, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}},
{col: 95, row: rows, state: {action: 'release', button: '<none>', modifier: {control: false, shift: false, meta: false}}}
@@ -1164,7 +1159,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseDown('left');
await mouseMove(44, 24);
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'move', button: '<none>', modifier: {control: false, shift: false, meta: false}}},
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: false}}},
@@ -1177,14 +1172,14 @@ describe('Mouse Tracking Tests', function(): void {
// await mouseDown('middle');
// await mouseMove(44, 24);
// await mouseUp('middle');
// assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]);
// await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]);
// right button
// bug: default action not cancelled (popup shown)
await mouseMove(43, 24);
await mouseDown('right');
await mouseMove(44, 24);
await mouseUp('right');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'move', button: '<none>', modifier: {control: false, shift: false, meta: false}}},
{col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'move', button: 'right', modifier: {control: false, shift: false, meta: false}}},
@@ -1195,9 +1190,9 @@ describe('Mouse Tracking Tests', function(): void {
await mouseMove(43, 24);
await getReports(encoding); // clear reports
await wheelUp();
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
await wheelDown();
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
// modifiers
// CTRL
@@ -1208,7 +1203,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseUp('left');
await wheelDown();
await page.keyboard.up('Control');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'move', button: '<none>', modifier: {control: true, shift: false, meta: false}}},
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: false}}},
@@ -1224,7 +1219,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseUp('left');
await wheelDown();
await page.keyboard.up('Alt');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'move', button: '<none>', modifier: {control: false, shift: false, meta: true}}},
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}},
{col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: true}}},
@@ -1242,12 +1237,12 @@ describe('Mouse Tracking Tests', function(): void {
await wheelDown();
await page.keyboard.up('Shift');
if (noShift) {
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'move', button: '<none>', modifier: {control: false, shift: true, meta: false}}},
{col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}}
]);
} else {
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'move', button: '<none>', modifier: {control: false, shift: true, meta: false}}},
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: true, meta: false}}},
{col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: true, meta: false}}},
@@ -1269,7 +1264,7 @@ describe('Mouse Tracking Tests', function(): void {
await page.keyboard.up('Control');
await page.keyboard.up('Alt');
// await page.keyboard.up('Shift');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'move', button: '<none>', modifier: {control: true, shift: false, meta: true}}},
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: true}}},
{col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: true}}},
@@ -1285,24 +1280,24 @@ describe('Mouse Tracking Tests', function(): void {
// test at 0,0
await mouseDown('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}
]);
// mouseup should report, encoding cannot report released button
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 1, row: 1, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}}
]);
// mousemove should report
await mouseMove(50, 10);
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 51, row: 11, state: {action: 'move', button: '<none>', modifier: {control: false, shift: false, meta: false}}}
]);
await mouseDown('left');
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}},
{col: 51, row: 11, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}}
]);
@@ -1313,7 +1308,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseMove(cols - 1, rows - 1);
await mouseDown('left');
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: cols, row: rows, state: {action: 'move', button: '<none>', modifier: {control: false, shift: false, meta: false}}},
{col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}},
{col: cols, row: rows, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}}
@@ -1325,7 +1320,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseDown('left');
await mouseMove(44, 24);
await mouseUp('left');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'move', button: '<none>', modifier: {control: false, shift: false, meta: false}}},
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: false}}},
@@ -1338,14 +1333,14 @@ describe('Mouse Tracking Tests', function(): void {
// await mouseDown('middle');
// await mouseMove(44, 24);
// await mouseUp('middle');
// assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]);
// await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]);
// right button
// bug: default action not cancelled (popup shown)
await mouseMove(43, 24);
await mouseDown('right');
await mouseMove(44, 24);
await mouseUp('right');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'move', button: '<none>', modifier: {control: false, shift: false, meta: false}}},
{col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'move', button: 'right', modifier: {control: false, shift: false, meta: false}}},
@@ -1356,9 +1351,9 @@ describe('Mouse Tracking Tests', function(): void {
await mouseMove(43, 24);
await getReports(encoding); // clear reports
await wheelUp();
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
await wheelDown();
assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
await pollFor(page, () => getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]);
// modifiers
// CTRL
@@ -1369,7 +1364,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseUp('left');
await wheelDown();
await page.keyboard.up('Control');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'move', button: '<none>', modifier: {control: true, shift: false, meta: false}}},
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}},
{col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: false}}},
@@ -1385,7 +1380,7 @@ describe('Mouse Tracking Tests', function(): void {
await mouseUp('left');
await wheelDown();
await page.keyboard.up('Alt');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'move', button: '<none>', modifier: {control: false, shift: false, meta: true}}},
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}},
{col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: true}}},
@@ -1403,12 +1398,12 @@ describe('Mouse Tracking Tests', function(): void {
await wheelDown();
await page.keyboard.up('Shift');
if (noShift) {
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'move', button: '<none>', modifier: {control: false, shift: true, meta: false}}},
{col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}}
]);
} else {
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'move', button: '<none>', modifier: {control: false, shift: true, meta: false}}},
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: true, meta: false}}},
{col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: true, meta: false}}},
@@ -1430,7 +1425,7 @@ describe('Mouse Tracking Tests', function(): void {
await page.keyboard.up('Control');
await page.keyboard.up('Alt');
// await page.keyboard.up('Shift');
assert.deepEqual(await getReports(encoding), [
await pollFor(page, () => getReports(encoding), [
{col: 44, row: 25, state: {action: 'move', button: '<none>', modifier: {control: true, shift: false, meta: true}}},
{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: true}}},
{col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: true}}},