Alanren/fixsmoketest (#5019)

* fix the smoke test

* update readme

* fix the selector for server name input

* add new property to server profile engineType
This commit is contained in:
Alan Ren
2019-04-16 16:43:11 -07:00
committed by GitHub
parent 82f707ee89
commit ec47ff7479
9 changed files with 115 additions and 55 deletions

View File

@@ -9,7 +9,7 @@ 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 CONNECTION_DETAIL_CONTROL_SELECTOR: string = '.connection-provider-info .connection-table .connection-input';
const SERVER_INPUT_ARIA_LABEL = 'Server';
const USERNAME_INPUT_ARIA_LABEL = 'User name';
@@ -46,6 +46,6 @@ export class ConnectionDialog {
}
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"]`);
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 .monaco-list-row div[aria-label="${authType}"][class*="option-text"]`);
}
}

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { Application } from '../../application';
import { getDefaultTestingServer } from '../testConfig';
import { getStandaloneServer } from '../testConfig';
export function setup() {
describe('profiler test suite', () => {
@@ -12,7 +12,7 @@ export function setup() {
const app = this.app as Application;
await app.workbench.profiler.launchProfiler();
await app.workbench.connectionDialog.waitForConnectionDialog();
await app.workbench.connectionDialog.connect(await getDefaultTestingServer());
await app.workbench.connectionDialog.connect(await getStandaloneServer());
await app.workbench.profiler.waitForNewSessionDialogAndStart();
});
});

View File

@@ -18,6 +18,7 @@ interface ITestServerProfile {
database: string;
provider: ConnectionProvider;
version: string;
engineType: EngineType;
}
interface INameDisplayNamePair {
@@ -34,6 +35,12 @@ export enum ConnectionProvider {
SQLServer
}
export enum EngineType {
Standalone,
Azure,
BigDataCluster
}
var connectionProviderMapping = {};
var authenticationTypeMapping = {};
connectionProviderMapping[ConnectionProvider.SQLServer] = { name: 'MSSQL', displayName: 'Microsoft SQL Server' };
@@ -41,6 +48,22 @@ connectionProviderMapping[ConnectionProvider.SQLServer] = { name: 'MSSQL', displ
authenticationTypeMapping[AuthenticationType.SqlLogin] = { name: 'SqlLogin', displayName: 'SQL Login' };
authenticationTypeMapping[AuthenticationType.Windows] = { name: 'Integrated', displayName: 'Windows Authentication' };
export function getConfigValue(name: string): string {
let configValue = process.env[name];
return configValue ? configValue.toString() : '';
}
export const EnvironmentVariable_BDC_SERVER: string = 'BDC_BACKEND_HOSTNAME';
export const EnvironmentVariable_BDC_USERNAME: string = 'BDC_BACKEND_USERNAME';
export const EnvironmentVariable_BDC_PASSWORD: string = 'BDC_BACKEND_PWD';
export const EnvironmentVariable_STANDALONE_SERVER: string = 'STANDALONE_SQL';
export const EnvironmentVariable_STANDALONE_USERNAME: string = 'STANDALONE_SQL_USERNAME';
export const EnvironmentVariable_STANDALONE_PASSWORD: string = 'STANDALONE_SQL_PWD';
export const EnvironmentVariable_AZURE_SERVER: string = 'AZURE_SQL';
export const EnvironmentVariable_AZURE_USERNAME: string = 'AZURE_SQL_USERNAME';
export const EnvironmentVariable_AZURE_PASSWORD: string = 'AZURE_SQL_PWD';
export const EnvironmentVariable_PYTHON_PATH: string = 'PYTHON_TEST_PATH';
export class TestServerProfile {
constructor(private _profile: ITestServerProfile) { }
public get serverName(): string { return this._profile.serverName; }
@@ -54,18 +77,42 @@ export class TestServerProfile {
public get authenticationType(): AuthenticationType { return this._profile.authenticationType; }
public get authenticationTypeName(): string { return getEnumMappingEntry(authenticationTypeMapping, this.authenticationType).name; }
public get authenticationTypeDisplayName(): string { return getEnumMappingEntry(authenticationTypeMapping, this.authenticationType).displayName; }
public get engineType(): EngineType { return this._profile.engineType; }
}
var TestingServers: TestServerProfile[] = [
new TestServerProfile(
{
serverName: 'SQLTOOLS2017-3',
userName: '',
password: '',
authenticationType: AuthenticationType.Windows,
serverName: getConfigValue(EnvironmentVariable_STANDALONE_SERVER),
userName: getConfigValue(EnvironmentVariable_STANDALONE_USERNAME),
password: getConfigValue(EnvironmentVariable_STANDALONE_PASSWORD),
authenticationType: AuthenticationType.SqlLogin,
database: 'master',
provider: ConnectionProvider.SQLServer,
version: '2017'
version: '2017',
engineType: EngineType.Standalone
}),
new TestServerProfile(
{
serverName: getConfigValue(EnvironmentVariable_AZURE_SERVER),
userName: getConfigValue(EnvironmentVariable_AZURE_USERNAME),
password: getConfigValue(EnvironmentVariable_AZURE_PASSWORD),
authenticationType: AuthenticationType.SqlLogin,
database: 'master',
provider: ConnectionProvider.SQLServer,
version: '2012',
engineType: EngineType.Azure
}),
new TestServerProfile(
{
serverName: getConfigValue(EnvironmentVariable_BDC_SERVER),
userName: getConfigValue(EnvironmentVariable_BDC_USERNAME),
password: getConfigValue(EnvironmentVariable_BDC_PASSWORD),
authenticationType: AuthenticationType.SqlLogin,
database: 'master',
provider: ConnectionProvider.SQLServer,
version: '2019',
engineType: EngineType.BigDataCluster
})
];
@@ -78,9 +125,19 @@ function getEnumMappingEntry(mapping: any, enumValue: any): INameDisplayNamePair
}
}
export async function getDefaultTestingServer(): Promise<TestServerProfile> {
export async function getAzureServer(): Promise<TestServerProfile> {
let servers = await getTestingServers();
return servers[0];
return servers.filter(s => s.engineType === EngineType.Azure)[0];
}
export async function getStandaloneServer(): Promise<TestServerProfile> {
let servers = await getTestingServers();
return servers.filter(s => s.version === '2017' && s.engineType === EngineType.Standalone)[0];
}
export async function getBdcServer(): Promise<TestServerProfile> {
let servers = await getTestingServers();
return servers.filter(s => s.version === '2019' && s.engineType === EngineType.BigDataCluster)[0];
}
export async function getTestingServers(): Promise<TestServerProfile[]> {