Skip to content

Commit

Permalink
Failed IPC communication with playwright smoke tests from preload s…
Browse files Browse the repository at this point in the history
…cript (for #146785)
  • Loading branch information
bpasero committed Apr 21, 2022
1 parent 88e0a4a commit fb8dc11
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 54 deletions.
25 changes: 1 addition & 24 deletions test/automation/src/application.ts
Expand Up @@ -115,7 +115,7 @@ export class Application {
private async checkWindowReady(code: Code): Promise<void> {

// 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) {
Expand All @@ -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<void> {

// 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);
}
}
}
}
19 changes: 8 additions & 11 deletions test/smoke/src/areas/extensions/extensions.test.ts
Expand Up @@ -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', () => {
Expand All @@ -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');
});
});
}
34 changes: 15 additions & 19 deletions test/smoke/src/areas/workbench/localization.test.ts
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import { Logger, Application } from '../../../../automation';
import { installAllHandlers, retryWithRestart } from '../../utils';
import { installAllHandlers } from '../../utils';

export function setup(logger: Logger) {

Expand All @@ -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)}`);
}
});
});
}

0 comments on commit fb8dc11

Please sign in to comment.