Files
azuredatastudio/test/automation/src/quickinput.ts
Lewis Sanchez 1d28f838a0 Reenable disabled smoke and integration tests (#23976)
* Smoke tests run locally

* Re-enable smoke tests for pipeline

* Resolves merge conflict with distro

* Runs smoke tests with xvfb

* Updates distro commit hash to fix merge conflict

* Install xvfb

* Install xvfb for fail on error

* Removing log path temporarily

* Clarifies edit comments

* Darwin SQL build publishes log files

* Resolve merge conflicts

* Revert "Resolve merge conflicts"

This reverts commit fb53d5662745d4ba5c897be0b0c9eb2ed093a38e.

* Update distro hash

* List all files to find full product.json path

* Fix script

* Fix script

* Adjust test path for arm64

* List all files for darwin

* always list all files

* Specify Darwin logs directory

* Adjust publish log files condition

* Fix condition

* Removes apt from script

* Add missing import

* Fix issues stopping smoke tests from running

* Disables failing tests

* Updates distro hash

* Remove list all files scripts

* Clean up

* Update distro hash
2023-07-26 10:39:30 -07:00

67 lines
2.7 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Code } from './code';
export class QuickInput {
private static QUICK_INPUT = '.quick-input-widget';
private static QUICK_INPUT_INPUT = `${QuickInput.QUICK_INPUT} .quick-input-box input`;
private static QUICK_INPUT_ROW = `${QuickInput.QUICK_INPUT} .quick-input-list .monaco-list-row`;
private static QUICK_INPUT_FOCUSED_ELEMENT = `${QuickInput.QUICK_INPUT_ROW}.focused .monaco-highlighted-label`;
// Note: this only grabs the label and not the description or detail
private static QUICK_INPUT_ENTRY_LABEL = `${QuickInput.QUICK_INPUT_ROW} .quick-input-list-row > .monaco-icon-label .label-name`;
private static QUICK_INPUT_ENTRY_LABEL_SPAN = `${QuickInput.QUICK_INPUT_ROW} .monaco-highlighted-label`;
constructor(private code: Code) { }
// {{SQL CARBON EDIT}} - defined submit
async submit(text: string): Promise<void> {
await this.code.waitForSetValue(QuickInput.QUICK_INPUT_INPUT, text);
await this.code.dispatchKeybinding('enter');
await this.waitForQuickInputClosed();
}
async waitForQuickInputOpened(retryCount?: number): Promise<void> {
await this.code.waitForActiveElement(QuickInput.QUICK_INPUT_INPUT, retryCount);
}
async type(value: string): Promise<void> {
await this.code.waitForSetValue(QuickInput.QUICK_INPUT_INPUT, value);
}
async waitForQuickInputElementFocused(): Promise<void> {
await this.code.waitForTextContent(QuickInput.QUICK_INPUT_FOCUSED_ELEMENT);
}
async waitForQuickInputElementText(): Promise<string> {
return this.code.waitForTextContent(QuickInput.QUICK_INPUT_ENTRY_LABEL_SPAN);
}
async closeQuickInput(): Promise<void> {
await this.code.dispatchKeybinding('escape');
await this.waitForQuickInputClosed();
}
async waitForQuickInputElements(accept: (names: string[]) => boolean): Promise<void> {
await this.code.waitForElements(QuickInput.QUICK_INPUT_ENTRY_LABEL, false, els => accept(els.map(e => e.textContent)));
}
async waitForQuickInputClosed(): Promise<void> {
await this.code.waitForElement(QuickInput.QUICK_INPUT, r => !!r && r.attributes.style.indexOf('display: none;') !== -1);
}
async selectQuickInputElement(index: number, keepOpen?: boolean): Promise<void> {
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();
}
}
}