Skip to content

Commit

Permalink
smoke: trust dialog should appear in 5 seconds, and we can ignore if …
Browse files Browse the repository at this point in the history
…it doesn't
  • Loading branch information
joaomoreno committed May 28, 2021
1 parent 5b64261 commit 541a5d4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
21 changes: 13 additions & 8 deletions test/automation/src/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();
}

private async dismissTrustDialog(): Promise<void> {
if (this.options.web) {
return;
}

if (!this.options.web) {
// Dismiss workspace trust dialog
await this.code.waitAndClick(`.monaco-workbench .dialog-buttons-row a:nth-child(1)`, 10, 10);
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?
}
}

Expand Down
4 changes: 2 additions & 2 deletions test/automation/src/code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down

0 comments on commit 541a5d4

Please sign in to comment.