Move to playwright-core, download browser if needed
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import WebSocket = require('ws');
|
import WebSocket = require('ws');
|
||||||
import { openTerminal, pollFor, getBrowserType } from '../../../out-test/api/TestUtils';
|
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';
|
const APP = 'http://127.0.0.1:3000/test';
|
||||||
|
|
||||||
@@ -16,7 +16,8 @@ const height = 600;
|
|||||||
|
|
||||||
describe('AttachAddon', () => {
|
describe('AttachAddon', () => {
|
||||||
before(async function(): Promise<any> {
|
before(async function(): Promise<any> {
|
||||||
browser = await getBrowserType().launch({
|
const browserType = await getBrowserType();
|
||||||
|
browser = await browserType.launch({
|
||||||
headless: process.argv.indexOf('--headless') !== -1,
|
headless: process.argv.indexOf('--headless') !== -1,
|
||||||
args: [`--window-size=${width},${height}`, `--no-sandbox`]
|
args: [`--window-size=${width},${height}`, `--no-sandbox`]
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { openTerminal, getBrowserType } from '../../../out-test/api/TestUtils';
|
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';
|
const APP = 'http://127.0.0.1:3000/test';
|
||||||
|
|
||||||
@@ -18,7 +18,8 @@ let isFirefox = false;
|
|||||||
|
|
||||||
describe('FitAddon', () => {
|
describe('FitAddon', () => {
|
||||||
before(async function(): Promise<any> {
|
before(async function(): Promise<any> {
|
||||||
browser = await getBrowserType().launch({
|
const browserType = await getBrowserType();
|
||||||
|
browser = await browserType.launch({
|
||||||
headless: process.argv.indexOf('--headless') !== -1,
|
headless: process.argv.indexOf('--headless') !== -1,
|
||||||
args: [`--window-size=${width},${height}`, `--no-sandbox`]
|
args: [`--window-size=${width},${height}`, `--no-sandbox`]
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { assert } from 'chai';
|
|||||||
import { readFile } from 'fs';
|
import { readFile } from 'fs';
|
||||||
import { resolve } from 'path';
|
import { resolve } from 'path';
|
||||||
import { openTerminal, writeSync, getBrowserType } from '../../../out-test/api/TestUtils';
|
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';
|
const APP = 'http://127.0.0.1:3000/test';
|
||||||
|
|
||||||
@@ -18,7 +18,8 @@ const height = 600;
|
|||||||
|
|
||||||
describe('Search Tests', function(): void {
|
describe('Search Tests', function(): void {
|
||||||
before(async function(): Promise<any> {
|
before(async function(): Promise<any> {
|
||||||
browser = await getBrowserType().launch({
|
const browserType = await getBrowserType();
|
||||||
|
browser = await browserType.launch({
|
||||||
headless: process.argv.indexOf('--headless') !== -1,
|
headless: process.argv.indexOf('--headless') !== -1,
|
||||||
args: [`--window-size=${width},${height}`, `--no-sandbox`]
|
args: [`--window-size=${width},${height}`, `--no-sandbox`]
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { openTerminal, writeSync, getBrowserType } from '../../../out-test/api/TestUtils';
|
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';
|
const APP = 'http://127.0.0.1:3000/test';
|
||||||
|
|
||||||
@@ -16,7 +16,8 @@ const height = 600;
|
|||||||
|
|
||||||
describe('SerializeAddon', () => {
|
describe('SerializeAddon', () => {
|
||||||
before(async function(): Promise<any> {
|
before(async function(): Promise<any> {
|
||||||
browser = await getBrowserType().launch({
|
const browserType = await getBrowserType();
|
||||||
|
browser = await browserType.launch({
|
||||||
headless: process.argv.indexOf('--headless') !== -1,
|
headless: process.argv.indexOf('--headless') !== -1,
|
||||||
args: [`--window-size=${width},${height}`]
|
args: [`--window-size=${width},${height}`]
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { openTerminal, getBrowserType } from '../../../out-test/api/TestUtils';
|
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';
|
const APP = 'http://127.0.0.1:3000/test';
|
||||||
|
|
||||||
@@ -16,7 +16,8 @@ const height = 600;
|
|||||||
|
|
||||||
describe('Unicode11Addon', () => {
|
describe('Unicode11Addon', () => {
|
||||||
before(async function(): Promise<any> {
|
before(async function(): Promise<any> {
|
||||||
browser = await getBrowserType().launch({
|
const browserType = await getBrowserType();
|
||||||
|
browser = await browserType.launch({
|
||||||
headless: process.argv.indexOf('--headless') !== -1,
|
headless: process.argv.indexOf('--headless') !== -1,
|
||||||
args: [`--window-size=${width},${height}`, `--no-sandbox`]
|
args: [`--window-size=${width},${height}`, `--no-sandbox`]
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { openTerminal, pollFor, writeSync, getBrowserType } from '../../../out-test/api/TestUtils';
|
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';
|
const APP = 'http://127.0.0.1:3000/test';
|
||||||
|
|
||||||
@@ -16,7 +16,8 @@ const height = 600;
|
|||||||
|
|
||||||
describe('WebLinksAddon', () => {
|
describe('WebLinksAddon', () => {
|
||||||
before(async function(): Promise<any> {
|
before(async function(): Promise<any> {
|
||||||
browser = await getBrowserType().launch({
|
const browserType = await getBrowserType();
|
||||||
|
browser = await browserType.launch({
|
||||||
headless: process.argv.indexOf('--headless') !== -1,
|
headless: process.argv.indexOf('--headless') !== -1,
|
||||||
args: [`--window-size=${width},${height}`, `--no-sandbox`]
|
args: [`--window-size=${width},${height}`, `--no-sandbox`]
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { ITerminalOptions } from '../../../src/Types';
|
|||||||
import { ITheme } from 'xterm';
|
import { ITheme } from 'xterm';
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { openTerminal, pollFor, writeSync, getBrowserType } from '../../../out-test/api/TestUtils';
|
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';
|
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;
|
let itWebgl: (expectation: string, callback?: (this: Mocha.ITestCallbackContext, done: MochaDone) => any) => Mocha.ITest | void;
|
||||||
|
|
||||||
describe('WebGL Renderer Integration Tests', function(): void {
|
describe('WebGL Renderer Integration Tests', async () => {
|
||||||
const browserType = getBrowserType();
|
const browserType = await getBrowserType();
|
||||||
const isHeadless = process.argv.indexOf('--headless') !== -1;
|
const isHeadless = process.argv.indexOf('--headless') !== -1;
|
||||||
// Firefox works only in non-headless mode https://github.com/microsoft/playwright/issues/1032
|
// Firefox works only in non-headless mode https://github.com/microsoft/playwright/issues/1032
|
||||||
const areTestsEnabled = browserType.name() === 'chromium' || (browserType.name() === 'firefox' && !isHeadless);
|
const areTestsEnabled = browserType.name() === 'chromium' || (browserType.name() === 'firefox' && !isHeadless);
|
||||||
@@ -898,7 +898,8 @@ async function getCellColor(col: number, row: number): Promise<number[]> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function setupBrowser(options: ITerminalOptions = { rendererType: 'dom' }): Promise<void> {
|
async function setupBrowser(options: ITerminalOptions = { rendererType: 'dom' }): Promise<void> {
|
||||||
browser = await getBrowserType().launch({
|
const browserType = await getBrowserType();
|
||||||
|
browser = await browserType.launch({
|
||||||
headless: process.argv.indexOf('--headless') !== -1,
|
headless: process.argv.indexOf('--headless') !== -1,
|
||||||
args: [`--window-size=${width},${height}`, `--no-sandbox`]
|
args: [`--window-size=${width},${height}`, `--no-sandbox`]
|
||||||
});
|
});
|
||||||
|
|||||||
+3
-1
@@ -53,7 +53,6 @@
|
|||||||
"mustache": "^3.0.1",
|
"mustache": "^3.0.1",
|
||||||
"node-pty": "^0.9.0",
|
"node-pty": "^0.9.0",
|
||||||
"nyc": "13",
|
"nyc": "13",
|
||||||
"playwright": "0.11.1",
|
|
||||||
"source-map-loader": "^0.2.4",
|
"source-map-loader": "^0.2.4",
|
||||||
"ts-loader": "^6.0.4",
|
"ts-loader": "^6.0.4",
|
||||||
"tslint": "^5.18.0",
|
"tslint": "^5.18.0",
|
||||||
@@ -64,5 +63,8 @@
|
|||||||
"webpack-cli": "^3.1.0",
|
"webpack-cli": "^3.1.0",
|
||||||
"ws": "^7.0.0",
|
"ws": "^7.0.0",
|
||||||
"xterm-benchmark": "^0.1.3"
|
"xterm-benchmark": "^0.1.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"playwright-core": "^0.11.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { pollFor, openTerminal, getBrowserType } from './TestUtils';
|
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';
|
const APP = 'http://127.0.0.1:3000/test';
|
||||||
|
|
||||||
@@ -15,7 +15,8 @@ const height = 600;
|
|||||||
|
|
||||||
describe('CharWidth Integration Tests', function(): void {
|
describe('CharWidth Integration Tests', function(): void {
|
||||||
before(async function(): Promise<any> {
|
before(async function(): Promise<any> {
|
||||||
browser = await getBrowserType().launch({
|
const browserType = await getBrowserType();
|
||||||
|
browser = await browserType.launch({
|
||||||
headless: process.argv.indexOf('--headless') !== -1,
|
headless: process.argv.indexOf('--headless') !== -1,
|
||||||
args: [`--window-size=${width},${height}`, `--no-sandbox`]
|
args: [`--window-size=${width},${height}`, `--no-sandbox`]
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { pollFor, openTerminal, getBrowserType } from './TestUtils';
|
import { pollFor, openTerminal, getBrowserType } from './TestUtils';
|
||||||
import { Browser, Page } from 'playwright';
|
import { Browser, Page } from 'playwright-core';
|
||||||
import { IRenderDimensions } from 'browser/renderer/Types';
|
import { IRenderDimensions } from 'browser/renderer/Types';
|
||||||
|
|
||||||
const APP = 'http://127.0.0.1:3000/test';
|
const APP = 'http://127.0.0.1:3000/test';
|
||||||
@@ -19,7 +19,7 @@ let isChromium = false;
|
|||||||
|
|
||||||
describe('InputHandler Integration Tests', function(): void {
|
describe('InputHandler Integration Tests', function(): void {
|
||||||
before(async function(): Promise<any> {
|
before(async function(): Promise<any> {
|
||||||
const browserType = getBrowserType();
|
const browserType = await getBrowserType();
|
||||||
isChromium = browserType.name() === 'chromium';
|
isChromium = browserType.name() === 'chromium';
|
||||||
browser = await browserType.launch({
|
browser = await browserType.launch({
|
||||||
headless: process.argv.indexOf('--headless') !== -1,
|
headless: process.argv.indexOf('--headless') !== -1,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { pollFor, writeSync, openTerminal, getBrowserType } from './TestUtils';
|
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';
|
const APP = 'http://127.0.0.1:3000/test';
|
||||||
|
|
||||||
@@ -22,8 +22,7 @@ const cols = 260;
|
|||||||
const rows = 50;
|
const rows = 50;
|
||||||
|
|
||||||
// Wheel events are hacked using private API that is only available in Chromium
|
// Wheel events are hacked using private API that is only available in Chromium
|
||||||
const isChromium = getBrowserType().name() === 'chromium';
|
const isChromium = false
|
||||||
const itMouse = isChromium ? it : it.skip;
|
|
||||||
|
|
||||||
// for some reason shift gets not caught by selection manager on macos
|
// for some reason shift gets not caught by selection manager on macos
|
||||||
const noShift = process.platform === 'darwin' ? false : true;
|
const noShift = process.platform === 'darwin' ? false : true;
|
||||||
@@ -208,9 +207,13 @@ function parseReport(encoding: string, msg: number[]): { state: any; row: number
|
|||||||
/**
|
/**
|
||||||
* Mouse tracking tests.
|
* 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<void> {
|
before(async function(): Promise<void> {
|
||||||
browser = await getBrowserType().launch({
|
browser = await browserType.launch({
|
||||||
headless: process.argv.indexOf('--headless') !== -1,
|
headless: process.argv.indexOf('--headless') !== -1,
|
||||||
args: [`--window-size=${width},${height}`, `--no-sandbox`]
|
args: [`--window-size=${width},${height}`, `--no-sandbox`]
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { writeSync, openTerminal, getBrowserType } from './TestUtils';
|
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';
|
const APP = 'http://127.0.0.1:3000/test';
|
||||||
|
|
||||||
@@ -16,7 +16,8 @@ const height = 600;
|
|||||||
|
|
||||||
describe('Parser Integration Tests', function(): void {
|
describe('Parser Integration Tests', function(): void {
|
||||||
before(async function(): Promise<any> {
|
before(async function(): Promise<any> {
|
||||||
browser = await getBrowserType().launch({
|
const browserType = await getBrowserType();
|
||||||
|
browser = await browserType.launch({
|
||||||
headless: process.argv.indexOf('--headless') !== -1,
|
headless: process.argv.indexOf('--headless') !== -1,
|
||||||
args: [`--window-size=${width},${height}`, `--no-sandbox`]
|
args: [`--window-size=${width},${height}`, `--no-sandbox`]
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { pollFor, timeout, writeSync, openTerminal, getBrowserType } from './TestUtils';
|
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';
|
const APP = 'http://127.0.0.1:3000/test';
|
||||||
|
|
||||||
@@ -16,7 +16,8 @@ const height = 600;
|
|||||||
|
|
||||||
describe('API Integration Tests', function(): void {
|
describe('API Integration Tests', function(): void {
|
||||||
before(async () => {
|
before(async () => {
|
||||||
browser = await getBrowserType().launch({
|
const browserType = await getBrowserType();
|
||||||
|
browser = await browserType.launch({
|
||||||
headless: process.argv.indexOf('--headless') !== -1,
|
headless: process.argv.indexOf('--headless') !== -1,
|
||||||
args: [`--window-size=${width},${height}`, `--no-sandbox`]
|
args: [`--window-size=${width},${height}`, `--no-sandbox`]
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as playwright from 'playwright';
|
import * as playwright from 'playwright-core';
|
||||||
import deepEqual = require('deep-equal');
|
import deepEqual = require('deep-equal');
|
||||||
import { ITerminalOptions } from 'xterm';
|
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<playwright.BrowserType> {
|
||||||
// Default to chromium
|
// Default to chromium
|
||||||
let browserType: playwright.BrowserType = playwright['chromium'];
|
let browserType: playwright.BrowserType = playwright['chromium'];
|
||||||
|
|
||||||
@@ -53,5 +53,7 @@ export function getBrowserType(): playwright.BrowserType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await browserType.downloadBrowserIfNeeded();
|
||||||
|
|
||||||
return browserType;
|
return browserType;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4026,7 +4026,7 @@ pkg-dir@^3.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
find-up "^3.0.0"
|
find-up "^3.0.0"
|
||||||
|
|
||||||
playwright-core@=0.11.1:
|
playwright-core@^0.11.1:
|
||||||
version "0.11.1"
|
version "0.11.1"
|
||||||
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-0.11.1.tgz#b488ad17015a4d0f54db5a5fb6a9d380afea6d5a"
|
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-0.11.1.tgz#b488ad17015a4d0f54db5a5fb6a9d380afea6d5a"
|
||||||
integrity sha512-9xsSkXlglvHIAofyNInA1p3beOAOBMWHZgiuH99gX1R8VL6fTXgfWD7pIvt+rJhVMJWMDAyMXRo4TYtYtdspIg==
|
integrity sha512-9xsSkXlglvHIAofyNInA1p3beOAOBMWHZgiuH99gX1R8VL6fTXgfWD7pIvt+rJhVMJWMDAyMXRo4TYtYtdspIg==
|
||||||
@@ -4042,13 +4042,6 @@ playwright-core@=0.11.1:
|
|||||||
uuid "^3.4.0"
|
uuid "^3.4.0"
|
||||||
ws "^6.1.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:
|
pn@^1.1.0:
|
||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb"
|
resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb"
|
||||||
|
|||||||
Reference in New Issue
Block a user