Move openTerminal() to common util file
This commit is contained in:
+2
-13
@@ -5,8 +5,7 @@
|
||||
|
||||
import * as puppeteer from 'puppeteer';
|
||||
import { assert } from 'chai';
|
||||
import { ITerminalOptions } from 'xterm';
|
||||
import { writeSync } from './TestUtils';
|
||||
import { writeSync, openTerminal } from './TestUtils';
|
||||
|
||||
const APP = 'http://127.0.0.1:3000/test';
|
||||
|
||||
@@ -24,7 +23,7 @@ describe('Parser Integration Tests', function(): void {
|
||||
page = (await browser.pages())[0];
|
||||
await page.setViewport({ width, height });
|
||||
await page.goto(APP);
|
||||
await openTerminal();
|
||||
await openTerminal(page);
|
||||
});
|
||||
|
||||
after(async () => browser.close());
|
||||
@@ -110,13 +109,3 @@ describe('Parser Integration Tests', function(): void {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
async function openTerminal(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') {
|
||||
await page.waitForSelector('.xterm-rows');
|
||||
} else {
|
||||
await page.waitForSelector('.xterm-text-layer');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user