Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use playwright instead of puppeteer #2712

Merged
merged 39 commits into from
Feb 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
7515ed6
Use playwright instead of puppeteer
jmbockhorst Feb 10, 2020
e7b3910
Update CI to node 10
jmbockhorst Feb 10, 2020
5209183
Fix some mouse tests
jmbockhorst Feb 11, 2020
8fb6ded
Fix mouse tests for chromium
jmbockhorst Feb 11, 2020
391313c
Revert some formatting and remove puppeteer
jmbockhorst Feb 11, 2020
2442dc0
Clean up some stuff based on feedback
jmbockhorst Feb 12, 2020
258b084
Merge branch 'master' of https://github.com/xtermjs/xterm.js into pla…
jmbockhorst Feb 13, 2020
383e2ed
Remove duplicate code and clean up after merge
jmbockhorst Feb 13, 2020
b53c2e1
Fix tests
jmbockhorst Feb 13, 2020
1d0cceb
Merge branch 'master' into playwright
Tyriar Feb 15, 2020
502452f
Enable tests on other browsers
Tyriar Feb 15, 2020
e6e181e
Fix firefox tests FitAddon tests
Tyriar Feb 15, 2020
6082c00
Fix serialize tests on firefox
Tyriar Feb 15, 2020
93026bc
Only enable webgl tests on chromium and non-headless firefox
Tyriar Feb 15, 2020
f3eb9f7
Movee api test timeout into CLI args
Tyriar Feb 15, 2020
a9356fd
Skip paste test when not Chromium
Tyriar Feb 15, 2020
3f15a72
Skip webgl tests instead of not registering
Tyriar Feb 15, 2020
7400b88
Skip mouse wheel-related tests on non-chromium
Tyriar Feb 15, 2020
3b51565
Fix pipelines file
Tyriar Feb 15, 2020
2b70802
Only start server once in pipelines
Tyriar Feb 15, 2020
7bd4f38
Fix lint
Tyriar Feb 15, 2020
4ae25e5
[email protected]
Tyriar Feb 15, 2020
4ebb61b
Adopt playwright breaking changes
Tyriar Feb 15, 2020
ffc5e2f
Move to playwright-core, download browser if needed
Tyriar Feb 15, 2020
03c6b0c
Fix typo in firefox job
Tyriar Feb 15, 2020
47dc137
Download browser at start of test
Tyriar Feb 15, 2020
cb1353c
Cache yarn modules on integration test jobs
Tyriar Feb 15, 2020
477b161
Change browserType back to sync
Tyriar Feb 15, 2020
2ac0c0a
Move playwright-core back to dev
Tyriar Feb 15, 2020
ed23194
Update macOS version
Tyriar Feb 15, 2020
cd1b251
Up timeout for slower CI agents
Tyriar Feb 15, 2020
579a135
Try firefox deps
Tyriar Feb 15, 2020
445a801
Fix syntax error
Tyriar Feb 15, 2020
446f8f9
Disable firefox on linux
Tyriar Feb 15, 2020
1a6ec0d
Disable webkit on Linux
Tyriar Feb 15, 2020
eb82346
Add a Windows test job
Tyriar Feb 15, 2020
83794c4
Tweak windows server start
Tyriar Feb 15, 2020
c36a468
script -> pwsh
Tyriar Feb 15, 2020
c73adf0
Disable windows tests
Tyriar Feb 15, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions addons/xterm-addon-attach/src/AttachAddon.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,35 @@
* @license MIT
*/

import * as puppeteer from 'puppeteer';
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-core';

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('AttachAddon', () => {
before(async function(): Promise<any> {
this.timeout(20000);
browser = await puppeteer.launch({
const browserType = getBrowserType();
browser = await browserType.launch({
headless: process.argv.indexOf('--headless') !== -1,
args: [`--window-size=${width},${height}`, `--no-sandbox`]
});
page = (await browser.pages())[0];
await page.setViewport({ width, height });
page = await (await browser.newContext()).newPage();
await page.setViewportSize({ width, height });
});

after(async () => {
await browser.close();
});

beforeEach(async function(): Promise<any> {
this.timeout(20000);
await page.goto(APP);
});
beforeEach(async () => await page.goto(APP));

it('string', async function(): Promise<any> {
this.timeout(20000);
await openTerminal(page, { rendererType: 'dom' });
const port = 8080;
const server = new WebSocket.Server({ port });
Expand All @@ -46,7 +42,6 @@ describe('AttachAddon', () => {
});

it('utf8', async function(): Promise<any> {
this.timeout(20000);
await openTerminal(page, { rendererType: 'dom' });
const port = 8080;
const server = new WebSocket.Server({ port });
Expand Down
30 changes: 18 additions & 12 deletions addons/xterm-addon-fit/src/FitAddon.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,34 @@
* @license MIT
*/

import * as puppeteer from 'puppeteer';
import { assert } from 'chai';
import { openTerminal } from '../../../out-test/api/TestUtils';
import { openTerminal, getBrowserType } from '../../../out-test/api/TestUtils';
import { Browser, Page } from 'playwright-core';

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 = 1024;
const height = 768;

let isFirefox = false;

describe('FitAddon', () => {
before(async function(): Promise<any> {
this.timeout(20000);
browser = await puppeteer.launch({
const browserType = getBrowserType();
browser = await browserType.launch({
headless: process.argv.indexOf('--headless') !== -1,
args: [`--window-size=${width},${height}`, `--no-sandbox`]
});
page = (await browser.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
// 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 () => {
Expand All @@ -45,15 +51,15 @@ describe('FitAddon', () => {
await loadFit();
assert.deepEqual(await page.evaluate(`window.fit.proposeDimensions()`), {
cols: 87,
rows: 26
rows: isFirefox ? 28 : 26
});
});

it('width', async function(): Promise<any> {
await loadFit(1008);
assert.deepEqual(await page.evaluate(`window.fit.proposeDimensions()`), {
cols: 110,
rows: 26
rows: isFirefox ? 28 : 26
});
});

Expand All @@ -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<any> {
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<any> {
Expand Down
17 changes: 8 additions & 9 deletions addons/xterm-addon-search/src/SearchAddon.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,28 @@
* @license MIT
*/

import * as puppeteer from 'puppeteer';
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-core';

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('Search Tests', function(): void {
this.timeout(20000);

before(async function(): Promise<any> {
browser = await puppeteer.launch({
const browserType = getBrowserType();
browser = await browserType.launch({
headless: process.argv.indexOf('--headless') !== -1,
args: [`--window-size=${width},${height}`, `--no-sandbox`]
});
page = (await browser.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();`);
Expand Down
45 changes: 23 additions & 22 deletions addons/xterm-addon-serialize/src/SerializeAddon.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,26 @@
* @license MIT
*/

import * as puppeteer from 'puppeteer';
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-core';

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('SerializeAddon', () => {
before(async function (): Promise<any> {
browser = await puppeteer.launch({
before(async function(): Promise<any> {
const browserType = getBrowserType();
browser = await browserType.launch({
headless: process.argv.indexOf('--headless') !== -1,
args: [`--window-size=${width},${height}`]
});
page = (await browser.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(`
Expand All @@ -33,13 +34,13 @@ describe('SerializeAddon', () => {
after(async () => await browser.close());
beforeEach(async () => await page.evaluate(`window.term.reset()`));

it('empty content', async function (): Promise<any> {
it('empty content', async function(): Promise<any> {
const rows = 10;
const cols = 10;
assert.equal(await page.evaluate(`serializeAddon.serialize();`), '');
});

it('trim last empty lines', async function (): Promise<any> {
it('trim last empty lines', async function(): Promise<any> {
const cols = 10;
const lines = [
'',
Expand All @@ -58,7 +59,7 @@ describe('SerializeAddon', () => {
assert.equal(await page.evaluate(`serializeAddon.serialize();`), lines.slice(0, 8).join('\r\n'));
});

it('digits content', async function (): Promise<any> {
it('digits content', async function(): Promise<any> {
const rows = 10;
const cols = 10;
const digitsLine = digitsString(cols);
Expand All @@ -67,7 +68,7 @@ describe('SerializeAddon', () => {
assert.equal(await page.evaluate(`serializeAddon.serialize();`), lines.join('\r\n'));
});

it('serialize half rows of content', async function (): Promise<any> {
it('serialize half rows of content', async function(): Promise<any> {
const rows = 10;
const halfRows = rows >> 1;
const cols = 10;
Expand All @@ -76,15 +77,15 @@ 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<any> {
it('serialize 0 rows of content', async function(): Promise<any> {
const rows = 10;
const cols = 10;
const lines = newArray<string>((index: number) => digitsString(cols, index), rows);
await writeSync(page, lines.join('\\r\\n'));
assert.equal(await page.evaluate(`serializeAddon.serialize(0);`), '');
});

it('serialize all rows of content with color16', async function (): Promise<any> {
it('serialize all rows of content with color16', async function(): Promise<any> {
const cols = 10;
const color16 = [
30, 31, 32, 33, 34, 35, 36, 37, // Set foreground color
Expand All @@ -101,7 +102,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<any> {
it('serialize all rows of content with fg/bg flags', async function(): Promise<any> {
const cols = 10;
const line = '+'.repeat(cols);
const lines: string[] = [
Expand All @@ -122,7 +123,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<any> {
it('serialize all rows of content with color256', async function(): Promise<any> {
const rows = 32;
const cols = 10;
const lines = newArray<string>(
Expand All @@ -133,7 +134,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<any> {
it('serialize all rows of content with color16 and style separately', async function(): Promise<any> {
const cols = 10;
const line = '+'.repeat(cols);
const lines: string[] = [
Expand All @@ -152,7 +153,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<any> {
it('serialize all rows of content with color16 and style together', async function(): Promise<any> {
const cols = 10;
const line = '+'.repeat(cols);
const lines: string[] = [
Expand All @@ -174,7 +175,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<any> {
it('serialize all rows of content with color256 and style separately', async function(): Promise<any> {
const cols = 10;
const line = '+'.repeat(cols);
const lines: string[] = [
Expand All @@ -193,7 +194,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<any> {
it('serialize all rows of content with color256 and style together', async function(): Promise<any> {
const cols = 10;
const line = '+'.repeat(cols);
const lines: string[] = [
Expand All @@ -215,7 +216,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<any> {
it('serialize all rows of content with colorRGB and style separately', async function(): Promise<any> {
const cols = 10;
const line = '+'.repeat(cols);
const lines: string[] = [
Expand All @@ -234,7 +235,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<any> {
it('serialize all rows of content with colorRGB and style together', async function(): Promise<any> {
const cols = 10;
const line = '+'.repeat(cols);
const lines: string[] = [
Expand Down
17 changes: 8 additions & 9 deletions addons/xterm-addon-unicode11/src/Unicode11Addon.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,33 @@
* @license MIT
*/

import * as puppeteer from 'puppeteer';
import { assert } from 'chai';
import { openTerminal } from '../../../out-test/api/TestUtils';
import { openTerminal, getBrowserType } from '../../../out-test/api/TestUtils';
import { Browser, Page } from 'playwright-core';

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('Unicode11Addon', () => {
before(async function(): Promise<any> {
this.timeout(20000);
browser = await puppeteer.launch({
const browserType = getBrowserType();
browser = await browserType.launch({
headless: process.argv.indexOf('--headless') !== -1,
args: [`--window-size=${width},${height}`, `--no-sandbox`]
});
page = (await browser.pages())[0];
await page.setViewport({ width, height });
page = await (await browser.newContext()).newPage();
await page.setViewportSize({ width, height });
});

after(async () => {
await browser.close();
});

beforeEach(async function(): Promise<any> {
this.timeout(20000);
await page.goto(APP);
await openTerminal(page);
});
Expand Down
Loading