From c249ac2caab1182ee2f596fda9648ba11af26061 Mon Sep 17 00:00:00 2001 From: Christof Marti Date: Wed, 9 May 2018 10:39:10 +0200 Subject: [PATCH] Update smoke test to Quick Input (#49340) --- test/smoke/src/areas/quickinput/quickinput.ts | 28 +++++++++++++++++++ .../src/areas/statusbar/statusbar.test.ts | 4 +-- test/smoke/src/areas/workbench/workbench.ts | 3 ++ 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 test/smoke/src/areas/quickinput/quickinput.ts diff --git a/test/smoke/src/areas/quickinput/quickinput.ts b/test/smoke/src/areas/quickinput/quickinput.ts new file mode 100644 index 0000000000000..c13b308c0d912 --- /dev/null +++ b/test/smoke/src/areas/quickinput/quickinput.ts @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { Code } from '../../vscode/code'; + +export class QuickInput { + + static QUICK_INPUT = '.quick-input-widget'; + static QUICK_INPUT_INPUT = `${QuickInput.QUICK_INPUT} .quick-input-box input`; + static QUICK_INPUT_FOCUSED_ELEMENT = `${QuickInput.QUICK_INPUT} .quick-open-tree .monaco-tree-row.focused .monaco-highlighted-label`; + + constructor(private code: Code) { } + + async closeQuickInput(): Promise { + await this.code.dispatchKeybinding('escape'); + await this.waitForQuickInputClosed(); + } + + async waitForQuickInputOpened(retryCount?: number): Promise { + await this.code.waitForActiveElement(QuickInput.QUICK_INPUT_INPUT, retryCount); + } + + private async waitForQuickInputClosed(): Promise { + await this.code.waitForElement(QuickInput.QUICK_INPUT, r => !!r && r.attributes.style.indexOf('display: none;') !== -1); + } +} diff --git a/test/smoke/src/areas/statusbar/statusbar.test.ts b/test/smoke/src/areas/statusbar/statusbar.test.ts index 9fcd47bf9b563..dfb1d7550d383 100644 --- a/test/smoke/src/areas/statusbar/statusbar.test.ts +++ b/test/smoke/src/areas/statusbar/statusbar.test.ts @@ -30,8 +30,8 @@ export function setup() { const app = this.app as Application; await app.workbench.statusbar.clickOn(StatusBarElement.BRANCH_STATUS); - await app.workbench.quickopen.waitForQuickOpenOpened(); - await app.workbench.quickopen.closeQuickOpen(); + await app.workbench.quickinput.waitForQuickInputOpened(); + await app.workbench.quickinput.closeQuickInput(); await app.workbench.quickopen.openFile('app.js'); await app.workbench.statusbar.clickOn(StatusBarElement.INDENTATION_STATUS); diff --git a/test/smoke/src/areas/workbench/workbench.ts b/test/smoke/src/areas/workbench/workbench.ts index 1e219bda869e8..661e0699a4da9 100644 --- a/test/smoke/src/areas/workbench/workbench.ts +++ b/test/smoke/src/areas/workbench/workbench.ts @@ -6,6 +6,7 @@ import { Explorer } from '../explorer/explorer'; import { ActivityBar } from '../activitybar/activityBar'; import { QuickOpen } from '../quickopen/quickopen'; +import { QuickInput } from '../quickinput/quickinput'; import { Extensions } from '../extensions/extensions'; import { Search } from '../search/search'; import { Editor } from '../editor/editor'; @@ -26,6 +27,7 @@ export interface Commands { export class Workbench { readonly quickopen: QuickOpen; + readonly quickinput: QuickInput; readonly editors: Editors; readonly explorer: Explorer; readonly activitybar: ActivityBar; @@ -43,6 +45,7 @@ export class Workbench { constructor(code: Code, userDataPath: string) { this.editors = new Editors(code); this.quickopen = new QuickOpen(code, this.editors); + this.quickinput = new QuickInput(code); this.explorer = new Explorer(code, this.editors); this.activitybar = new ActivityBar(code); this.search = new Search(code);