smoke: trust dialog should appear in 5 seconds, and we can ignore if it doesn't

This commit is contained in:
João Moreno 2021-05-28 11:38:10 +02:00
parent 5b642616ef
commit 541a5d4fa7
No known key found for this signature in database
GPG key ID: 896B853774D1A575
2 changed files with 15 additions and 10 deletions

View file

@ -71,11 +71,7 @@ export class Application {
async start(expectWalkthroughPart = true): Promise<any> {
await this._start();
await this.code.waitForElement('.explorer-folders-view');
if (!this.options.web) {
// Dismiss workspace trust dialog
await this.code.waitAndClick(`.monaco-workbench .dialog-buttons-row a:nth-child(1)`, 10, 10);
}
await this.dismissTrustDialog();
// https://github.com/microsoft/vscode/issues/118748
// if (expectWalkthroughPart) {
@ -88,10 +84,19 @@ export class Application {
await new Promise(c => setTimeout(c, 1000));
await this._start(options.workspaceOrFolder, options.extraArgs);
await this.code.waitForElement('.explorer-folders-view');
await this.dismissTrustDialog();
}
if (!this.options.web) {
// Dismiss workspace trust dialog
await this.code.waitAndClick(`.monaco-workbench .dialog-buttons-row a:nth-child(1)`, 10, 10);
private async dismissTrustDialog(): Promise<void> {
if (this.options.web) {
return;
}
try {
// Dismiss workspace trust dialog, if found
await this.code.waitAndClick(`.monaco-workbench .dialog-buttons-row a:nth-child(1)`, 10, 10, 50);
} catch {
// there musn't be any trust dialog, maybe workspace is trusted?
}
}

View file

@ -307,9 +307,9 @@ export class Code {
);
}
async waitAndClick(selector: string, xoffset?: number, yoffset?: number): Promise<void> {
async waitAndClick(selector: string, xoffset?: number, yoffset?: number, retryCount: number = 200): Promise<void> {
const windowId = await this.getActiveWindowId();
await poll(() => this.driver.click(windowId, selector, xoffset, yoffset), () => true, `click '${selector}'`);
await poll(() => this.driver.click(windowId, selector, xoffset, yoffset), () => true, `click '${selector}'`, retryCount);
}
async waitAndDoubleClick(selector: string): Promise<void> {