提交 15bf0c61 编写于 作者: M Michel Kaporin

Allow 3 trials to wait until editor is drawn.

上级 8c77107f
......@@ -149,16 +149,31 @@ export class CommonActions {
}
public async getEditorFirstLinePlainText(): Promise<any> {
try {
const span = await this.spectron.client.getText('.view-lines span span');
if (Array.isArray(span)) {
return span[0];
}
const trials = 3;
let retry = 0;
let error;
while (retry < trials) {
try {
const span = await this.spectron.client.getText('.view-lines span span');
if (Array.isArray(span)) {
return span[0];
}
return span;
} catch (e) {
return Promise.reject('Could not obtain text on the first line of an editor: ' + e);
return span;
} catch (e) {
error = e;
retry++;
if (retry < trials) {
this.spectron.wait();
} else {
error = e;
}
}
}
return Promise.reject('Could not obtain text on the first line of an editor: ' + error);
}
public removeFile(filePath: string): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册