From 7515ed614660d1e836cece74fe6cc0888cc368bf Mon Sep 17 00:00:00 2001 From: Jon Bockhorst Date: Mon, 10 Feb 2020 16:56:37 -0600 Subject: [PATCH 01/37] Use playwright instead of puppeteer --- .../xterm-addon-attach/src/AttachAddon.api.ts | 35 +- addons/xterm-addon-fit/src/FitAddon.api.ts | 41 +- .../xterm-addon-search/src/SearchAddon.api.ts | 33 +- .../src/SerializeAddon.api.ts | 29 +- .../src/Unicode11Addon.api.ts | 29 +- .../src/WebLinksAddon.api.ts | 29 +- .../src/WebglRenderer.api.ts | 35 +- package.json | 2 + test/api/CharWidth.api.ts | 28 +- test/api/InputHandler.api.ts | 76 +-- test/api/MouseTracking.api.ts | 490 +++++++++--------- test/api/Parser.api.ts | 16 +- test/api/Terminal.api.ts | 16 +- test/api/TestUtils.ts | 22 +- yarn.lock | 61 ++- 15 files changed, 562 insertions(+), 380 deletions(-) diff --git a/addons/xterm-addon-attach/src/AttachAddon.api.ts b/addons/xterm-addon-attach/src/AttachAddon.api.ts index 264b32ee..50891efd 100644 --- a/addons/xterm-addon-attach/src/AttachAddon.api.ts +++ b/addons/xterm-addon-attach/src/AttachAddon.api.ts @@ -3,26 +3,26 @@ * @license MIT */ -import * as puppeteer from 'puppeteer'; +import * as playwright from 'playwright'; import { assert } from 'chai'; import { ITerminalOptions } from 'xterm'; import WebSocket = require('ws'); const APP = 'http://127.0.0.1:3000/test'; -let browser: puppeteer.Browser; -let page: puppeteer.Page; +let browser: playwright.Browser; +let page: playwright.Page; const width = 800; const height = 600; describe('AttachAddon', () => { - before(async function(): Promise { + before(async function (): Promise { this.timeout(20000); - browser = await puppeteer.launch({ + browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.pages())[0]; + page = (await browser.defaultContext().pages())[0]; await page.setViewport({ width, height }); }); @@ -30,12 +30,12 @@ describe('AttachAddon', () => { await browser.close(); }); - beforeEach(async function(): Promise { + beforeEach(async function (): Promise { this.timeout(20000); await page.goto(APP); }); - it('string', async function(): Promise { + it('string', async function (): Promise { this.timeout(20000); await openTerminal({ rendererType: 'dom' }); const port = 8080; @@ -46,7 +46,7 @@ describe('AttachAddon', () => { server.close(); }); - it('utf8', async function(): Promise { + it('utf8', async function (): Promise { this.timeout(20000); await openTerminal({ rendererType: 'dom' }); const port = 8080; @@ -69,7 +69,7 @@ async function openTerminal(options: ITerminalOptions = {}): Promise { } } -async function pollFor(page: puppeteer.Page, fn: string, val: any): Promise { +async function pollFor(page: playwright.Page, fn: string, val: any): Promise { const result = await page.evaluate(fn); if (result !== val) { return new Promise(r => { @@ -77,3 +77,18 @@ async function pollFor(page: puppeteer.Page, fn: string, val: any): Promise index + 2 && typeof process.argv[index + 1] === 'string') { + const string = process.argv[index + 1]; + if (string === 'firefox' || string === 'webkit') { + browserType = playwright[string]; + } + } + + return browserType; +} diff --git a/addons/xterm-addon-fit/src/FitAddon.api.ts b/addons/xterm-addon-fit/src/FitAddon.api.ts index aa73a9b6..c170d75a 100644 --- a/addons/xterm-addon-fit/src/FitAddon.api.ts +++ b/addons/xterm-addon-fit/src/FitAddon.api.ts @@ -3,25 +3,25 @@ * @license MIT */ -import * as puppeteer from 'puppeteer'; +import * as playwright from 'playwright'; import { assert } from 'chai'; import { ITerminalOptions } from 'xterm'; const APP = 'http://127.0.0.1:3000/test'; -let browser: puppeteer.Browser; -let page: puppeteer.Page; +let browser: playwright.Browser; +let page: playwright.Page; const width = 1024; const height = 768; describe('FitAddon', () => { - before(async function(): Promise { + before(async function (): Promise { this.timeout(20000); - browser = await puppeteer.launch({ + browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.pages())[0]; + page = (await browser.defaultContext().pages())[0]; await page.setViewport({ width, height }); await page.goto(APP); await openTerminal(); @@ -31,7 +31,7 @@ describe('FitAddon', () => { await browser.close(); }); - it('no terminal', async function(): Promise { + it('no terminal', async function (): Promise { await page.evaluate(`window.fit = new FitAddon();`); assert.equal(await page.evaluate(`window.fit.proposeDimensions()`), undefined); }); @@ -41,7 +41,7 @@ describe('FitAddon', () => { return unloadFit(); }); - it('default', async function(): Promise { + it('default', async function (): Promise { await loadFit(); assert.deepEqual(await page.evaluate(`window.fit.proposeDimensions()`), { cols: 87, @@ -49,7 +49,7 @@ describe('FitAddon', () => { }); }); - it('width', async function(): Promise { + it('width', async function (): Promise { await loadFit(1008); assert.deepEqual(await page.evaluate(`window.fit.proposeDimensions()`), { cols: 110, @@ -57,7 +57,7 @@ describe('FitAddon', () => { }); }); - it('small', async function(): Promise { + it('small', async function (): Promise { await loadFit(1, 1); assert.deepEqual(await page.evaluate(`window.fit.proposeDimensions()`), { cols: 2, @@ -71,21 +71,21 @@ describe('FitAddon', () => { return unloadFit(); }); - it('default', async function(): Promise { + it('default', async function (): Promise { await loadFit(); await page.evaluate(`window.fit.fit()`); assert.equal(await page.evaluate(`window.term.cols`), 87); assert.equal(await page.evaluate(`window.term.rows`), 26); }); - it('width', async function(): Promise { + it('width', async function (): Promise { await loadFit(1008); await page.evaluate(`window.fit.fit()`); assert.equal(await page.evaluate(`window.term.cols`), 110); assert.equal(await page.evaluate(`window.term.rows`), 26); }); - it('small', async function(): Promise { + it('small', async function (): Promise { await loadFit(1, 1); await page.evaluate(`window.fit.fit()`); assert.equal(await page.evaluate(`window.term.cols`), 2); @@ -116,3 +116,18 @@ async function openTerminal(options: ITerminalOptions = {}): Promise { await page.waitForSelector('.xterm-text-layer'); } } + +function getBrowserType(): playwright.BrowserType { + // Default to chromium + let browserType: playwright.BrowserType = playwright['chromium']; + + const index = process.argv.indexOf('--browser'); + if (index !== -1 && process.argv.length > index + 2 && typeof process.argv[index + 1] === 'string') { + const string = process.argv[index + 1]; + if (string === 'firefox' || string === 'webkit') { + browserType = playwright[string]; + } + } + + return browserType; +} diff --git a/addons/xterm-addon-search/src/SearchAddon.api.ts b/addons/xterm-addon-search/src/SearchAddon.api.ts index 72a69b5f..bb983e08 100644 --- a/addons/xterm-addon-search/src/SearchAddon.api.ts +++ b/addons/xterm-addon-search/src/SearchAddon.api.ts @@ -3,7 +3,7 @@ * @license MIT */ -import * as puppeteer from 'puppeteer'; +import * as playwright from 'playwright'; import { assert } from 'chai'; import { ITerminalOptions } from 'xterm'; import { readFile } from 'fs'; @@ -11,8 +11,8 @@ import { resolve } from 'path'; const APP = 'http://127.0.0.1:3000/test'; -let browser: puppeteer.Browser; -let page: puppeteer.Page; +let browser: playwright.Browser; +let page: playwright.Page; const width = 800; const height = 600; @@ -20,11 +20,11 @@ describe('Search Tests', function (): void { this.timeout(20000); before(async function (): Promise { - browser = await puppeteer.launch({ + browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.pages())[0]; + page = (await browser.defaultContext().pages())[0]; await page.setViewport({ width, height }); await page.goto(APP); await openTerminal(); @@ -58,12 +58,12 @@ describe('Search Tests', function (): void { assert.deepEqual(await page.evaluate(`window.search.findNext('$^1_3{}test$#')`), true); assert.deepEqual(await page.evaluate(`window.term.getSelection()`), '$^1_3{}test$#'); }); - it ('Incremental Find Previous', async () => { + it('Incremental Find Previous', async () => { await page.evaluate(`window.term.writeln('package.jsonc\\n')`); await writeSync('package.json pack package.lock'); await page.evaluate(`window.search.findPrevious('pack', {incremental: true})`); let line: string = await page.evaluate(`window.term.buffer.getLine(window.term.getSelectionPosition().startRow).translateToString()`); - let selectionPosition: {startColumn: number, startRow: number, endColumn: number, endRow: number} = await page.evaluate(`window.term.getSelectionPosition()`); + let selectionPosition: { startColumn: number, startRow: number, endColumn: number, endRow: number } = await page.evaluate(`window.term.getSelectionPosition()`); // We look further ahead in the line to ensure that pack was selected from package.lock assert.deepEqual(line.substring(selectionPosition.startColumn, selectionPosition.endColumn + 8), 'package.lock'); await page.evaluate(`window.search.findPrevious('package.j', {incremental: true})`); @@ -75,12 +75,12 @@ describe('Search Tests', function (): void { selectionPosition = await page.evaluate(`window.term.getSelectionPosition()`); assert.deepEqual(line.substring(selectionPosition.startColumn, selectionPosition.endColumn), 'package.jsonc'); }); - it ('Incremental Find Next', async () => { + it('Incremental Find Next', async () => { await page.evaluate(`window.term.writeln('package.lock pack package.json package.ups\\n')`); await writeSync('package.jsonc'); await page.evaluate(`window.search.findNext('pack', {incremental: true})`); let line: string = await page.evaluate(`window.term.buffer.getLine(window.term.getSelectionPosition().startRow).translateToString()`); - let selectionPosition: {startColumn: number, startRow: number, endColumn: number, endRow: number} = await page.evaluate(`window.term.getSelectionPosition()`); + let selectionPosition: { startColumn: number, startRow: number, endColumn: number, endRow: number } = await page.evaluate(`window.term.getSelectionPosition()`); // We look further ahead in the line to ensure that pack was selected from package.lock assert.deepEqual(line.substring(selectionPosition.startColumn, selectionPosition.endColumn + 8), 'package.lock'); await page.evaluate(`window.search.findNext('package.j', {incremental: true})`); @@ -211,3 +211,18 @@ function makeData(length: number): string { } return result; } + +function getBrowserType(): playwright.BrowserType { + // Default to chromium + let browserType: playwright.BrowserType = playwright['chromium']; + + const index = process.argv.indexOf('--browser'); + if (index !== -1 && process.argv.length > index + 2 && typeof process.argv[index + 1] === 'string') { + const string = process.argv[index + 1]; + if (string === 'firefox' || string === 'webkit') { + browserType = playwright[string]; + } + } + + return browserType; +} diff --git a/addons/xterm-addon-serialize/src/SerializeAddon.api.ts b/addons/xterm-addon-serialize/src/SerializeAddon.api.ts index a34aa0bd..dfdbcdb7 100644 --- a/addons/xterm-addon-serialize/src/SerializeAddon.api.ts +++ b/addons/xterm-addon-serialize/src/SerializeAddon.api.ts @@ -3,24 +3,24 @@ * @license MIT */ -import * as puppeteer from 'puppeteer'; +import * as playwright from 'playwright'; import { assert } from 'chai'; import { ITerminalOptions } from 'xterm'; const APP = 'http://127.0.0.1:3000/test'; -let browser: puppeteer.Browser; -let page: puppeteer.Page; +let browser: playwright.Browser; +let page: playwright.Page; const width = 800; const height = 600; describe('SerializeAddon', () => { before(async function (): Promise { - browser = await puppeteer.launch({ + browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`] }); - page = (await browser.pages())[0]; + page = (await browser.defaultContext().pages())[0]; await page.setViewport({ width, height }); await page.goto(APP); await openTerminal({ rows: 10, cols: 10, rendererType: 'dom' }); @@ -349,7 +349,7 @@ const DIM = '2'; const NO_ITALIC = '23'; const NO_DIM = '22'; -async function writeSync(page: puppeteer.Page, data: string): Promise { +async function writeSync(page: playwright.Page, data: string): Promise { await page.evaluate(` window.ready = false; window.term.write('${data}', () => window.ready = true); @@ -357,7 +357,7 @@ async function writeSync(page: puppeteer.Page, data: string): Promise { await pollFor(page, 'window.ready', true); } -async function pollFor(page: puppeteer.Page, fn: string, val: any, preFn?: () => Promise): Promise { +async function pollFor(page: playwright.Page, fn: string, val: any, preFn?: () => Promise): Promise { if (preFn) { await preFn(); } @@ -368,3 +368,18 @@ async function pollFor(page: puppeteer.Page, fn: string, val: any, preFn?: () => }); } } + +function getBrowserType(): playwright.BrowserType { + // Default to chromium + let browserType: playwright.BrowserType = playwright['chromium']; + + const index = process.argv.indexOf('--browser'); + if (index !== -1 && process.argv.length > index + 2 && typeof process.argv[index + 1] === 'string') { + const string = process.argv[index + 1]; + if (string === 'firefox' || string === 'webkit') { + browserType = playwright[string]; + } + } + + return browserType; +} diff --git a/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts b/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts index fb721b47..68426df7 100644 --- a/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts +++ b/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts @@ -3,25 +3,25 @@ * @license MIT */ -import * as puppeteer from 'puppeteer'; +import * as playwright from 'playwright'; import { ITerminalOptions } from 'xterm'; import { assert } from 'chai'; const APP = 'http://127.0.0.1:3000/test'; -let browser: puppeteer.Browser; -let page: puppeteer.Page; +let browser: playwright.Browser; +let page: playwright.Page; const width = 800; const height = 600; describe('Unicode11Addon', () => { - before(async function(): Promise { + before(async function (): Promise { this.timeout(20000); - browser = await puppeteer.launch({ + browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.pages())[0]; + page = (await browser.defaultContext().pages())[0]; await page.setViewport({ width, height }); }); @@ -29,7 +29,7 @@ describe('Unicode11Addon', () => { await browser.close(); }); - beforeEach(async function(): Promise { + beforeEach(async function (): Promise { this.timeout(20000); await page.goto(APP); await openTerminal(); @@ -59,3 +59,18 @@ async function openTerminal(options: ITerminalOptions = {}): Promise { await page.waitForSelector('.xterm-text-layer'); } } + +function getBrowserType(): playwright.BrowserType { + // Default to chromium + let browserType: playwright.BrowserType = playwright['chromium']; + + const index = process.argv.indexOf('--browser'); + if (index !== -1 && process.argv.length > index + 2 && typeof process.argv[index + 1] === 'string') { + const string = process.argv[index + 1]; + if (string === 'firefox' || string === 'webkit') { + browserType = playwright[string]; + } + } + + return browserType; +} diff --git a/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts b/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts index d2644e83..a51343c0 100644 --- a/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts +++ b/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts @@ -3,25 +3,25 @@ * @license MIT */ -import * as puppeteer from 'puppeteer'; +import * as playwright from 'playwright'; import { assert } from 'chai'; import { ITerminalOptions } from 'xterm'; const APP = 'http://127.0.0.1:3000/test'; -let browser: puppeteer.Browser; -let page: puppeteer.Page; +let browser: playwright.Browser; +let page: playwright.Page; const width = 800; const height = 600; describe('WebLinksAddon', () => { before(async function (): Promise { this.timeout(10000); - browser = await puppeteer.launch({ + browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.pages())[0]; + page = (await browser.defaultContext().pages())[0]; await page.setViewport({ width, height }); }); @@ -88,7 +88,7 @@ async function pollForLinkAtCell(col: number, row: number, value: string): Promi assert.equal(await page.evaluate(`Array.prototype.reduce.call(document.querySelectorAll('${rowSelector} > span[style]'), (a, b) => a + b.textContent, '');`), value); } -async function pollFor(page: puppeteer.Page, fn: string, val: any, preFn?: () => Promise): Promise { +async function pollFor(page: playwright.Page, fn: string, val: any, preFn?: () => Promise): Promise { if (preFn) { await preFn(); } @@ -100,10 +100,25 @@ async function pollFor(page: puppeteer.Page, fn: string, val: any, preFn?: () => } } -async function writeSync(page: puppeteer.Page, data: string): Promise { +async function writeSync(page: playwright.Page, data: string): Promise { await page.evaluate(` window.ready = false; window.term.write('${data}', () => window.ready = true); `); await pollFor(page, 'window.ready', true); } + +function getBrowserType(): playwright.BrowserType { + // Default to chromium + let browserType: playwright.BrowserType = playwright['chromium']; + + const index = process.argv.indexOf('--browser'); + if (index !== -1 && process.argv.length > index + 2 && typeof process.argv[index + 1] === 'string') { + const string = process.argv[index + 1]; + if (string === 'firefox' || string === 'webkit') { + browserType = playwright[string]; + } + } + + return browserType; +} diff --git a/addons/xterm-addon-webgl/src/WebglRenderer.api.ts b/addons/xterm-addon-webgl/src/WebglRenderer.api.ts index 8b9c84bf..c783271b 100644 --- a/addons/xterm-addon-webgl/src/WebglRenderer.api.ts +++ b/addons/xterm-addon-webgl/src/WebglRenderer.api.ts @@ -3,7 +3,7 @@ * @license MIT */ -import * as puppeteer from 'puppeteer'; +import * as playwright from 'playwright'; import { ITerminalOptions } from '../../../src/Types'; import { ITheme } from 'xterm'; import { assert } from 'chai'; @@ -11,12 +11,12 @@ import deepEqual = require('deep-equal'); const APP = 'http://127.0.0.1:3000/test'; -let browser: puppeteer.Browser; -let page: puppeteer.Page; +let browser: playwright.Browser; +let page: playwright.Page; const width = 800; const height = 600; -describe('WebGL Renderer Integration Tests', function(): void { +describe('WebGL Renderer Integration Tests', function (): void { it('dispose removes renderer canvases', async () => { await setupBrowser(); assert.equal(await page.evaluate(`document.querySelectorAll('.xterm canvas').length`), 3); @@ -504,7 +504,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('foreground true color red inverse', async function(): Promise { + it('foreground true color red inverse', async function (): Promise { let data = ''; for (let y = 0; y < 16; y++) { for (let x = 0; x < 16; x++) { @@ -522,7 +522,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('background true color red inverse', async function(): Promise { + it('background true color red inverse', async function (): Promise { let data = ''; for (let y = 0; y < 16; y++) { for (let x = 0; x < 16; x++) { @@ -850,7 +850,7 @@ describe('WebGL Renderer Integration Tests', function(): void { }); describe('allowTransparency', async () => { - before(async () => setupBrowser({ rendererType: 'dom', allowTransparency: true})); + before(async () => setupBrowser({ rendererType: 'dom', allowTransparency: true })); after(async () => browser.close()); beforeEach(async () => page.evaluate(`window.term.reset()`)); it('transparent background inverse', async () => { @@ -895,11 +895,11 @@ async function getCellColor(col: number, row: number): Promise { } async function setupBrowser(options: ITerminalOptions = { rendererType: 'dom' }): Promise { - browser = await puppeteer.launch({ + browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.pages())[0]; + page = (await browser.defaultContext().pages())[0]; await page.setViewport({ width, height }); await page.goto(APP); await openTerminal(options); @@ -909,7 +909,7 @@ async function setupBrowser(options: ITerminalOptions = { rendererType: 'dom' }) `); } -export async function pollFor(page: puppeteer.Page, evalOrFn: string | (() => Promise), val: T, preFn?: () => Promise): Promise { +export async function pollFor(page: playwright.Page, evalOrFn: string | (() => Promise), val: T, preFn?: () => Promise): Promise { if (preFn) { await preFn(); } @@ -938,3 +938,18 @@ const COLORS_16_TO_255 = [ '#ffd7d7', '#ffd7ff', '#ffff00', '#ffff5f', '#ffff87', '#ffffaf', '#ffffd7', '#ffffff', '#080808', '#121212', '#1c1c1c', '#262626', '#303030', '#3a3a3a', '#444444', '#4e4e4e', '#585858', '#626262', '#6c6c6c', '#767676', '#808080', '#8a8a8a', '#949494', '#9e9e9e', '#a8a8a8', '#b2b2b2', '#bcbcbc', '#c6c6c6', '#d0d0d0', '#dadada', '#e4e4e4', '#eeeeee' ]; + +function getBrowserType(): playwright.BrowserType { + // Default to chromium + let browserType: playwright.BrowserType = playwright['chromium']; + + const index = process.argv.indexOf('--browser'); + if (index !== -1 && process.argv.length > index + 2 && typeof process.argv[index + 1] === 'string') { + const string = process.argv[index + 1]; + if (string === 'firefox' || string === 'webkit') { + browserType = playwright[string]; + } + } + + return browserType; +} diff --git a/package.json b/package.json index 956cdbb1..2d61fac8 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ }, "devDependencies": { "@types/chai": "^3.4.34", + "@types/debug": "^4.1.5", "@types/deep-equal": "^1.0.1", "@types/glob": "^5.0.35", "@types/jsdom": "11.0.1", @@ -50,6 +51,7 @@ "mustache": "^3.0.1", "node-pty": "^0.9.0", "nyc": "13", + "playwright": "^0.10.0", "puppeteer": "^1.15.0", "source-map-loader": "^0.2.4", "ts-loader": "^6.0.4", diff --git a/test/api/CharWidth.api.ts b/test/api/CharWidth.api.ts index a2352f40..63b94aa7 100644 --- a/test/api/CharWidth.api.ts +++ b/test/api/CharWidth.api.ts @@ -3,24 +3,24 @@ * @license MIT */ -import * as puppeteer from 'puppeteer'; import { ITerminalOptions } from 'xterm'; -import { pollFor } from './TestUtils'; +import { pollFor, getBrowserType } from './TestUtils'; +import { Browser, Page } from 'playwright'; const APP = 'http://127.0.0.1:3000/test'; -let browser: puppeteer.Browser; -let page: puppeteer.Page; +let browser: Browser; +let page: Page; const width = 800; const height = 600; -describe('CharWidth Integration Tests', function(): void { - before(async function(): Promise { - browser = await puppeteer.launch({ +describe('CharWidth Integration Tests', function (): void { + before(async function (): Promise { + browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.pages())[0]; + page = (await browser.defaultContext().pages())[0]; await page.setViewport({ width, height }); await page.goto(APP); await openTerminal({ rows: 5, cols: 30 }); @@ -35,37 +35,37 @@ describe('CharWidth Integration Tests', function(): void { await page.evaluate(`window.term.reset()`); }); - it('ASCII chars', async function(): Promise { + it('ASCII chars', async function (): Promise { const input = 'This is just ASCII text.#'; await page.evaluate(`window.term.write('${input}')`); await pollFor(page, () => sumWidths(0, 1, '#'), 25); }); - it('combining chars', async function(): Promise { + it('combining chars', async function (): Promise { const input = 'e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301#'; await page.evaluate(`window.term.write('${input}')`); await pollFor(page, () => sumWidths(0, 1, '#'), 10); }); - it('surrogate chars', async function(): Promise { + it('surrogate chars', async function (): Promise { const input = '𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞#'; await page.evaluate(`window.term.write('${input}')`); await pollFor(page, () => sumWidths(0, 1, '#'), 28); }); - it('surrogate combining chars', async function(): Promise { + it('surrogate combining chars', async function (): Promise { const input = '𓂀\u0301𓂀\u0301𓂀\u0301𓂀\u0301𓂀\u0301𓂀\u0301𓂀\u0301𓂀\u0301𓂀\u0301𓂀\u0301𓂀\u0301#'; await page.evaluate(`window.term.write('${input}')`); await pollFor(page, () => sumWidths(0, 1, '#'), 12); }); - it('fullwidth chars', async function(): Promise { + it('fullwidth chars', async function (): Promise { const input = '1234567890#'; await page.evaluate(`window.term.write('${input}')`); await pollFor(page, () => sumWidths(0, 1, '#'), 21); }); - it('fullwidth chars offset 1', async function(): Promise { + it('fullwidth chars offset 1', async function (): Promise { const input = 'a1234567890#'; await page.evaluate(`window.term.write('${input}')`); await pollFor(page, () => sumWidths(0, 1, '#'), 22); diff --git a/test/api/InputHandler.api.ts b/test/api/InputHandler.api.ts index ad30a51c..c95b83f8 100644 --- a/test/api/InputHandler.api.ts +++ b/test/api/InputHandler.api.ts @@ -3,25 +3,25 @@ * @license MIT */ -import * as puppeteer from 'puppeteer'; import { assert } from 'chai'; import { ITerminalOptions } from 'xterm'; -import { pollFor } from './TestUtils'; +import { pollFor, getBrowserType } from './TestUtils'; +import { Page, Browser } from 'playwright'; const APP = 'http://127.0.0.1:3000/test'; -let browser: puppeteer.Browser; -let page: puppeteer.Page; +let browser: Browser; +let page: Page; const width = 800; const height = 600; -describe('InputHandler Integration Tests', function(): void { - before(async function(): Promise { - browser = await puppeteer.launch({ +describe('InputHandler Integration Tests', function (): void { + before(async function (): Promise { + browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.pages())[0]; + page = (await browser.defaultContext().pages())[0]; await page.setViewport({ width, height }); await page.goto(APP); await openTerminal(); @@ -36,7 +36,7 @@ describe('InputHandler Integration Tests', function(): void { await page.evaluate(`window.term.reset()`); }); - it('ICH: Insert Ps (Blank) Character(s) (default = 1) - CSI Ps @', async function(): Promise { + it('ICH: Insert Ps (Blank) Character(s) (default = 1) - CSI Ps @', async function (): Promise { await page.evaluate(` // Default window.term.write('foo\\x1b[3D\\x1b[@\\n\\r') @@ -46,7 +46,7 @@ describe('InputHandler Integration Tests', function(): void { await pollFor(page, () => getLinesAsArray(2), [' foo', ' bar']); }); - it('CUU: Cursor Up Ps Times (default = 1) - CSI Ps A', async function(): Promise { + it('CUU: Cursor Up Ps Times (default = 1) - CSI Ps A', async function (): Promise { await page.evaluate(` // Default window.term.write('\\n\\n\\n\\n\x1b[Aa') @@ -56,7 +56,7 @@ describe('InputHandler Integration Tests', function(): void { await pollFor(page, () => getLinesAsArray(4), ['', ' b', '', 'a']); }); - it('CUD: Cursor Down Ps Times (default = 1) - CSI Ps B', async function(): Promise { + it('CUD: Cursor Down Ps Times (default = 1) - CSI Ps B', async function (): Promise { await page.evaluate(` // Default window.term.write('\x1b[Ba') @@ -66,7 +66,7 @@ describe('InputHandler Integration Tests', function(): void { await pollFor(page, () => getLinesAsArray(4), ['', 'a', '', ' b']); }); - it('CUF: Cursor Forward Ps Times (default = 1) - CSI Ps C', async function(): Promise { + it('CUF: Cursor Forward Ps Times (default = 1) - CSI Ps C', async function (): Promise { await page.evaluate(` // Default window.term.write('\x1b[Ca') @@ -76,7 +76,7 @@ describe('InputHandler Integration Tests', function(): void { await pollFor(page, () => getLinesAsArray(1), [' a b']); }); - it('CUB: Cursor Backward Ps Times (default = 1) - CSI Ps D', async function(): Promise { + it('CUB: Cursor Backward Ps Times (default = 1) - CSI Ps D', async function (): Promise { await page.evaluate(` // Default window.term.write('foo\x1b[Da') @@ -86,7 +86,7 @@ describe('InputHandler Integration Tests', function(): void { await pollFor(page, () => getLinesAsArray(1), ['fba']); }); - it('CNL: Cursor Next Line Ps Times (default = 1) - CSI Ps E', async function(): Promise { + it('CNL: Cursor Next Line Ps Times (default = 1) - CSI Ps E', async function (): Promise { await page.evaluate(` // Default window.term.write('\x1b[Ea') @@ -96,7 +96,7 @@ describe('InputHandler Integration Tests', function(): void { await pollFor(page, () => getLinesAsArray(4), ['', 'a', '', 'b']); }); - it('CPL: Cursor Preceding Line Ps Times (default = 1) - CSI Ps F', async function(): Promise { + it('CPL: Cursor Preceding Line Ps Times (default = 1) - CSI Ps F', async function (): Promise { await page.evaluate(` // Default window.term.write('\\n\\n\\n\\n\x1b[Fa') @@ -106,7 +106,7 @@ describe('InputHandler Integration Tests', function(): void { await pollFor(page, () => getLinesAsArray(5), ['', 'b', '', 'a', '']); }); - it('CHA: Cursor Character Absolute [column] (default = [row,1]) - CSI Ps G', async function(): Promise { + it('CHA: Cursor Character Absolute [column] (default = [row,1]) - CSI Ps G', async function (): Promise { await page.evaluate(` // Default window.term.write('foo\x1b[Ga') @@ -116,7 +116,7 @@ describe('InputHandler Integration Tests', function(): void { await pollFor(page, () => getLinesAsArray(1), ['aoo b']); }); - it('CUP: Cursor Position [row;column] (default = [1,1]) - CSI Ps ; Ps H', async function(): Promise { + it('CUP: Cursor Position [row;column] (default = [1,1]) - CSI Ps ; Ps H', async function (): Promise { await page.evaluate(` // Default window.term.write('foo\x1b[Ha') @@ -126,7 +126,7 @@ describe('InputHandler Integration Tests', function(): void { await pollFor(page, () => getLinesAsArray(3), ['aoo', '', ' b']); }); - it('CHT: Cursor Forward Tabulation Ps tab stops (default = 1) - CSI Ps I', async function(): Promise { + it('CHT: Cursor Forward Tabulation Ps tab stops (default = 1) - CSI Ps I', async function (): Promise { await page.evaluate(` // Default window.term.write('\x1b[Ia') @@ -136,7 +136,7 @@ describe('InputHandler Integration Tests', function(): void { await pollFor(page, () => getLinesAsArray(2), [' a', ' b']); }); - it('ED: Erase in Display, VT100 - CSI Ps J', async function(): Promise { + it('ED: Erase in Display, VT100 - CSI Ps J', async function (): Promise { const fixture = 'abc\\n\\rdef\\n\\rghi\x1b[2;2H'; await page.evaluate(` // Default: Erase Below @@ -165,7 +165,7 @@ describe('InputHandler Integration Tests', function(): void { await pollFor(page, () => getLinesAsArray(5), [' 4', ' 5', 'abc', 'def', 'ghi']); }); - it('DECSED: Erase in Display, VT220 - CSI ? Ps J', async function(): Promise { + it('DECSED: Erase in Display, VT220 - CSI ? Ps J', async function (): Promise { const fixture = 'abc\\n\\rdef\\n\\rghi\x1b[2;2H'; await page.evaluate(` // Default: Erase Below @@ -194,7 +194,7 @@ describe('InputHandler Integration Tests', function(): void { await pollFor(page, () => getLinesAsArray(5), [' 4', ' 5', 'abc', 'def', 'ghi']); }); - it('IL: Insert Ps Line(s) (default = 1) - CSI Ps L', async function(): Promise { + it('IL: Insert Ps Line(s) (default = 1) - CSI Ps L', async function (): Promise { await page.evaluate(` // Default window.term.write('foo\x1b[La') @@ -204,7 +204,7 @@ describe('InputHandler Integration Tests', function(): void { await pollFor(page, () => getLinesAsArray(4), ['b', '', 'a', 'foo']); }); - it('DL: Delete Ps Line(s) (default = 1) - CSI Ps M', async function(): Promise { + it('DL: Delete Ps Line(s) (default = 1) - CSI Ps M', async function (): Promise { await page.evaluate(` // Default window.term.write('a\\nb\x1b[1F\x1b[M') @@ -214,7 +214,7 @@ describe('InputHandler Integration Tests', function(): void { await pollFor(page, () => getLinesAsArray(5), [' b', ' f', '', '', '']); }); - it('DCH: Delete Ps Character(s) (default = 1) - CSI Ps P', async function(): Promise { + it('DCH: Delete Ps Character(s) (default = 1) - CSI Ps P', async function (): Promise { await page.evaluate(` // Default window.term.write('abc\x1b[1;1H\x1b[P') @@ -225,7 +225,7 @@ describe('InputHandler Integration Tests', function(): void { }); describe('DSR: Device Status Report', () => { - it('Status Report - CSI 5 n', async function(): Promise { + it('Status Report - CSI 5 n', async function (): Promise { await page.evaluate(` window.term.onData(e => window.result = e); window.term.write('\\x1b[5n'); @@ -233,7 +233,7 @@ describe('InputHandler Integration Tests', function(): void { await pollFor(page, () => page.evaluate(`window.result`), '\x1b[0n'); }); - it('Report Cursor Position (CPR) - CSI 6 n', async function(): Promise { + it('Report Cursor Position (CPR) - CSI 6 n', async function (): Promise { await page.evaluate(`window.term.write('\\n\\nfoo')`); await pollFor(page, () => page.evaluate(` [window.term.buffer.cursorY, window.term.buffer.cursorX] @@ -245,7 +245,7 @@ describe('InputHandler Integration Tests', function(): void { await pollFor(page, () => page.evaluate(`window.result`), '\x1b[3;4R'); }); - it('Report Cursor Position (DECXCPR) - CSI ? 6 n', async function(): Promise { + it('Report Cursor Position (DECXCPR) - CSI ? 6 n', async function (): Promise { await page.evaluate(`window.term.write('\\n\\nfoo')`); await pollFor(page, () => page.evaluate(` [window.term.buffer.cursorY, window.term.buffer.cursorX] @@ -260,8 +260,8 @@ describe('InputHandler Integration Tests', function(): void { describe('SM: Set Mode', () => { describe('CSI ? Pm h', () => { - it('Pm = 1003, Set Use All Motion (any event) Mouse Tracking', async() => { - const coords = await page.evaluate(` + it('Pm = 1003, Set Use All Motion (any event) Mouse Tracking', async () => { + const coords: any = await page.evaluate(` (function() { const rect = window.term.element.getBoundingClientRect(); return {left: rect.left, top: rect.top, bottom: rect.bottom, right: rect.right}; @@ -271,7 +271,7 @@ describe('InputHandler Integration Tests', function(): void { await page.mouse.click((coords.left + coords.right) / 2, (coords.top + coords.bottom) / 2); await page.mouse.down(); await page.mouse.move((coords.left + coords.right) / 2, (coords.top + coords.bottom) / 4); - assert.ok(await page.evaluate(`window.term.getSelection().length`) > 0, 'mouse events are off so there should be a selection'); + assert.ok(await page.evaluate(`window.term.getSelection().length`) as number > 0, 'mouse events are off so there should be a selection'); await page.mouse.up(); // Clear selection await page.mouse.click((coords.left + coords.right) / 2, (coords.top + coords.bottom) / 2); @@ -286,7 +286,7 @@ describe('InputHandler Integration Tests', function(): void { await pollFor(page, () => page.evaluate(`window.term.getSelection().length`), 0); await page.mouse.up(); }); - it('Pm = 2004, Set bracketed paste mode', async function(): Promise { + it('Pm = 2004, Set bracketed paste mode', async function (): Promise { await pollFor(page, () => simulatePaste('foo'), 'foo'); await page.evaluate(`window.term.write('\x1b[?2004h')`); await pollFor(page, () => simulatePaste('bar'), '\x1b[200~bar\x1b[201~'); @@ -296,7 +296,7 @@ describe('InputHandler Integration Tests', function(): void { }); }); - it('REP: Repeat preceding character, ECMA48 - CSI Ps b', async function(): Promise { + it('REP: Repeat preceding character, ECMA48 - CSI Ps b', async function (): Promise { // default to 1 await page.evaluate(` window.term.resize(10, 10); @@ -309,7 +309,7 @@ describe('InputHandler Integration Tests', function(): void { window.term.write('#\x1b[5b'); `); await pollFor(page, () => getLinesAsArray(4), ['##', '##', '##', '######']); - await pollFor(page, () => getCursor(), {col: 6, row: 3}); + await pollFor(page, () => getCursor(), { col: 6, row: 3 }); // should not repeat on fullwidth chars await page.evaluate(` window.term.reset(); @@ -347,7 +347,7 @@ describe('InputHandler Integration Tests', function(): void { }); describe('Window Options - CSI Ps ; Ps ; Ps t', () => { - it('should be disabled by default', async function() { + it('should be disabled by default', async function () { await page.evaluate(`(() => { window._stack = []; const _h = window.term.onData(data => window._stack.push(data)); @@ -360,7 +360,7 @@ describe('InputHandler Integration Tests', function(): void { })()`); await pollFor(page, async () => await page.evaluate(`(() => _stack)()`), []); }); - it('14 - GetWinSizePixels', async function() { + it('14 - GetWinSizePixels', async function () { await page.evaluate(`window.term.setOption('windowOptions', {getWinSizePixels: true});`); await page.evaluate(`(() => { window._stack = []; @@ -371,7 +371,7 @@ describe('InputHandler Integration Tests', function(): void { const d = await getDimensions(); await pollFor(page, async () => await page.evaluate(`(() => _stack)()`), [`\x1b[4;${d.height};${d.width}t`]); }); - it('16 - GetCellSizePixels', async function() { + it('16 - GetCellSizePixels', async function () { await page.evaluate(`window.term.setOption('windowOptions', {getCellSizePixels: true});`); await page.evaluate(`(() => { window._stack = []; @@ -397,7 +397,7 @@ describe('InputHandler Integration Tests', function(): void { window.term.resize(10, 4); window.term.write('\\x1b[?47l\\x1b8'); `); - await pollFor(page, () => getCursor(), {col: 1, row: 3}); + await pollFor(page, () => getCursor(), { col: 1, row: 3 }); }); }); }); @@ -434,7 +434,7 @@ async function simulatePaste(text: string): Promise { return await page.evaluate(`window.result_${id}`); } -async function getCursor(): Promise<{col: number, row: number}> { +async function getCursor(): Promise<{ col: number, row: number }> { return page.evaluate(` (function() { return {col: term.buffer.cursorX, row: term.buffer.cursorY}; @@ -443,7 +443,7 @@ async function getCursor(): Promise<{col: number, row: number}> { } async function getDimensions(): Promise { - const dim = await page.evaluate(`term._core._renderService.dimensions`); + const dim: any = await page.evaluate(`term._core._renderService.dimensions`); return { cellWidth: dim.actualCellWidth.toFixed(0), cellHeight: dim.actualCellHeight.toFixed(0), diff --git a/test/api/MouseTracking.api.ts b/test/api/MouseTracking.api.ts index 7cae660f..0fa4dfa1 100644 --- a/test/api/MouseTracking.api.ts +++ b/test/api/MouseTracking.api.ts @@ -3,14 +3,14 @@ * @license MIT */ -import * as puppeteer from 'puppeteer'; import { ITerminalOptions } from 'xterm'; -import { pollFor, writeSync } from './TestUtils'; +import { pollFor, writeSync, getBrowserType } from './TestUtils'; +import { Browser, Page } from 'playwright'; const APP = 'http://127.0.0.1:3000/test'; -let browser: puppeteer.Browser; -let page: puppeteer.Page; +let browser: Browser; +let page: Page; // adjusted to work inside devcontainer // see https://github.com/xtermjs/xterm.js/issues/2379 const width = 1280; @@ -46,7 +46,7 @@ async function resetMouseModes(): Promise { } async function getReports(encoding: string): Promise { - const reports = await page.evaluate(`window.calls`); + const reports: number[][] = await page.evaluate(`window.calls`); await page.evaluate(`window.calls = [];`); return reports.map((report: number[]) => parseReport(encoding, report)); } @@ -55,7 +55,7 @@ async function getReports(encoding: string): Promise { // always adds +2 in each direction so we dont end up in the wrong cell // due to rounding issues async function cellPos(col: number, row: number): Promise { - const coords = await page.evaluate(` + const coords: any = await page.evaluate(` (function() { const rect = window.term.element.getBoundingClientRect(); const dim = term._core._renderService.dimensions; @@ -66,7 +66,7 @@ async function cellPos(col: number, row: number): Promise { } /** - * Patched puppeteer functions. + * Patched playwright functions. * This is needed to: * - translate cell positions into pixel positions * - allow modifiers to be set @@ -77,10 +77,10 @@ async function mouseMove(col: number, row: number): Promise { return await page.mouse.move(xPixels, yPixels); } async function mouseDown(button: 'left' | 'right' | 'middle' | undefined): Promise { - return await page.mouse.down({button}); + return await page.mouse.down({ button }); } async function mouseUp(button: 'left' | 'right' | 'middle' | undefined): Promise { - return await page.mouse.up({button}); + return await page.mouse.up({ button }); } async function wheelUp(): Promise { const self = (page.mouse as any); @@ -106,24 +106,24 @@ async function wheelDown(): Promise { } // button definitions -const buttons: {[key: string]: number} = { - '': -1, - left: 0, - middle: 1, - right: 2, - released: 3, - wheelUp: 4, - wheelDown: 5, - wheelLeft: 6, +const buttons: { [key: string]: number } = { + '': -1, + left: 0, + middle: 1, + right: 2, + released: 3, + wheelUp: 4, + wheelDown: 5, + wheelLeft: 6, wheelRight: 7, - aux8: 8, - aux9: 9, - aux10: 10, - aux11: 11, - aux12: 12, - aux13: 13, - aux14: 14, - aux15: 15 + aux8: 8, + aux9: 9, + aux10: 10, + aux11: 11, + aux12: 12, + aux13: 13, + aux14: 14, + aux15: 15 }; const reverseButtons: any = {}; for (const el in buttons) { @@ -133,9 +133,9 @@ for (const el in buttons) { // extract button data from buttonCode function evalButtonCode(code: number): any { if (code > 255) { - return {button: 'invalid', action: 'invalid', modifier: {}}; + return { button: 'invalid', action: 'invalid', modifier: {} }; } - const modifier = {shift: !!(code & 4), meta: !!(code & 8), control: !!(code & 16)}; + const modifier = { shift: !!(code & 4), meta: !!(code & 8), control: !!(code & 16) }; const move = code & 32; let button = code & 3; if (code & 128) { @@ -156,11 +156,11 @@ function evalButtonCode(code: number): any { buttonS = 'wheel'; actionS = button === 4 ? 'up' : button === 5 ? 'down' : button === 6 ? 'left' : 'right'; } - return {button: buttonS, action: actionS, modifier}; + return { button: buttonS, action: actionS, modifier }; } // parse a single mouse report -function parseReport(encoding: string, msg: number[]): {state: any; row: number; col: number; } | string { +function parseReport(encoding: string, msg: number[]): { state: any; row: number; col: number; } | string { let sReport: string; let buttonCode: number; let row: number; @@ -185,7 +185,7 @@ function parseReport(encoding: string, msg: number[]): {state: any; row: number; if (report[report.length - 1] === 'm') { state.action = 'release'; } - return {state, row, col}; + return { state, row, col }; default: return { state: evalButtonCode(report.charCodeAt(3) - 32), @@ -199,12 +199,12 @@ function parseReport(encoding: string, msg: number[]): {state: any; row: number; * Mouse tracking tests. */ describe('Mouse Tracking Tests', () => { - before(async function(): Promise { - browser = await puppeteer.launch({ + before(async function (): Promise { + browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.pages())[0]; + page = (await browser.defaultContext().pages())[0]; await page.setViewport({ width, height }); }); @@ -242,7 +242,7 @@ describe('Mouse Tracking Tests', () => { // test at 0,0 await mouseDown('left'); - await pollFor(page, () => 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'); @@ -253,14 +253,14 @@ describe('Mouse Tracking Tests', () => { await pollFor(page, () => getReports(encoding), []); await mouseDown('left'); await mouseUp('left'); - await pollFor(page, () => 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 // capped at 223 (1-based) await mouseMove(223 - 1, rows - 1); await mouseDown('left'); await mouseUp('left'); - await pollFor(page, () => getReports(encoding), [{col: 223, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); + await pollFor(page, () => getReports(encoding), [{ col: 223, row: rows, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } }]); // higher than 223 should not report at all await mouseMove(257, rows - 1); @@ -275,7 +275,7 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); - await pollFor(page, () => 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); @@ -291,7 +291,7 @@ describe('Mouse Tracking Tests', () => { await mouseDown('right'); await mouseMove(44, 24); await mouseUp('right'); - await pollFor(page, () => 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); @@ -311,7 +311,7 @@ describe('Mouse Tracking Tests', () => { await mouseUp('left'); await wheelDown(); await page.keyboard.up('Control'); - await pollFor(page, () => 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 @@ -323,7 +323,7 @@ describe('Mouse Tracking Tests', () => { await mouseUp('left'); await wheelDown(); await page.keyboard.up('Alt'); - await pollFor(page, () => 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 @@ -341,7 +341,7 @@ describe('Mouse Tracking Tests', () => { await pollFor(page, () => getReports(encoding), []); } else { await pollFor(page, () => getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} + { col: 44, row: 25, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } } ]); } @@ -359,7 +359,7 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Control'); await page.keyboard.up('Alt'); // await page.keyboard.up('Shift'); - await pollFor(page, () => 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'; @@ -369,7 +369,7 @@ describe('Mouse Tracking Tests', () => { // test at 0,0 await mouseDown('left'); - await pollFor(page, () => 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'); @@ -380,13 +380,13 @@ describe('Mouse Tracking Tests', () => { await pollFor(page, () => getReports(encoding), []); await mouseDown('left'); await mouseUp('left'); - await pollFor(page, () => 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'); - await pollFor(page, () => 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 @@ -395,7 +395,7 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); - await pollFor(page, () => 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); @@ -411,7 +411,7 @@ describe('Mouse Tracking Tests', () => { await mouseDown('right'); await mouseMove(44, 24); await mouseUp('right'); - await pollFor(page, () => 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); @@ -431,7 +431,7 @@ describe('Mouse Tracking Tests', () => { await mouseUp('left'); await wheelDown(); await page.keyboard.up('Control'); - await pollFor(page, () => 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 @@ -443,7 +443,7 @@ describe('Mouse Tracking Tests', () => { await mouseUp('left'); await wheelDown(); await page.keyboard.up('Alt'); - await pollFor(page, () => 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 @@ -459,7 +459,7 @@ describe('Mouse Tracking Tests', () => { await pollFor(page, () => getReports(encoding), []); } else { await pollFor(page, () => getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} + { col: 44, row: 25, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } } ]); } @@ -477,7 +477,7 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Control'); await page.keyboard.up('Alt'); // await page.keyboard.up('Shift'); - await pollFor(page, () => 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)', () => { @@ -497,13 +497,13 @@ describe('Mouse Tracking Tests', () => { // test at 0,0 await mouseDown('left'); await pollFor(page, () => getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} + { 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'); await pollFor(page, () => getReports(encoding), [ - {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} + { col: 1, row: 1, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } ]); // mousemove should not report @@ -512,8 +512,8 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseUp('left'); 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: '', modifier: {control: false, shift: false, meta: false}}} + { col: 51, row: 11, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } }, + { col: 51, row: 11, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } ]); // test at max rows/cols @@ -522,8 +522,8 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseUp('left'); await pollFor(page, () => getReports(encoding), [ - {col: 223, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 223, row: rows, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} + { col: 223, row: rows, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } }, + { col: 223, row: rows, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } ]); // button press/move/release tests @@ -534,8 +534,8 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('left'); 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: '', 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: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } ]); // middle button // bug: default action not cancelled (adds data to getReports from clipboard under X11) @@ -553,17 +553,17 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('right'); 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: '', 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: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } ]); // wheel await mouseMove(43, 24); await getReports(encoding); // clear reports await wheelUp(); - await pollFor(page, () => 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(); - await pollFor(page, () => 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 @@ -576,9 +576,9 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Control'); 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: '', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', 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: 'release', button: '', modifier: { control: true, shift: false, meta: false } } }, + { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: true, shift: false, meta: false } } } ]); // ALT @@ -591,9 +591,9 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Alt'); 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: '', modifier: {control: false, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', 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: 'release', button: '', modifier: { control: false, shift: false, meta: true } } }, + { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: false, shift: false, meta: true } } } ]); // SHIFT @@ -609,13 +609,13 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Shift'); if (noShift) { await pollFor(page, () => getReports(encoding), [ - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} + { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: false, shift: true, meta: false } } } ]); } else { 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: '', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', 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: 'release', button: '', modifier: { control: false, shift: true, meta: false } } }, + { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: false, shift: true, meta: false } } } ]); } @@ -634,9 +634,9 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Alt'); // await page.keyboard.up('Shift'); 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: '', modifier: {control: true, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', 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: 'release', button: '', modifier: { control: true, shift: false, meta: true } } }, + { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: true, shift: false, meta: true } } } ]); }); it('SGR encoding', async () => { @@ -648,13 +648,13 @@ describe('Mouse Tracking Tests', () => { // test at 0,0 await mouseDown('left'); await pollFor(page, () => getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} + { col: 1, row: 1, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } } ]); // mouseup should report await mouseUp('left'); await pollFor(page, () => getReports(encoding), [ - {col: 1, row: 1, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}} + { col: 1, row: 1, state: { action: 'release', button: 'left', modifier: { control: false, shift: false, meta: false } } } ]); // mousemove should not report @@ -663,8 +663,8 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseUp('left'); 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}}} + { 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 } } } ]); // test at max rows/cols @@ -672,8 +672,8 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseUp('left'); 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}}} + { 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 } } } ]); // button press/move/release tests @@ -684,8 +684,8 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('left'); 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}}} + { 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 } } } ]); // middle button // bug: default action not cancelled (adds data to getReports from clipboard under X11) @@ -703,17 +703,17 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('right'); 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}}} + { 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 } } } ]); // wheel await mouseMove(43, 24); await getReports(encoding); // clear reports await wheelUp(); - await pollFor(page, () => 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(); - await pollFor(page, () => 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 @@ -726,9 +726,9 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Control'); 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}}} + { 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 } } } ]); // ALT @@ -741,9 +741,9 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Alt'); 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}}} + { 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 } } } ]); // SHIFT @@ -758,13 +758,13 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Shift'); if (noShift) { await pollFor(page, () => getReports(encoding), [ - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} + { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: false, shift: true, meta: false } } } ]); } else { 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}}} + { 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 } } } ]); } @@ -783,9 +783,9 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Alt'); // await page.keyboard.up('Shift'); 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}}} + { 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 } } } ]); }); }); @@ -806,13 +806,13 @@ describe('Mouse Tracking Tests', () => { // test at 0,0 await mouseDown('left'); await pollFor(page, () => getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} + { 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'); await pollFor(page, () => getReports(encoding), [ - {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} + { col: 1, row: 1, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } ]); // mousemove should not report @@ -821,8 +821,8 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseUp('left'); 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: '', modifier: {control: false, shift: false, meta: false}}} + { col: 51, row: 11, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } }, + { col: 51, row: 11, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } ]); // test at max rows/cols @@ -831,8 +831,8 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseUp('left'); await pollFor(page, () => getReports(encoding), [ - {col: 223, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 223, row: rows, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} + { col: 223, row: rows, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } }, + { col: 223, row: rows, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } ]); // button press/move/release tests @@ -843,9 +843,9 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('left'); 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: '', 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 } } }, + { col: 45, row: 25, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } ]); // middle button // bug: default action not cancelled (adds data to getReports from clipboard under X11) @@ -863,18 +863,18 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('right'); 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: '', 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 } } }, + { col: 45, row: 25, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } ]); // wheel await mouseMove(43, 24); await getReports(encoding); // clear reports await wheelUp(); - await pollFor(page, () => 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(); - await pollFor(page, () => 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,10 +887,10 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Control'); 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: '', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', 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 } } }, + { col: 45, row: 25, state: { action: 'release', button: '', modifier: { control: true, shift: false, meta: false } } }, + { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: true, shift: false, meta: false } } } ]); // ALT @@ -903,10 +903,10 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Alt'); 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: '', modifier: {control: false, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', 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 } } }, + { col: 45, row: 25, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: true } } }, + { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: false, shift: false, meta: true } } } ]); // SHIFT @@ -921,14 +921,14 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Shift'); if (noShift) { await pollFor(page, () => getReports(encoding), [ - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} + { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: false, shift: true, meta: false } } } ]); } else { 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: '', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', 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 } } }, + { col: 45, row: 25, state: { action: 'release', button: '', modifier: { control: false, shift: true, meta: false } } }, + { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: false, shift: true, meta: false } } } ]); } @@ -947,10 +947,10 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Alt'); // await page.keyboard.up('Shift'); 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: '', modifier: {control: true, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', 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 } } }, + { col: 45, row: 25, state: { action: 'release', button: '', modifier: { control: true, shift: false, meta: true } } }, + { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: true, shift: false, meta: true } } } ]); }); it('SGR encoding', async () => { @@ -963,13 +963,13 @@ describe('Mouse Tracking Tests', () => { // bug: release is fired immediately await mouseDown('left'); await pollFor(page, () => getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} + { 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'); await pollFor(page, () => getReports(encoding), [ - {col: 1, row: 1, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}} + { col: 1, row: 1, state: { action: 'release', button: 'left', modifier: { control: false, shift: false, meta: false } } } ]); // mousemove should not report @@ -978,8 +978,8 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseUp('left'); 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}}} + { 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 } } } ]); // test at max rows/cols @@ -987,8 +987,8 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseUp('left'); 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}}} + { 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 } } } ]); // button press/move/release tests @@ -999,9 +999,9 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('left'); 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}}} + { 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 } } } ]); // middle button // bug: default action not cancelled (adds data to getReports from clipboard under X11) @@ -1019,18 +1019,18 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('right'); 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}}} + { 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 } } } ]); // wheel await mouseMove(43, 24); await getReports(encoding); // clear reports await wheelUp(); - await pollFor(page, () => 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(); - await pollFor(page, () => 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,10 +1043,10 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Control'); 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}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', 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 } } }, + { 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 } } } ]); // ALT @@ -1059,10 +1059,10 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Alt'); 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}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', 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 } } }, + { 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 } } } ]); // SHIFT @@ -1077,14 +1077,14 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Shift'); if (noShift) { await pollFor(page, () => getReports(encoding), [ - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} + { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: false, shift: true, meta: false } } } ]); } else { 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}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', 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 } } }, + { 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 } } } ]); } @@ -1103,10 +1103,10 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Alt'); // await page.keyboard.up('Shift'); 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}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', 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 } } }, + { 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 } } } ]); }); }); @@ -1124,25 +1124,25 @@ describe('Mouse Tracking Tests', () => { // test at 0,0 await mouseDown('left'); await pollFor(page, () => getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} + { 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'); await pollFor(page, () => getReports(encoding), [ - {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} + { col: 1, row: 1, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } ]); // mousemove should report await mouseMove(50, 10); await pollFor(page, () => getReports(encoding), [ - {col: 51, row: 11, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}} + { col: 51, row: 11, state: { action: 'move', button: '', modifier: { control: false, shift: false, meta: false } } } ]); await mouseDown('left'); await mouseUp('left'); 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: '', modifier: {control: false, shift: false, meta: false}}} + { col: 51, row: 11, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } }, + { col: 51, row: 11, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } ]); // test at max rows/cols @@ -1151,9 +1151,9 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseUp('left'); await pollFor(page, () => getReports(encoding), [ - {col: 223, row: rows, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: 223, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 223, row: rows, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} + { col: 223, row: rows, state: { action: 'move', button: '', modifier: { control: false, shift: false, meta: false } } }, + { col: 223, row: rows, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } }, + { col: 223, row: rows, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } ]); // button press/move/release tests @@ -1163,10 +1163,10 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('left'); await pollFor(page, () => getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} + { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, + { col: 45, row: 25, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } ]); // middle button // bug: default action not cancelled (adds data to getReports from clipboard under X11) @@ -1183,19 +1183,19 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('right'); await pollFor(page, () => getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} + { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, + { col: 45, row: 25, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } ]); // wheel await mouseMove(43, 24); await getReports(encoding); // clear reports await wheelUp(); - await pollFor(page, () => 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(); - await pollFor(page, () => 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 @@ -1207,11 +1207,11 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Control'); await pollFor(page, () => getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} + { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, + { col: 45, row: 25, state: { action: 'release', button: '', modifier: { control: true, shift: false, meta: false } } }, + { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: true, shift: false, meta: false } } } ]); // ALT @@ -1223,11 +1223,11 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Alt'); await pollFor(page, () => getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} + { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, + { col: 45, row: 25, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: true } } }, + { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: false, shift: false, meta: true } } } ]); // SHIFT @@ -1241,16 +1241,16 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Shift'); if (noShift) { await pollFor(page, () => getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} + { col: 44, row: 25, state: { action: 'move', button: '', modifier: { control: false, shift: true, meta: false } } }, + { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: false, shift: true, meta: false } } } ]); } else { await pollFor(page, () => getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} + { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, + { col: 45, row: 25, state: { action: 'release', button: '', modifier: { control: false, shift: true, meta: false } } }, + { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: false, shift: true, meta: false } } } ]); } @@ -1268,11 +1268,11 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Alt'); // await page.keyboard.up('Shift'); await pollFor(page, () => getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} + { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, + { col: 45, row: 25, state: { action: 'release', button: '', modifier: { control: true, shift: false, meta: true } } }, + { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: true, shift: false, meta: true } } } ]); }); it('SGR encoding', async () => { @@ -1284,25 +1284,25 @@ describe('Mouse Tracking Tests', () => { // test at 0,0 await mouseDown('left'); await pollFor(page, () => getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} + { 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'); await pollFor(page, () => getReports(encoding), [ - {col: 1, row: 1, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}} + { col: 1, row: 1, state: { action: 'release', button: 'left', modifier: { control: false, shift: false, meta: false } } } ]); // mousemove should report await mouseMove(50, 10); await pollFor(page, () => getReports(encoding), [ - {col: 51, row: 11, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}} + { col: 51, row: 11, state: { action: 'move', button: '', modifier: { control: false, shift: false, meta: false } } } ]); await mouseDown('left'); await mouseUp('left'); 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}}} + { 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 } } } ]); // test at max rows/cols @@ -1312,9 +1312,9 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseUp('left'); await pollFor(page, () => getReports(encoding), [ - {col: cols, row: rows, state: {action: 'move', button: '', 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}}} + { col: cols, row: rows, state: { action: 'move', button: '', 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 } } } ]); // button press/move/release tests @@ -1324,10 +1324,10 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('left'); await pollFor(page, () => getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, - {col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}} + { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, + { col: 45, row: 25, state: { action: 'release', button: 'left', modifier: { control: false, shift: false, meta: false } } } ]); // middle button // bug: default action not cancelled (adds data to getReports from clipboard under X11) @@ -1344,19 +1344,19 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('right'); await pollFor(page, () => getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, - {col: 45, row: 25, state: {action: 'release', button: 'right', modifier: {control: false, shift: false, meta: false}}} + { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, + { col: 45, row: 25, state: { action: 'release', button: 'right', modifier: { control: false, shift: false, meta: false } } } ]); // wheel await mouseMove(43, 24); await getReports(encoding); // clear reports await wheelUp(); - await pollFor(page, () => 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(); - await pollFor(page, () => 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 @@ -1368,11 +1368,11 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Control'); await pollFor(page, () => getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, - {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}}} + { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, + { 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 } } } ]); // ALT @@ -1384,11 +1384,11 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Alt'); await pollFor(page, () => getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, - {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}}} + { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, + { 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 } } } ]); // SHIFT @@ -1402,16 +1402,16 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Shift'); if (noShift) { await pollFor(page, () => getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} + { col: 44, row: 25, state: { action: 'move', button: '', modifier: { control: false, shift: true, meta: false } } }, + { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: false, shift: true, meta: false } } } ]); } else { await pollFor(page, () => getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, - {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}}} + { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, + { 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 } } } ]); } @@ -1429,17 +1429,17 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Alt'); // await page.keyboard.up('Shift'); await pollFor(page, () => getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, - {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}}} + { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, + { 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 } } } ]); }); }); /** * move tests with multiple buttons pressed: - * currently not possible due to a limitation of the puppeteer mouse interface + * currently not possible due to a limitation of the playwright mouse interface * (saves only the last one pressed) */ }); diff --git a/test/api/Parser.api.ts b/test/api/Parser.api.ts index 72f56799..656f2ba3 100644 --- a/test/api/Parser.api.ts +++ b/test/api/Parser.api.ts @@ -3,25 +3,25 @@ * @license MIT */ -import * as puppeteer from 'puppeteer'; import { assert } from 'chai'; import { ITerminalOptions } from 'xterm'; -import { writeSync } from './TestUtils'; +import { writeSync, getBrowserType } from './TestUtils'; +import { Browser, Page } from 'playwright'; const APP = 'http://127.0.0.1:3000/test'; -let browser: puppeteer.Browser; -let page: puppeteer.Page; +let browser: Browser; +let page: Page; const width = 800; const height = 600; -describe('Parser Integration Tests', function(): void { - before(async function(): Promise { - browser = await puppeteer.launch({ +describe('Parser Integration Tests', function (): void { + before(async function (): Promise { + browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.pages())[0]; + page = (await browser.defaultContext().pages())[0]; await page.setViewport({ width, height }); await page.goto(APP); await openTerminal(); diff --git a/test/api/Terminal.api.ts b/test/api/Terminal.api.ts index 36966bfb..4d2ce7fa 100644 --- a/test/api/Terminal.api.ts +++ b/test/api/Terminal.api.ts @@ -3,25 +3,25 @@ * @license MIT */ -import * as puppeteer from 'puppeteer'; import { assert } from 'chai'; import { ITerminalOptions } from 'xterm'; -import { pollFor, timeout, writeSync } from './TestUtils'; +import { pollFor, timeout, writeSync, getBrowserType } from './TestUtils'; +import { Browser, Page } from 'playwright'; const APP = 'http://127.0.0.1:3000/test'; -let browser: puppeteer.Browser; -let page: puppeteer.Page; +let browser: Browser; +let page: Page; const width = 800; const height = 600; -describe('API Integration Tests', function(): void { +describe('API Integration Tests', function (): void { before(async () => { - browser = await puppeteer.launch({ + browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.pages())[0]; + page = (await browser.defaultContext().pages())[0]; await page.setViewport({ width, height }); }); @@ -713,7 +713,7 @@ async function getCellCoordinates(dimensions: IDimensions, col: number, row: num }; } -async function moveMouseCell(page: puppeteer.Page, dimensions: IDimensions, col: number, row: number) { +async function moveMouseCell(page: Page, dimensions: IDimensions, col: number, row: number) { const coords = await getCellCoordinates(dimensions, col, row); await page.mouse.move(coords.x, coords.y); } diff --git a/test/api/TestUtils.ts b/test/api/TestUtils.ts index d3674812..5ee88082 100644 --- a/test/api/TestUtils.ts +++ b/test/api/TestUtils.ts @@ -3,10 +3,11 @@ * @license MIT */ -import * as puppeteer from 'puppeteer'; +// import * as playwright from 'playwright'; +import * as playwright from 'playwright'; import deepEqual = require('deep-equal'); -export async function pollFor(page: puppeteer.Page, evalOrFn: string | (() => Promise), val: T, preFn?: () => Promise): Promise { +export async function pollFor(page: playwright.Page, evalOrFn: string | (() => Promise), val: T, preFn?: () => Promise): Promise { if (preFn) { await preFn(); } @@ -18,7 +19,7 @@ export async function pollFor(page: puppeteer.Page, evalOrFn: string | (() => } } -export async function writeSync(page: puppeteer.Page, data: string): Promise { +export async function writeSync(page: playwright.Page, data: string): Promise { await page.evaluate(` window.ready = false; window.term.write('${data}', () => window.ready = true); @@ -29,3 +30,18 @@ export async function writeSync(page: puppeteer.Page, data: string): Promise { return new Promise(r => setTimeout(r, ms)); } + +export function getBrowserType(): playwright.BrowserType { + // Default to chromium + let browserType: playwright.BrowserType = playwright['chromium']; + + const index = process.argv.indexOf('--browser'); + if (index !== -1 && process.argv.length > index + 2 && typeof process.argv[index + 1] === 'string') { + const string = process.argv[index + 1]; + if (string === 'firefox' || string === 'webkit') { + browserType = playwright[string]; + } + } + + return browserType; +} diff --git a/yarn.lock b/yarn.lock index 22e3acc6..f19014b1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -130,6 +130,11 @@ resolved "https://registry.yarnpkg.com/@types/cli-table/-/cli-table-0.3.0.tgz#f1857156bf5fd115c6a2db260ba0be1f8fc5671c" integrity sha512-QnZUISJJXyhyD6L1e5QwXDV/A5i2W1/gl6D6YMc8u0ncPepbv/B4w3S+izVvtAg60m6h+JP09+Y/0zF2mojlFQ== +"@types/debug@^4.1.5": + version "4.1.5" + resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd" + integrity sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ== + "@types/deep-equal@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@types/deep-equal/-/deep-equal-1.0.1.tgz#71cfabb247c22bcc16d536111f50c0ed12476b03" @@ -447,6 +452,13 @@ agent-base@^4.1.0: dependencies: es6-promisify "^5.0.0" +agent-base@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee" + integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg== + dependencies: + es6-promisify "^5.0.0" + ajv-errors@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/ajv-errors/-/ajv-errors-1.0.1.tgz#f35986aceb91afadec4102fbd85014950cefa64d" @@ -2451,6 +2463,14 @@ https-proxy-agent@^2.2.1: agent-base "^4.1.0" debug "^3.1.0" +https-proxy-agent@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-3.0.1.tgz#b8c286433e87602311b01c8ea34413d856a4af81" + integrity sha512-+ML2Rbh6DAuee7d07tYGEKOEi2voWPUGan+ExdPbPW6Z3svq+JCqr0v8WmKPOkz1vOVykPCBSuobe7G8GJUtVg== + dependencies: + agent-base "^4.3.0" + debug "^3.1.0" + iconv-lite@0.4.19: version "0.4.19" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" @@ -2843,6 +2863,11 @@ javascript-natural-sort@0.7.1: resolved "https://registry.yarnpkg.com/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz#f9e2303d4507f6d74355a73664d1440fb5a0ef59" integrity sha1-+eIwPUUH9tdDVac2ZNFED7Wg71k= +jpeg-js@^0.3.6: + version "0.3.6" + resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.3.6.tgz#c40382aac9506e7d1f2d856eb02f6c7b2a98b37c" + integrity sha512-MUj2XlMB8kpe+8DJUGH/3UJm4XpI8XEgZQ+CiHDeyrGoKPdW/8FJv6ku+3UiYm5Fz3CWaL+iXmD8Q4Ap6aC1Jw== + js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -4001,11 +4026,40 @@ pkg-dir@^3.0.0: dependencies: find-up "^3.0.0" +playwright-core@=0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-0.10.0.tgz#86699c9cc3e613d733e6635a54aceea1993013d5" + integrity sha512-yernA6yrrBhmb8M5eO6GZsJOrBKWOZszlu65Luz8LP7ryaDExN1sE9XjQBNbiwJ5Gfs8cehtAO7GfTDJt+Z2cQ== + dependencies: + debug "^4.1.0" + extract-zip "^1.6.6" + https-proxy-agent "^3.0.0" + jpeg-js "^0.3.6" + mime "^2.0.3" + pngjs "^3.4.0" + progress "^2.0.3" + proxy-from-env "^1.0.0" + rimraf "^2.6.1" + uuid "^3.4.0" + ws "^6.1.0" + +playwright@^0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/playwright/-/playwright-0.10.0.tgz#d37f7e42e0e868dcc4ec35cb0a8dbc6248457642" + integrity sha512-f3VRME/PIO5NbcWnlCDfXwPC0DAZJ7ETkcAdE+sensLCOkfDtLh97E71ZuxNCaPYsUA6FIPi5syD8pHJW/4hQQ== + dependencies: + playwright-core "=0.10.0" + pn@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" integrity sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA== +pngjs@^3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-3.4.0.tgz#99ca7d725965fb655814eaf65f38f12bbdbf555f" + integrity sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w== + posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" @@ -4026,7 +4080,7 @@ process@^0.11.10: resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI= -progress@^2.0.1: +progress@^2.0.1, progress@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== @@ -5342,6 +5396,11 @@ uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== +uuid@^3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" + integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== + v8-compile-cache@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.0.2.tgz#a428b28bb26790734c4fc8bc9fa106fccebf6a6c" From e7b3910f3d4ba6a86969c516b3ea037218efc2ac Mon Sep 17 00:00:00 2001 From: Jon Bockhorst Date: Mon, 10 Feb 2020 17:05:18 -0600 Subject: [PATCH 02/37] Update CI to node 10 --- azure-pipelines.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e641e716..b77f3408 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -12,7 +12,7 @@ jobs: steps: - task: NodeTool@0 inputs: - versionSpec: '8.x' + versionSpec: '10.x' displayName: 'Install Node.js' - task: YarnInstaller@3 inputs: @@ -47,7 +47,7 @@ jobs: steps: - task: NodeTool@0 inputs: - versionSpec: '8.x' + versionSpec: '10.x' displayName: 'Install Node.js' - task: CacheBeta@1 inputs: @@ -69,7 +69,7 @@ jobs: steps: - task: NodeTool@0 inputs: - versionSpec: '8.x' + versionSpec: '10.x' displayName: 'Install Node.js' - task: CacheBeta@1 inputs: @@ -89,7 +89,7 @@ jobs: steps: - task: NodeTool@0 inputs: - versionSpec: '8.x' + versionSpec: '10.x' displayName: 'Install Node.js' - task: YarnInstaller@3 inputs: @@ -109,7 +109,7 @@ jobs: steps: - task: NodeTool@0 inputs: - versionSpec: '8.x' + versionSpec: '10.x' displayName: 'Install Node.js' - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' @@ -134,7 +134,7 @@ jobs: steps: - task: NodeTool@0 inputs: - versionSpec: '8.x' + versionSpec: '10.x' displayName: 'Install Node.js' - task: YarnInstaller@3 inputs: From 520918348ea41115cb3be80506938122d3c3d244 Mon Sep 17 00:00:00 2001 From: Jon Bockhorst Date: Mon, 10 Feb 2020 18:18:23 -0600 Subject: [PATCH 03/37] Fix some mouse tests --- test/api/MouseTracking.api.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/api/MouseTracking.api.ts b/test/api/MouseTracking.api.ts index 0fa4dfa1..74e6aade 100644 --- a/test/api/MouseTracking.api.ts +++ b/test/api/MouseTracking.api.ts @@ -46,7 +46,7 @@ async function resetMouseModes(): Promise { } async function getReports(encoding: string): Promise { - const reports: number[][] = await page.evaluate(`window.calls`); + const reports: any = await page.evaluate(`window.calls`); await page.evaluate(`window.calls = [];`); return reports.map((report: number[]) => parseReport(encoding, report)); } @@ -84,7 +84,7 @@ async function mouseUp(button: 'left' | 'right' | 'middle' | undefined): Promise } async function wheelUp(): Promise { const self = (page.mouse as any); - return await self._client.send('Input.dispatchMouseEvent', { + return await self._raw._client.send('Input.dispatchMouseEvent', { type: 'mouseWheel', x: self._x, y: self._y, @@ -95,7 +95,7 @@ async function wheelUp(): Promise { } async function wheelDown(): Promise { const self = (page.mouse as any); - return await self._client.send('Input.dispatchMouseEvent', { + return await self._raw._client.send('Input.dispatchMouseEvent', { type: 'mouseWheel', x: self._x, y: self._y, From 8fb6ded5066b0fd765cc96b1a00a4870607aa4b0 Mon Sep 17 00:00:00 2001 From: Jon Bockhorst Date: Tue, 11 Feb 2020 13:13:03 -0600 Subject: [PATCH 04/37] Fix mouse tests for chromium --- test/api/MouseTracking.api.ts | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/test/api/MouseTracking.api.ts b/test/api/MouseTracking.api.ts index 74e6aade..98b65b2a 100644 --- a/test/api/MouseTracking.api.ts +++ b/test/api/MouseTracking.api.ts @@ -90,7 +90,7 @@ async function wheelUp(): Promise { y: self._y, deltaX: 0, deltaY: -10, - modifiers: self._keyboard._modifiers + modifiers: toModifiersMask(page.keyboard._modifiers()) }); } async function wheelDown(): Promise { @@ -101,10 +101,27 @@ async function wheelDown(): Promise { y: self._y, deltaX: 0, deltaY: 10, - modifiers: self._keyboard._modifiers + modifiers: toModifiersMask(page.keyboard._modifiers()) }); } +function toModifiersMask(modifiers: Set): 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 } = { '': -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 { + before(async function(): Promise { browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] From 391313cd396f1487675dd560ae1f201dcc707390 Mon Sep 17 00:00:00 2001 From: Jon Bockhorst Date: Tue, 11 Feb 2020 13:32:55 -0600 Subject: [PATCH 05/37] Revert some formatting and remove puppeteer --- addons/xterm-addon-fit/src/FitAddon.api.ts | 16 +- package.json | 1 - test/api/CharWidth.api.ts | 16 +- test/api/InputHandler.api.ts | 50 +-- test/api/MouseTracking.api.ts | 438 ++++++++++----------- yarn.lock | 14 - 6 files changed, 260 insertions(+), 275 deletions(-) diff --git a/addons/xterm-addon-fit/src/FitAddon.api.ts b/addons/xterm-addon-fit/src/FitAddon.api.ts index c170d75a..4a30db90 100644 --- a/addons/xterm-addon-fit/src/FitAddon.api.ts +++ b/addons/xterm-addon-fit/src/FitAddon.api.ts @@ -15,7 +15,7 @@ const width = 1024; const height = 768; describe('FitAddon', () => { - before(async function (): Promise { + before(async function(): Promise { this.timeout(20000); browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, @@ -31,7 +31,7 @@ describe('FitAddon', () => { await browser.close(); }); - it('no terminal', async function (): Promise { + it('no terminal', async function(): Promise { await page.evaluate(`window.fit = new FitAddon();`); assert.equal(await page.evaluate(`window.fit.proposeDimensions()`), undefined); }); @@ -41,7 +41,7 @@ describe('FitAddon', () => { return unloadFit(); }); - it('default', async function (): Promise { + it('default', async function(): Promise { await loadFit(); assert.deepEqual(await page.evaluate(`window.fit.proposeDimensions()`), { cols: 87, @@ -49,7 +49,7 @@ describe('FitAddon', () => { }); }); - it('width', async function (): Promise { + it('width', async function(): Promise { await loadFit(1008); assert.deepEqual(await page.evaluate(`window.fit.proposeDimensions()`), { cols: 110, @@ -57,7 +57,7 @@ describe('FitAddon', () => { }); }); - it('small', async function (): Promise { + it('small', async function(): Promise { await loadFit(1, 1); assert.deepEqual(await page.evaluate(`window.fit.proposeDimensions()`), { cols: 2, @@ -71,21 +71,21 @@ describe('FitAddon', () => { return unloadFit(); }); - it('default', async function (): Promise { + it('default', async function(): Promise { await loadFit(); await page.evaluate(`window.fit.fit()`); assert.equal(await page.evaluate(`window.term.cols`), 87); assert.equal(await page.evaluate(`window.term.rows`), 26); }); - it('width', async function (): Promise { + it('width', async function(): Promise { await loadFit(1008); await page.evaluate(`window.fit.fit()`); assert.equal(await page.evaluate(`window.term.cols`), 110); assert.equal(await page.evaluate(`window.term.rows`), 26); }); - it('small', async function (): Promise { + it('small', async function(): Promise { await loadFit(1, 1); await page.evaluate(`window.fit.fit()`); assert.equal(await page.evaluate(`window.term.cols`), 2); diff --git a/package.json b/package.json index 2d61fac8..b4f3de39 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,6 @@ "node-pty": "^0.9.0", "nyc": "13", "playwright": "^0.10.0", - "puppeteer": "^1.15.0", "source-map-loader": "^0.2.4", "ts-loader": "^6.0.4", "tslint": "^5.18.0", diff --git a/test/api/CharWidth.api.ts b/test/api/CharWidth.api.ts index 63b94aa7..79040942 100644 --- a/test/api/CharWidth.api.ts +++ b/test/api/CharWidth.api.ts @@ -14,8 +14,8 @@ let page: Page; const width = 800; const height = 600; -describe('CharWidth Integration Tests', function (): void { - before(async function (): Promise { +describe('CharWidth Integration Tests', function(): void { + before(async function(): Promise { browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] @@ -35,37 +35,37 @@ describe('CharWidth Integration Tests', function (): void { await page.evaluate(`window.term.reset()`); }); - it('ASCII chars', async function (): Promise { + it('ASCII chars', async function(): Promise { const input = 'This is just ASCII text.#'; await page.evaluate(`window.term.write('${input}')`); await pollFor(page, () => sumWidths(0, 1, '#'), 25); }); - it('combining chars', async function (): Promise { + it('combining chars', async function(): Promise { const input = 'e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301#'; await page.evaluate(`window.term.write('${input}')`); await pollFor(page, () => sumWidths(0, 1, '#'), 10); }); - it('surrogate chars', async function (): Promise { + it('surrogate chars', async function(): Promise { const input = '𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞𝄞#'; await page.evaluate(`window.term.write('${input}')`); await pollFor(page, () => sumWidths(0, 1, '#'), 28); }); - it('surrogate combining chars', async function (): Promise { + it('surrogate combining chars', async function(): Promise { const input = '𓂀\u0301𓂀\u0301𓂀\u0301𓂀\u0301𓂀\u0301𓂀\u0301𓂀\u0301𓂀\u0301𓂀\u0301𓂀\u0301𓂀\u0301#'; await page.evaluate(`window.term.write('${input}')`); await pollFor(page, () => sumWidths(0, 1, '#'), 12); }); - it('fullwidth chars', async function (): Promise { + it('fullwidth chars', async function(): Promise { const input = '1234567890#'; await page.evaluate(`window.term.write('${input}')`); await pollFor(page, () => sumWidths(0, 1, '#'), 21); }); - it('fullwidth chars offset 1', async function (): Promise { + it('fullwidth chars offset 1', async function(): Promise { const input = 'a1234567890#'; await page.evaluate(`window.term.write('${input}')`); await pollFor(page, () => sumWidths(0, 1, '#'), 22); diff --git a/test/api/InputHandler.api.ts b/test/api/InputHandler.api.ts index c95b83f8..95682aa5 100644 --- a/test/api/InputHandler.api.ts +++ b/test/api/InputHandler.api.ts @@ -15,8 +15,8 @@ let page: Page; const width = 800; const height = 600; -describe('InputHandler Integration Tests', function (): void { - before(async function (): Promise { +describe('InputHandler Integration Tests', function(): void { + before(async function(): Promise { browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] @@ -36,7 +36,7 @@ describe('InputHandler Integration Tests', function (): void { await page.evaluate(`window.term.reset()`); }); - it('ICH: Insert Ps (Blank) Character(s) (default = 1) - CSI Ps @', async function (): Promise { + it('ICH: Insert Ps (Blank) Character(s) (default = 1) - CSI Ps @', async function(): Promise { await page.evaluate(` // Default window.term.write('foo\\x1b[3D\\x1b[@\\n\\r') @@ -46,7 +46,7 @@ describe('InputHandler Integration Tests', function (): void { await pollFor(page, () => getLinesAsArray(2), [' foo', ' bar']); }); - it('CUU: Cursor Up Ps Times (default = 1) - CSI Ps A', async function (): Promise { + it('CUU: Cursor Up Ps Times (default = 1) - CSI Ps A', async function(): Promise { await page.evaluate(` // Default window.term.write('\\n\\n\\n\\n\x1b[Aa') @@ -56,7 +56,7 @@ describe('InputHandler Integration Tests', function (): void { await pollFor(page, () => getLinesAsArray(4), ['', ' b', '', 'a']); }); - it('CUD: Cursor Down Ps Times (default = 1) - CSI Ps B', async function (): Promise { + it('CUD: Cursor Down Ps Times (default = 1) - CSI Ps B', async function(): Promise { await page.evaluate(` // Default window.term.write('\x1b[Ba') @@ -66,7 +66,7 @@ describe('InputHandler Integration Tests', function (): void { await pollFor(page, () => getLinesAsArray(4), ['', 'a', '', ' b']); }); - it('CUF: Cursor Forward Ps Times (default = 1) - CSI Ps C', async function (): Promise { + it('CUF: Cursor Forward Ps Times (default = 1) - CSI Ps C', async function(): Promise { await page.evaluate(` // Default window.term.write('\x1b[Ca') @@ -76,7 +76,7 @@ describe('InputHandler Integration Tests', function (): void { await pollFor(page, () => getLinesAsArray(1), [' a b']); }); - it('CUB: Cursor Backward Ps Times (default = 1) - CSI Ps D', async function (): Promise { + it('CUB: Cursor Backward Ps Times (default = 1) - CSI Ps D', async function(): Promise { await page.evaluate(` // Default window.term.write('foo\x1b[Da') @@ -86,7 +86,7 @@ describe('InputHandler Integration Tests', function (): void { await pollFor(page, () => getLinesAsArray(1), ['fba']); }); - it('CNL: Cursor Next Line Ps Times (default = 1) - CSI Ps E', async function (): Promise { + it('CNL: Cursor Next Line Ps Times (default = 1) - CSI Ps E', async function(): Promise { await page.evaluate(` // Default window.term.write('\x1b[Ea') @@ -96,7 +96,7 @@ describe('InputHandler Integration Tests', function (): void { await pollFor(page, () => getLinesAsArray(4), ['', 'a', '', 'b']); }); - it('CPL: Cursor Preceding Line Ps Times (default = 1) - CSI Ps F', async function (): Promise { + it('CPL: Cursor Preceding Line Ps Times (default = 1) - CSI Ps F', async function(): Promise { await page.evaluate(` // Default window.term.write('\\n\\n\\n\\n\x1b[Fa') @@ -106,7 +106,7 @@ describe('InputHandler Integration Tests', function (): void { await pollFor(page, () => getLinesAsArray(5), ['', 'b', '', 'a', '']); }); - it('CHA: Cursor Character Absolute [column] (default = [row,1]) - CSI Ps G', async function (): Promise { + it('CHA: Cursor Character Absolute [column] (default = [row,1]) - CSI Ps G', async function(): Promise { await page.evaluate(` // Default window.term.write('foo\x1b[Ga') @@ -116,7 +116,7 @@ describe('InputHandler Integration Tests', function (): void { await pollFor(page, () => getLinesAsArray(1), ['aoo b']); }); - it('CUP: Cursor Position [row;column] (default = [1,1]) - CSI Ps ; Ps H', async function (): Promise { + it('CUP: Cursor Position [row;column] (default = [1,1]) - CSI Ps ; Ps H', async function(): Promise { await page.evaluate(` // Default window.term.write('foo\x1b[Ha') @@ -126,7 +126,7 @@ describe('InputHandler Integration Tests', function (): void { await pollFor(page, () => getLinesAsArray(3), ['aoo', '', ' b']); }); - it('CHT: Cursor Forward Tabulation Ps tab stops (default = 1) - CSI Ps I', async function (): Promise { + it('CHT: Cursor Forward Tabulation Ps tab stops (default = 1) - CSI Ps I', async function(): Promise { await page.evaluate(` // Default window.term.write('\x1b[Ia') @@ -136,7 +136,7 @@ describe('InputHandler Integration Tests', function (): void { await pollFor(page, () => getLinesAsArray(2), [' a', ' b']); }); - it('ED: Erase in Display, VT100 - CSI Ps J', async function (): Promise { + it('ED: Erase in Display, VT100 - CSI Ps J', async function(): Promise { const fixture = 'abc\\n\\rdef\\n\\rghi\x1b[2;2H'; await page.evaluate(` // Default: Erase Below @@ -165,7 +165,7 @@ describe('InputHandler Integration Tests', function (): void { await pollFor(page, () => getLinesAsArray(5), [' 4', ' 5', 'abc', 'def', 'ghi']); }); - it('DECSED: Erase in Display, VT220 - CSI ? Ps J', async function (): Promise { + it('DECSED: Erase in Display, VT220 - CSI ? Ps J', async function(): Promise { const fixture = 'abc\\n\\rdef\\n\\rghi\x1b[2;2H'; await page.evaluate(` // Default: Erase Below @@ -194,7 +194,7 @@ describe('InputHandler Integration Tests', function (): void { await pollFor(page, () => getLinesAsArray(5), [' 4', ' 5', 'abc', 'def', 'ghi']); }); - it('IL: Insert Ps Line(s) (default = 1) - CSI Ps L', async function (): Promise { + it('IL: Insert Ps Line(s) (default = 1) - CSI Ps L', async function(): Promise { await page.evaluate(` // Default window.term.write('foo\x1b[La') @@ -204,7 +204,7 @@ describe('InputHandler Integration Tests', function (): void { await pollFor(page, () => getLinesAsArray(4), ['b', '', 'a', 'foo']); }); - it('DL: Delete Ps Line(s) (default = 1) - CSI Ps M', async function (): Promise { + it('DL: Delete Ps Line(s) (default = 1) - CSI Ps M', async function(): Promise { await page.evaluate(` // Default window.term.write('a\\nb\x1b[1F\x1b[M') @@ -214,7 +214,7 @@ describe('InputHandler Integration Tests', function (): void { await pollFor(page, () => getLinesAsArray(5), [' b', ' f', '', '', '']); }); - it('DCH: Delete Ps Character(s) (default = 1) - CSI Ps P', async function (): Promise { + it('DCH: Delete Ps Character(s) (default = 1) - CSI Ps P', async function(): Promise { await page.evaluate(` // Default window.term.write('abc\x1b[1;1H\x1b[P') @@ -225,7 +225,7 @@ describe('InputHandler Integration Tests', function (): void { }); describe('DSR: Device Status Report', () => { - it('Status Report - CSI 5 n', async function (): Promise { + it('Status Report - CSI 5 n', async function(): Promise { await page.evaluate(` window.term.onData(e => window.result = e); window.term.write('\\x1b[5n'); @@ -233,7 +233,7 @@ describe('InputHandler Integration Tests', function (): void { await pollFor(page, () => page.evaluate(`window.result`), '\x1b[0n'); }); - it('Report Cursor Position (CPR) - CSI 6 n', async function (): Promise { + it('Report Cursor Position (CPR) - CSI 6 n', async function(): Promise { await page.evaluate(`window.term.write('\\n\\nfoo')`); await pollFor(page, () => page.evaluate(` [window.term.buffer.cursorY, window.term.buffer.cursorX] @@ -245,7 +245,7 @@ describe('InputHandler Integration Tests', function (): void { await pollFor(page, () => page.evaluate(`window.result`), '\x1b[3;4R'); }); - it('Report Cursor Position (DECXCPR) - CSI ? 6 n', async function (): Promise { + it('Report Cursor Position (DECXCPR) - CSI ? 6 n', async function(): Promise { await page.evaluate(`window.term.write('\\n\\nfoo')`); await pollFor(page, () => page.evaluate(` [window.term.buffer.cursorY, window.term.buffer.cursorX] @@ -286,7 +286,7 @@ describe('InputHandler Integration Tests', function (): void { await pollFor(page, () => page.evaluate(`window.term.getSelection().length`), 0); await page.mouse.up(); }); - it('Pm = 2004, Set bracketed paste mode', async function (): Promise { + it('Pm = 2004, Set bracketed paste mode', async function(): Promise { await pollFor(page, () => simulatePaste('foo'), 'foo'); await page.evaluate(`window.term.write('\x1b[?2004h')`); await pollFor(page, () => simulatePaste('bar'), '\x1b[200~bar\x1b[201~'); @@ -296,7 +296,7 @@ describe('InputHandler Integration Tests', function (): void { }); }); - it('REP: Repeat preceding character, ECMA48 - CSI Ps b', async function (): Promise { + it('REP: Repeat preceding character, ECMA48 - CSI Ps b', async function(): Promise { // default to 1 await page.evaluate(` window.term.resize(10, 10); @@ -347,7 +347,7 @@ describe('InputHandler Integration Tests', function (): void { }); describe('Window Options - CSI Ps ; Ps ; Ps t', () => { - it('should be disabled by default', async function () { + it('should be disabled by default', async function() { await page.evaluate(`(() => { window._stack = []; const _h = window.term.onData(data => window._stack.push(data)); @@ -360,7 +360,7 @@ describe('InputHandler Integration Tests', function (): void { })()`); await pollFor(page, async () => await page.evaluate(`(() => _stack)()`), []); }); - it('14 - GetWinSizePixels', async function () { + it('14 - GetWinSizePixels', async function() { await page.evaluate(`window.term.setOption('windowOptions', {getWinSizePixels: true});`); await page.evaluate(`(() => { window._stack = []; @@ -371,7 +371,7 @@ describe('InputHandler Integration Tests', function (): void { const d = await getDimensions(); await pollFor(page, async () => await page.evaluate(`(() => _stack)()`), [`\x1b[4;${d.height};${d.width}t`]); }); - it('16 - GetCellSizePixels', async function () { + it('16 - GetCellSizePixels', async function() { await page.evaluate(`window.term.setOption('windowOptions', {getCellSizePixels: true});`); await page.evaluate(`(() => { window._stack = []; diff --git a/test/api/MouseTracking.api.ts b/test/api/MouseTracking.api.ts index 98b65b2a..65131760 100644 --- a/test/api/MouseTracking.api.ts +++ b/test/api/MouseTracking.api.ts @@ -77,10 +77,10 @@ async function mouseMove(col: number, row: number): Promise { return await page.mouse.move(xPixels, yPixels); } async function mouseDown(button: 'left' | 'right' | 'middle' | undefined): Promise { - return await page.mouse.down({ button }); + return await page.mouse.down({button}); } async function mouseUp(button: 'left' | 'right' | 'middle' | undefined): Promise { - return await page.mouse.up({ button }); + return await page.mouse.up({button}); } async function wheelUp(): Promise { const self = (page.mouse as any); @@ -123,7 +123,7 @@ function toModifiersMask(modifiers: Set): number { } // button definitions -const buttons: { [key: string]: number } = { +const buttons: {[key: string]: number} = { '': -1, left: 0, middle: 1, @@ -150,9 +150,9 @@ for (const el in buttons) { // extract button data from buttonCode function evalButtonCode(code: number): any { if (code > 255) { - return { button: 'invalid', action: 'invalid', modifier: {} }; + return {button: 'invalid', action: 'invalid', modifier: {}}; } - const modifier = { shift: !!(code & 4), meta: !!(code & 8), control: !!(code & 16) }; + const modifier = {shift: !!(code & 4), meta: !!(code & 8), control: !!(code & 16)}; const move = code & 32; let button = code & 3; if (code & 128) { @@ -173,11 +173,11 @@ function evalButtonCode(code: number): any { buttonS = 'wheel'; actionS = button === 4 ? 'up' : button === 5 ? 'down' : button === 6 ? 'left' : 'right'; } - return { button: buttonS, action: actionS, modifier }; + return {button: buttonS, action: actionS, modifier}; } // parse a single mouse report -function parseReport(encoding: string, msg: number[]): { state: any; row: number; col: number; } | string { +function parseReport(encoding: string, msg: number[]): {state: any; row: number; col: number;} | string { let sReport: string; let buttonCode: number; let row: number; @@ -202,7 +202,7 @@ function parseReport(encoding: string, msg: number[]): { state: any; row: number if (report[report.length - 1] === 'm') { state.action = 'release'; } - return { state, row, col }; + return {state, row, col}; default: return { state: evalButtonCode(report.charCodeAt(3) - 32), @@ -222,7 +222,7 @@ describe('Mouse Tracking Tests', () => { args: [`--window-size=${width},${height}`, `--no-sandbox`] }); page = (await browser.defaultContext().pages())[0]; - await page.setViewport({ width, height }); + await page.setViewport({width, height}); }); after(async () => browser.close()); @@ -259,7 +259,7 @@ describe('Mouse Tracking Tests', () => { // test at 0,0 await mouseDown('left'); - await pollFor(page, () => 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'); @@ -270,14 +270,14 @@ describe('Mouse Tracking Tests', () => { await pollFor(page, () => getReports(encoding), []); await mouseDown('left'); await mouseUp('left'); - await pollFor(page, () => 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 // capped at 223 (1-based) await mouseMove(223 - 1, rows - 1); await mouseDown('left'); await mouseUp('left'); - await pollFor(page, () => getReports(encoding), [{ col: 223, row: rows, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } }]); + await pollFor(page, () => getReports(encoding), [{col: 223, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); // higher than 223 should not report at all await mouseMove(257, rows - 1); @@ -292,7 +292,7 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); - await pollFor(page, () => 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); @@ -308,7 +308,7 @@ describe('Mouse Tracking Tests', () => { await mouseDown('right'); await mouseMove(44, 24); await mouseUp('right'); - await pollFor(page, () => 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); @@ -328,7 +328,7 @@ describe('Mouse Tracking Tests', () => { await mouseUp('left'); await wheelDown(); await page.keyboard.up('Control'); - await pollFor(page, () => 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 @@ -340,7 +340,7 @@ describe('Mouse Tracking Tests', () => { await mouseUp('left'); await wheelDown(); await page.keyboard.up('Alt'); - await pollFor(page, () => 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 @@ -358,7 +358,7 @@ describe('Mouse Tracking Tests', () => { await pollFor(page, () => getReports(encoding), []); } else { await pollFor(page, () => getReports(encoding), [ - { col: 44, row: 25, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } } + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} ]); } @@ -376,7 +376,7 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Control'); await page.keyboard.up('Alt'); // await page.keyboard.up('Shift'); - await pollFor(page, () => 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'; @@ -386,7 +386,7 @@ describe('Mouse Tracking Tests', () => { // test at 0,0 await mouseDown('left'); - await pollFor(page, () => 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'); @@ -397,13 +397,13 @@ describe('Mouse Tracking Tests', () => { await pollFor(page, () => getReports(encoding), []); await mouseDown('left'); await mouseUp('left'); - await pollFor(page, () => 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'); - await pollFor(page, () => 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 @@ -412,7 +412,7 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); - await pollFor(page, () => 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); @@ -428,7 +428,7 @@ describe('Mouse Tracking Tests', () => { await mouseDown('right'); await mouseMove(44, 24); await mouseUp('right'); - await pollFor(page, () => 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); @@ -448,7 +448,7 @@ describe('Mouse Tracking Tests', () => { await mouseUp('left'); await wheelDown(); await page.keyboard.up('Control'); - await pollFor(page, () => 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 @@ -460,7 +460,7 @@ describe('Mouse Tracking Tests', () => { await mouseUp('left'); await wheelDown(); await page.keyboard.up('Alt'); - await pollFor(page, () => 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 @@ -476,7 +476,7 @@ describe('Mouse Tracking Tests', () => { await pollFor(page, () => getReports(encoding), []); } else { await pollFor(page, () => getReports(encoding), [ - { col: 44, row: 25, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } } + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} ]); } @@ -494,7 +494,7 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Control'); await page.keyboard.up('Alt'); // await page.keyboard.up('Shift'); - await pollFor(page, () => 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)', () => { @@ -514,13 +514,13 @@ describe('Mouse Tracking Tests', () => { // test at 0,0 await mouseDown('left'); await pollFor(page, () => getReports(encoding), [ - { col: 1, row: 1, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } } + {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'); await pollFor(page, () => getReports(encoding), [ - { col: 1, row: 1, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } + {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // mousemove should not report @@ -529,8 +529,8 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseUp('left'); 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: '', modifier: { control: false, shift: false, meta: false } } } + {col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, + {col: 51, row: 11, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // test at max rows/cols @@ -539,8 +539,8 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseUp('left'); await pollFor(page, () => getReports(encoding), [ - { col: 223, row: rows, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } }, - { col: 223, row: rows, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } + {col: 223, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, + {col: 223, row: rows, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // button press/move/release tests @@ -551,8 +551,8 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('left'); 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: '', 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: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // middle button // bug: default action not cancelled (adds data to getReports from clipboard under X11) @@ -570,17 +570,17 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('right'); 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: '', 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: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // wheel await mouseMove(43, 24); await getReports(encoding); // clear reports await wheelUp(); - await pollFor(page, () => 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(); - await pollFor(page, () => 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 @@ -593,9 +593,9 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Control'); 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: '', modifier: { control: true, shift: false, meta: false } } }, - { col: 45, row: 25, state: { action: 'down', button: 'wheel', 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: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} ]); // ALT @@ -608,9 +608,9 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Alt'); 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: '', modifier: { control: false, shift: false, meta: true } } }, - { col: 45, row: 25, state: { action: 'down', button: 'wheel', 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: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} ]); // SHIFT @@ -626,13 +626,13 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Shift'); if (noShift) { await pollFor(page, () => getReports(encoding), [ - { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: false, shift: true, meta: false } } } + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } else { 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: '', modifier: { control: false, shift: true, meta: false } } }, - { col: 45, row: 25, state: { action: 'down', button: 'wheel', 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: 'release', button: '', modifier: {control: false, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } @@ -651,9 +651,9 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Alt'); // await page.keyboard.up('Shift'); 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: '', modifier: { control: true, shift: false, meta: true } } }, - { col: 45, row: 25, state: { action: 'down', button: 'wheel', 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: 'release', button: '', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); }); it('SGR encoding', async () => { @@ -665,13 +665,13 @@ describe('Mouse Tracking Tests', () => { // test at 0,0 await mouseDown('left'); await pollFor(page, () => getReports(encoding), [ - { col: 1, row: 1, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } } + {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} ]); // mouseup should report await mouseUp('left'); await pollFor(page, () => getReports(encoding), [ - { col: 1, row: 1, state: { action: 'release', button: 'left', modifier: { control: false, shift: false, meta: false } } } + {col: 1, row: 1, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}} ]); // mousemove should not report @@ -680,8 +680,8 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseUp('left'); 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 } } } + {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}}} ]); // test at max rows/cols @@ -689,8 +689,8 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseUp('left'); 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 } } } + {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}}} ]); // button press/move/release tests @@ -701,8 +701,8 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('left'); 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 } } } + {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}}} ]); // middle button // bug: default action not cancelled (adds data to getReports from clipboard under X11) @@ -720,17 +720,17 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('right'); 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 } } } + {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}}} ]); // wheel await mouseMove(43, 24); await getReports(encoding); // clear reports await wheelUp(); - await pollFor(page, () => 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(); - await pollFor(page, () => 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 @@ -743,9 +743,9 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Control'); 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 } } } + {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}}} ]); // ALT @@ -758,9 +758,9 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Alt'); 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 } } } + {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}}} ]); // SHIFT @@ -775,13 +775,13 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Shift'); if (noShift) { await pollFor(page, () => getReports(encoding), [ - { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: false, shift: true, meta: false } } } + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } else { 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 } } } + {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}}} ]); } @@ -800,9 +800,9 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Alt'); // await page.keyboard.up('Shift'); 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 } } } + {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}}} ]); }); }); @@ -823,13 +823,13 @@ describe('Mouse Tracking Tests', () => { // test at 0,0 await mouseDown('left'); await pollFor(page, () => getReports(encoding), [ - { col: 1, row: 1, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } } + {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'); await pollFor(page, () => getReports(encoding), [ - { col: 1, row: 1, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } + {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // mousemove should not report @@ -838,8 +838,8 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseUp('left'); 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: '', modifier: { control: false, shift: false, meta: false } } } + {col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, + {col: 51, row: 11, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // test at max rows/cols @@ -848,8 +848,8 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseUp('left'); await pollFor(page, () => getReports(encoding), [ - { col: 223, row: rows, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } }, - { col: 223, row: rows, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } + {col: 223, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, + {col: 223, row: rows, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // button press/move/release tests @@ -860,9 +860,9 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('left'); 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: '', 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}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // middle button // bug: default action not cancelled (adds data to getReports from clipboard under X11) @@ -880,18 +880,18 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('right'); 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: '', 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}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // wheel await mouseMove(43, 24); await getReports(encoding); // clear reports await wheelUp(); - await pollFor(page, () => 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(); - await pollFor(page, () => 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 @@ -904,10 +904,10 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Control'); 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: '', modifier: { control: true, shift: false, meta: false } } }, - { col: 45, row: 25, state: { action: 'down', button: 'wheel', 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}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} ]); // ALT @@ -920,10 +920,10 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Alt'); 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: '', modifier: { control: false, shift: false, meta: true } } }, - { col: 45, row: 25, state: { action: 'down', button: 'wheel', 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}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} ]); // SHIFT @@ -938,14 +938,14 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Shift'); if (noShift) { await pollFor(page, () => getReports(encoding), [ - { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: false, shift: true, meta: false } } } + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } else { 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: '', modifier: { control: false, shift: true, meta: false } } }, - { col: 45, row: 25, state: { action: 'down', button: 'wheel', 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}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } @@ -964,10 +964,10 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Alt'); // await page.keyboard.up('Shift'); 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: '', modifier: { control: true, shift: false, meta: true } } }, - { col: 45, row: 25, state: { action: 'down', button: 'wheel', 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}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); }); it('SGR encoding', async () => { @@ -980,13 +980,13 @@ describe('Mouse Tracking Tests', () => { // bug: release is fired immediately await mouseDown('left'); await pollFor(page, () => getReports(encoding), [ - { col: 1, row: 1, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } } + {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'); await pollFor(page, () => getReports(encoding), [ - { col: 1, row: 1, state: { action: 'release', button: 'left', modifier: { control: false, shift: false, meta: false } } } + {col: 1, row: 1, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}} ]); // mousemove should not report @@ -995,8 +995,8 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseUp('left'); 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 } } } + {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}}} ]); // test at max rows/cols @@ -1004,8 +1004,8 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseUp('left'); 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 } } } + {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}}} ]); // button press/move/release tests @@ -1016,9 +1016,9 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('left'); 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 } } } + {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}}} ]); // middle button // bug: default action not cancelled (adds data to getReports from clipboard under X11) @@ -1036,18 +1036,18 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('right'); 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 } } } + {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}}} ]); // wheel await mouseMove(43, 24); await getReports(encoding); // clear reports await wheelUp(); - await pollFor(page, () => 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(); - await pollFor(page, () => 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 @@ -1060,10 +1060,10 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Control'); 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 } } }, - { col: 45, row: 25, state: { action: 'down', button: 'wheel', 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}}}, + {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}}} ]); // ALT @@ -1076,10 +1076,10 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Alt'); 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 } } }, - { col: 45, row: 25, state: { action: 'down', button: 'wheel', 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}}}, + {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}}} ]); // SHIFT @@ -1094,14 +1094,14 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Shift'); if (noShift) { await pollFor(page, () => getReports(encoding), [ - { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: false, shift: true, meta: false } } } + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } else { 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 } } }, - { col: 45, row: 25, state: { action: 'down', button: 'wheel', 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}}}, + {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}}} ]); } @@ -1120,10 +1120,10 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Alt'); // await page.keyboard.up('Shift'); 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 } } }, - { col: 45, row: 25, state: { action: 'down', button: 'wheel', 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}}}, + {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}}} ]); }); }); @@ -1141,25 +1141,25 @@ describe('Mouse Tracking Tests', () => { // test at 0,0 await mouseDown('left'); await pollFor(page, () => getReports(encoding), [ - { col: 1, row: 1, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } } + {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'); await pollFor(page, () => getReports(encoding), [ - { col: 1, row: 1, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } + {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // mousemove should report await mouseMove(50, 10); await pollFor(page, () => getReports(encoding), [ - { col: 51, row: 11, state: { action: 'move', button: '', modifier: { control: false, shift: false, meta: false } } } + {col: 51, row: 11, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}} ]); await mouseDown('left'); await mouseUp('left'); 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: '', modifier: { control: false, shift: false, meta: false } } } + {col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, + {col: 51, row: 11, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // test at max rows/cols @@ -1168,9 +1168,9 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseUp('left'); await pollFor(page, () => getReports(encoding), [ - { col: 223, row: rows, state: { action: 'move', button: '', modifier: { control: false, shift: false, meta: false } } }, - { col: 223, row: rows, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } }, - { col: 223, row: rows, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } + {col: 223, row: rows, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}}, + {col: 223, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, + {col: 223, row: rows, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // button press/move/release tests @@ -1180,10 +1180,10 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('left'); await pollFor(page, () => getReports(encoding), [ - { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, - { col: 45, row: 25, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } + {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // middle button // bug: default action not cancelled (adds data to getReports from clipboard under X11) @@ -1200,19 +1200,19 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('right'); await pollFor(page, () => getReports(encoding), [ - { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, - { col: 45, row: 25, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: false } } } + {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // wheel await mouseMove(43, 24); await getReports(encoding); // clear reports await wheelUp(); - await pollFor(page, () => 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(); - await pollFor(page, () => 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 @@ -1224,11 +1224,11 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Control'); await pollFor(page, () => getReports(encoding), [ - { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, - { col: 45, row: 25, state: { action: 'release', button: '', modifier: { control: true, shift: false, meta: false } } }, - { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: true, shift: false, meta: false } } } + {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} ]); // ALT @@ -1240,11 +1240,11 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Alt'); await pollFor(page, () => getReports(encoding), [ - { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, - { col: 45, row: 25, state: { action: 'release', button: '', modifier: { control: false, shift: false, meta: true } } }, - { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: false, shift: false, meta: true } } } + {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} ]); // SHIFT @@ -1258,16 +1258,16 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Shift'); if (noShift) { await pollFor(page, () => getReports(encoding), [ - { col: 44, row: 25, state: { action: 'move', button: '', modifier: { control: false, shift: true, meta: false } } }, - { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: false, shift: true, meta: false } } } + {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: false, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } else { await pollFor(page, () => getReports(encoding), [ - { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, - { col: 45, row: 25, state: { action: 'release', button: '', modifier: { control: false, shift: true, meta: false } } }, - { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: false, shift: true, meta: false } } } + {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } @@ -1285,11 +1285,11 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Alt'); // await page.keyboard.up('Shift'); await pollFor(page, () => getReports(encoding), [ - { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, - { col: 45, row: 25, state: { action: 'release', button: '', modifier: { control: true, shift: false, meta: true } } }, - { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: true, shift: false, meta: true } } } + {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); }); it('SGR encoding', async () => { @@ -1301,25 +1301,25 @@ describe('Mouse Tracking Tests', () => { // test at 0,0 await mouseDown('left'); await pollFor(page, () => getReports(encoding), [ - { col: 1, row: 1, state: { action: 'press', button: 'left', modifier: { control: false, shift: false, meta: false } } } + {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'); await pollFor(page, () => getReports(encoding), [ - { col: 1, row: 1, state: { action: 'release', button: 'left', modifier: { control: false, shift: false, meta: false } } } + {col: 1, row: 1, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}} ]); // mousemove should report await mouseMove(50, 10); await pollFor(page, () => getReports(encoding), [ - { col: 51, row: 11, state: { action: 'move', button: '', modifier: { control: false, shift: false, meta: false } } } + {col: 51, row: 11, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}} ]); await mouseDown('left'); await mouseUp('left'); 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 } } } + {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}}} ]); // test at max rows/cols @@ -1329,9 +1329,9 @@ describe('Mouse Tracking Tests', () => { await mouseDown('left'); await mouseUp('left'); await pollFor(page, () => getReports(encoding), [ - { col: cols, row: rows, state: { action: 'move', button: '', 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 } } } + {col: cols, row: rows, state: {action: 'move', button: '', 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}}} ]); // button press/move/release tests @@ -1341,10 +1341,10 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('left'); await pollFor(page, () => getReports(encoding), [ - { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, - { col: 45, row: 25, state: { action: 'release', button: 'left', modifier: { control: false, shift: false, meta: false } } } + {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, + {col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}} ]); // middle button // bug: default action not cancelled (adds data to getReports from clipboard under X11) @@ -1361,19 +1361,19 @@ describe('Mouse Tracking Tests', () => { await mouseMove(44, 24); await mouseUp('right'); await pollFor(page, () => getReports(encoding), [ - { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, - { col: 45, row: 25, state: { action: 'release', button: 'right', modifier: { control: false, shift: false, meta: false } } } + {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, + {col: 45, row: 25, state: {action: 'release', button: 'right', modifier: {control: false, shift: false, meta: false}}} ]); // wheel await mouseMove(43, 24); await getReports(encoding); // clear reports await wheelUp(); - await pollFor(page, () => 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(); - await pollFor(page, () => 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 @@ -1385,11 +1385,11 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Control'); await pollFor(page, () => getReports(encoding), [ - { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, - { 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 } } } + {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, + {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}}} ]); // ALT @@ -1401,11 +1401,11 @@ describe('Mouse Tracking Tests', () => { await wheelDown(); await page.keyboard.up('Alt'); await pollFor(page, () => getReports(encoding), [ - { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, - { 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 } } } + {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, + {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}}} ]); // SHIFT @@ -1419,16 +1419,16 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Shift'); if (noShift) { await pollFor(page, () => getReports(encoding), [ - { col: 44, row: 25, state: { action: 'move', button: '', modifier: { control: false, shift: true, meta: false } } }, - { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: false, shift: true, meta: false } } } + {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: false, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } else { await pollFor(page, () => getReports(encoding), [ - { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, - { 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 } } } + {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, + {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}}} ]); } @@ -1446,11 +1446,11 @@ describe('Mouse Tracking Tests', () => { await page.keyboard.up('Alt'); // await page.keyboard.up('Shift'); await pollFor(page, () => getReports(encoding), [ - { col: 44, row: 25, state: { action: 'move', button: '', 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 } } }, - { 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 } } } + {col: 44, row: 25, state: {action: 'move', button: '', 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}}}, + {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}}} ]); }); }); diff --git a/yarn.lock b/yarn.lock index f19014b1..168016c6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4170,20 +4170,6 @@ punycode@^2.1.0: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== -puppeteer@^1.15.0: - version "1.15.0" - resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-1.15.0.tgz#1680fac13e51f609143149a5b7fa99eec392b34f" - integrity sha512-D2y5kwA9SsYkNUmcBzu9WZ4V1SGHiQTmgvDZSx6sRYFsgV25IebL4V6FaHjF6MbwLK9C6f3G3pmck9qmwM8H3w== - dependencies: - debug "^4.1.0" - extract-zip "^1.6.6" - https-proxy-agent "^2.2.1" - mime "^2.0.3" - progress "^2.0.1" - proxy-from-env "^1.0.0" - rimraf "^2.6.1" - ws "^6.1.0" - puppeteer@^1.17.0: version "1.17.0" resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-1.17.0.tgz#371957d227a2f450fa74b78e78a2dadb2be7f14f" From 2442dc09b01a9e21a9bfdc928a002a4e2c264ee1 Mon Sep 17 00:00:00 2001 From: Jon Bockhorst Date: Wed, 12 Feb 2020 16:00:21 -0600 Subject: [PATCH 06/37] Clean up some stuff based on feedback --- .../xterm-addon-attach/src/AttachAddon.api.ts | 8 ++--- .../xterm-addon-search/src/SearchAddon.api.ts | 4 +-- .../src/SerializeAddon.api.ts | 30 +++++++++---------- .../src/Unicode11Addon.api.ts | 4 +-- .../src/WebLinksAddon.api.ts | 10 +++---- package.json | 1 - test/api/InputHandler.api.ts | 11 +++---- test/api/TestUtils.ts | 1 - test/api/tsconfig.json | 13 +++++++- 9 files changed, 46 insertions(+), 36 deletions(-) diff --git a/addons/xterm-addon-attach/src/AttachAddon.api.ts b/addons/xterm-addon-attach/src/AttachAddon.api.ts index 50891efd..12e4feea 100644 --- a/addons/xterm-addon-attach/src/AttachAddon.api.ts +++ b/addons/xterm-addon-attach/src/AttachAddon.api.ts @@ -16,7 +16,7 @@ const width = 800; const height = 600; describe('AttachAddon', () => { - before(async function (): Promise { + before(async function(): Promise { this.timeout(20000); browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, @@ -30,12 +30,12 @@ describe('AttachAddon', () => { await browser.close(); }); - beforeEach(async function (): Promise { + beforeEach(async function(): Promise { this.timeout(20000); await page.goto(APP); }); - it('string', async function (): Promise { + it('string', async function(): Promise { this.timeout(20000); await openTerminal({ rendererType: 'dom' }); const port = 8080; @@ -46,7 +46,7 @@ describe('AttachAddon', () => { server.close(); }); - it('utf8', async function (): Promise { + it('utf8', async function(): Promise { this.timeout(20000); await openTerminal({ rendererType: 'dom' }); const port = 8080; diff --git a/addons/xterm-addon-search/src/SearchAddon.api.ts b/addons/xterm-addon-search/src/SearchAddon.api.ts index bb983e08..6485e555 100644 --- a/addons/xterm-addon-search/src/SearchAddon.api.ts +++ b/addons/xterm-addon-search/src/SearchAddon.api.ts @@ -16,10 +16,10 @@ let page: playwright.Page; const width = 800; const height = 600; -describe('Search Tests', function (): void { +describe('Search Tests', function(): void { this.timeout(20000); - before(async function (): Promise { + before(async function(): Promise { browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] diff --git a/addons/xterm-addon-serialize/src/SerializeAddon.api.ts b/addons/xterm-addon-serialize/src/SerializeAddon.api.ts index dfdbcdb7..b451542c 100644 --- a/addons/xterm-addon-serialize/src/SerializeAddon.api.ts +++ b/addons/xterm-addon-serialize/src/SerializeAddon.api.ts @@ -15,7 +15,7 @@ const width = 800; const height = 600; describe('SerializeAddon', () => { - before(async function (): Promise { + before(async function(): Promise { browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`] @@ -33,13 +33,13 @@ describe('SerializeAddon', () => { after(async () => await browser.close()); beforeEach(async () => await page.evaluate(`window.term.reset()`)); - it('empty content', async function (): Promise { + it('empty content', async function(): Promise { const rows = 10; const cols = 10; assert.equal(await page.evaluate(`serializeAddon.serialize();`), ''); }); - it('trim last empty lines', async function (): Promise { + it('trim last empty lines', async function(): Promise { const cols = 10; const lines = [ '', @@ -58,7 +58,7 @@ describe('SerializeAddon', () => { assert.equal(await page.evaluate(`serializeAddon.serialize();`), lines.slice(0, 8).join('\r\n')); }); - it('digits content', async function (): Promise { + it('digits content', async function(): Promise { const rows = 10; const cols = 10; const digitsLine = digitsString(cols); @@ -67,7 +67,7 @@ describe('SerializeAddon', () => { assert.equal(await page.evaluate(`serializeAddon.serialize();`), lines.join('\r\n')); }); - it('serialize half rows of content', async function (): Promise { + it('serialize half rows of content', async function(): Promise { const rows = 10; const halfRows = rows >> 1; const cols = 10; @@ -76,7 +76,7 @@ describe('SerializeAddon', () => { assert.equal(await page.evaluate(`serializeAddon.serialize(${halfRows});`), lines.slice(halfRows, 2 * halfRows).join('\r\n')); }); - it('serialize 0 rows of content', async function (): Promise { + it('serialize 0 rows of content', async function(): Promise { const rows = 10; const cols = 10; const lines = newArray((index: number) => digitsString(cols, index), rows); @@ -84,7 +84,7 @@ describe('SerializeAddon', () => { assert.equal(await page.evaluate(`serializeAddon.serialize(0);`), ''); }); - it('serialize all rows of content with color16', async function (): Promise { + it('serialize all rows of content with color16', async function(): Promise { const cols = 10; const color16 = [ 30, 31, 32, 33, 34, 35, 36, 37, // Set foreground color @@ -101,7 +101,7 @@ describe('SerializeAddon', () => { assert.equal(await page.evaluate(`serializeAddon.serialize();`), lines.join('\r\n')); }); - it('serialize all rows of content with fg/bg flags', async function (): Promise { + it('serialize all rows of content with fg/bg flags', async function(): Promise { const cols = 10; const line = '+'.repeat(cols); const lines: string[] = [ @@ -122,7 +122,7 @@ describe('SerializeAddon', () => { assert.equal(await page.evaluate(`serializeAddon.serialize();`), lines.join('\r\n')); }); - it('serialize all rows of content with color256', async function (): Promise { + it('serialize all rows of content with color256', async function(): Promise { const rows = 32; const cols = 10; const lines = newArray( @@ -133,7 +133,7 @@ describe('SerializeAddon', () => { assert.equal(await page.evaluate(`serializeAddon.serialize();`), lines.join('\r\n')); }); - it('serialize all rows of content with color16 and style separately', async function (): Promise { + it('serialize all rows of content with color16 and style separately', async function(): Promise { const cols = 10; const line = '+'.repeat(cols); const lines: string[] = [ @@ -152,7 +152,7 @@ describe('SerializeAddon', () => { assert.equal(await page.evaluate(`serializeAddon.serialize();`), lines.join('\r\n')); }); - it('serialize all rows of content with color16 and style together', async function (): Promise { + it('serialize all rows of content with color16 and style together', async function(): Promise { const cols = 10; const line = '+'.repeat(cols); const lines: string[] = [ @@ -174,7 +174,7 @@ describe('SerializeAddon', () => { assert.equal(await page.evaluate(`serializeAddon.serialize();`), lines.join('\r\n')); }); - it('serialize all rows of content with color256 and style separately', async function (): Promise { + it('serialize all rows of content with color256 and style separately', async function(): Promise { const cols = 10; const line = '+'.repeat(cols); const lines: string[] = [ @@ -193,7 +193,7 @@ describe('SerializeAddon', () => { assert.equal(await page.evaluate(`serializeAddon.serialize();`), lines.join('\r\n')); }); - it('serialize all rows of content with color256 and style together', async function (): Promise { + it('serialize all rows of content with color256 and style together', async function(): Promise { const cols = 10; const line = '+'.repeat(cols); const lines: string[] = [ @@ -215,7 +215,7 @@ describe('SerializeAddon', () => { assert.equal(await page.evaluate(`serializeAddon.serialize();`), lines.join('\r\n')); }); - it('serialize all rows of content with colorRGB and style separately', async function (): Promise { + it('serialize all rows of content with colorRGB and style separately', async function(): Promise { const cols = 10; const line = '+'.repeat(cols); const lines: string[] = [ @@ -234,7 +234,7 @@ describe('SerializeAddon', () => { assert.equal(await page.evaluate(`serializeAddon.serialize();`), lines.join('\r\n')); }); - it('serialize all rows of content with colorRGB and style together', async function (): Promise { + it('serialize all rows of content with colorRGB and style together', async function(): Promise { const cols = 10; const line = '+'.repeat(cols); const lines: string[] = [ diff --git a/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts b/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts index 68426df7..4dbc8960 100644 --- a/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts +++ b/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts @@ -15,7 +15,7 @@ const width = 800; const height = 600; describe('Unicode11Addon', () => { - before(async function (): Promise { + before(async function(): Promise { this.timeout(20000); browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, @@ -29,7 +29,7 @@ describe('Unicode11Addon', () => { await browser.close(); }); - beforeEach(async function (): Promise { + beforeEach(async function(): Promise { this.timeout(20000); await page.goto(APP); await openTerminal(); diff --git a/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts b/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts index a51343c0..6fd51178 100644 --- a/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts +++ b/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts @@ -15,7 +15,7 @@ const width = 800; const height = 600; describe('WebLinksAddon', () => { - before(async function (): Promise { + before(async function(): Promise { this.timeout(10000); browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, @@ -29,22 +29,22 @@ describe('WebLinksAddon', () => { await browser.close(); }); - beforeEach(async function (): Promise { + beforeEach(async function(): Promise { this.timeout(5000); await page.goto(APP); }); - it('.com', async function (): Promise { + it('.com', async function(): Promise { this.timeout(20000); await testHostName('foo.com'); }); - it('.com.au', async function (): Promise { + it('.com.au', async function(): Promise { this.timeout(20000); await testHostName('foo.com.au'); }); - it('.io', async function (): Promise { + it('.io', async function(): Promise { this.timeout(20000); await testHostName('foo.io'); }); diff --git a/package.json b/package.json index b4f3de39..831601bc 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "@types/jsdom": "11.0.1", "@types/mocha": "^2.2.33", "@types/node": "6.0.108", - "@types/puppeteer": "^1.12.4", "@types/utf8": "^2.1.6", "@types/webpack": "^4.4.11", "@types/ws": "^6.0.1", diff --git a/test/api/InputHandler.api.ts b/test/api/InputHandler.api.ts index 95682aa5..d7bab1e0 100644 --- a/test/api/InputHandler.api.ts +++ b/test/api/InputHandler.api.ts @@ -7,6 +7,7 @@ import { assert } from 'chai'; import { ITerminalOptions } from 'xterm'; import { pollFor, getBrowserType } from './TestUtils'; import { Page, Browser } from 'playwright'; +import { IRenderDimensions } from 'browser/renderer/Types'; const APP = 'http://127.0.0.1:3000/test'; @@ -261,7 +262,7 @@ describe('InputHandler Integration Tests', function(): void { describe('SM: Set Mode', () => { describe('CSI ? Pm h', () => { it('Pm = 1003, Set Use All Motion (any event) Mouse Tracking', async () => { - const coords: any = await page.evaluate(` + const coords: { left: number, top: number, bottom: number, right: number } = await page.evaluate(` (function() { const rect = window.term.element.getBoundingClientRect(); return {left: rect.left, top: rect.top, bottom: rect.bottom, right: rect.right}; @@ -347,7 +348,7 @@ describe('InputHandler Integration Tests', function(): void { }); describe('Window Options - CSI Ps ; Ps ; Ps t', () => { - it('should be disabled by default', async function() { + it('should be disabled by default', async function(): Promise { await page.evaluate(`(() => { window._stack = []; const _h = window.term.onData(data => window._stack.push(data)); @@ -360,7 +361,7 @@ describe('InputHandler Integration Tests', function(): void { })()`); await pollFor(page, async () => await page.evaluate(`(() => _stack)()`), []); }); - it('14 - GetWinSizePixels', async function() { + it('14 - GetWinSizePixels', async function(): Promise { await page.evaluate(`window.term.setOption('windowOptions', {getWinSizePixels: true});`); await page.evaluate(`(() => { window._stack = []; @@ -371,7 +372,7 @@ describe('InputHandler Integration Tests', function(): void { const d = await getDimensions(); await pollFor(page, async () => await page.evaluate(`(() => _stack)()`), [`\x1b[4;${d.height};${d.width}t`]); }); - it('16 - GetCellSizePixels', async function() { + it('16 - GetCellSizePixels', async function(): Promise { await page.evaluate(`window.term.setOption('windowOptions', {getCellSizePixels: true});`); await page.evaluate(`(() => { window._stack = []; @@ -443,7 +444,7 @@ async function getCursor(): Promise<{ col: number, row: number }> { } async function getDimensions(): Promise { - const dim: any = await page.evaluate(`term._core._renderService.dimensions`); + const dim: IRenderDimensions = await page.evaluate(`term._core._renderService.dimensions`); return { cellWidth: dim.actualCellWidth.toFixed(0), cellHeight: dim.actualCellHeight.toFixed(0), diff --git a/test/api/TestUtils.ts b/test/api/TestUtils.ts index 5ee88082..5835b5ca 100644 --- a/test/api/TestUtils.ts +++ b/test/api/TestUtils.ts @@ -3,7 +3,6 @@ * @license MIT */ -// import * as playwright from 'playwright'; import * as playwright from 'playwright'; import deepEqual = require('deep-equal'); diff --git a/test/api/tsconfig.json b/test/api/tsconfig.json index 2bd0a92b..a246f906 100644 --- a/test/api/tsconfig.json +++ b/test/api/tsconfig.json @@ -12,10 +12,21 @@ "sourceMap": true, "removeComments": true, "pretty": true, - "strict": true + "strict": true, + "baseUrl": ".", + "paths": { + "browser/*": [ + "../../src/browser/*" + ] + } }, "include": [ "./**/*", "../../typings/xterm.d.ts" + ], + "references": [ + { + "path": "../../src/browser" + } ] } From 383e2ed46f41432c81e2e718b51147cf374c5dfa Mon Sep 17 00:00:00 2001 From: Jon Bockhorst Date: Thu, 13 Feb 2020 00:07:07 -0600 Subject: [PATCH 07/37] Remove duplicate code and clean up after merge --- .../xterm-addon-attach/src/AttachAddon.api.ts | 8 +++---- addons/xterm-addon-fit/src/FitAddon.api.ts | 8 +++---- .../xterm-addon-search/src/SearchAddon.api.ts | 23 ++++--------------- .../src/SerializeAddon.api.ts | 8 +++---- .../src/Unicode11Addon.api.ts | 8 +++---- .../src/WebLinksAddon.api.ts | 8 +++---- .../src/WebglRenderer.api.ts | 23 ++++--------------- test/api/CharWidth.api.ts | 2 +- test/api/InputHandler.api.ts | 3 +-- test/api/TestUtils.ts | 2 +- 10 files changed, 31 insertions(+), 62 deletions(-) diff --git a/addons/xterm-addon-attach/src/AttachAddon.api.ts b/addons/xterm-addon-attach/src/AttachAddon.api.ts index 20a08179..c175de62 100644 --- a/addons/xterm-addon-attach/src/AttachAddon.api.ts +++ b/addons/xterm-addon-attach/src/AttachAddon.api.ts @@ -3,14 +3,14 @@ * @license MIT */ -import * as playwright from 'playwright'; import WebSocket = require('ws'); -import { openTerminal, pollFor } from '../../../out-test/api/TestUtils'; +import { openTerminal, pollFor, getBrowserType } from '../../../out-test/api/TestUtils'; +import { Browser, Page } from 'playwright'; const APP = 'http://127.0.0.1:3000/test'; -let browser: playwright.Browser; -let page: playwright.Page; +let browser: Browser; +let page: Page; const width = 800; const height = 600; diff --git a/addons/xterm-addon-fit/src/FitAddon.api.ts b/addons/xterm-addon-fit/src/FitAddon.api.ts index a0b719e5..b10b6563 100644 --- a/addons/xterm-addon-fit/src/FitAddon.api.ts +++ b/addons/xterm-addon-fit/src/FitAddon.api.ts @@ -3,14 +3,14 @@ * @license MIT */ -import * as playwright from 'playwright'; import { assert } from 'chai'; -import { openTerminal } from '../../../out-test/api/TestUtils'; +import { openTerminal, getBrowserType } from '../../../out-test/api/TestUtils'; +import { Browser, Page } from 'playwright'; const APP = 'http://127.0.0.1:3000/test'; -let browser: playwright.Browser; -let page: playwright.Page; +let browser: Browser; +let page: Page; const width = 1024; const height = 768; diff --git a/addons/xterm-addon-search/src/SearchAddon.api.ts b/addons/xterm-addon-search/src/SearchAddon.api.ts index cff7312c..85c5ae7f 100644 --- a/addons/xterm-addon-search/src/SearchAddon.api.ts +++ b/addons/xterm-addon-search/src/SearchAddon.api.ts @@ -3,16 +3,16 @@ * @license MIT */ -import * as playwright from 'playwright'; import { assert } from 'chai'; import { readFile } from 'fs'; import { resolve } from 'path'; -import { openTerminal, writeSync } from '../../../out-test/api/TestUtils'; +import { openTerminal, writeSync, getBrowserType } from '../../../out-test/api/TestUtils'; +import { Browser, Page } from 'playwright'; const APP = 'http://127.0.0.1:3000/test'; -let browser: playwright.Browser; -let page: playwright.Page; +let browser: Browser; +let page: Page; const width = 800; const height = 600; @@ -197,18 +197,3 @@ function makeData(length: number): string { } return result; } - -function getBrowserType(): playwright.BrowserType { - // Default to chromium - let browserType: playwright.BrowserType = playwright['chromium']; - - const index = process.argv.indexOf('--browser'); - if (index !== -1 && process.argv.length > index + 2 && typeof process.argv[index + 1] === 'string') { - const string = process.argv[index + 1]; - if (string === 'firefox' || string === 'webkit') { - browserType = playwright[string]; - } - } - - return browserType; -} diff --git a/addons/xterm-addon-serialize/src/SerializeAddon.api.ts b/addons/xterm-addon-serialize/src/SerializeAddon.api.ts index c27263d2..aba4b091 100644 --- a/addons/xterm-addon-serialize/src/SerializeAddon.api.ts +++ b/addons/xterm-addon-serialize/src/SerializeAddon.api.ts @@ -3,14 +3,14 @@ * @license MIT */ -import * as playwright from 'playwright'; import { assert } from 'chai'; -import { openTerminal, writeSync } from '../../../out-test/api/TestUtils'; +import { openTerminal, writeSync, getBrowserType } from '../../../out-test/api/TestUtils'; +import { Browser, Page } from 'playwright'; const APP = 'http://127.0.0.1:3000/test'; -let browser: playwright.Browser; -let page: playwright.Page; +let browser: Browser; +let page: Page; const width = 800; const height = 600; diff --git a/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts b/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts index 3a0b4c13..36fe221a 100644 --- a/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts +++ b/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts @@ -3,14 +3,14 @@ * @license MIT */ -import * as playwright from 'playwright'; import { assert } from 'chai'; -import { openTerminal } from '../../../out-test/api/TestUtils'; +import { openTerminal, getBrowserType } from '../../../out-test/api/TestUtils'; +import { Browser, Page } from 'playwright'; const APP = 'http://127.0.0.1:3000/test'; -let browser: playwright.Browser; -let page: playwright.Page; +let browser: Browser; +let page: Page; const width = 800; const height = 600; diff --git a/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts b/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts index 5ac5eb50..318b0c23 100644 --- a/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts +++ b/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts @@ -3,14 +3,14 @@ * @license MIT */ -import * as playwright from 'playwright'; import { assert } from 'chai'; -import { openTerminal, pollFor, writeSync } from '../../../out-test/api/TestUtils'; +import { openTerminal, pollFor, writeSync, getBrowserType } from '../../../out-test/api/TestUtils'; +import { Browser, Page } from 'playwright'; const APP = 'http://127.0.0.1:3000/test'; -let browser: playwright.Browser; -let page: playwright.Page; +let browser: Browser; +let page: Page; const width = 800; const height = 600; diff --git a/addons/xterm-addon-webgl/src/WebglRenderer.api.ts b/addons/xterm-addon-webgl/src/WebglRenderer.api.ts index 7c954f9d..03127eb0 100644 --- a/addons/xterm-addon-webgl/src/WebglRenderer.api.ts +++ b/addons/xterm-addon-webgl/src/WebglRenderer.api.ts @@ -3,16 +3,16 @@ * @license MIT */ -import * as playwright from 'playwright'; import { ITerminalOptions } from '../../../src/Types'; import { ITheme } from 'xterm'; import { assert } from 'chai'; -import { openTerminal, pollFor, writeSync } from '../../../out-test/api/TestUtils'; +import { openTerminal, pollFor, writeSync, getBrowserType } from '../../../out-test/api/TestUtils'; +import { Browser, Page } from 'playwright'; const APP = 'http://127.0.0.1:3000/test'; -let browser: playwright.Browser; -let page: playwright.Page; +let browser: Browser; +let page: Page; const width = 800; const height = 600; @@ -912,18 +912,3 @@ const COLORS_16_TO_255 = [ '#ffd7d7', '#ffd7ff', '#ffff00', '#ffff5f', '#ffff87', '#ffffaf', '#ffffd7', '#ffffff', '#080808', '#121212', '#1c1c1c', '#262626', '#303030', '#3a3a3a', '#444444', '#4e4e4e', '#585858', '#626262', '#6c6c6c', '#767676', '#808080', '#8a8a8a', '#949494', '#9e9e9e', '#a8a8a8', '#b2b2b2', '#bcbcbc', '#c6c6c6', '#d0d0d0', '#dadada', '#e4e4e4', '#eeeeee' ]; - -function getBrowserType(): playwright.BrowserType { - // Default to chromium - let browserType: playwright.BrowserType = playwright['chromium']; - - const index = process.argv.indexOf('--browser'); - if (index !== -1 && process.argv.length > index + 2 && typeof process.argv[index + 1] === 'string') { - const string = process.argv[index + 1]; - if (string === 'firefox' || string === 'webkit') { - browserType = playwright[string]; - } - } - - return browserType; -} diff --git a/test/api/CharWidth.api.ts b/test/api/CharWidth.api.ts index a33ca328..1bafea50 100644 --- a/test/api/CharWidth.api.ts +++ b/test/api/CharWidth.api.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { pollFor, getBrowserType, openTerminal } from './TestUtils'; +import { pollFor, openTerminal, getBrowserType } from './TestUtils'; import { Browser, Page } from 'playwright'; const APP = 'http://127.0.0.1:3000/test'; diff --git a/test/api/InputHandler.api.ts b/test/api/InputHandler.api.ts index 5b315a24..0bfc9648 100644 --- a/test/api/InputHandler.api.ts +++ b/test/api/InputHandler.api.ts @@ -4,9 +4,8 @@ */ import { assert } from 'chai'; -import { ITerminalOptions } from 'xterm'; import { pollFor, openTerminal, getBrowserType } from './TestUtils'; -import { Page, Browser } from 'playwright'; +import { Browser, Page } from 'playwright'; import { IRenderDimensions } from 'browser/renderer/Types'; const APP = 'http://127.0.0.1:3000/test'; diff --git a/test/api/TestUtils.ts b/test/api/TestUtils.ts index a579328c..a78dab44 100644 --- a/test/api/TestUtils.ts +++ b/test/api/TestUtils.ts @@ -31,7 +31,7 @@ export async function timeout(ms: number): Promise { return new Promise(r => setTimeout(r, ms)); } -export async function openTerminal(page: puppeteer.Page, options: ITerminalOptions = {}): Promise { +export async function openTerminal(page: playwright.Page, options: ITerminalOptions = {}): Promise { await page.evaluate(`window.term = new Terminal(${JSON.stringify(options)})`); await page.evaluate(`window.term.open(document.querySelector('#terminal-container'))`); if (options.rendererType === 'dom') { From b53c2e1a26fbf70fcc2df040705a7a69c61ca78f Mon Sep 17 00:00:00 2001 From: Jon Bockhorst Date: Thu, 13 Feb 2020 00:15:12 -0600 Subject: [PATCH 08/37] Fix tests --- test/api/InputHandler.api.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/api/InputHandler.api.ts b/test/api/InputHandler.api.ts index 0bfc9648..f220a443 100644 --- a/test/api/InputHandler.api.ts +++ b/test/api/InputHandler.api.ts @@ -369,7 +369,7 @@ describe('InputHandler Integration Tests', function(): void { return new Promise((r) => window.term.write('', () => { _h.dispose(); r(); })); })()`); const d = await getDimensions(); - await pollFor(page, async () => await page.evaluate(`(() => _stack)()`), [`\x1b[4; ${d.height}; ${d.width} t`]); + await pollFor(page, async () => await page.evaluate(`(() => _stack)()`), [`\x1b[4;${d.height};${d.width}t`]); }); it('16 - GetCellSizePixels', async function(): Promise { await page.evaluate(`window.term.setOption('windowOptions', { getCellSizePixels: true }); `); @@ -380,7 +380,7 @@ describe('InputHandler Integration Tests', function(): void { return new Promise((r) => window.term.write('', () => { _h.dispose(); r(); })); })()`); const d = await getDimensions(); - await pollFor(page, async () => await page.evaluate(`(() => _stack)()`), [`\x1b[6; ${d.cellHeight}; ${d.cellWidth} t`]); + await pollFor(page, async () => await page.evaluate(`(() => _stack)()`), [`\x1b[6;${d.cellHeight};${d.cellWidth}t`]); }); }); }); From 502452f58e4929911659aec6d9fd9d00f91ebb0f Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 03:35:08 -0800 Subject: [PATCH 09/37] Enable tests on other browsers --- azure-pipelines.yml | 29 +++++++++++++++++++++++++---- package.json | 5 ++++- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b77f3408..9f2a87a2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -100,8 +100,18 @@ jobs: - script: | yarn start & sleep 10 - yarn test-api --headless --forbid-only - displayName: 'Linux Integration tests' + yarn test-api-chromium --headless --forbid-only + displayName: 'Integration tests (Chromium)' + - script: | + yarn start & + sleep 10 + yarn test-api-firefox --headless --forbid-only + displayName: 'Integration tests (Firefox)' + - script: | + yarn start & + sleep 10 + yarn test-api-webkit --headless --forbid-only + displayName: 'Integration tests (Webkit)' - job: macOS_IntegrationTests pool: @@ -116,8 +126,19 @@ jobs: - script: | yarn start & sleep 10 - yarn test-api --headless --forbid-only - displayName: 'MacOS Integration tests' + yarn test-api-chromium --headless --forbid-only + displayName: 'Integration tests (Chromium)' + - script: | + yarn start & + sleep 10 + yarn test-api-firfox --headless --forbid-only + continueOnError: true, + displayName: 'Integration tests (Firefox)' + - script: | + yarn start & + sleep 10 + yarn test-api-webkit --headless --forbid-only + displayName: 'Integration tests (Webkit)' - job: Release dependsOn: diff --git a/package.json b/package.json index 831601bc..93b689a1 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,10 @@ "lint": "tslint 'src/**/*.ts' 'addons/*/src/**/*.ts'", "test": "npm run test-unit", "posttest": "npm run lint", - "test-api": "mocha \"**/*.api.js\"", + "test-api": "npm run test-api-chromium", + "test-api-chromium": "mocha \"**/*.api.js\" --browser chromium", + "test-api-firefox": "mocha \"**/*.api.js\" --browser firefox", + "test-api-webkit": "mocha \"**/*.api.js\" --browser webkit", "test-unit": "node ./bin/test.js", "test-unit-coverage": "node ./bin/test.js --coverage", "build": "tsc -b ./tsconfig.all.json", From e6e181e6bc19df140614ae7f8654c110586daed5 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 03:54:03 -0800 Subject: [PATCH 10/37] Fix firefox tests FitAddon tests --- addons/xterm-addon-fit/src/FitAddon.api.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/addons/xterm-addon-fit/src/FitAddon.api.ts b/addons/xterm-addon-fit/src/FitAddon.api.ts index b10b6563..184fb0ba 100644 --- a/addons/xterm-addon-fit/src/FitAddon.api.ts +++ b/addons/xterm-addon-fit/src/FitAddon.api.ts @@ -14,6 +14,8 @@ let page: Page; const width = 1024; const height = 768; +let isFirefox = false; + describe('FitAddon', () => { before(async function(): Promise { this.timeout(20000); @@ -25,6 +27,10 @@ describe('FitAddon', () => { await page.setViewport({ width, height }); await page.goto(APP); await openTerminal(page); + // This is used to do conditional assertions since cell height is 1 pixel higher with the + // default font on Firefox. Minor differences in font rendering/sizing is expected so this is + // fine. + isFirefox = await page.evaluate(`navigator.userAgent.toLowerCase().indexOf('firefox') > -1`); }); after(async () => { @@ -45,7 +51,7 @@ describe('FitAddon', () => { await loadFit(); assert.deepEqual(await page.evaluate(`window.fit.proposeDimensions()`), { cols: 87, - rows: 26 + rows: isFirefox ? 28 : 26 }); }); @@ -53,7 +59,7 @@ describe('FitAddon', () => { await loadFit(1008); assert.deepEqual(await page.evaluate(`window.fit.proposeDimensions()`), { cols: 110, - rows: 26 + rows: isFirefox? 28 : 26 }); }); @@ -75,14 +81,14 @@ describe('FitAddon', () => { await loadFit(); await page.evaluate(`window.fit.fit()`); assert.equal(await page.evaluate(`window.term.cols`), 87); - assert.equal(await page.evaluate(`window.term.rows`), 26); + assert.equal(await page.evaluate(`window.term.rows`), isFirefox? 28 : 26); }); it('width', async function(): Promise { await loadFit(1008); await page.evaluate(`window.fit.fit()`); assert.equal(await page.evaluate(`window.term.cols`), 110); - assert.equal(await page.evaluate(`window.term.rows`), 26); + assert.equal(await page.evaluate(`window.term.rows`), isFirefox? 28 : 26); }); it('small', async function(): Promise { From 6082c00b1df943277df0a2e89c3a57d3abfa6d10 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 03:58:08 -0800 Subject: [PATCH 11/37] Fix serialize tests on firefox Firefox takes longer to start up --- addons/xterm-addon-serialize/src/SerializeAddon.api.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/xterm-addon-serialize/src/SerializeAddon.api.ts b/addons/xterm-addon-serialize/src/SerializeAddon.api.ts index aba4b091..61d4b116 100644 --- a/addons/xterm-addon-serialize/src/SerializeAddon.api.ts +++ b/addons/xterm-addon-serialize/src/SerializeAddon.api.ts @@ -16,6 +16,7 @@ const height = 600; describe('SerializeAddon', () => { before(async function(): Promise { + this.timeout(20000); browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`] From 93026bcae0e8fa020e5c9ba2ee6d5582fb0a7585 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 04:23:31 -0800 Subject: [PATCH 12/37] Only enable webgl tests on chromium and non-headless firefox See microsoft/playwright#1032 --- addons/xterm-addon-webgl/src/WebglRenderer.api.ts | 15 +++++++++++++-- addons/xterm-addon-webgl/src/WebglRenderer.ts | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/addons/xterm-addon-webgl/src/WebglRenderer.api.ts b/addons/xterm-addon-webgl/src/WebglRenderer.api.ts index 03127eb0..611c0055 100644 --- a/addons/xterm-addon-webgl/src/WebglRenderer.api.ts +++ b/addons/xterm-addon-webgl/src/WebglRenderer.api.ts @@ -7,7 +7,7 @@ import { ITerminalOptions } from '../../../src/Types'; import { ITheme } from 'xterm'; import { assert } from 'chai'; import { openTerminal, pollFor, writeSync, getBrowserType } from '../../../out-test/api/TestUtils'; -import { Browser, Page } from 'playwright'; +import { Browser, Page, BrowserType } from 'playwright'; const APP = 'http://127.0.0.1:3000/test'; @@ -17,7 +17,18 @@ const width = 800; const height = 600; describe('WebGL Renderer Integration Tests', function(): void { - it('dispose removes renderer canvases', async () => { + this.timeout(20000); + + const browserType = getBrowserType(); + const isHeadless = process.argv.indexOf('--headless') !== -1; + const areTestsEnabled = browserType.name() === 'chromium' || (browserType.name() === 'firefox' && !isHeadless); + if (!areTestsEnabled) { + // Firefox work only in non-headless mode https://github.com/microsoft/playwright/issues/1032 + console.log(`WebGL Renderer tests are disabled browser "${browserType.name()}" and headless mode "${isHeadless}"`); + return; + } + + it('dispose removes renderer canvases', async function(): Promise { await setupBrowser(); assert.equal(await page.evaluate(`document.querySelectorAll('.xterm canvas').length`), 3); await page.evaluate(`addon.dispose()`); diff --git a/addons/xterm-addon-webgl/src/WebglRenderer.ts b/addons/xterm-addon-webgl/src/WebglRenderer.ts index ae85d9a0..aba9c456 100644 --- a/addons/xterm-addon-webgl/src/WebglRenderer.ts +++ b/addons/xterm-addon-webgl/src/WebglRenderer.ts @@ -81,7 +81,7 @@ export class WebglRenderer extends Disposable implements IRenderer { }; this._gl = this._canvas.getContext('webgl2', contextAttributes) as IWebGL2RenderingContext; if (!this._gl) { - throw new Error('WebGL2 not supported'); + throw new Error('WebGL2 not supported ' + this._gl); } this._core.screenElement.appendChild(this._canvas); From f3eb9f79a1b19f89e910b7910314dfd4288e6a34 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 04:29:04 -0800 Subject: [PATCH 13/37] Movee api test timeout into CLI args --- addons/xterm-addon-attach/src/AttachAddon.api.ts | 8 +------- addons/xterm-addon-fit/src/FitAddon.api.ts | 1 - addons/xterm-addon-search/src/SearchAddon.api.ts | 2 -- .../src/SerializeAddon.api.ts | 1 - .../src/Unicode11Addon.api.ts | 2 -- .../xterm-addon-web-links/src/WebLinksAddon.api.ts | 14 ++------------ addons/xterm-addon-webgl/src/WebglRenderer.api.ts | 2 -- package.json | 6 +++--- 8 files changed, 6 insertions(+), 30 deletions(-) diff --git a/addons/xterm-addon-attach/src/AttachAddon.api.ts b/addons/xterm-addon-attach/src/AttachAddon.api.ts index c175de62..14ac1e1c 100644 --- a/addons/xterm-addon-attach/src/AttachAddon.api.ts +++ b/addons/xterm-addon-attach/src/AttachAddon.api.ts @@ -16,7 +16,6 @@ const height = 600; describe('AttachAddon', () => { before(async function(): Promise { - this.timeout(20000); browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] @@ -29,13 +28,9 @@ describe('AttachAddon', () => { await browser.close(); }); - beforeEach(async function(): Promise { - this.timeout(20000); - await page.goto(APP); - }); + beforeEach(async () => await page.goto(APP)); it('string', async function(): Promise { - this.timeout(20000); await openTerminal(page, { rendererType: 'dom' }); const port = 8080; const server = new WebSocket.Server({ port }); @@ -46,7 +41,6 @@ describe('AttachAddon', () => { }); it('utf8', async function(): Promise { - this.timeout(20000); await openTerminal(page, { rendererType: 'dom' }); const port = 8080; const server = new WebSocket.Server({ port }); diff --git a/addons/xterm-addon-fit/src/FitAddon.api.ts b/addons/xterm-addon-fit/src/FitAddon.api.ts index 184fb0ba..29d94a83 100644 --- a/addons/xterm-addon-fit/src/FitAddon.api.ts +++ b/addons/xterm-addon-fit/src/FitAddon.api.ts @@ -18,7 +18,6 @@ let isFirefox = false; describe('FitAddon', () => { before(async function(): Promise { - this.timeout(20000); browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] diff --git a/addons/xterm-addon-search/src/SearchAddon.api.ts b/addons/xterm-addon-search/src/SearchAddon.api.ts index 85c5ae7f..7d278245 100644 --- a/addons/xterm-addon-search/src/SearchAddon.api.ts +++ b/addons/xterm-addon-search/src/SearchAddon.api.ts @@ -17,8 +17,6 @@ const width = 800; const height = 600; describe('Search Tests', function(): void { - this.timeout(20000); - before(async function(): Promise { browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, diff --git a/addons/xterm-addon-serialize/src/SerializeAddon.api.ts b/addons/xterm-addon-serialize/src/SerializeAddon.api.ts index 61d4b116..aba4b091 100644 --- a/addons/xterm-addon-serialize/src/SerializeAddon.api.ts +++ b/addons/xterm-addon-serialize/src/SerializeAddon.api.ts @@ -16,7 +16,6 @@ const height = 600; describe('SerializeAddon', () => { before(async function(): Promise { - this.timeout(20000); browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`] diff --git a/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts b/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts index 36fe221a..3402dac7 100644 --- a/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts +++ b/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts @@ -16,7 +16,6 @@ const height = 600; describe('Unicode11Addon', () => { before(async function(): Promise { - this.timeout(20000); browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] @@ -30,7 +29,6 @@ describe('Unicode11Addon', () => { }); beforeEach(async function(): Promise { - this.timeout(20000); await page.goto(APP); await openTerminal(page); }); diff --git a/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts b/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts index 318b0c23..00181956 100644 --- a/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts +++ b/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts @@ -16,7 +16,6 @@ const height = 600; describe('WebLinksAddon', () => { before(async function(): Promise { - this.timeout(10000); browser = await getBrowserType().launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] @@ -25,27 +24,18 @@ describe('WebLinksAddon', () => { await page.setViewport({ width, height }); }); - after(async () => { - await browser.close(); - }); - - beforeEach(async function(): Promise { - this.timeout(5000); - await page.goto(APP); - }); + after(async () => await browser.close()); + beforeEach(async () => await page.goto(APP)); it('.com', async function(): Promise { - this.timeout(20000); await testHostName('foo.com'); }); it('.com.au', async function(): Promise { - this.timeout(20000); await testHostName('foo.com.au'); }); it('.io', async function(): Promise { - this.timeout(20000); await testHostName('foo.io'); }); }); diff --git a/addons/xterm-addon-webgl/src/WebglRenderer.api.ts b/addons/xterm-addon-webgl/src/WebglRenderer.api.ts index 611c0055..ba951e8e 100644 --- a/addons/xterm-addon-webgl/src/WebglRenderer.api.ts +++ b/addons/xterm-addon-webgl/src/WebglRenderer.api.ts @@ -17,8 +17,6 @@ const width = 800; const height = 600; describe('WebGL Renderer Integration Tests', function(): void { - this.timeout(20000); - const browserType = getBrowserType(); const isHeadless = process.argv.indexOf('--headless') !== -1; const areTestsEnabled = browserType.name() === 'chromium' || (browserType.name() === 'firefox' && !isHeadless); diff --git a/package.json b/package.json index 93b689a1..09338e62 100644 --- a/package.json +++ b/package.json @@ -15,9 +15,9 @@ "test": "npm run test-unit", "posttest": "npm run lint", "test-api": "npm run test-api-chromium", - "test-api-chromium": "mocha \"**/*.api.js\" --browser chromium", - "test-api-firefox": "mocha \"**/*.api.js\" --browser firefox", - "test-api-webkit": "mocha \"**/*.api.js\" --browser webkit", + "test-api-chromium": "mocha \"**/*.api.js\" --browser chromium --timeout 10000", + "test-api-firefox": "mocha \"**/*.api.js\" --browser firefox --timeout 10000", + "test-api-webkit": "mocha \"**/*.api.js\" --browser webkit --timeout 10000", "test-unit": "node ./bin/test.js", "test-unit-coverage": "node ./bin/test.js --coverage", "build": "tsc -b ./tsconfig.all.json", From a9356fd3770cf01bd8d7e4dd4ed8ead8122f47d9 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 04:43:38 -0800 Subject: [PATCH 14/37] Skip paste test when not Chromium --- test/api/InputHandler.api.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/api/InputHandler.api.ts b/test/api/InputHandler.api.ts index f220a443..60f434a7 100644 --- a/test/api/InputHandler.api.ts +++ b/test/api/InputHandler.api.ts @@ -15,9 +15,13 @@ let page: Page; const width = 800; const height = 600; +let isChromium = false; + describe('InputHandler Integration Tests', function(): void { before(async function(): Promise { - browser = await getBrowserType().launch({ + const browserType = getBrowserType(); + isChromium = browserType.name() === 'chromium'; + browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); @@ -286,9 +290,9 @@ describe('InputHandler Integration Tests', function(): void { await pollFor(page, () => page.evaluate(`window.term.getSelection().length`), 0); await page.mouse.up(); }); - it('Pm = 2004, Set bracketed paste mode', async function(): Promise { + (isChromium ? it : it.skip)('Pm = 2004, Set bracketed paste mode', async function(): Promise { await pollFor(page, () => simulatePaste('foo'), 'foo'); - await page.evaluate(`window.term.write('\x1b[?2004h')`); + await page.evaluate(`window.term.write('\x1b[?2004h')`) await pollFor(page, () => simulatePaste('bar'), '\x1b[200~bar\x1b[201~'); await page.evaluate(`window.term.write('\x1b[?2004l')`); await pollFor(page, () => simulatePaste('baz'), 'baz'); @@ -415,7 +419,7 @@ async function simulatePaste(text: string): Promise { const id = Math.floor(Math.random() * 1000000); await page.evaluate(` (function() { - window.term.onData(e => window.result_${ id} = e); + window.term.onData(e => window.result_${id} = e); const clipboardData = new DataTransfer(); clipboardData.setData('text/plain', '${text}'); window.term.textarea.dispatchEvent(new ClipboardEvent('paste', { clipboardData })); From 3f15a7251b91428500dc301ce204b84eab3b1174 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 04:53:45 -0800 Subject: [PATCH 15/37] Skip webgl tests instead of not registering --- .../src/WebglRenderer.api.ts | 118 ++++++++++-------- 1 file changed, 63 insertions(+), 55 deletions(-) diff --git a/addons/xterm-addon-webgl/src/WebglRenderer.api.ts b/addons/xterm-addon-webgl/src/WebglRenderer.api.ts index ba951e8e..014825c7 100644 --- a/addons/xterm-addon-webgl/src/WebglRenderer.api.ts +++ b/addons/xterm-addon-webgl/src/WebglRenderer.api.ts @@ -16,17 +16,16 @@ let page: Page; const width = 800; const height = 600; +let itWebgl: (expectation: string, callback?: (this: Mocha.ITestCallbackContext, done: MochaDone) => any) => Mocha.ITest | void; + describe('WebGL Renderer Integration Tests', function(): void { const browserType = getBrowserType(); const isHeadless = process.argv.indexOf('--headless') !== -1; + // Firefox works only in non-headless mode https://github.com/microsoft/playwright/issues/1032 const areTestsEnabled = browserType.name() === 'chromium' || (browserType.name() === 'firefox' && !isHeadless); - if (!areTestsEnabled) { - // Firefox work only in non-headless mode https://github.com/microsoft/playwright/issues/1032 - console.log(`WebGL Renderer tests are disabled browser "${browserType.name()}" and headless mode "${isHeadless}"`); - return; - } + itWebgl = areTestsEnabled ? it : it.skip; - it('dispose removes renderer canvases', async function(): Promise { + itWebgl('dispose removes renderer canvases', async function(): Promise { await setupBrowser(); assert.equal(await page.evaluate(`document.querySelectorAll('.xterm canvas').length`), 3); await page.evaluate(`addon.dispose()`); @@ -35,11 +34,13 @@ describe('WebGL Renderer Integration Tests', function(): void { }); describe('colors', () => { - before(async () => setupBrowser()); - after(async () => browser.close()); - beforeEach(async () => page.evaluate(`window.term.reset()`)); + if (areTestsEnabled) { + before(async () => setupBrowser()); + after(async () => browser.close()); + beforeEach(async () => page.evaluate(`window.term.reset()`)); + } - it('foreground 0-15', async () => { + itWebgl('foreground 0-15', async () => { const theme: ITheme = { black: '#010203', red: '#040506', @@ -62,7 +63,7 @@ describe('WebGL Renderer Integration Tests', function(): void { await pollFor(page, () => getCellColor(8, 1), [22, 23, 24, 255]); }); - it('foreground 0-7 drawBoldTextInBrightColors', async () => { + itWebgl('foreground 0-7 drawBoldTextInBrightColors', async () => { const theme: ITheme = { brightBlack: '#010203', brightRed: '#040506', @@ -88,7 +89,7 @@ describe('WebGL Renderer Integration Tests', function(): void { await pollFor(page, () => getCellColor(8, 1), [22, 23, 24, 255]); }); - it('background 0-15', async () => { + itWebgl('background 0-15', async () => { const theme: ITheme = { black: '#010203', red: '#040506', @@ -111,7 +112,7 @@ describe('WebGL Renderer Integration Tests', function(): void { await pollFor(page, () => getCellColor(8, 1), [22, 23, 24, 255]); }); - it('foreground 0-15 inverse', async () => { + itWebgl('foreground 0-15 inverse', async () => { const theme: ITheme = { black: '#010203', red: '#040506', @@ -134,7 +135,7 @@ describe('WebGL Renderer Integration Tests', function(): void { await pollFor(page, () => getCellColor(8, 1), [22, 23, 24, 255]); }); - it('background 0-15 inverse', async () => { + itWebgl('background 0-15 inverse', async () => { const theme: ITheme = { black: '#010203', red: '#040506', @@ -157,7 +158,7 @@ describe('WebGL Renderer Integration Tests', function(): void { await pollFor(page, () => getCellColor(8, 1), [22, 23, 24, 255]); }); - it('foreground 0-15 inivisible', async () => { + itWebgl('foreground 0-15 inivisible', async () => { const theme: ITheme = { black: '#010203', red: '#040506', @@ -180,7 +181,7 @@ describe('WebGL Renderer Integration Tests', function(): void { await pollFor(page, () => getCellColor(8, 1), [0, 0, 0, 255]); }); - it('background 0-15 inivisible', async () => { + itWebgl('background 0-15 inivisible', async () => { const theme: ITheme = { black: '#010203', red: '#040506', @@ -203,7 +204,7 @@ describe('WebGL Renderer Integration Tests', function(): void { await pollFor(page, () => getCellColor(8, 1), [22, 23, 24, 255]); }); - it('foreground 0-15 bright', async () => { + itWebgl('foreground 0-15 bright', async () => { const theme: ITheme = { brightBlack: '#010203', brightRed: '#040506', @@ -226,7 +227,7 @@ describe('WebGL Renderer Integration Tests', function(): void { await pollFor(page, () => getCellColor(8, 1), [22, 23, 24, 255]); }); - it('background 0-15 bright', async () => { + itWebgl('background 0-15 bright', async () => { const theme: ITheme = { brightBlack: '#010203', brightRed: '#040506', @@ -249,7 +250,7 @@ describe('WebGL Renderer Integration Tests', function(): void { await pollFor(page, () => getCellColor(8, 1), [22, 23, 24, 255]); }); - it('foreground 16-255', async () => { + itWebgl('foreground 16-255', async () => { let data = ''; for (let y = 0; y < 240 / 16; y++) { for (let x = 0; x < 16; x++) { @@ -269,7 +270,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('background 16-255', async () => { + itWebgl('background 16-255', async () => { let data = ''; for (let y = 0; y < 240 / 16; y++) { for (let x = 0; x < 16; x++) { @@ -289,7 +290,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('foreground 16-255 inverse', async () => { + itWebgl('foreground 16-255 inverse', async () => { let data = ''; for (let y = 0; y < 240 / 16; y++) { for (let x = 0; x < 16; x++) { @@ -309,7 +310,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('background 16-255 inverse', async () => { + itWebgl('background 16-255 inverse', async () => { let data = ''; for (let y = 0; y < 240 / 16; y++) { for (let x = 0; x < 16; x++) { @@ -329,7 +330,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('foreground 16-255 invisible', async () => { + itWebgl('foreground 16-255 invisible', async () => { let data = ''; for (let y = 0; y < 240 / 16; y++) { for (let x = 0; x < 16; x++) { @@ -349,7 +350,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('background 16-255 invisible', async () => { + itWebgl('background 16-255 invisible', async () => { let data = ''; for (let y = 0; y < 240 / 16; y++) { for (let x = 0; x < 16; x++) { @@ -369,7 +370,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('foreground true color red', async () => { + itWebgl('foreground true color red', async () => { let data = ''; for (let y = 0; y < 16; y++) { for (let x = 0; x < 16; x++) { @@ -387,7 +388,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('background true color red', async () => { + itWebgl('background true color red', async () => { let data = ''; for (let y = 0; y < 16; y++) { for (let x = 0; x < 16; x++) { @@ -405,7 +406,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('foreground true color green', async () => { + itWebgl('foreground true color green', async () => { let data = ''; for (let y = 0; y < 16; y++) { for (let x = 0; x < 16; x++) { @@ -423,7 +424,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('background true color green', async () => { + itWebgl('background true color green', async () => { let data = ''; for (let y = 0; y < 16; y++) { for (let x = 0; x < 16; x++) { @@ -441,7 +442,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('foreground true color blue', async () => { + itWebgl('foreground true color blue', async () => { let data = ''; for (let y = 0; y < 16; y++) { for (let x = 0; x < 16; x++) { @@ -459,7 +460,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('background true color blue', async () => { + itWebgl('background true color blue', async () => { let data = ''; for (let y = 0; y < 16; y++) { for (let x = 0; x < 16; x++) { @@ -477,7 +478,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('foreground true color grey', async () => { + itWebgl('foreground true color grey', async () => { let data = ''; for (let y = 0; y < 16; y++) { for (let x = 0; x < 16; x++) { @@ -495,7 +496,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('background true color grey', async () => { + itWebgl('background true color grey', async () => { let data = ''; for (let y = 0; y < 16; y++) { for (let x = 0; x < 16; x++) { @@ -513,7 +514,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('foreground true color red inverse', async function(): Promise { + itWebgl('foreground true color red inverse', async function(): Promise { let data = ''; for (let y = 0; y < 16; y++) { for (let x = 0; x < 16; x++) { @@ -531,7 +532,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('background true color red inverse', async function(): Promise { + itWebgl('background true color red inverse', async function(): Promise { let data = ''; for (let y = 0; y < 16; y++) { for (let x = 0; x < 16; x++) { @@ -549,7 +550,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('foreground true color green inverse', async () => { + itWebgl('foreground true color green inverse', async () => { let data = ''; for (let y = 0; y < 16; y++) { for (let x = 0; x < 16; x++) { @@ -567,7 +568,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('background true color green inverse', async () => { + itWebgl('background true color green inverse', async () => { let data = ''; for (let y = 0; y < 16; y++) { for (let x = 0; x < 16; x++) { @@ -585,7 +586,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('foreground true color blue inverse', async () => { + itWebgl('foreground true color blue inverse', async () => { let data = ''; for (let y = 0; y < 16; y++) { for (let x = 0; x < 16; x++) { @@ -603,7 +604,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('background true color blue inverse', async () => { + itWebgl('background true color blue inverse', async () => { let data = ''; for (let y = 0; y < 16; y++) { for (let x = 0; x < 16; x++) { @@ -621,7 +622,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('foreground true color grey inverse', async () => { + itWebgl('foreground true color grey inverse', async () => { let data = ''; for (let y = 0; y < 16; y++) { for (let x = 0; x < 16; x++) { @@ -639,7 +640,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('background true color grey inverse', async () => { + itWebgl('background true color grey inverse', async () => { let data = ''; for (let y = 0; y < 16; y++) { for (let x = 0; x < 16; x++) { @@ -657,7 +658,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('foreground true color grey invisible', async () => { + itWebgl('foreground true color grey invisible', async () => { let data = ''; for (let y = 0; y < 16; y++) { for (let x = 0; x < 16; x++) { @@ -675,7 +676,7 @@ describe('WebGL Renderer Integration Tests', function(): void { } }); - it('background true color grey invisible', async () => { + itWebgl('background true color grey invisible', async () => { let data = ''; for (let y = 0; y < 16; y++) { for (let x = 0; x < 16; x++) { @@ -695,11 +696,13 @@ describe('WebGL Renderer Integration Tests', function(): void { }); describe('minimumContrastRatio', async () => { - before(async () => setupBrowser()); - after(async () => browser.close()); - beforeEach(async () => page.evaluate(`window.term.reset()`)); + if (areTestsEnabled) { + before(async () => setupBrowser()); + after(async () => browser.close()); + beforeEach(async () => page.evaluate(`window.term.reset()`)); + } - it('should adjust 0-15 colors on black background', async () => { + itWebgl('should adjust 0-15 colors on black background', async () => { const theme: ITheme = { black: '#2e3436', red: '#cc0000', @@ -766,7 +769,7 @@ describe('WebGL Renderer Integration Tests', function(): void { await pollFor(page, () => getCellColor(8, 2), [0xee, 0xee, 0xec, 255]); }); - it('should adjust 0-15 colors on white background', async () => { + itWebgl('should adjust 0-15 colors on white background', async () => { const theme: ITheme = { background: '#ffffff', black: '#2e3436', @@ -835,11 +838,13 @@ describe('WebGL Renderer Integration Tests', function(): void { }); describe('selection', async () => { - before(async () => setupBrowser()); - after(async () => browser.close()); - beforeEach(async () => page.evaluate(`window.term.reset()`)); + if (areTestsEnabled) { + before(async () => setupBrowser()); + after(async () => browser.close()); + beforeEach(async () => page.evaluate(`window.term.reset()`)); + } - it('should resolve the inverse foreground color based on the original background color, not the selection', async () => { + itWebgl('should resolve the inverse foreground color based on the original background color, not the selection', async () => { const theme: ITheme = { foreground: '#FF0000', background: '#00FF00', @@ -859,10 +864,13 @@ describe('WebGL Renderer Integration Tests', function(): void { }); describe('allowTransparency', async () => { - before(async () => setupBrowser({ rendererType: 'dom', allowTransparency: true })); - after(async () => browser.close()); - beforeEach(async () => page.evaluate(`window.term.reset()`)); - it('transparent background inverse', async () => { + if (areTestsEnabled) { + before(async () => setupBrowser({ rendererType: 'dom', allowTransparency: true })); + after(async () => browser.close()); + beforeEach(async () => page.evaluate(`window.term.reset()`)); + } + + itWebgl('transparent background inverse', async () => { const theme: ITheme = { background: '#ff000080' }; From 7400b888df698d15864ab2c41ad0ed0262f812fb Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 05:00:52 -0800 Subject: [PATCH 16/37] Skip mouse wheel-related tests on non-chromium --- test/api/MouseTracking.api.ts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/test/api/MouseTracking.api.ts b/test/api/MouseTracking.api.ts index 800d4415..f6129625 100644 --- a/test/api/MouseTracking.api.ts +++ b/test/api/MouseTracking.api.ts @@ -21,6 +21,10 @@ const fontSize = 6; const cols = 260; const rows = 50; +// Wheel events are hacked using private API that is only available in Chromium +const isChromium = getBrowserType().name() === 'chromium'; +const itMouse = isChromium ? it : it.skip; + // for some reason shift gets not caught by selection manager on macos const noShift = process.platform === 'darwin' ? false : true; @@ -240,7 +244,7 @@ describe('Mouse Tracking Tests', () => { * - no move * - no modifiers */ - it('default encoding', async () => { + itMouse('default encoding', async () => { const encoding = 'DEFAULT'; await resetMouseModes(); await mouseMove(0, 0); @@ -367,7 +371,7 @@ describe('Mouse Tracking Tests', () => { // await page.keyboard.up('Shift'); 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 () => { + itMouse('SGR encoding', async () => { const encoding = 'SGR'; await resetMouseModes(); await mouseMove(0, 0); @@ -494,7 +498,7 @@ describe('Mouse Tracking Tests', () => { * - no move * - all modifiers */ - it('default encoding', async () => { + itMouse('default encoding', async () => { const encoding = 'DEFAULT'; await resetMouseModes(); await mouseMove(0, 0); @@ -645,7 +649,7 @@ describe('Mouse Tracking Tests', () => { { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: true, shift: false, meta: true } } } ]); }); - it('SGR encoding', async () => { + itMouse('SGR encoding', async () => { const encoding = 'SGR'; await resetMouseModes(); await mouseMove(0, 0); @@ -803,7 +807,7 @@ describe('Mouse Tracking Tests', () => { * - all modifiers * Note: tmux runs this with SGR encoding. */ - it('default encoding', async () => { + itMouse('default encoding', async () => { const encoding = 'DEFAULT'; await resetMouseModes(); await mouseMove(0, 0); @@ -959,7 +963,7 @@ describe('Mouse Tracking Tests', () => { { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: true, shift: false, meta: true } } } ]); }); - it('SGR encoding', async () => { + itMouse('SGR encoding', async () => { const encoding = 'SGR'; await resetMouseModes(); await mouseMove(0, 0); @@ -1121,7 +1125,7 @@ describe('Mouse Tracking Tests', () => { * - all events (press, release, wheel, move) * - all modifiers */ - it('default encoding', async () => { + itMouse('default encoding', async () => { const encoding = 'DEFAULT'; await resetMouseModes(); await mouseMove(0, 0); @@ -1281,7 +1285,7 @@ describe('Mouse Tracking Tests', () => { { col: 45, row: 25, state: { action: 'down', button: 'wheel', modifier: { control: true, shift: false, meta: true } } } ]); }); - it('SGR encoding', async () => { + itMouse('SGR encoding', async () => { const encoding = 'SGR'; await resetMouseModes(); await mouseMove(0, 0); From 3b51565a1345a0a6eaedc0ec1c6e7806466a152c Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 05:02:28 -0800 Subject: [PATCH 17/37] Fix pipelines file --- azure-pipelines.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9f2a87a2..ee0f7315 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -132,7 +132,6 @@ jobs: yarn start & sleep 10 yarn test-api-firfox --headless --forbid-only - continueOnError: true, displayName: 'Integration tests (Firefox)' - script: | yarn start & From 2b7080294df11b615e4bd14c8828d6f3977479fa Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 05:06:44 -0800 Subject: [PATCH 18/37] Only start server once in pipelines --- azure-pipelines.yml | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ee0f7315..add925c2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -100,17 +100,12 @@ jobs: - script: | yarn start & sleep 10 - yarn test-api-chromium --headless --forbid-only + displayName: 'Start test server' + - script: yarn test-api-chromium --headless --forbid-only displayName: 'Integration tests (Chromium)' - - script: | - yarn start & - sleep 10 - yarn test-api-firefox --headless --forbid-only + - script: yarn test-api-firefox --headless --forbid-only displayName: 'Integration tests (Firefox)' - - script: | - yarn start & - sleep 10 - yarn test-api-webkit --headless --forbid-only + - script: yarn test-api-webkit --headless --forbid-only displayName: 'Integration tests (Webkit)' - job: macOS_IntegrationTests @@ -126,17 +121,12 @@ jobs: - script: | yarn start & sleep 10 - yarn test-api-chromium --headless --forbid-only + displayName: 'Start test server' + - script: yarn test-api-chromium --headless --forbid-only displayName: 'Integration tests (Chromium)' - - script: | - yarn start & - sleep 10 - yarn test-api-firfox --headless --forbid-only + - script: yarn test-api-firfox --headless --forbid-only displayName: 'Integration tests (Firefox)' - - script: | - yarn start & - sleep 10 - yarn test-api-webkit --headless --forbid-only + - script: yarn test-api-webkit --headless --forbid-only displayName: 'Integration tests (Webkit)' - job: Release From 7bd4f3874ec4d166a0ed730355ee7b5dc8772533 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 05:13:52 -0800 Subject: [PATCH 19/37] Fix lint --- addons/xterm-addon-fit/src/FitAddon.api.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/xterm-addon-fit/src/FitAddon.api.ts b/addons/xterm-addon-fit/src/FitAddon.api.ts index 29d94a83..824db4e8 100644 --- a/addons/xterm-addon-fit/src/FitAddon.api.ts +++ b/addons/xterm-addon-fit/src/FitAddon.api.ts @@ -58,7 +58,7 @@ describe('FitAddon', () => { await loadFit(1008); assert.deepEqual(await page.evaluate(`window.fit.proposeDimensions()`), { cols: 110, - rows: isFirefox? 28 : 26 + rows: isFirefox ? 28 : 26 }); }); @@ -80,14 +80,14 @@ describe('FitAddon', () => { await loadFit(); await page.evaluate(`window.fit.fit()`); assert.equal(await page.evaluate(`window.term.cols`), 87); - assert.equal(await page.evaluate(`window.term.rows`), isFirefox? 28 : 26); + assert.equal(await page.evaluate(`window.term.rows`), isFirefox ? 28 : 26); }); it('width', async function(): Promise { await loadFit(1008); await page.evaluate(`window.fit.fit()`); assert.equal(await page.evaluate(`window.term.cols`), 110); - assert.equal(await page.evaluate(`window.term.rows`), isFirefox? 28 : 26); + assert.equal(await page.evaluate(`window.term.rows`), isFirefox ? 28 : 26); }); it('small', async function(): Promise { From 4ae25e57a3198efa4ecc8917a7a3f6e6a840a9de Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 05:14:00 -0800 Subject: [PATCH 20/37] playwright@0.11.1 --- package.json | 2 +- yarn.lock | 28 +++++++++++++++++----------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 09338e62..ec33abce 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "mustache": "^3.0.1", "node-pty": "^0.9.0", "nyc": "13", - "playwright": "^0.10.0", + "playwright": "0.11.1", "source-map-loader": "^0.2.4", "ts-loader": "^6.0.4", "tslint": "^5.18.0", diff --git a/yarn.lock b/yarn.lock index 168016c6..74c94d43 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4026,29 +4026,28 @@ pkg-dir@^3.0.0: dependencies: find-up "^3.0.0" -playwright-core@=0.10.0: - version "0.10.0" - resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-0.10.0.tgz#86699c9cc3e613d733e6635a54aceea1993013d5" - integrity sha512-yernA6yrrBhmb8M5eO6GZsJOrBKWOZszlu65Luz8LP7ryaDExN1sE9XjQBNbiwJ5Gfs8cehtAO7GfTDJt+Z2cQ== +playwright-core@=0.11.1: + version "0.11.1" + resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-0.11.1.tgz#b488ad17015a4d0f54db5a5fb6a9d380afea6d5a" + integrity sha512-9xsSkXlglvHIAofyNInA1p3beOAOBMWHZgiuH99gX1R8VL6fTXgfWD7pIvt+rJhVMJWMDAyMXRo4TYtYtdspIg== dependencies: debug "^4.1.0" extract-zip "^1.6.6" https-proxy-agent "^3.0.0" jpeg-js "^0.3.6" - mime "^2.0.3" pngjs "^3.4.0" progress "^2.0.3" proxy-from-env "^1.0.0" - rimraf "^2.6.1" + rimraf "^3.0.2" uuid "^3.4.0" ws "^6.1.0" -playwright@^0.10.0: - version "0.10.0" - resolved "https://registry.yarnpkg.com/playwright/-/playwright-0.10.0.tgz#d37f7e42e0e868dcc4ec35cb0a8dbc6248457642" - integrity sha512-f3VRME/PIO5NbcWnlCDfXwPC0DAZJ7ETkcAdE+sensLCOkfDtLh97E71ZuxNCaPYsUA6FIPi5syD8pHJW/4hQQ== +playwright@0.11.1: + version "0.11.1" + resolved "https://registry.yarnpkg.com/playwright/-/playwright-0.11.1.tgz#e35a2a67d87fdc497a3f706596ea40822f373e82" + integrity sha512-Sx/WCb88u6Q73klQKGjGY2PJSbUl7JAHIie3mFGTpXPPo79cmMzVJl2e07v/qO3VGFd13bF4z8vMt2UVPc/ygQ== dependencies: - playwright-core "=0.10.0" + playwright-core "=0.11.1" pn@^1.1.0: version "1.1.0" @@ -4452,6 +4451,13 @@ rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3: dependencies: glob "^7.1.3" +rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + ripemd160@^2.0.0, ripemd160@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" From 4ebb61b5801a7966ce5fa934d275192a67967c57 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 05:18:46 -0800 Subject: [PATCH 21/37] Adopt playwright breaking changes --- addons/xterm-addon-attach/src/AttachAddon.api.ts | 4 ++-- addons/xterm-addon-fit/src/FitAddon.api.ts | 4 ++-- addons/xterm-addon-search/src/SearchAddon.api.ts | 4 ++-- addons/xterm-addon-serialize/src/SerializeAddon.api.ts | 4 ++-- addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts | 4 ++-- addons/xterm-addon-web-links/src/WebLinksAddon.api.ts | 4 ++-- addons/xterm-addon-webgl/src/WebglRenderer.api.ts | 4 ++-- test/api/CharWidth.api.ts | 4 ++-- test/api/InputHandler.api.ts | 4 ++-- test/api/MouseTracking.api.ts | 4 ++-- test/api/Parser.api.ts | 4 ++-- test/api/Terminal.api.ts | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/addons/xterm-addon-attach/src/AttachAddon.api.ts b/addons/xterm-addon-attach/src/AttachAddon.api.ts index 14ac1e1c..065c1940 100644 --- a/addons/xterm-addon-attach/src/AttachAddon.api.ts +++ b/addons/xterm-addon-attach/src/AttachAddon.api.ts @@ -20,8 +20,8 @@ describe('AttachAddon', () => { headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.defaultContext().pages())[0]; - await page.setViewport({ width, height }); + page = await (await browser.newContext()).newPage(); + await page.setViewportSize({ width, height }); }); after(async () => { diff --git a/addons/xterm-addon-fit/src/FitAddon.api.ts b/addons/xterm-addon-fit/src/FitAddon.api.ts index 824db4e8..33a0e6fd 100644 --- a/addons/xterm-addon-fit/src/FitAddon.api.ts +++ b/addons/xterm-addon-fit/src/FitAddon.api.ts @@ -22,8 +22,8 @@ describe('FitAddon', () => { headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.defaultContext().pages())[0]; - await page.setViewport({ width, height }); + page = await (await browser.newContext()).newPage(); + await page.setViewportSize({ width, height }); await page.goto(APP); await openTerminal(page); // This is used to do conditional assertions since cell height is 1 pixel higher with the diff --git a/addons/xterm-addon-search/src/SearchAddon.api.ts b/addons/xterm-addon-search/src/SearchAddon.api.ts index 7d278245..21e9d04b 100644 --- a/addons/xterm-addon-search/src/SearchAddon.api.ts +++ b/addons/xterm-addon-search/src/SearchAddon.api.ts @@ -22,8 +22,8 @@ describe('Search Tests', function(): void { headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.defaultContext().pages())[0]; - await page.setViewport({ width, height }); + page = await (await browser.newContext()).newPage(); + await page.setViewportSize({ width, height }); await page.goto(APP); await openTerminal(page); await page.evaluate(`window.search = new SearchAddon();`); diff --git a/addons/xterm-addon-serialize/src/SerializeAddon.api.ts b/addons/xterm-addon-serialize/src/SerializeAddon.api.ts index aba4b091..072804f2 100644 --- a/addons/xterm-addon-serialize/src/SerializeAddon.api.ts +++ b/addons/xterm-addon-serialize/src/SerializeAddon.api.ts @@ -20,8 +20,8 @@ describe('SerializeAddon', () => { headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`] }); - page = (await browser.defaultContext().pages())[0]; - await page.setViewport({ width, height }); + page = await (await browser.newContext()).newPage(); + await page.setViewportSize({ width, height }); await page.goto(APP); await openTerminal(page, { rows: 10, cols: 10, rendererType: 'dom' }); await page.evaluate(` diff --git a/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts b/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts index 3402dac7..cf12dae1 100644 --- a/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts +++ b/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts @@ -20,8 +20,8 @@ describe('Unicode11Addon', () => { headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.defaultContext().pages())[0]; - await page.setViewport({ width, height }); + page = await (await browser.newContext()).newPage(); + await page.setViewportSize({ width, height }); }); after(async () => { diff --git a/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts b/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts index 00181956..16789233 100644 --- a/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts +++ b/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts @@ -20,8 +20,8 @@ describe('WebLinksAddon', () => { headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.defaultContext().pages())[0]; - await page.setViewport({ width, height }); + page = await (await browser.newContext()).newPage(); + await page.setViewportSize({ width, height }); }); after(async () => await browser.close()); diff --git a/addons/xterm-addon-webgl/src/WebglRenderer.api.ts b/addons/xterm-addon-webgl/src/WebglRenderer.api.ts index 014825c7..c3e27c7d 100644 --- a/addons/xterm-addon-webgl/src/WebglRenderer.api.ts +++ b/addons/xterm-addon-webgl/src/WebglRenderer.api.ts @@ -902,8 +902,8 @@ async function setupBrowser(options: ITerminalOptions = { rendererType: 'dom' }) headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.defaultContext().pages())[0]; - await page.setViewport({ width, height }); + page = await (await browser.newContext()).newPage(); + await page.setViewportSize({ width, height }); await page.goto(APP); await openTerminal(page, options); await page.evaluate(` diff --git a/test/api/CharWidth.api.ts b/test/api/CharWidth.api.ts index 1bafea50..1fe8a34d 100644 --- a/test/api/CharWidth.api.ts +++ b/test/api/CharWidth.api.ts @@ -19,8 +19,8 @@ describe('CharWidth Integration Tests', function(): void { headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.defaultContext().pages())[0]; - await page.setViewport({ width, height }); + page = await (await browser.newContext()).newPage(); + await page.setViewportSize({ width, height }); await page.goto(APP); await openTerminal(page, { rows: 5, cols: 30 }); }); diff --git a/test/api/InputHandler.api.ts b/test/api/InputHandler.api.ts index 60f434a7..a4d3f82f 100644 --- a/test/api/InputHandler.api.ts +++ b/test/api/InputHandler.api.ts @@ -25,8 +25,8 @@ describe('InputHandler Integration Tests', function(): void { headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.defaultContext().pages())[0]; - await page.setViewport({ width, height }); + page = await (await browser.newContext()).newPage(); + await page.setViewportSize({ width, height }); await page.goto(APP); await openTerminal(page); }); diff --git a/test/api/MouseTracking.api.ts b/test/api/MouseTracking.api.ts index f6129625..27283c19 100644 --- a/test/api/MouseTracking.api.ts +++ b/test/api/MouseTracking.api.ts @@ -214,8 +214,8 @@ describe('Mouse Tracking Tests', () => { headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.defaultContext().pages())[0]; - await page.setViewport({ width, height }); + page = await (await browser.newContext()).newPage(); + await page.setViewportSize({ width, height }); }); after(async () => browser.close()); diff --git a/test/api/Parser.api.ts b/test/api/Parser.api.ts index 87f64de3..5ac287a5 100644 --- a/test/api/Parser.api.ts +++ b/test/api/Parser.api.ts @@ -20,8 +20,8 @@ describe('Parser Integration Tests', function(): void { headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.defaultContext().pages())[0]; - await page.setViewport({ width, height }); + page = await (await browser.newContext()).newPage(); + await page.setViewportSize({ width, height }); await page.goto(APP); await openTerminal(page); }); diff --git a/test/api/Terminal.api.ts b/test/api/Terminal.api.ts index 7bd0c0f3..188a6f7c 100644 --- a/test/api/Terminal.api.ts +++ b/test/api/Terminal.api.ts @@ -20,8 +20,8 @@ describe('API Integration Tests', function(): void { headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); - page = (await browser.defaultContext().pages())[0]; - await page.setViewport({ width, height }); + page = await (await browser.newContext()).newPage(); + await page.setViewportSize({ width, height }); }); after(async () => browser.close()); From ffc5e2f44648ddced2514be597a8eba86418e62f Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 05:28:21 -0800 Subject: [PATCH 22/37] Move to playwright-core, download browser if needed --- addons/xterm-addon-attach/src/AttachAddon.api.ts | 5 +++-- addons/xterm-addon-fit/src/FitAddon.api.ts | 5 +++-- addons/xterm-addon-search/src/SearchAddon.api.ts | 5 +++-- .../xterm-addon-serialize/src/SerializeAddon.api.ts | 5 +++-- .../xterm-addon-unicode11/src/Unicode11Addon.api.ts | 5 +++-- .../xterm-addon-web-links/src/WebLinksAddon.api.ts | 5 +++-- addons/xterm-addon-webgl/src/WebglRenderer.api.ts | 9 +++++---- package.json | 4 +++- test/api/CharWidth.api.ts | 5 +++-- test/api/InputHandler.api.ts | 4 ++-- test/api/MouseTracking.api.ts | 13 ++++++++----- test/api/Parser.api.ts | 5 +++-- test/api/Terminal.api.ts | 5 +++-- test/api/TestUtils.ts | 6 ++++-- yarn.lock | 9 +-------- 15 files changed, 50 insertions(+), 40 deletions(-) diff --git a/addons/xterm-addon-attach/src/AttachAddon.api.ts b/addons/xterm-addon-attach/src/AttachAddon.api.ts index 065c1940..fdef5c41 100644 --- a/addons/xterm-addon-attach/src/AttachAddon.api.ts +++ b/addons/xterm-addon-attach/src/AttachAddon.api.ts @@ -5,7 +5,7 @@ import WebSocket = require('ws'); import { openTerminal, pollFor, getBrowserType } from '../../../out-test/api/TestUtils'; -import { Browser, Page } from 'playwright'; +import { Browser, Page } from 'playwright-core'; const APP = 'http://127.0.0.1:3000/test'; @@ -16,7 +16,8 @@ const height = 600; describe('AttachAddon', () => { before(async function(): Promise { - browser = await getBrowserType().launch({ + const browserType = await getBrowserType(); + browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); diff --git a/addons/xterm-addon-fit/src/FitAddon.api.ts b/addons/xterm-addon-fit/src/FitAddon.api.ts index 33a0e6fd..f154a30e 100644 --- a/addons/xterm-addon-fit/src/FitAddon.api.ts +++ b/addons/xterm-addon-fit/src/FitAddon.api.ts @@ -5,7 +5,7 @@ import { assert } from 'chai'; import { openTerminal, getBrowserType } from '../../../out-test/api/TestUtils'; -import { Browser, Page } from 'playwright'; +import { Browser, Page } from 'playwright-core'; const APP = 'http://127.0.0.1:3000/test'; @@ -18,7 +18,8 @@ let isFirefox = false; describe('FitAddon', () => { before(async function(): Promise { - browser = await getBrowserType().launch({ + const browserType = await getBrowserType(); + browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); diff --git a/addons/xterm-addon-search/src/SearchAddon.api.ts b/addons/xterm-addon-search/src/SearchAddon.api.ts index 21e9d04b..741ddea2 100644 --- a/addons/xterm-addon-search/src/SearchAddon.api.ts +++ b/addons/xterm-addon-search/src/SearchAddon.api.ts @@ -7,7 +7,7 @@ import { assert } from 'chai'; import { readFile } from 'fs'; import { resolve } from 'path'; import { openTerminal, writeSync, getBrowserType } from '../../../out-test/api/TestUtils'; -import { Browser, Page } from 'playwright'; +import { Browser, Page } from 'playwright-core'; const APP = 'http://127.0.0.1:3000/test'; @@ -18,7 +18,8 @@ const height = 600; describe('Search Tests', function(): void { before(async function(): Promise { - browser = await getBrowserType().launch({ + const browserType = await getBrowserType(); + browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); diff --git a/addons/xterm-addon-serialize/src/SerializeAddon.api.ts b/addons/xterm-addon-serialize/src/SerializeAddon.api.ts index 072804f2..992f9351 100644 --- a/addons/xterm-addon-serialize/src/SerializeAddon.api.ts +++ b/addons/xterm-addon-serialize/src/SerializeAddon.api.ts @@ -5,7 +5,7 @@ import { assert } from 'chai'; import { openTerminal, writeSync, getBrowserType } from '../../../out-test/api/TestUtils'; -import { Browser, Page } from 'playwright'; +import { Browser, Page } from 'playwright-core'; const APP = 'http://127.0.0.1:3000/test'; @@ -16,7 +16,8 @@ const height = 600; describe('SerializeAddon', () => { before(async function(): Promise { - browser = await getBrowserType().launch({ + const browserType = await getBrowserType(); + browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`] }); diff --git a/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts b/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts index cf12dae1..5729751a 100644 --- a/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts +++ b/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts @@ -5,7 +5,7 @@ import { assert } from 'chai'; import { openTerminal, getBrowserType } from '../../../out-test/api/TestUtils'; -import { Browser, Page } from 'playwright'; +import { Browser, Page } from 'playwright-core'; const APP = 'http://127.0.0.1:3000/test'; @@ -16,7 +16,8 @@ const height = 600; describe('Unicode11Addon', () => { before(async function(): Promise { - browser = await getBrowserType().launch({ + const browserType = await getBrowserType(); + browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); diff --git a/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts b/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts index 16789233..219e7490 100644 --- a/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts +++ b/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts @@ -5,7 +5,7 @@ import { assert } from 'chai'; import { openTerminal, pollFor, writeSync, getBrowserType } from '../../../out-test/api/TestUtils'; -import { Browser, Page } from 'playwright'; +import { Browser, Page } from 'playwright-core'; const APP = 'http://127.0.0.1:3000/test'; @@ -16,7 +16,8 @@ const height = 600; describe('WebLinksAddon', () => { before(async function(): Promise { - browser = await getBrowserType().launch({ + const browserType = await getBrowserType(); + browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); diff --git a/addons/xterm-addon-webgl/src/WebglRenderer.api.ts b/addons/xterm-addon-webgl/src/WebglRenderer.api.ts index c3e27c7d..a170132a 100644 --- a/addons/xterm-addon-webgl/src/WebglRenderer.api.ts +++ b/addons/xterm-addon-webgl/src/WebglRenderer.api.ts @@ -7,7 +7,7 @@ import { ITerminalOptions } from '../../../src/Types'; import { ITheme } from 'xterm'; import { assert } from 'chai'; import { openTerminal, pollFor, writeSync, getBrowserType } from '../../../out-test/api/TestUtils'; -import { Browser, Page, BrowserType } from 'playwright'; +import { Browser, Page } from 'playwright-core'; const APP = 'http://127.0.0.1:3000/test'; @@ -18,8 +18,8 @@ const height = 600; let itWebgl: (expectation: string, callback?: (this: Mocha.ITestCallbackContext, done: MochaDone) => any) => Mocha.ITest | void; -describe('WebGL Renderer Integration Tests', function(): void { - const browserType = getBrowserType(); +describe('WebGL Renderer Integration Tests', async () => { + const browserType = await getBrowserType(); const isHeadless = process.argv.indexOf('--headless') !== -1; // Firefox works only in non-headless mode https://github.com/microsoft/playwright/issues/1032 const areTestsEnabled = browserType.name() === 'chromium' || (browserType.name() === 'firefox' && !isHeadless); @@ -898,7 +898,8 @@ async function getCellColor(col: number, row: number): Promise { } async function setupBrowser(options: ITerminalOptions = { rendererType: 'dom' }): Promise { - browser = await getBrowserType().launch({ + const browserType = await getBrowserType(); + browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); diff --git a/package.json b/package.json index ec33abce..0946688f 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "mustache": "^3.0.1", "node-pty": "^0.9.0", "nyc": "13", - "playwright": "0.11.1", "source-map-loader": "^0.2.4", "ts-loader": "^6.0.4", "tslint": "^5.18.0", @@ -64,5 +63,8 @@ "webpack-cli": "^3.1.0", "ws": "^7.0.0", "xterm-benchmark": "^0.1.3" + }, + "dependencies": { + "playwright-core": "^0.11.1" } } diff --git a/test/api/CharWidth.api.ts b/test/api/CharWidth.api.ts index 1fe8a34d..26cf488e 100644 --- a/test/api/CharWidth.api.ts +++ b/test/api/CharWidth.api.ts @@ -4,7 +4,7 @@ */ import { pollFor, openTerminal, getBrowserType } from './TestUtils'; -import { Browser, Page } from 'playwright'; +import { Browser, Page } from 'playwright-core'; const APP = 'http://127.0.0.1:3000/test'; @@ -15,7 +15,8 @@ const height = 600; describe('CharWidth Integration Tests', function(): void { before(async function(): Promise { - browser = await getBrowserType().launch({ + const browserType = await getBrowserType(); + browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); diff --git a/test/api/InputHandler.api.ts b/test/api/InputHandler.api.ts index a4d3f82f..881a2e35 100644 --- a/test/api/InputHandler.api.ts +++ b/test/api/InputHandler.api.ts @@ -5,7 +5,7 @@ import { assert } from 'chai'; import { pollFor, openTerminal, getBrowserType } from './TestUtils'; -import { Browser, Page } from 'playwright'; +import { Browser, Page } from 'playwright-core'; import { IRenderDimensions } from 'browser/renderer/Types'; const APP = 'http://127.0.0.1:3000/test'; @@ -19,7 +19,7 @@ let isChromium = false; describe('InputHandler Integration Tests', function(): void { before(async function(): Promise { - const browserType = getBrowserType(); + const browserType = await getBrowserType(); isChromium = browserType.name() === 'chromium'; browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, diff --git a/test/api/MouseTracking.api.ts b/test/api/MouseTracking.api.ts index 27283c19..4867902e 100644 --- a/test/api/MouseTracking.api.ts +++ b/test/api/MouseTracking.api.ts @@ -4,7 +4,7 @@ */ import { pollFor, writeSync, openTerminal, getBrowserType } from './TestUtils'; -import { Browser, Page } from 'playwright'; +import { Browser, Page } from 'playwright-core'; const APP = 'http://127.0.0.1:3000/test'; @@ -22,8 +22,7 @@ const cols = 260; const rows = 50; // Wheel events are hacked using private API that is only available in Chromium -const isChromium = getBrowserType().name() === 'chromium'; -const itMouse = isChromium ? it : it.skip; +const isChromium = false // for some reason shift gets not caught by selection manager on macos const noShift = process.platform === 'darwin' ? false : true; @@ -208,9 +207,13 @@ function parseReport(encoding: string, msg: number[]): { state: any; row: number /** * Mouse tracking tests. */ -describe('Mouse Tracking Tests', () => { +describe('Mouse Tracking Tests', async () => { + const browserType = await getBrowserType(); + browserType.name() === 'chromium'; + const itMouse = isChromium ? it : it.skip; + before(async function(): Promise { - browser = await getBrowserType().launch({ + browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); diff --git a/test/api/Parser.api.ts b/test/api/Parser.api.ts index 5ac287a5..07b677ab 100644 --- a/test/api/Parser.api.ts +++ b/test/api/Parser.api.ts @@ -5,7 +5,7 @@ import { assert } from 'chai'; import { writeSync, openTerminal, getBrowserType } from './TestUtils'; -import { Browser, Page } from 'playwright'; +import { Browser, Page } from 'playwright-core'; const APP = 'http://127.0.0.1:3000/test'; @@ -16,7 +16,8 @@ const height = 600; describe('Parser Integration Tests', function(): void { before(async function(): Promise { - browser = await getBrowserType().launch({ + const browserType = await getBrowserType(); + browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); diff --git a/test/api/Terminal.api.ts b/test/api/Terminal.api.ts index 188a6f7c..00eba4bb 100644 --- a/test/api/Terminal.api.ts +++ b/test/api/Terminal.api.ts @@ -5,7 +5,7 @@ import { assert } from 'chai'; import { pollFor, timeout, writeSync, openTerminal, getBrowserType } from './TestUtils'; -import { Browser, Page } from 'playwright'; +import { Browser, Page } from 'playwright-core'; const APP = 'http://127.0.0.1:3000/test'; @@ -16,7 +16,8 @@ const height = 600; describe('API Integration Tests', function(): void { before(async () => { - browser = await getBrowserType().launch({ + const browserType = await getBrowserType(); + browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] }); diff --git a/test/api/TestUtils.ts b/test/api/TestUtils.ts index a78dab44..7bad9b8f 100644 --- a/test/api/TestUtils.ts +++ b/test/api/TestUtils.ts @@ -3,7 +3,7 @@ * @license MIT */ -import * as playwright from 'playwright'; +import * as playwright from 'playwright-core'; import deepEqual = require('deep-equal'); import { ITerminalOptions } from 'xterm'; @@ -41,7 +41,7 @@ export async function openTerminal(page: playwright.Page, options: ITerminalOpti } } -export function getBrowserType(): playwright.BrowserType { +export async function getBrowserType(): Promise { // Default to chromium let browserType: playwright.BrowserType = playwright['chromium']; @@ -53,5 +53,7 @@ export function getBrowserType(): playwright.BrowserType { } } + await browserType.downloadBrowserIfNeeded(); + return browserType; } diff --git a/yarn.lock b/yarn.lock index 74c94d43..c11f1acb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4026,7 +4026,7 @@ pkg-dir@^3.0.0: dependencies: find-up "^3.0.0" -playwright-core@=0.11.1: +playwright-core@^0.11.1: version "0.11.1" resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-0.11.1.tgz#b488ad17015a4d0f54db5a5fb6a9d380afea6d5a" integrity sha512-9xsSkXlglvHIAofyNInA1p3beOAOBMWHZgiuH99gX1R8VL6fTXgfWD7pIvt+rJhVMJWMDAyMXRo4TYtYtdspIg== @@ -4042,13 +4042,6 @@ playwright-core@=0.11.1: uuid "^3.4.0" ws "^6.1.0" -playwright@0.11.1: - version "0.11.1" - resolved "https://registry.yarnpkg.com/playwright/-/playwright-0.11.1.tgz#e35a2a67d87fdc497a3f706596ea40822f373e82" - integrity sha512-Sx/WCb88u6Q73klQKGjGY2PJSbUl7JAHIie3mFGTpXPPo79cmMzVJl2e07v/qO3VGFd13bF4z8vMt2UVPc/ygQ== - dependencies: - playwright-core "=0.11.1" - pn@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" From 03c6b0c688cc368cb1313ae8101c771abf2a8409 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 05:30:33 -0800 Subject: [PATCH 23/37] Fix typo in firefox job --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index add925c2..12f7b83d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -124,7 +124,7 @@ jobs: displayName: 'Start test server' - script: yarn test-api-chromium --headless --forbid-only displayName: 'Integration tests (Chromium)' - - script: yarn test-api-firfox --headless --forbid-only + - script: yarn test-api-firefox --headless --forbid-only displayName: 'Integration tests (Firefox)' - script: yarn test-api-webkit --headless --forbid-only displayName: 'Integration tests (Webkit)' From 47dc137de0c0ecdcc414258db60a9472bfbc4240 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 05:47:42 -0800 Subject: [PATCH 24/37] Download browser at start of test --- azure-pipelines.yml | 8 -------- bin/download_browser.js | 23 +++++++++++++++++++++++ package.json | 3 +++ test/api/TestUtils.ts | 2 +- 4 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 bin/download_browser.js diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 12f7b83d..4081cec5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,8 +7,6 @@ jobs: - job: Linux pool: vmImage: 'ubuntu-16.04' - variables: - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1 steps: - task: NodeTool@0 inputs: @@ -42,8 +40,6 @@ jobs: - job: macOS pool: vmImage: 'xcode9-macos10.13' - variables: - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1 steps: - task: NodeTool@0 inputs: @@ -64,8 +60,6 @@ jobs: - job: Windows pool: vmImage: 'vs2017-win2016' - variables: - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1 steps: - task: NodeTool@0 inputs: @@ -139,8 +133,6 @@ jobs: condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['FORCE_RELEASE'], 'true'))) pool: vmImage: 'ubuntu-16.04' - variables: - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1 steps: - task: NodeTool@0 inputs: diff --git a/bin/download_browser.js b/bin/download_browser.js new file mode 100644 index 00000000..44380db2 --- /dev/null +++ b/bin/download_browser.js @@ -0,0 +1,23 @@ +/** + * Copyright (c) 2020 The xterm.js authors. All rights reserved. + * @license MIT + */ + +const playwright = require('playwright-core'); +const fs = require('fs'); + +// Default to chromium +let browserType = playwright['chromium']; +const index = process.argv.indexOf('--browser'); +if (index !== -1 && process.argv.length > index + 1 && typeof process.argv[index + 1] === 'string') { + const string = process.argv[index + 1]; + if (string === 'firefox' || string === 'webkit') { + browserType = playwright[string]; + } +} + +const exists = fs.existsSync(browserType.executablePath()); +if (!exists) { + console.log(`Downloading ${browserType.name()}`); + browserType.downloadBrowserIfNeeded().then(() => process.exit(0)); +} diff --git a/package.json b/package.json index 0946688f..88467328 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,9 @@ "test-api-chromium": "mocha \"**/*.api.js\" --browser chromium --timeout 10000", "test-api-firefox": "mocha \"**/*.api.js\" --browser firefox --timeout 10000", "test-api-webkit": "mocha \"**/*.api.js\" --browser webkit --timeout 10000", + "pretest-api-chromium": "node ./bin/download_browser.js --browser chromium", + "pretest-api-firefox": "node ./bin/download_browser.js --browser firefox", + "pretest-api-webkit": "node ./bin/download_browser.js --browser webkit", "test-unit": "node ./bin/test.js", "test-unit-coverage": "node ./bin/test.js --coverage", "build": "tsc -b ./tsconfig.all.json", diff --git a/test/api/TestUtils.ts b/test/api/TestUtils.ts index 7bad9b8f..60044746 100644 --- a/test/api/TestUtils.ts +++ b/test/api/TestUtils.ts @@ -46,7 +46,7 @@ export async function getBrowserType(): Promise { let browserType: playwright.BrowserType = playwright['chromium']; const index = process.argv.indexOf('--browser'); - if (index !== -1 && process.argv.length > index + 2 && typeof process.argv[index + 1] === 'string') { + if (index !== -1 && process.argv.length > index + 1 && typeof process.argv[index + 1] === 'string') { const string = process.argv[index + 1]; if (string === 'firefox' || string === 'webkit') { browserType = playwright[string]; From cb1353c89837d9efbeaa1fc8efff4cb51644bc01 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 05:48:38 -0800 Subject: [PATCH 25/37] Cache yarn modules on integration test jobs --- azure-pipelines.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4081cec5..d4e0d52e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -89,6 +89,11 @@ jobs: inputs: versionSpec: '1.x' displayName: 'Install Yarn' + - task: CacheBeta@1 + inputs: + key: yarn2 | $(Agent.OS) | yarn.lock + path: node_modules + displayName: Cache node modules - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - script: | @@ -110,6 +115,11 @@ jobs: inputs: versionSpec: '10.x' displayName: 'Install Node.js' + - task: CacheBeta@1 + inputs: + key: yarn2 | $(Agent.OS) | yarn.lock + path: node_modules + displayName: Cache node modules - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - script: | From 477b161ba2a6f81122c5b5dad69443b454612b67 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 05:51:39 -0800 Subject: [PATCH 26/37] Change browserType back to sync --- addons/xterm-addon-attach/src/AttachAddon.api.ts | 2 +- addons/xterm-addon-fit/src/FitAddon.api.ts | 2 +- addons/xterm-addon-search/src/SearchAddon.api.ts | 2 +- addons/xterm-addon-serialize/src/SerializeAddon.api.ts | 2 +- addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts | 2 +- addons/xterm-addon-web-links/src/WebLinksAddon.api.ts | 2 +- addons/xterm-addon-webgl/src/WebglRenderer.api.ts | 4 ++-- test/api/CharWidth.api.ts | 2 +- test/api/InputHandler.api.ts | 2 +- test/api/MouseTracking.api.ts | 2 +- test/api/Parser.api.ts | 2 +- test/api/Terminal.api.ts | 2 +- test/api/TestUtils.ts | 4 +--- 13 files changed, 14 insertions(+), 16 deletions(-) diff --git a/addons/xterm-addon-attach/src/AttachAddon.api.ts b/addons/xterm-addon-attach/src/AttachAddon.api.ts index fdef5c41..625e1b4d 100644 --- a/addons/xterm-addon-attach/src/AttachAddon.api.ts +++ b/addons/xterm-addon-attach/src/AttachAddon.api.ts @@ -16,7 +16,7 @@ const height = 600; describe('AttachAddon', () => { before(async function(): Promise { - const browserType = await getBrowserType(); + const browserType = getBrowserType(); browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] diff --git a/addons/xterm-addon-fit/src/FitAddon.api.ts b/addons/xterm-addon-fit/src/FitAddon.api.ts index f154a30e..760a3176 100644 --- a/addons/xterm-addon-fit/src/FitAddon.api.ts +++ b/addons/xterm-addon-fit/src/FitAddon.api.ts @@ -18,7 +18,7 @@ let isFirefox = false; describe('FitAddon', () => { before(async function(): Promise { - const browserType = await getBrowserType(); + const browserType = getBrowserType(); browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] diff --git a/addons/xterm-addon-search/src/SearchAddon.api.ts b/addons/xterm-addon-search/src/SearchAddon.api.ts index 741ddea2..21238332 100644 --- a/addons/xterm-addon-search/src/SearchAddon.api.ts +++ b/addons/xterm-addon-search/src/SearchAddon.api.ts @@ -18,7 +18,7 @@ const height = 600; describe('Search Tests', function(): void { before(async function(): Promise { - const browserType = await getBrowserType(); + const browserType = getBrowserType(); browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] diff --git a/addons/xterm-addon-serialize/src/SerializeAddon.api.ts b/addons/xterm-addon-serialize/src/SerializeAddon.api.ts index 992f9351..824b4b89 100644 --- a/addons/xterm-addon-serialize/src/SerializeAddon.api.ts +++ b/addons/xterm-addon-serialize/src/SerializeAddon.api.ts @@ -16,7 +16,7 @@ const height = 600; describe('SerializeAddon', () => { before(async function(): Promise { - const browserType = await getBrowserType(); + const browserType = getBrowserType(); browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`] diff --git a/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts b/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts index 5729751a..983e795f 100644 --- a/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts +++ b/addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts @@ -16,7 +16,7 @@ const height = 600; describe('Unicode11Addon', () => { before(async function(): Promise { - const browserType = await getBrowserType(); + const browserType = getBrowserType(); browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] diff --git a/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts b/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts index 219e7490..b2516cdf 100644 --- a/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts +++ b/addons/xterm-addon-web-links/src/WebLinksAddon.api.ts @@ -16,7 +16,7 @@ const height = 600; describe('WebLinksAddon', () => { before(async function(): Promise { - const browserType = await getBrowserType(); + const browserType = getBrowserType(); browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] diff --git a/addons/xterm-addon-webgl/src/WebglRenderer.api.ts b/addons/xterm-addon-webgl/src/WebglRenderer.api.ts index a170132a..cd90ddd9 100644 --- a/addons/xterm-addon-webgl/src/WebglRenderer.api.ts +++ b/addons/xterm-addon-webgl/src/WebglRenderer.api.ts @@ -19,7 +19,7 @@ const height = 600; let itWebgl: (expectation: string, callback?: (this: Mocha.ITestCallbackContext, done: MochaDone) => any) => Mocha.ITest | void; describe('WebGL Renderer Integration Tests', async () => { - const browserType = await getBrowserType(); + const browserType = getBrowserType(); const isHeadless = process.argv.indexOf('--headless') !== -1; // Firefox works only in non-headless mode https://github.com/microsoft/playwright/issues/1032 const areTestsEnabled = browserType.name() === 'chromium' || (browserType.name() === 'firefox' && !isHeadless); @@ -898,7 +898,7 @@ async function getCellColor(col: number, row: number): Promise { } async function setupBrowser(options: ITerminalOptions = { rendererType: 'dom' }): Promise { - const browserType = await getBrowserType(); + const browserType = getBrowserType(); browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] diff --git a/test/api/CharWidth.api.ts b/test/api/CharWidth.api.ts index 26cf488e..b5cb5838 100644 --- a/test/api/CharWidth.api.ts +++ b/test/api/CharWidth.api.ts @@ -15,7 +15,7 @@ const height = 600; describe('CharWidth Integration Tests', function(): void { before(async function(): Promise { - const browserType = await getBrowserType(); + const browserType = getBrowserType(); browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] diff --git a/test/api/InputHandler.api.ts b/test/api/InputHandler.api.ts index 881a2e35..d4018d90 100644 --- a/test/api/InputHandler.api.ts +++ b/test/api/InputHandler.api.ts @@ -19,7 +19,7 @@ let isChromium = false; describe('InputHandler Integration Tests', function(): void { before(async function(): Promise { - const browserType = await getBrowserType(); + const browserType = getBrowserType(); isChromium = browserType.name() === 'chromium'; browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, diff --git a/test/api/MouseTracking.api.ts b/test/api/MouseTracking.api.ts index 4867902e..4d10a987 100644 --- a/test/api/MouseTracking.api.ts +++ b/test/api/MouseTracking.api.ts @@ -208,7 +208,7 @@ function parseReport(encoding: string, msg: number[]): { state: any; row: number * Mouse tracking tests. */ describe('Mouse Tracking Tests', async () => { - const browserType = await getBrowserType(); + const browserType = getBrowserType(); browserType.name() === 'chromium'; const itMouse = isChromium ? it : it.skip; diff --git a/test/api/Parser.api.ts b/test/api/Parser.api.ts index 07b677ab..29dcbb0b 100644 --- a/test/api/Parser.api.ts +++ b/test/api/Parser.api.ts @@ -16,7 +16,7 @@ const height = 600; describe('Parser Integration Tests', function(): void { before(async function(): Promise { - const browserType = await getBrowserType(); + const browserType = getBrowserType(); browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] diff --git a/test/api/Terminal.api.ts b/test/api/Terminal.api.ts index 00eba4bb..fce17511 100644 --- a/test/api/Terminal.api.ts +++ b/test/api/Terminal.api.ts @@ -16,7 +16,7 @@ const height = 600; describe('API Integration Tests', function(): void { before(async () => { - const browserType = await getBrowserType(); + const browserType = getBrowserType(); browser = await browserType.launch({ headless: process.argv.indexOf('--headless') !== -1, args: [`--window-size=${width},${height}`, `--no-sandbox`] diff --git a/test/api/TestUtils.ts b/test/api/TestUtils.ts index 60044746..987940d0 100644 --- a/test/api/TestUtils.ts +++ b/test/api/TestUtils.ts @@ -41,7 +41,7 @@ export async function openTerminal(page: playwright.Page, options: ITerminalOpti } } -export async function getBrowserType(): Promise { +export function getBrowserType(): playwright.BrowserType { // Default to chromium let browserType: playwright.BrowserType = playwright['chromium']; @@ -53,7 +53,5 @@ export async function getBrowserType(): Promise { } } - await browserType.downloadBrowserIfNeeded(); - return browserType; } From 2ac0c0a95782afcc6b6000507ef1a9bdd836678d Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 05:55:01 -0800 Subject: [PATCH 27/37] Move playwright-core back to dev --- package.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/package.json b/package.json index 88467328..5048a2c3 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "mustache": "^3.0.1", "node-pty": "^0.9.0", "nyc": "13", + "playwright-core": "^0.11.1", "source-map-loader": "^0.2.4", "ts-loader": "^6.0.4", "tslint": "^5.18.0", @@ -66,8 +67,5 @@ "webpack-cli": "^3.1.0", "ws": "^7.0.0", "xterm-benchmark": "^0.1.3" - }, - "dependencies": { - "playwright-core": "^0.11.1" } } From ed23194abd3815c10524e7634fde7236065aceba Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 06:00:59 -0800 Subject: [PATCH 28/37] Update macOS version --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d4e0d52e..cd938eb0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -109,7 +109,7 @@ jobs: - job: macOS_IntegrationTests pool: - vmImage: 'xcode9-macos10.13' + vmImage: 'macOS-10.15' steps: - task: NodeTool@0 inputs: From cd1b251cef435413debe1c23007d7579574204c6 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 06:07:33 -0800 Subject: [PATCH 29/37] Up timeout for slower CI agents --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 5048a2c3..1124d4e4 100644 --- a/package.json +++ b/package.json @@ -15,9 +15,9 @@ "test": "npm run test-unit", "posttest": "npm run lint", "test-api": "npm run test-api-chromium", - "test-api-chromium": "mocha \"**/*.api.js\" --browser chromium --timeout 10000", - "test-api-firefox": "mocha \"**/*.api.js\" --browser firefox --timeout 10000", - "test-api-webkit": "mocha \"**/*.api.js\" --browser webkit --timeout 10000", + "test-api-chromium": "mocha \"**/*.api.js\" --browser chromium --timeout 20000", + "test-api-firefox": "mocha \"**/*.api.js\" --browser firefox --timeout 20000", + "test-api-webkit": "mocha \"**/*.api.js\" --browser webkit --timeout 20000", "pretest-api-chromium": "node ./bin/download_browser.js --browser chromium", "pretest-api-firefox": "node ./bin/download_browser.js --browser firefox", "pretest-api-webkit": "node ./bin/download_browser.js --browser webkit", From 579a13508711b13f781e49e6ed5b60104cbb96f0 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 06:17:53 -0800 Subject: [PATCH 30/37] Try firefox deps https://bugzilla.mozilla.org/show_bug.cgi?id=1372998 --- azure-pipelines.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index cd938eb0..d5eca902 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -95,6 +95,14 @@ jobs: path: node_modules displayName: Cache node modules - script: yarn --frozen-lockfile + - run: | + sudo apt-get update + sudo apt-get install -y libgtk-3-0 libdbus-glib-1-2 xvfb + sudo cp build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb + sudo chmod +x /etc/init.d/xvfb + sudo update-rc.d xvfb defaults + sudo service xvfb start + name: Install firefox dependencies displayName: 'Install dependencies and build' - script: | yarn start & From 445a801d5dde6a4efd4347759497d9e8c0f6d257 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 06:21:05 -0800 Subject: [PATCH 31/37] Fix syntax error --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d5eca902..34e74781 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -95,15 +95,15 @@ jobs: path: node_modules displayName: Cache node modules - script: yarn --frozen-lockfile - - run: | + displayName: 'Install dependencies and build' + - script: | sudo apt-get update sudo apt-get install -y libgtk-3-0 libdbus-glib-1-2 xvfb sudo cp build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb sudo chmod +x /etc/init.d/xvfb sudo update-rc.d xvfb defaults sudo service xvfb start - name: Install firefox dependencies - displayName: 'Install dependencies and build' + displayName: Install firefox dependencies - script: | yarn start & sleep 10 From 446f8f93c6069ed8d019fada02a754d21d3efdcb Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 06:27:03 -0800 Subject: [PATCH 32/37] Disable firefox on linux --- azure-pipelines.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 34e74781..a7ef39fb 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -96,22 +96,12 @@ jobs: displayName: Cache node modules - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - - script: | - sudo apt-get update - sudo apt-get install -y libgtk-3-0 libdbus-glib-1-2 xvfb - sudo cp build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb - sudo chmod +x /etc/init.d/xvfb - sudo update-rc.d xvfb defaults - sudo service xvfb start - displayName: Install firefox dependencies - script: | yarn start & sleep 10 displayName: 'Start test server' - script: yarn test-api-chromium --headless --forbid-only displayName: 'Integration tests (Chromium)' - - script: yarn test-api-firefox --headless --forbid-only - displayName: 'Integration tests (Firefox)' - script: yarn test-api-webkit --headless --forbid-only displayName: 'Integration tests (Webkit)' From 1a6ec0d76881f79d95bdfcc66bbdd87f0daa7264 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 06:39:10 -0800 Subject: [PATCH 33/37] Disable webkit on Linux --- azure-pipelines.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a7ef39fb..7f8d36fb 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -102,8 +102,6 @@ jobs: displayName: 'Start test server' - script: yarn test-api-chromium --headless --forbid-only displayName: 'Integration tests (Chromium)' - - script: yarn test-api-webkit --headless --forbid-only - displayName: 'Integration tests (Webkit)' - job: macOS_IntegrationTests pool: From eb82346ce7182a175381d80f631540503eb9781b Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 06:40:04 -0800 Subject: [PATCH 34/37] Add a Windows test job --- azure-pipelines.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7f8d36fb..9df660c8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -103,6 +103,32 @@ jobs: - script: yarn test-api-chromium --headless --forbid-only displayName: 'Integration tests (Chromium)' +- job: Windows_IntegrationTests + pool: + vmImage: 'vs2017-win2016' + steps: + - task: NodeTool@0 + inputs: + versionSpec: '10.x' + displayName: 'Install Node.js' + - task: CacheBeta@1 + inputs: + key: yarn2 | $(Agent.OS) | yarn.lock + path: node_modules + displayName: Cache node modules + - script: yarn --frozen-lockfile + displayName: 'Install dependencies and build' + - script: | + yarn start & + sleep 10 + displayName: 'Start test server' + - script: yarn test-api-chromium --headless --forbid-only + displayName: 'Integration tests (Chromium)' + - script: yarn test-api-firefox --headless --forbid-only + displayName: 'Integration tests (Firefox)' + - script: yarn test-api-webkit --headless --forbid-only + displayName: 'Integration tests (Webkit)' + - job: macOS_IntegrationTests pool: vmImage: 'macOS-10.15' From 83794c433f0f8a2b09946ed7d0f5440442672031 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 07:05:20 -0800 Subject: [PATCH 35/37] Tweak windows server start --- azure-pipelines.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9df660c8..2eed2a7a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -119,8 +119,10 @@ jobs: - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - script: | - yarn start & - sleep 10 + Start-Job -ScriptBlock { + & yarn start + } + Start-Sleep -s 10 displayName: 'Start test server' - script: yarn test-api-chromium --headless --forbid-only displayName: 'Integration tests (Chromium)' From c36a468561d678425b9beb959dabf42c4d66d003 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 07:08:42 -0800 Subject: [PATCH 36/37] script -> pwsh --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2eed2a7a..87584f50 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -118,7 +118,7 @@ jobs: displayName: Cache node modules - script: yarn --frozen-lockfile displayName: 'Install dependencies and build' - - script: | + - pwsh: | Start-Job -ScriptBlock { & yarn start } From c73adf02bccda4a016d911b868b9cb627f8d3a88 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 15 Feb 2020 07:14:09 -0800 Subject: [PATCH 37/37] Disable windows tests --- azure-pipelines.yml | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 87584f50..7f8d36fb 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -103,34 +103,6 @@ jobs: - script: yarn test-api-chromium --headless --forbid-only displayName: 'Integration tests (Chromium)' -- job: Windows_IntegrationTests - pool: - vmImage: 'vs2017-win2016' - steps: - - task: NodeTool@0 - inputs: - versionSpec: '10.x' - displayName: 'Install Node.js' - - task: CacheBeta@1 - inputs: - key: yarn2 | $(Agent.OS) | yarn.lock - path: node_modules - displayName: Cache node modules - - script: yarn --frozen-lockfile - displayName: 'Install dependencies and build' - - pwsh: | - Start-Job -ScriptBlock { - & yarn start - } - Start-Sleep -s 10 - displayName: 'Start test server' - - script: yarn test-api-chromium --headless --forbid-only - displayName: 'Integration tests (Chromium)' - - script: yarn test-api-firefox --headless --forbid-only - displayName: 'Integration tests (Firefox)' - - script: yarn test-api-webkit --headless --forbid-only - displayName: 'Integration tests (Webkit)' - - job: macOS_IntegrationTests pool: vmImage: 'macOS-10.15'