Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move API test timeout to top-level describe #2114

Merged
merged 3 commits into from
May 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/InputHandler.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ let page: puppeteer.Page;
const width = 800;
const height = 600;

describe('InputHandler Integration Tests', () => {
describe('InputHandler Integration Tests', function(): void {
this.timeout(10000);

before(async function(): Promise<any> {
this.timeout(10000);
browser = await puppeteer.launch({
headless: process.argv.indexOf('--headless') !== -1,
slowMo: 80,
Expand All @@ -36,7 +37,6 @@ describe('InputHandler Integration Tests', () => {

describe('Device Status Report (DSR)', () => {
it('Status Report - CSI 5 n', async function(): Promise<any> {
this.timeout(10000);
await openTerminal();
await page.evaluate(`
window.term.onData(e => window.result = e);
Expand All @@ -46,7 +46,6 @@ describe('InputHandler Integration Tests', () => {
});

it('Report Cursor Position (CPR) - CSI 6 n', async function(): Promise<any> {
this.timeout(10000);
await openTerminal();
await page.evaluate(`window.term.write('\\n\\nfoo')`);
assert.deepEqual(await page.evaluate(`
Expand All @@ -60,7 +59,6 @@ describe('InputHandler Integration Tests', () => {
});

it('Report Cursor Position (DECXCPR) - CSI ? 6 n', async function(): Promise<any> {
this.timeout(10000);
await openTerminal();
await page.evaluate(`window.term.write('\\n\\nfoo')`);
assert.deepEqual(await page.evaluate(`
Expand Down
35 changes: 3 additions & 32 deletions src/public/Terminal.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ let page: puppeteer.Page;
const width = 800;
const height = 600;

describe('API Integration Tests', () => {
describe('API Integration Tests', function(): void {
this.timeout(10000);

before(async function(): Promise<any> {
this.timeout(10000);
browser = await puppeteer.launch({
headless: process.argv.indexOf('--headless') !== -1,
slowMo: 80,
Expand All @@ -35,14 +36,12 @@ describe('API Integration Tests', () => {
});

it('Default options', async function(): Promise<any> {
this.timeout(10000);
await openTerminal();
assert.equal(await page.evaluate(`window.term.cols`), 80);
assert.equal(await page.evaluate(`window.term.rows`), 24);
});

it('write', async function(): Promise<any> {
this.timeout(10000);
await openTerminal();
await page.evaluate(`
window.term.write('foo');
Expand All @@ -53,7 +52,6 @@ describe('API Integration Tests', () => {
});

it('writeln', async function(): Promise<any> {
this.timeout(10000);
await openTerminal();
await page.evaluate(`
window.term.writeln('foo');
Expand All @@ -66,7 +64,6 @@ describe('API Integration Tests', () => {
});

it('writeUtf8', async function(): Promise<any> {
this.timeout(10000);
await openTerminal();
await page.evaluate(`
// foo
Expand All @@ -80,7 +77,6 @@ describe('API Integration Tests', () => {
});

it('clear', async function(): Promise<any> {
this.timeout(10000);
await openTerminal({ rows: 5 });
await page.evaluate(`
window.term.write('test0');
Expand All @@ -97,7 +93,6 @@ describe('API Integration Tests', () => {
});

it('getOption, setOption', async function(): Promise<any> {
this.timeout(10000);
await openTerminal();
assert.equal(await page.evaluate(`window.term.getOption('rendererType')`), 'canvas');
await page.evaluate(`window.term.setOption('rendererType', 'dom')`);
Expand All @@ -106,7 +101,6 @@ describe('API Integration Tests', () => {

describe('renderer', () => {
it('foreground', async function(): Promise<any> {
this.timeout(10000);
await openTerminal({ rendererType: 'dom' });
await page.evaluate(`window.term.write('\\x1b[30m0\\x1b[31m1\\x1b[32m2\\x1b[33m3\\x1b[34m4\\x1b[35m5\\x1b[36m6\\x1b[37m7')`);
assert.deepEqual(await page.evaluate(`
Expand All @@ -131,7 +125,6 @@ describe('API Integration Tests', () => {
});

it('background', async function(): Promise<any> {
this.timeout(10000);
await openTerminal({ rendererType: 'dom' });
await page.evaluate(`window.term.write('\\x1b[40m0\\x1b[41m1\\x1b[42m2\\x1b[43m3\\x1b[44m4\\x1b[45m5\\x1b[46m6\\x1b[47m7')`);
assert.deepEqual(await page.evaluate(`
Expand All @@ -157,7 +150,6 @@ describe('API Integration Tests', () => {
});

it('selection', async function(): Promise<any> {
this.timeout(10000);
await openTerminal({ rows: 5, cols: 5 });
await page.evaluate(`window.term.write('\\n\\nfoo\\n\\n\\rbar\\n\\n\\rbaz')`);
assert.equal(await page.evaluate(`window.term.hasSelection()`), false);
Expand All @@ -178,7 +170,6 @@ describe('API Integration Tests', () => {
});

it('focus, blur', async function(): Promise<any> {
this.timeout(10000);
await openTerminal();
assert.equal(await page.evaluate(`document.activeElement.className`), '');
await page.evaluate(`window.term.focus()`);
Expand All @@ -189,7 +180,6 @@ describe('API Integration Tests', () => {

describe('loadAddon', () => {
it('constructor', async function(): Promise<any> {
this.timeout(10000);
await openTerminal({ cols: 5 });
await page.evaluate(`
window.cols = 0;
Expand All @@ -202,7 +192,6 @@ describe('API Integration Tests', () => {
});

it('dispose (addon)', async function(): Promise<any> {
this.timeout(10000);
await openTerminal();
await page.evaluate(`
window.disposeCalled = false
Expand All @@ -218,7 +207,6 @@ describe('API Integration Tests', () => {
});

it('dispose (terminal)', async function(): Promise<any> {
this.timeout(10000);
await openTerminal();
await page.evaluate(`
window.disposeCalled = false
Expand All @@ -235,7 +223,6 @@ describe('API Integration Tests', () => {

describe('Events', () => {
it('onCursorMove', async function(): Promise<any> {
this.timeout(10000);
await openTerminal();
await page.evaluate(`
window.callCount = 0;
Expand All @@ -248,7 +235,6 @@ describe('API Integration Tests', () => {
});

it('onData', async function(): Promise<any> {
this.timeout(10000);
await openTerminal();
await page.evaluate(`
window.calls = [];
Expand All @@ -259,7 +245,6 @@ describe('API Integration Tests', () => {
});

it('onKey', async function(): Promise<any> {
this.timeout(10000);
await openTerminal();
await page.evaluate(`
window.calls = [];
Expand All @@ -270,7 +255,6 @@ describe('API Integration Tests', () => {
});

it('onLineFeed', async function(): Promise<any> {
this.timeout(10000);
await openTerminal();
await page.evaluate(`
window.callCount = 0;
Expand All @@ -283,7 +267,6 @@ describe('API Integration Tests', () => {
});

it('onScroll', async function(): Promise<any> {
this.timeout(10000);
await openTerminal({ rows: 5 });
await page.evaluate(`
window.calls = [];
Expand All @@ -300,7 +283,6 @@ describe('API Integration Tests', () => {
});

it('onSelectionChange', async function(): Promise<any> {
this.timeout(10000);
await openTerminal();
await page.evaluate(`
window.callCount = 0;
Expand All @@ -314,7 +296,6 @@ describe('API Integration Tests', () => {
});

it('onRender', async function(): Promise<any> {
this.timeout(10000);
await openTerminal();
await page.evaluate(`
window.calls = [];
Expand All @@ -328,7 +309,6 @@ describe('API Integration Tests', () => {
});

it('onResize', async function(): Promise<any> {
this.timeout(10000);
await openTerminal();
await page.evaluate(`
window.calls = [];
Expand All @@ -342,7 +322,6 @@ describe('API Integration Tests', () => {
});

it('onTitleChange', async function(): Promise<any> {
this.timeout(10000);
await openTerminal();
await page.evaluate(`
window.calls = [];
Expand All @@ -356,7 +335,6 @@ describe('API Integration Tests', () => {

describe('buffer', () => {
it('cursorX, cursorY', async function(): Promise<any> {
this.timeout(10000);
await openTerminal({ rows: 5, cols: 5 });
assert.equal(await page.evaluate(`window.term.buffer.cursorX`), 0);
assert.equal(await page.evaluate(`window.term.buffer.cursorY`), 0);
Expand All @@ -378,7 +356,6 @@ describe('API Integration Tests', () => {
});

it('viewportY', async function(): Promise<any> {
this.timeout(10000);
await openTerminal({ rows: 5 });
assert.equal(await page.evaluate(`window.term.buffer.viewportY`), 0);
await page.evaluate(`window.term.write('\\n\\n\\n\\n')`);
Expand All @@ -394,7 +371,6 @@ describe('API Integration Tests', () => {
});

it('baseY', async function(): Promise<any> {
this.timeout(10000);
await openTerminal({ rows: 5 });
assert.equal(await page.evaluate(`window.term.buffer.baseY`), 0);
await page.evaluate(`window.term.write('\\n\\n\\n\\n')`);
Expand All @@ -410,7 +386,6 @@ describe('API Integration Tests', () => {
});

it('length', async function(): Promise<any> {
this.timeout(10000);
await openTerminal({ rows: 5 });
assert.equal(await page.evaluate(`window.term.buffer.length`), 5);
await page.evaluate(`window.term.write('\\n\\n\\n\\n')`);
Expand All @@ -423,14 +398,12 @@ describe('API Integration Tests', () => {

describe('getLine', () => {
it('invalid index', async function(): Promise<any> {
this.timeout(10000);
await openTerminal({ rows: 5 });
assert.equal(await page.evaluate(`window.term.buffer.getLine(-1)`), undefined);
assert.equal(await page.evaluate(`window.term.buffer.getLine(5)`), undefined);
});

it('isWrapped', async function(): Promise<any> {
this.timeout(10000);
await openTerminal({ cols: 5 });
assert.equal(await page.evaluate(`window.term.buffer.getLine(0).isWrapped`), false);
assert.equal(await page.evaluate(`window.term.buffer.getLine(1).isWrapped`), false);
Expand All @@ -443,7 +416,6 @@ describe('API Integration Tests', () => {
});

it('translateToString', async function(): Promise<any> {
this.timeout(10000);
await openTerminal({ cols: 5 });
assert.equal(await page.evaluate(`window.term.buffer.getLine(0).translateToString()`), ' ');
assert.equal(await page.evaluate(`window.term.buffer.getLine(0).translateToString(true)`), '');
Expand All @@ -459,7 +431,6 @@ describe('API Integration Tests', () => {
});

it('getCell', async function(): Promise<any> {
this.timeout(10000);
await openTerminal({ cols: 5 });
assert.equal(await page.evaluate(`window.term.buffer.getLine(0).getCell(-1)`), undefined);
assert.equal(await page.evaluate(`window.term.buffer.getLine(0).getCell(5)`), undefined);
Expand Down