mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-22 01:25:38 -05:00
Alanren/integration test (#3657)
* add an extension for integration tests * setup ads before running test * test setup * test cases * bash script * shorter temp folder name * code cleanup * add commented out original code * fix test error * test result path * rename results file * change file path * report smoke test results * test stablize * test stablization and configurable test servers * fix smoke test error * connection provider * simplify the integration test script * add comment * fix tslint error * address PR comments * add temp log to check whether the environment variable is already set * remove temp log * move api definition to testapi typing file * exclude integration tests extension * address comments
This commit is contained in:
51
test/smoke/src/sql/connectionDialog/connectionDialog.ts
Normal file
51
test/smoke/src/sql/connectionDialog/connectionDialog.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* 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 '../../vscode/code';
|
||||
import { waitForNewDialog, clickDialogButton } from '../sqlutils';
|
||||
import { TestServerProfile, AuthenticationType } from '../testConfig';
|
||||
|
||||
const CONNECTION_DIALOG_TITLE = 'Connection';
|
||||
const CONNECTION_DIALOG_SELECTOR: string = '.modal-dialog .modal-content .modal-body .connection-dialog';
|
||||
const CONNECTION_DETAIL_CONTROL_SELECTOR: string = '.connection-type .connection-table .connection-input';
|
||||
|
||||
const SERVER_INPUT_ARIA_LABEL = 'Server';
|
||||
const USERNAME_INPUT_ARIA_LABEL = 'User name';
|
||||
const PASSWORD_INPUT_ARIA_LABEL = 'Password';
|
||||
const AUTH_TYPE_ARIA_LABEL = 'Authentication type';
|
||||
|
||||
const CONNECT_BUTTON_ARIA_LABEL = 'Connect';
|
||||
|
||||
export class ConnectionDialog {
|
||||
|
||||
constructor(private code: Code) { }
|
||||
|
||||
async waitForConnectionDialog(): Promise<void> {
|
||||
await waitForNewDialog(this.code, CONNECTION_DIALOG_TITLE);
|
||||
}
|
||||
|
||||
async connect(profile: TestServerProfile): Promise<void> {
|
||||
await this.code.waitForSetValue(this.getInputCssSelector(SERVER_INPUT_ARIA_LABEL), profile.serverName);
|
||||
if (profile.authenticationType === AuthenticationType.SqlLogin) {
|
||||
await this.code.waitAndClick(this.getSelectCssSelector(AUTH_TYPE_ARIA_LABEL));
|
||||
await this.selectAuthType(profile.authenticationTypeDisplayName);
|
||||
await this.code.waitForSetValue(this.getInputCssSelector(USERNAME_INPUT_ARIA_LABEL), profile.userName);
|
||||
await this.code.waitForSetValue(this.getInputCssSelector(PASSWORD_INPUT_ARIA_LABEL), profile.password);
|
||||
}
|
||||
await clickDialogButton(this.code, CONNECT_BUTTON_ARIA_LABEL);
|
||||
}
|
||||
|
||||
private getInputCssSelector(ariaLabel: string): string {
|
||||
return `${CONNECTION_DIALOG_SELECTOR} ${CONNECTION_DETAIL_CONTROL_SELECTOR} .monaco-inputbox input[aria-label="${ariaLabel}"]`;
|
||||
}
|
||||
|
||||
private getSelectCssSelector(ariaLabel: string): string {
|
||||
return `${CONNECTION_DIALOG_SELECTOR} ${CONNECTION_DETAIL_CONTROL_SELECTOR} select[aria-label="${ariaLabel}"]`;
|
||||
}
|
||||
|
||||
private async selectAuthType(authType: string) {
|
||||
await this.code.waitAndClick(`.context-view.bottom.left .monaco-select-box-dropdown-container .select-box-dropdown-list-container .monaco-list .monaco-scrollable-element .monaco-list-rows div[aria-label="${authType}"][class*="monaco-list-row"]`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user