From fa548237beab078e757122a5cb5b2e915b43b766 Mon Sep 17 00:00:00 2001 From: Aiday Marlen Kyzy Date: Wed, 5 Mar 2025 11:38:48 +0100 Subject: [PATCH] Adding `acceptance` condition to dispatchKeybinding in smoketests (#242570) * adding code for smoke tests * adding awaits * changing wait code * renaming dispatch to send * moving comment * update to send --- test/automation/src/code.ts | 4 +-- test/automation/src/debug.ts | 21 ++++++++----- test/automation/src/editor.ts | 2 +- test/automation/src/editors.ts | 14 ++++----- test/automation/src/explorer.ts | 4 +-- test/automation/src/keybindings.ts | 14 ++++----- test/automation/src/notebook.ts | 4 +-- test/automation/src/peek.ts | 3 +- test/automation/src/playwrightDriver.ts | 12 +++++-- test/automation/src/quickaccess.ts | 31 +++++++++---------- test/automation/src/quickinput.ts | 14 ++++----- test/automation/src/scm.ts | 3 +- test/automation/src/search.ts | 15 ++++----- test/automation/src/settings.ts | 22 +++++++------ test/automation/src/task.ts | 13 ++++++-- test/automation/src/terminal.ts | 17 +++++++--- .../src/areas/preferences/preferences.test.ts | 8 ++--- test/smoke/src/areas/search/search.test.ts | 10 +++--- 18 files changed, 116 insertions(+), 95 deletions(-) diff --git a/test/automation/src/code.ts b/test/automation/src/code.ts index b297dd50a65..75b8a4980ec 100644 --- a/test/automation/src/code.ts +++ b/test/automation/src/code.ts @@ -129,8 +129,8 @@ export class Code { return await this.driver.stopTracing(name, persist); } - async dispatchKeybinding(keybinding: string): Promise { - await this.driver.dispatchKeybinding(keybinding); + async sendKeybinding(keybinding: string, accept?: () => Promise | void): Promise { + await this.driver.sendKeybinding(keybinding, accept); } async didFinishLoad(): Promise { diff --git a/test/automation/src/debug.ts b/test/automation/src/debug.ts index e2e227fc35e..43f974ebec9 100644 --- a/test/automation/src/debug.ts +++ b/test/automation/src/debug.ts @@ -58,10 +58,13 @@ export class Debug extends Viewlet { } async openDebugViewlet(): Promise { + const accept = async () => { + await this.code.waitForElement(DEBUG_VIEW); + }; if (process.platform === 'darwin') { - await this.code.dispatchKeybinding('cmd+shift+d'); + await this.code.sendKeybinding('cmd+shift+d', accept); } else { - await this.code.dispatchKeybinding('ctrl+shift+d'); + await this.code.sendKeybinding('ctrl+shift+d', accept); } await this.code.waitForElement(DEBUG_VIEW); @@ -79,9 +82,10 @@ export class Debug extends Viewlet { } async startDebugging(): Promise { - await this.code.dispatchKeybinding('f5'); - await this.code.waitForElement(PAUSE); - await this.code.waitForElement(DEBUG_STATUS_BAR); + await this.code.sendKeybinding('f5', async () => { + await this.code.waitForElement(PAUSE); + await this.code.waitForElement(DEBUG_STATUS_BAR); + }); const portPrefix = 'Port: '; const output = await this.waitForOutput(output => output.some(line => line.indexOf(portPrefix) >= 0)); @@ -135,9 +139,10 @@ export class Debug extends Viewlet { // Wait for the keys to be picked up by the editor model such that repl evaluates what just got typed await this.editor.waitForEditorContents('debug:replinput', s => s.indexOf(text) >= 0); - await this.code.dispatchKeybinding('enter'); - await this.code.waitForElements(CONSOLE_EVALUATION_RESULT, false, - elements => !!elements.length && accept(elements[elements.length - 1].textContent)); + await this.code.sendKeybinding('enter', async () => { + await this.code.waitForElements(CONSOLE_EVALUATION_RESULT, false, + elements => !!elements.length && accept(elements[elements.length - 1].textContent)); + }); } // Different node versions give different number of variables. As a workaround be more relaxed when checking for variable count diff --git a/test/automation/src/editor.ts b/test/automation/src/editor.ts index 9f5a9c90170..6587b28edaf 100644 --- a/test/automation/src/editor.ts +++ b/test/automation/src/editor.ts @@ -36,7 +36,7 @@ export class Editor { await this.code.waitForActiveElement(RENAME_INPUT); await this.code.waitForSetValue(RENAME_INPUT, to); - await this.code.dispatchKeybinding('enter'); + await this.code.sendKeybinding('enter'); } async gotoDefinition(filename: string, term: string, line: number): Promise { diff --git a/test/automation/src/editors.ts b/test/automation/src/editors.ts index 472385c8534..e147d3b69ec 100644 --- a/test/automation/src/editors.ts +++ b/test/automation/src/editors.ts @@ -12,9 +12,9 @@ export class Editors { async saveOpenedFile(): Promise { if (process.platform === 'darwin') { - await this.code.dispatchKeybinding('cmd+s'); + await this.code.sendKeybinding('cmd+s'); } else { - await this.code.dispatchKeybinding('ctrl+s'); + await this.code.sendKeybinding('ctrl+s'); } } @@ -29,10 +29,9 @@ export class Editors { let retries = 0; while (retries < 10) { await this.code.waitAndClick(`.tabs-container div.tab[data-resource-name$="${fileName}"]`); - await this.code.dispatchKeybinding(process.platform === 'darwin' ? 'cmd+1' : 'ctrl+1'); // make editor really active if click failed somehow try { - await this.waitForEditorFocus(fileName, 50 /* 50 retries * 100ms delay = 5s */); + await this.code.sendKeybinding(process.platform === 'darwin' ? 'cmd+1' : 'ctrl+1', () => this.waitForEditorFocus(fileName, 50 /* 50 retries * 100ms delay = 5s */)); return; } catch (e) { error = e; @@ -63,12 +62,11 @@ export class Editors { } async newUntitledFile(): Promise { + const accept = () => this.waitForEditorFocus('Untitled-1'); if (process.platform === 'darwin') { - await this.code.dispatchKeybinding('cmd+n'); + await this.code.sendKeybinding('cmd+n', accept); } else { - await this.code.dispatchKeybinding('ctrl+n'); + await this.code.sendKeybinding('ctrl+n', accept); } - - await this.waitForEditorFocus('Untitled-1'); } } diff --git a/test/automation/src/explorer.ts b/test/automation/src/explorer.ts index 2c1e2eeec28..48cca3f02de 100644 --- a/test/automation/src/explorer.ts +++ b/test/automation/src/explorer.ts @@ -17,9 +17,9 @@ export class Explorer extends Viewlet { async openExplorerView(): Promise { if (process.platform === 'darwin') { - await this.code.dispatchKeybinding('cmd+shift+e'); + await this.code.sendKeybinding('cmd+shift+e'); } else { - await this.code.dispatchKeybinding('ctrl+shift+e'); + await this.code.sendKeybinding('ctrl+shift+e'); } } diff --git a/test/automation/src/keybindings.ts b/test/automation/src/keybindings.ts index 9b7babfac4f..82bfcdd1fe3 100644 --- a/test/automation/src/keybindings.ts +++ b/test/automation/src/keybindings.ts @@ -12,10 +12,11 @@ export class KeybindingsEditor { constructor(private code: Code) { } async updateKeybinding(command: string, commandName: string | undefined, keybinding: string, keybindingTitle: string): Promise { + const accept = () => this.code.waitForActiveElement(SEARCH_INPUT); if (process.platform === 'darwin') { - await this.code.dispatchKeybinding('cmd+k cmd+s'); + await this.code.sendKeybinding('cmd+k cmd+s', accept); } else { - await this.code.dispatchKeybinding('ctrl+k ctrl+s'); + await this.code.sendKeybinding('ctrl+k ctrl+s', accept); } await this.code.waitForActiveElement(SEARCH_INPUT); @@ -24,11 +25,8 @@ export class KeybindingsEditor { const commandTitle = commandName ? `${commandName} (${command})` : command; await this.code.waitAndClick(`.keybindings-table-container .monaco-list-row .command[aria-label="${commandTitle}"]`); await this.code.waitForElement(`.keybindings-table-container .monaco-list-row.focused.selected .command[aria-label="${commandTitle}"]`); - await this.code.dispatchKeybinding('enter'); - - await this.code.waitForActiveElement('.defineKeybindingWidget .monaco-inputbox input'); - await this.code.dispatchKeybinding(keybinding); - await this.code.dispatchKeybinding('enter'); - await this.code.waitForElement(`.keybindings-table-container .keybinding-label div[aria-label="${keybindingTitle}"]`); + await this.code.sendKeybinding('enter', () => this.code.waitForActiveElement('.defineKeybindingWidget .monaco-inputbox input')); + await this.code.sendKeybinding(keybinding); + await this.code.sendKeybinding('enter', async () => { await this.code.waitForElement(`.keybindings-table-container .keybinding-label div[aria-label="${keybindingTitle}"]`); }); } } diff --git a/test/automation/src/notebook.ts b/test/automation/src/notebook.ts index cd46cbdb0dd..3ba9101a1de 100644 --- a/test/automation/src/notebook.ts +++ b/test/automation/src/notebook.ts @@ -27,7 +27,7 @@ export class Notebook { } async focusNextCell() { - await this.code.dispatchKeybinding('down'); + await this.code.sendKeybinding('down'); } async focusFirstCell() { @@ -35,7 +35,7 @@ export class Notebook { } async editCell() { - await this.code.dispatchKeybinding('enter'); + await this.code.sendKeybinding('enter'); } async stopEditingCell() { diff --git a/test/automation/src/peek.ts b/test/automation/src/peek.ts index 2c9f00c5659..59c613613c8 100644 --- a/test/automation/src/peek.ts +++ b/test/automation/src/peek.ts @@ -37,10 +37,9 @@ export class References { // Sometimes someone else eats up the `Escape` key let count = 0; while (true) { - await this.code.dispatchKeybinding('escape'); try { - await this.code.waitForElement(References.REFERENCES_WIDGET, el => !el, 10); + await this.code.sendKeybinding('escape', async () => { await this.code.waitForElement(References.REFERENCES_WIDGET, el => !el, 10); }); return; } catch (err) { if (++count > 5) { diff --git a/test/automation/src/playwrightDriver.ts b/test/automation/src/playwrightDriver.ts index dbde9955766..018fe7c351a 100644 --- a/test/automation/src/playwrightDriver.ts +++ b/test/automation/src/playwrightDriver.ts @@ -229,7 +229,7 @@ export class PlaywrightDriver { } } - async dispatchKeybinding(keybinding: string) { + async sendKeybinding(keybinding: string, accept?: () => Promise | void) { const chords = keybinding.split(' '); for (let i = 0; i < chords.length; i++) { const chord = chords[i]; @@ -256,7 +256,9 @@ export class PlaywrightDriver { } } - await this.wait(100); + if (accept) { + await accept(); + } } async click(selector: string, xoffset?: number | undefined, yoffset?: number | undefined) { @@ -317,7 +319,7 @@ export class PlaywrightDriver { } wait(ms: number): Promise { - return new Promise(resolve => setTimeout(resolve, ms)); + return wait(ms); } whenWorkbenchRestored(): Promise { @@ -328,3 +330,7 @@ export class PlaywrightDriver { return this.page.evaluateHandle('window.driver'); } } + +export function wait(ms: number): Promise { + return new Promise(resolve => setTimeout(resolve, ms)); +} diff --git a/test/automation/src/quickaccess.ts b/test/automation/src/quickaccess.ts index 5d94a96f1c4..da838493d6b 100644 --- a/test/automation/src/quickaccess.ts +++ b/test/automation/src/quickaccess.ts @@ -137,22 +137,21 @@ export class QuickAccess { // Other parts of code might steal focus away from quickinput :( while (retries < 5) { - // Open via keybinding - switch (kind) { - case QuickAccessKind.Files: - await this.code.dispatchKeybinding(process.platform === 'darwin' ? 'cmd+p' : 'ctrl+p'); - break; - case QuickAccessKind.Symbols: - await this.code.dispatchKeybinding(process.platform === 'darwin' ? 'cmd+shift+o' : 'ctrl+shift+o'); - break; - case QuickAccessKind.Commands: - await this.code.dispatchKeybinding(process.platform === 'darwin' ? 'cmd+shift+p' : 'ctrl+shift+p'); - break; - } - - // Await for quick input widget opened try { - await this.quickInput.waitForQuickInputOpened(10); + // Await for quick input widget opened + const accept = () => this.quickInput.waitForQuickInputOpened(10); + // Open via keybinding + switch (kind) { + case QuickAccessKind.Files: + await this.code.sendKeybinding(process.platform === 'darwin' ? 'cmd+p' : 'ctrl+p', accept); + break; + case QuickAccessKind.Symbols: + await this.code.sendKeybinding(process.platform === 'darwin' ? 'cmd+shift+o' : 'ctrl+shift+o', accept); + break; + case QuickAccessKind.Commands: + await this.code.sendKeybinding(process.platform === 'darwin' ? 'cmd+shift+p' : 'ctrl+shift+p', accept); + break; + } break; } catch (err) { if (++retries > 5) { @@ -160,7 +159,7 @@ export class QuickAccess { } // Retry - await this.code.dispatchKeybinding('escape'); + await this.code.sendKeybinding('escape'); } } diff --git a/test/automation/src/quickinput.ts b/test/automation/src/quickinput.ts index 2fc3db3a9c6..b83703f72d6 100644 --- a/test/automation/src/quickinput.ts +++ b/test/automation/src/quickinput.ts @@ -34,8 +34,7 @@ export class QuickInput { } async closeQuickInput(): Promise { - await this.code.dispatchKeybinding('escape'); - await this.waitForQuickInputClosed(); + await this.code.sendKeybinding('escape', () => this.waitForQuickInputClosed()); } async waitForQuickInputElements(accept: (names: string[]) => boolean): Promise { @@ -49,11 +48,12 @@ export class QuickInput { async selectQuickInputElement(index: number, keepOpen?: boolean): Promise { await this.waitForQuickInputOpened(); for (let from = 0; from < index; from++) { - await this.code.dispatchKeybinding('down'); - } - await this.code.dispatchKeybinding('enter'); - if (!keepOpen) { - await this.waitForQuickInputClosed(); + await this.code.sendKeybinding('down'); } + await this.code.sendKeybinding('enter', async () => { + if (!keepOpen) { + await this.waitForQuickInputClosed(); + } + }); } } diff --git a/test/automation/src/scm.ts b/test/automation/src/scm.ts index 6489badbe8a..2277bcb2875 100644 --- a/test/automation/src/scm.ts +++ b/test/automation/src/scm.ts @@ -45,8 +45,7 @@ export class SCM extends Viewlet { } async openSCMViewlet(): Promise { - await this.code.dispatchKeybinding('ctrl+shift+g'); - await this.code.waitForElement(this._editContextSelector()); + await this.code.sendKeybinding('ctrl+shift+g', async () => { await this.code.waitForElement(this._editContextSelector()); }); } async waitForChange(name: string, type?: string): Promise { diff --git a/test/automation/src/search.ts b/test/automation/src/search.ts index 5cf6018b72a..b4f205d8f82 100644 --- a/test/automation/src/search.ts +++ b/test/automation/src/search.ts @@ -40,13 +40,12 @@ export class Search extends Viewlet { } async openSearchViewlet(): Promise { + const accept = () => this.waitForInputFocus(INPUT); if (process.platform === 'darwin') { - await this.code.dispatchKeybinding('cmd+shift+f'); + await this.code.sendKeybinding('cmd+shift+f', accept); } else { - await this.code.dispatchKeybinding('ctrl+shift+f'); + await this.code.sendKeybinding('ctrl+shift+f', accept); } - - await this.waitForInputFocus(INPUT); } async getSearchTooltip(): Promise { @@ -69,18 +68,16 @@ export class Search extends Viewlet { } async waitForPageUp(): Promise { - await this.code.dispatchKeybinding('PageUp'); + await this.code.sendKeybinding('PageUp'); } async waitForPageDown(): Promise { - await this.code.dispatchKeybinding('PageDown'); + await this.code.sendKeybinding('PageDown'); } async submitSearch(): Promise { await this.waitForInputFocus(INPUT); - - await this.code.dispatchKeybinding('enter'); - await this.code.waitForElement(`${VIEWLET} .messages`); + await this.code.sendKeybinding('enter', async () => { await this.code.waitForElement(`${VIEWLET} .messages`); }); } async setFilesToIncludeText(text: string): Promise { diff --git a/test/automation/src/settings.ts b/test/automation/src/settings.ts index 2ade8b4a9af..319f4b0b236 100644 --- a/test/automation/src/settings.ts +++ b/test/automation/src/settings.ts @@ -24,8 +24,8 @@ export class SettingsEditor { async addUserSetting(setting: string, value: string): Promise { await this.openUserSettingsFile(); - await this.code.dispatchKeybinding('right'); - await this.editor.waitForEditorSelection('settings.json', (s) => this._acceptEditorSelection(this.code.quality, s)); + await this.code.sendKeybinding('right', () => + this.editor.waitForEditorSelection('settings.json', (s) => this._acceptEditorSelection(this.code.quality, s))); await this.editor.waitForTypeInEditor('settings.json', `"${setting}": ${value},`); await this.editors.saveOpenedFile(); } @@ -39,8 +39,8 @@ export class SettingsEditor { async addUserSettings(settings: [key: string, value: string][]): Promise { await this.openUserSettingsFile(); - await this.code.dispatchKeybinding('right'); - await this.editor.waitForEditorSelection('settings.json', (s) => this._acceptEditorSelection(this.code.quality, s)); + await this.code.sendKeybinding('right', () => + this.editor.waitForEditorSelection('settings.json', (s) => this._acceptEditorSelection(this.code.quality, s))); await this.editor.waitForTypeInEditor('settings.json', settings.map(v => `"${v[0]}": ${v[1]},`).join('')); await this.editors.saveOpenedFile(); } @@ -48,8 +48,9 @@ export class SettingsEditor { async clearUserSettings(): Promise { await this.openUserSettingsFile(); await this.quickaccess.runCommand('editor.action.selectAll'); - await this.code.dispatchKeybinding('Delete'); - await this.editor.waitForEditorContents('settings.json', contents => contents === ''); + await this.code.sendKeybinding('Delete', async () => { + await this.editor.waitForEditorContents('settings.json', contents => contents === ''); + }); await this.editor.waitForTypeInEditor('settings.json', `{`); // will auto close } await this.editors.saveOpenedFile(); await this.quickaccess.runCommand('workbench.action.closeActiveEditor'); @@ -70,12 +71,13 @@ export class SettingsEditor { await this.code.waitAndClick(this._editContextSelector()); if (process.platform === 'darwin') { - await this.code.dispatchKeybinding('cmd+a'); + await this.code.sendKeybinding('cmd+a'); } else { - await this.code.dispatchKeybinding('ctrl+a'); + await this.code.sendKeybinding('ctrl+a'); } - await this.code.dispatchKeybinding('Delete'); - await this.code.waitForElements('.settings-editor .settings-count-widget', false, results => !results || (results?.length === 1 && !results[0].textContent)); + await this.code.sendKeybinding('Delete', async () => { + await this.code.waitForElements('.settings-editor .settings-count-widget', false, results => !results || (results?.length === 1 && !results[0].textContent)); + }); await this.code.waitForTypeInEditor(this._editContextSelector(), query); await this.code.waitForElements('.settings-editor .settings-count-widget', false, results => results?.length === 1 && results[0].textContent.includes('Found')); } diff --git a/test/automation/src/task.ts b/test/automation/src/task.ts index ab95e9947d5..74ffa3f5ff0 100644 --- a/test/automation/src/task.ts +++ b/test/automation/src/task.ts @@ -9,6 +9,7 @@ import { QuickAccess } from './quickaccess'; import { Editors } from './editors'; import { QuickInput } from './quickinput'; import { Terminal } from './terminal'; +import { wait } from './playwrightDriver'; interface ITaskConfigurationProperties { label?: string; @@ -33,7 +34,9 @@ export class Task { } async assertTasks(filter: string, expected: ITaskConfigurationProperties[], type: 'run' | 'configure') { - await this.code.dispatchKeybinding('right'); + await this.code.sendKeybinding('right'); + // TODO https://github.com/microsoft/vscode/issues/242535 + await wait(100); await this.editors.saveOpenedFile(); type === 'run' ? await this.quickaccess.runCommand('workbench.action.tasks.runTask', { keepOpen: true }) : await this.quickaccess.runCommand('workbench.action.tasks.configureTask', { keepOpen: true }); if (expected.length === 0) { @@ -57,7 +60,9 @@ export class Task { await this.quickaccess.openFileQuickAccessAndWait('tasks.json', 'tasks.json'); await this.quickinput.selectQuickInputElement(0); await this.quickaccess.runCommand('editor.action.selectAll'); - await this.code.dispatchKeybinding('Delete'); + await this.code.sendKeybinding('Delete'); + // TODO https://github.com/microsoft/vscode/issues/242535 + await wait(100); const taskStringLines: string[] = [ '{', // Brackets auto close '"version": "2.0.0",', @@ -78,7 +83,9 @@ export class Task { for (const [i, line] of taskStringLines.entries()) { await this.editor.waitForTypeInEditor('tasks.json', `${line}`); if (i !== taskStringLines.length - 1) { - await this.code.dispatchKeybinding('Enter'); + await this.code.sendKeybinding('Enter'); + // TODO https://github.com/microsoft/vscode/issues/242535 + await wait(100); } } await this.editors.saveOpenedFile(); diff --git a/test/automation/src/terminal.ts b/test/automation/src/terminal.ts index 1b3ecc7cdfa..214ca824f7c 100644 --- a/test/automation/src/terminal.ts +++ b/test/automation/src/terminal.ts @@ -7,6 +7,7 @@ import { QuickInput } from './quickinput'; import { Code } from './code'; import { QuickAccess } from './quickaccess'; import { IElement } from './driver'; +import { wait } from './playwrightDriver'; export enum Selector { TerminalView = `#terminal`, @@ -82,7 +83,9 @@ export class Terminal { const keepOpen = commandId === TerminalCommandId.Join; await this.quickaccess.runCommand(commandId, { keepOpen }); if (keepOpen) { - await this.code.dispatchKeybinding('enter'); + await this.code.sendKeybinding('enter'); + // TODO https://github.com/microsoft/vscode/issues/242535 + await wait(100); await this.quickinput.waitForQuickInputClosed(); } switch (commandId) { @@ -117,10 +120,14 @@ export class Terminal { await this.quickinput.type(value); } else if (commandId === TerminalCommandIdWithValue.Rename) { // Reset - await this.code.dispatchKeybinding('Backspace'); + await this.code.sendKeybinding('Backspace'); + // TODO https://github.com/microsoft/vscode/issues/242535 + await wait(100); } await this.code.wait(100); - await this.code.dispatchKeybinding(altKey ? 'Alt+Enter' : 'enter'); + await this.code.sendKeybinding(altKey ? 'Alt+Enter' : 'enter'); + // TODO https://github.com/microsoft/vscode/issues/242535 + await wait(100); await this.quickinput.waitForQuickInputClosed(); if (commandId === TerminalCommandIdWithValue.NewWithProfile) { await this._waitForTerminal(); @@ -130,7 +137,9 @@ export class Terminal { async runCommandInTerminal(commandText: string, skipEnter?: boolean): Promise { await this.code.writeInTerminal(Selector.Xterm, commandText); if (!skipEnter) { - await this.code.dispatchKeybinding('enter'); + await this.code.sendKeybinding('enter'); + // TODO https://github.com/microsoft/vscode/issues/242535 + await wait(100); } } diff --git a/test/smoke/src/areas/preferences/preferences.test.ts b/test/smoke/src/areas/preferences/preferences.test.ts index 02d5cdeac05..a8f620e7196 100644 --- a/test/smoke/src/areas/preferences/preferences.test.ts +++ b/test/smoke/src/areas/preferences/preferences.test.ts @@ -29,8 +29,7 @@ export function setup(logger: Logger) { await app.workbench.keybindingsEditor.updateKeybinding('workbench.action.toggleSidebarPosition', 'View: Toggle Primary Side Bar Position', 'ctrl+u', 'Control+U'); - await app.code.dispatchKeybinding('ctrl+u'); - await app.workbench.activitybar.waitForActivityBar(ActivityBarPosition.RIGHT); + await app.code.sendKeybinding('ctrl+u', () => app.workbench.activitybar.waitForActivityBar(ActivityBarPosition.RIGHT)); }); }); @@ -53,8 +52,9 @@ export function setup(logger: Logger) { const app = this.app as Application; await app.workbench.editors.newUntitledFile(); - await app.code.dispatchKeybinding('enter'); - await app.code.waitForElements('.line-numbers', false, elements => !!elements.length); + await app.code.sendKeybinding('enter', async () => { + await app.code.waitForElements('.line-numbers', false, elements => !!elements.length); + }); // Turn off line numbers await app.workbench.settingsEditor.searchSettingsUI('editor.lineNumbers'); diff --git a/test/smoke/src/areas/search/search.test.ts b/test/smoke/src/areas/search/search.test.ts index 78f79b61838..d0768f7b087 100644 --- a/test/smoke/src/areas/search/search.test.ts +++ b/test/smoke/src/areas/search/search.test.ts @@ -23,11 +23,13 @@ export function setup(logger: Logger) { const app = this.app as Application; await app.workbench.search.openSearchViewlet(); - await app.code.dispatchKeybinding('PageUp'); - await app.workbench.search.hasActivityBarMoved(); + await app.code.sendKeybinding('PageUp', async () => { + await app.workbench.search.hasActivityBarMoved(); + }); - await app.code.dispatchKeybinding('PageUp'); - await app.workbench.search.hasActivityBarMoved(); + await app.code.sendKeybinding('PageUp', async () => { + await app.workbench.search.hasActivityBarMoved(); + }); }); it('searches for body & checks for correct result number', async function () {