diff --git a/test/smoke/src/areas/terminal/terminal.test.ts b/test/smoke/src/areas/terminal/terminal.test.ts index a88257b97f3..6373712b279 100644 --- a/test/smoke/src/areas/terminal/terminal.test.ts +++ b/test/smoke/src/areas/terminal/terminal.test.ts @@ -16,11 +16,9 @@ describe('Terminal', () => { const expected = new Date().getTime().toString(); await app.workbench.terminal.showTerminal(); - const currentLine = await app.workbench.terminal.getCurrentLineNumber(); - await app.workbench.terminal.runCommand(`echo ${expected}`); + const resultLineNumber = await app.workbench.terminal.runCommand(`echo ${expected}`); - const actual = await app.workbench.terminal.waitForTextInLine(currentLine + 1, text => !!text.trim()); - app.screenshot.capture('Terminal text'); + const actual = await app.workbench.terminal.waitForTextInLine(resultLineNumber, text => text.trim() === expected); assert.equal(actual.trim(), expected); }); }); \ No newline at end of file diff --git a/test/smoke/src/areas/terminal/terminal.ts b/test/smoke/src/areas/terminal/terminal.ts index 6d91cb5b6c6..697ab0c4dce 100644 --- a/test/smoke/src/areas/terminal/terminal.ts +++ b/test/smoke/src/areas/terminal/terminal.ts @@ -17,7 +17,7 @@ export class Terminal { if (!await this.isVisible()) { await this.spectron.workbench.commandPallette.runCommand('Toggle Integrated Terminal'); await this.spectron.client.waitForElement(Terminal.TERMINAL_SELECTOR); - await this.waitForText(text => !!text[text.length - 1] && text[text.length - 1].trim().indexOf('vscode-smoketest-express') !== -1); + await this.waitForTerminalText(text => !!text[text.length - 1] && text[text.length - 1].trim().indexOf('vscode-smoketest-express') !== -1); } } @@ -26,17 +26,19 @@ export class Terminal { return !!element; } - public async runCommand(commandText: string): Promise { + public async runCommand(commandText: string): Promise { await this.spectron.client.type(commandText); + const currentLineNumber = await this.getCurrentLineNumber(); await this.spectron.client.keys(['Enter', 'NULL']); + return currentLineNumber + 1; } public async waitForTextInLine(line: number, fn: (text: string) => boolean): Promise { - const text = await this.waitForText(text => !!text[line]); - return text[line]; + const terminalText = await this.waitForTerminalText(terminalText => fn(terminalText[line - 1])); + return terminalText[line - 1]; } - public async waitForText(fn: (text: string[]) => boolean): Promise { + public async waitForTerminalText(fn: (text: string[]) => boolean): Promise { return this.spectron.client.waitFor(async () => { const terminalText = await this.getTerminalText(); if (fn(terminalText)) {