Remove duplicate code and clean up after merge

This commit is contained in:
Jon Bockhorst
2020-02-13 00:07:07 -06:00
parent 258b084a62
commit 383e2ed46f
10 changed files with 31 additions and 62 deletions
@@ -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;
+4 -4
View File
@@ -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;
@@ -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;
}
@@ -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;
@@ -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;
@@ -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;
@@ -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;
}
+1 -1
View File
@@ -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';
+1 -2
View File
@@ -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';
+1 -1
View File
@@ -31,7 +31,7 @@ export async function timeout(ms: number): Promise<void> {
return new Promise<void>(r => setTimeout(r, ms));
}
export async function openTerminal(page: puppeteer.Page, options: ITerminalOptions = {}): Promise<void> {
export async function openTerminal(page: playwright.Page, options: ITerminalOptions = {}): Promise<void> {
await page.evaluate(`window.term = new Terminal(${JSON.stringify(options)})`);
await page.evaluate(`window.term.open(document.querySelector('#terminal-container'))`);
if (options.rendererType === 'dom') {