From 8b6e4033d3f3efd7dd85bd9894bdbac657219b3c Mon Sep 17 00:00:00 2001 From: Jean Pierre Date: Sat, 4 Sep 2021 14:29:39 +0000 Subject: [PATCH] Add web worker extension test --- resources/server/web.sh | 12 +++++++--- test/automation/src/extensions.ts | 6 +++++ test/automation/src/playwrightDriver.ts | 3 ++- .../src/areas/extensions/extensions.test.ts | 23 ++++++++++++++++--- 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/resources/server/web.sh b/resources/server/web.sh index 51a30aa8d5370..0a9e41d4e9e21 100755 --- a/resources/server/web.sh +++ b/resources/server/web.sh @@ -1,5 +1,11 @@ -#!/usr/bin/env sh -ROOT=$(dirname $(dirname "$(dirname "$0")")) +#!/usr/bin/env bash + +if [[ "$OSTYPE" == "darwin"* ]]; then + realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; } + ROOT=$(dirname $(dirname $(dirname $(realpath "$0")))) +else + ROOT=$(dirname $(dirname $(dirname $(readlink -f $0)))) +fi SERVER_SCRIPT="$ROOT/out/server.js" -node "$SERVER_SCRIPT" "$@" +exec /usr/bin/env node "$SERVER_SCRIPT" "$@" diff --git a/test/automation/src/extensions.ts b/test/automation/src/extensions.ts index 3e71563a2025f..47d4b24cda03e 100644 --- a/test/automation/src/extensions.ts +++ b/test/automation/src/extensions.ts @@ -27,6 +27,12 @@ export class Extensions extends Viewlet { async searchForExtension(id: string): Promise { await this.code.waitAndClick(SEARCH_BOX); await this.code.waitForActiveElement(SEARCH_BOX); + if (process.platform === 'darwin') { + await this.code.dispatchKeybinding('cmd+a'); + } else { + await this.code.dispatchKeybinding('ctrl+a'); + } + await this.code.dispatchKeybinding('delete'); await this.code.waitForTypeInEditor(SEARCH_BOX, `@id:${id}`); await this.code.waitForElement(`div.extensions-viewlet[id="workbench.view.extensions"] .monaco-list-row[data-extension-id="${id}"]`); } diff --git a/test/automation/src/playwrightDriver.ts b/test/automation/src/playwrightDriver.ts index ce40b6b1519bc..ea35fc05d75ef 100644 --- a/test/automation/src/playwrightDriver.ts +++ b/test/automation/src/playwrightDriver.ts @@ -29,7 +29,8 @@ const vscodeToPlaywrightKey: { [key: string]: string } = { down: 'ArrowDown', left: 'ArrowLeft', home: 'Home', - esc: 'Escape' + esc: 'Escape', + delete: 'Delete' }; let traceCounter = 1; diff --git a/test/smoke/src/areas/extensions/extensions.test.ts b/test/smoke/src/areas/extensions/extensions.test.ts index 5ee13542b00a0..81598e106179d 100644 --- a/test/smoke/src/areas/extensions/extensions.test.ts +++ b/test/smoke/src/areas/extensions/extensions.test.ts @@ -15,9 +15,9 @@ export function setup(opts: minimist.ParsedArgs) { it(`install and enable vscode-smoketest-check extension`, async function () { const app = this.app as Application; - if (app.quality === Quality.Dev) { - this.skip(); - } + // if (app.quality === Quality.Dev) { + // this.skip(); + // } await app.workbench.extensions.openExtensionsViewlet(); @@ -30,5 +30,22 @@ export function setup(opts: minimist.ParsedArgs) { await app.workbench.quickaccess.runCommand('Smoke Test Check'); }); + it(`install and enable smoketest-check-web extension in web worker`, async function () { + const app = this.app as Application; + + // if (app.quality === Quality.Dev) { + // this.skip(); + // } + + await app.workbench.extensions.openExtensionsViewlet(); + + await app.workbench.extensions.installExtension('jeanp413.smoketest-check-web', 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('smoketest-check-web'); + + await app.workbench.quickaccess.runCommand('Smoke Test Check Web'); + }); }); }