Smoke test fail on all platforms (fix #147749)

This commit is contained in:
Benjamin Pasero 2022-04-20 17:36:10 +02:00
parent 5ca4d13b40
commit 21cc113c82
No known key found for this signature in database
GPG key ID: E6380CC4C8219E65

View file

@ -8,6 +8,7 @@ import { Disposable } from 'vs/base/common/lifecycle';
import { IConfirmation, IConfirmationResult, IDialogOptions, IDialogService, IInput, IInputResult, IShowResult } from 'vs/platform/dialogs/common/dialogs';
import { DialogsModel } from 'vs/workbench/common/dialogs';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
export class DialogService extends Disposable implements IDialogService {
@ -19,25 +20,53 @@ export class DialogService extends Disposable implements IDialogService {
readonly onDidShowDialog = this.model.onDidShowDialog;
constructor(@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService) {
super();
}
private skipDialogs(): boolean {
if (this.environmentService.isExtensionDevelopment && this.environmentService.extensionTestsLocationURI) {
return true; // integration tests
}
return !!this.environmentService.enableSmokeTestDriver; // smoke tests
}
async confirm(confirmation: IConfirmation): Promise<IConfirmationResult> {
if (this.skipDialogs()) {
return { confirmed: true };
}
const handle = this.model.show({ confirmArgs: { confirmation } });
return await handle.result as IConfirmationResult;
}
async show(severity: Severity, message: string, buttons?: string[], options?: IDialogOptions): Promise<IShowResult> {
if (this.skipDialogs()) {
throw new Error('Dialogs are disabled in tests');
}
const handle = this.model.show({ showArgs: { severity, message, buttons, options } });
return await handle.result as IShowResult;
}
async input(severity: Severity, message: string, buttons: string[], inputs: IInput[], options?: IDialogOptions): Promise<IInputResult> {
if (this.skipDialogs()) {
throw new Error('Dialogs are disabled in tests');
}
const handle = this.model.show({ inputArgs: { severity, message, buttons, inputs, options } });
return await handle.result as IInputResult;
}
async about(): Promise<void> {
if (this.skipDialogs()) {
throw new Error('Dialogs are disabled in tests');
}
const handle = this.model.show({});
await handle.result;
}