Move to playwright-core, download browser if needed

This commit is contained in:
Daniel Imms
2020-02-15 05:28:21 -08:00
parent 4ebb61b580
commit ffc5e2f446
15 changed files with 50 additions and 40 deletions
@@ -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<number[]> {
}
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,
args: [`--window-size=${width},${height}`, `--no-sandbox`]
});