From 18a7108073195fc491498fe89fa27b5074cc9bd1 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 30 Dec 2021 22:38:59 +0100 Subject: [PATCH] smoke - select tab over quick pick (#139944) * smoke - further try to reduce usages of quick pick * poke --- test/automation/src/code.ts | 16 ++++++++-------- test/smoke/src/areas/workbench/data-loss.test.ts | 12 +++++++----- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/test/automation/src/code.ts b/test/automation/src/code.ts index 87d26159758..2bfffd3be84 100644 --- a/test/automation/src/code.ts +++ b/test/automation/src/code.ts @@ -94,8 +94,8 @@ async function poll( acceptFn: (result: T) => boolean, logger: Logger, timeoutMessage: string, - retryCount: number = 200, - retryInterval: number = 100 // millis + retryCount = 200, + retryInterval = 100 // millis ): Promise { let trial = 1; let lastError: string = ''; @@ -174,8 +174,8 @@ export class Code { } } - async waitForWindowIds(fn: (windowIds: number[]) => boolean): Promise { - await poll(() => this.driver.getWindowIds(), fn, this.logger, `get window ids`); + async waitForWindowIds(accept: (windowIds: number[]) => boolean): Promise { + await poll(() => this.driver.getWindowIds(), accept, this.logger, `get window ids`); } async dispatchKeybinding(keybinding: string): Promise { @@ -262,9 +262,9 @@ export class Code { await poll(() => this.driver.isActiveElement(windowId, selector), r => r, this.logger, `is active element '${selector}'`, retryCount); } - async waitForTitle(fn: (title: string) => boolean): Promise { + async waitForTitle(accept: (title: string) => boolean): Promise { const windowId = await this.getActiveWindowId(); - await poll(() => this.driver.getTitle(windowId), fn, this.logger, `get title`); + await poll(() => this.driver.getTitle(windowId), accept, this.logger, `get title`); } async waitForTypeInEditor(selector: string, text: string): Promise { @@ -284,12 +284,12 @@ export class Code { async getLocaleInfo(): Promise { const windowId = await this.getActiveWindowId(); - return await this.driver.getLocaleInfo(windowId); + return this.driver.getLocaleInfo(windowId); } async getLocalizedStrings(): Promise { const windowId = await this.getActiveWindowId(); - return await this.driver.getLocalizedStrings(windowId); + return this.driver.getLocalizedStrings(windowId); } private async getActiveWindowId(): Promise { diff --git a/test/smoke/src/areas/workbench/data-loss.test.ts b/test/smoke/src/areas/workbench/data-loss.test.ts index 89883f2a062..833ab128a83 100644 --- a/test/smoke/src/areas/workbench/data-loss.test.ts +++ b/test/smoke/src/areas/workbench/data-loss.test.ts @@ -95,7 +95,7 @@ export function setup(ensureStableCode: () => string | undefined, logger: Logger await app.workbench.editors.waitForTab('readme.md', !autoSave); if (typeof restartDelay === 'number') { - // this is an OK use of a timeout in a smoke test + // this is an OK use of a timeout in a smoke test: // we want to simulate a user having typed into // the editor and pausing for a moment before // terminating @@ -105,10 +105,11 @@ export function setup(ensureStableCode: () => string | undefined, logger: Logger await app.restart(); await app.workbench.editors.waitForTab('readme.md', !autoSave); - await app.workbench.quickaccess.openFile(join(app.workspacePathOrFolder, 'readme.md')); + await app.workbench.editors.waitForTab('Untitled-1', true); + + await app.workbench.editors.selectTab('readme.md'); await app.workbench.editor.waitForEditorContents('readme.md', contents => contents.indexOf(textToType) > -1); - await app.workbench.editors.waitForTab('Untitled-1', true); await app.workbench.editors.selectTab('Untitled-1'); await app.workbench.editor.waitForEditorContents('Untitled-1', contents => contents.indexOf(textToTypeInUntitled) > -1); @@ -230,10 +231,11 @@ export function setup(ensureStableCode: () => string | undefined, logger: Logger await insidersApp.start(); await insidersApp.workbench.editors.waitForTab('readme.md', true); - await insidersApp.workbench.quickaccess.openFile(join(insidersApp.workspacePathOrFolder, 'readme.md')); + await insidersApp.workbench.editors.waitForTab('Untitled-1', true); + + await insidersApp.workbench.editors.selectTab('readme.md'); await insidersApp.workbench.editor.waitForEditorContents('readme.md', contents => contents.indexOf(textToType) > -1); - await insidersApp.workbench.editors.waitForTab('Untitled-1', true); await insidersApp.workbench.editors.selectTab('Untitled-1'); await insidersApp.workbench.editor.waitForEditorContents('Untitled-1', contents => contents.indexOf(textToTypeInUntitled) > -1);