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" + } ] }