Remove duplicate code and clean up after merge
This commit is contained in:
@@ -3,14 +3,14 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as playwright from 'playwright';
|
|
||||||
import WebSocket = require('ws');
|
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';
|
const APP = 'http://127.0.0.1:3000/test';
|
||||||
|
|
||||||
let browser: playwright.Browser;
|
let browser: Browser;
|
||||||
let page: playwright.Page;
|
let page: Page;
|
||||||
const width = 800;
|
const width = 800;
|
||||||
const height = 600;
|
const height = 600;
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as playwright from 'playwright';
|
|
||||||
import { assert } from 'chai';
|
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';
|
const APP = 'http://127.0.0.1:3000/test';
|
||||||
|
|
||||||
let browser: playwright.Browser;
|
let browser: Browser;
|
||||||
let page: playwright.Page;
|
let page: Page;
|
||||||
const width = 1024;
|
const width = 1024;
|
||||||
const height = 768;
|
const height = 768;
|
||||||
|
|
||||||
|
|||||||
@@ -3,16 +3,16 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as playwright from 'playwright';
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { readFile } from 'fs';
|
import { readFile } from 'fs';
|
||||||
import { resolve } from 'path';
|
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';
|
const APP = 'http://127.0.0.1:3000/test';
|
||||||
|
|
||||||
let browser: playwright.Browser;
|
let browser: Browser;
|
||||||
let page: playwright.Page;
|
let page: Page;
|
||||||
const width = 800;
|
const width = 800;
|
||||||
const height = 600;
|
const height = 600;
|
||||||
|
|
||||||
@@ -197,18 +197,3 @@ function makeData(length: number): string {
|
|||||||
}
|
}
|
||||||
return result;
|
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
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as playwright from 'playwright';
|
|
||||||
import { assert } from 'chai';
|
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';
|
const APP = 'http://127.0.0.1:3000/test';
|
||||||
|
|
||||||
let browser: playwright.Browser;
|
let browser: Browser;
|
||||||
let page: playwright.Page;
|
let page: Page;
|
||||||
const width = 800;
|
const width = 800;
|
||||||
const height = 600;
|
const height = 600;
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as playwright from 'playwright';
|
|
||||||
import { assert } from 'chai';
|
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';
|
const APP = 'http://127.0.0.1:3000/test';
|
||||||
|
|
||||||
let browser: playwright.Browser;
|
let browser: Browser;
|
||||||
let page: playwright.Page;
|
let page: Page;
|
||||||
const width = 800;
|
const width = 800;
|
||||||
const height = 600;
|
const height = 600;
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as playwright from 'playwright';
|
|
||||||
import { assert } from 'chai';
|
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';
|
const APP = 'http://127.0.0.1:3000/test';
|
||||||
|
|
||||||
let browser: playwright.Browser;
|
let browser: Browser;
|
||||||
let page: playwright.Page;
|
let page: Page;
|
||||||
const width = 800;
|
const width = 800;
|
||||||
const height = 600;
|
const height = 600;
|
||||||
|
|
||||||
|
|||||||
@@ -3,16 +3,16 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as playwright from 'playwright';
|
|
||||||
import { ITerminalOptions } from '../../../src/Types';
|
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 } 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';
|
const APP = 'http://127.0.0.1:3000/test';
|
||||||
|
|
||||||
let browser: playwright.Browser;
|
let browser: Browser;
|
||||||
let page: playwright.Page;
|
let page: Page;
|
||||||
const width = 800;
|
const width = 800;
|
||||||
const height = 600;
|
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',
|
'#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'
|
'#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;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { pollFor, getBrowserType, openTerminal } from './TestUtils';
|
import { pollFor, openTerminal, getBrowserType } from './TestUtils';
|
||||||
import { Browser, Page } from 'playwright';
|
import { Browser, Page } from 'playwright';
|
||||||
|
|
||||||
const APP = 'http://127.0.0.1:3000/test';
|
const APP = 'http://127.0.0.1:3000/test';
|
||||||
|
|||||||
@@ -4,9 +4,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { ITerminalOptions } from 'xterm';
|
|
||||||
import { pollFor, openTerminal, getBrowserType } from './TestUtils';
|
import { pollFor, openTerminal, getBrowserType } from './TestUtils';
|
||||||
import { Page, Browser } from 'playwright';
|
import { Browser, Page } from 'playwright';
|
||||||
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';
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export async function timeout(ms: number): Promise<void> {
|
|||||||
return new Promise<void>(r => setTimeout(r, ms));
|
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 = new Terminal(${JSON.stringify(options)})`);
|
||||||
await page.evaluate(`window.term.open(document.querySelector('#terminal-container'))`);
|
await page.evaluate(`window.term.open(document.querySelector('#terminal-container'))`);
|
||||||
if (options.rendererType === 'dom') {
|
if (options.rendererType === 'dom') {
|
||||||
|
|||||||
Reference in New Issue
Block a user