mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-19 14:22:19 +01:00
smoke: wait for marketplace for longer than 5 seconds
This commit is contained in:
@@ -33,7 +33,11 @@ export class Extensions extends Viewlet {
|
||||
|
||||
public async installExtension(name: string): Promise<boolean> {
|
||||
await this.searchForExtension(name);
|
||||
await this.spectron.client.waitAndClick(`div.extensions-viewlet[id="workbench.view.extensions"] .monaco-list-row[aria-label="${name}"] .extension li[class='action-item'] .extension-action.install`);
|
||||
|
||||
// we might want to wait for a while longer since the Marketplace can be slow
|
||||
// a minute should do
|
||||
await this.spectron.client.waitFor(() => this.spectron.client.click(`div.extensions-viewlet[id="workbench.view.extensions"] .monaco-list-row[aria-label="${name}"] .extension li[class='action-item'] .extension-action.install`), void 0, 'waiting for install button', 600);
|
||||
|
||||
await this.spectron.client.waitForElement(`div.extensions-viewlet[id="workbench.view.extensions"] .monaco-list-row[aria-label="${name}"] .extension li[class='action-item'] .extension-action.reload`);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -145,14 +145,15 @@ export class SpectronClient {
|
||||
return this.spectron.client.getTitle();
|
||||
}
|
||||
|
||||
public async waitFor<T>(func: () => T | Promise<T | undefined>, accept?: (result: T) => boolean | Promise<boolean>, timeoutMessage?: string): Promise<T>;
|
||||
public async waitFor<T>(func: () => T | Promise<T>, accept: (result: T) => boolean | Promise<boolean> = result => !!result, timeoutMessage?: string): Promise<T> {
|
||||
public async waitFor<T>(func: () => T | Promise<T | undefined>, accept?: (result: T) => boolean | Promise<boolean>, timeoutMessage?: string, retryCount?: number): Promise<T>;
|
||||
public async waitFor<T>(func: () => T | Promise<T>, accept: (result: T) => boolean | Promise<boolean> = result => !!result, timeoutMessage?: string, retryCount?: number): Promise<T> {
|
||||
let trial = 1;
|
||||
retryCount = typeof retryCount === 'number' ? retryCount : this.retryCount;
|
||||
|
||||
while (true) {
|
||||
if (trial > this.retryCount) {
|
||||
if (trial > retryCount) {
|
||||
this.application.screenCapturer.capture('timeout');
|
||||
throw new Error(`${timeoutMessage}: Timed out after ${(this.retryCount * this.retryDuration) / 1000} seconds.`);
|
||||
throw new Error(`${timeoutMessage}: Timed out after ${(retryCount * this.retryDuration) / 1000} seconds.`);
|
||||
}
|
||||
|
||||
let result;
|
||||
|
||||
Reference in New Issue
Block a user