提交 c52f0d8c 编写于 作者: S Sandeep Somavarapu

smoke: make terminal tests more reliable

上级 1aaf47e8
......@@ -34,7 +34,6 @@ export class References {
await this.spectron.client.waitForText(References.REFERENCES_TITLE_FILE_NAME, file);
}
public async close(): Promise<void> {
await this.spectron.client.keys(['Escape', 'NULL']);
await this.spectron.client.waitForElement(References.REFERENCES_WIDGET, element => !element);
......
......@@ -17,6 +17,14 @@ describe('Terminal', () => {
await app.workbench.terminal.runCommand(`echo ${expected}`);
await app.workbench.terminal.waitForTerminalText(terminalText => !!terminalText[terminalText.length - 2] && terminalText[terminalText.length - 2].trim() === expected);
await app.workbench.terminal.waitForTerminalText(terminalText => {
// Last line will not contain the output
for (let index = terminalText.length - 2; index >= 0; index--) {
if (!!terminalText[index] && terminalText[index].trim() === expected) {
return true;
}
}
return false;
});
});
});
\ No newline at end of file
......@@ -32,11 +32,6 @@ export class Terminal {
await this.spectron.client.keys(['Enter', 'NULL']);
}
public async waitForTextInLine(line: number, fn: (text: string) => boolean): Promise<string> {
const terminalText = await this.waitForTerminalText(terminalText => fn(terminalText[line - 1]), 'Waiting for Text in line ' + line);
return terminalText[line - 1];
}
public async waitForTerminalText(fn: (text: string[]) => boolean, timeOutDescription: string = 'Getting Terminal Text'): Promise<string[]> {
return this.spectron.client.waitFor(async () => {
const terminalText = await this.getTerminalText();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册