From fb8dc11d586fe92633ac3342c8dc05aa49dc6070 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 21 Apr 2022 18:58:44 +0200 Subject: [PATCH] Failed IPC communication with `playwright` smoke tests from preload script (for #146785) --- test/automation/src/application.ts | 25 +------------- .../src/areas/extensions/extensions.test.ts | 19 +++++------ .../src/areas/workbench/localization.test.ts | 34 ++++++++----------- 3 files changed, 24 insertions(+), 54 deletions(-) diff --git a/test/automation/src/application.ts b/test/automation/src/application.ts index 675915bd26caf..c65f1cfd70129 100644 --- a/test/automation/src/application.ts +++ b/test/automation/src/application.ts @@ -115,7 +115,7 @@ export class Application { private async checkWindowReady(code: Code): Promise { // We need a rendered workbench - await this.checkWorkbenchReady(code); + await measureAndLog(code.waitForElement('.monaco-workbench'), 'Application#checkWindowReady: wait for .monaco-workbench element', this.logger); // Remote but not web: wait for a remote connection state change if (this.remote) { @@ -134,27 +134,4 @@ export class Application { }, 300 /* = 30s of retry */), 'Application#checkWindowReady: wait for remote indicator', this.logger); } } - - private async checkWorkbenchReady(code: Code): Promise { - - // Web / Legacy: just poll for workbench element - if (this.web) { - await measureAndLog(code.waitForElement('.monaco-workbench'), 'Application#checkWindowReady: wait for .monaco-workbench element', this.logger); - } - - // Desktop (playwright): we see hangs, where IPC messages - // are not delivered (https://github.com/microsoft/vscode/issues/146785) - // Workaround is to try to reload the window when that happens - else { - try { - await measureAndLog(code.waitForElement('.monaco-workbench', undefined, 100 /* 10s of retry */), 'Application#checkWindowReady: wait for .monaco-workbench element', this.logger); - } catch (error) { - this.logger.log(`checkWindowReady: giving up after 10s, reloading window and trying again...`); - - await code.driver.reload(); - - return this.checkWorkbenchReady(code); - } - } - } } diff --git a/test/smoke/src/areas/extensions/extensions.test.ts b/test/smoke/src/areas/extensions/extensions.test.ts index de5b4fa91c6b4..7a4875bcd7f86 100644 --- a/test/smoke/src/areas/extensions/extensions.test.ts +++ b/test/smoke/src/areas/extensions/extensions.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { Application, Logger } from '../../../../automation'; -import { installAllHandlers, retryWithRestart } from '../../utils'; +import { installAllHandlers } from '../../utils'; export function setup(logger: Logger) { describe('Extensions', () => { @@ -13,19 +13,16 @@ export function setup(logger: Logger) { installAllHandlers(logger); it('install and enable vscode-smoketest-check extension', async function () { - this.timeout(2 * 60 * 1000); // https://github.com/microsoft/vscode/issues/146800 - const app = this.app as Application; - await retryWithRestart(app, async () => { - await app.workbench.extensions.openExtensionsViewlet(); - await app.workbench.extensions.installExtension('ms-vscode.vscode-smoketest-check', true); - // Close extension editor because keybindings dispatch is not working when web views are opened and focused - // https://github.com/microsoft/vscode/issues/110276 - await app.workbench.extensions.closeExtension('vscode-smoketest-check'); + await app.workbench.extensions.openExtensionsViewlet(); + await app.workbench.extensions.installExtension('ms-vscode.vscode-smoketest-check', true); + + // Close extension editor because keybindings dispatch is not working when web views are opened and focused + // https://github.com/microsoft/vscode/issues/110276 + await app.workbench.extensions.closeExtension('vscode-smoketest-check'); - await app.workbench.quickaccess.runCommand('Smoke Test Check'); - }); + await app.workbench.quickaccess.runCommand('Smoke Test Check'); }); }); } diff --git a/test/smoke/src/areas/workbench/localization.test.ts b/test/smoke/src/areas/workbench/localization.test.ts index 2b8704b72ffb5..be81bb17d4c33 100644 --- a/test/smoke/src/areas/workbench/localization.test.ts +++ b/test/smoke/src/areas/workbench/localization.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { Logger, Application } from '../../../../automation'; -import { installAllHandlers, retryWithRestart } from '../../utils'; +import { installAllHandlers } from '../../utils'; export function setup(logger: Logger) { @@ -14,30 +14,26 @@ export function setup(logger: Logger) { installAllHandlers(logger); it('starts with "DE" locale and verifies title and viewlets text is in German', async function () { - this.timeout(2 * 60 * 1000); // https://github.com/microsoft/vscode/issues/146800 - const app = this.app as Application; - await retryWithRestart(app, async () => { - await app.workbench.extensions.openExtensionsViewlet(); - await app.workbench.extensions.installExtension('ms-ceintl.vscode-language-pack-de', false); - await app.restart({ extraArgs: ['--locale=DE'] }); + await app.workbench.extensions.openExtensionsViewlet(); + await app.workbench.extensions.installExtension('ms-ceintl.vscode-language-pack-de', false); + await app.restart({ extraArgs: ['--locale=DE'] }); - const result = await app.workbench.localization.getLocalizedStrings(); - const localeInfo = await app.workbench.localization.getLocaleInfo(); + const result = await app.workbench.localization.getLocalizedStrings(); + const localeInfo = await app.workbench.localization.getLocaleInfo(); - if (localeInfo.locale === undefined || localeInfo.locale.toLowerCase() !== 'de') { - throw new Error(`The requested locale for VS Code was not German. The received value is: ${localeInfo.locale === undefined ? 'not set' : localeInfo.locale}`); - } + if (localeInfo.locale === undefined || localeInfo.locale.toLowerCase() !== 'de') { + throw new Error(`The requested locale for VS Code was not German. The received value is: ${localeInfo.locale === undefined ? 'not set' : localeInfo.locale}`); + } - if (localeInfo.language.toLowerCase() !== 'de') { - throw new Error(`The UI language is not German. It is ${localeInfo.language}`); - } + if (localeInfo.language.toLowerCase() !== 'de') { + throw new Error(`The UI language is not German. It is ${localeInfo.language}`); + } - if (result.open.toLowerCase() !== 'öffnen' || result.close.toLowerCase() !== 'schließen' || result.find.toLowerCase() !== 'finden') { - throw new Error(`Received wrong German localized strings: ${JSON.stringify(result, undefined, 0)}`); - } - }); + if (result.open.toLowerCase() !== 'öffnen' || result.close.toLowerCase() !== 'schließen' || result.find.toLowerCase() !== 'finden') { + throw new Error(`Received wrong German localized strings: ${JSON.stringify(result, undefined, 0)}`); + } }); }); }