mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
rewrite some automation; add notebook tests (#10853)
This commit is contained in:
24
test/automation/src/sql/notebook.ts
Normal file
24
test/automation/src/sql/notebook.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* 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';
|
||||
import { QuickAccess } from '../quickaccess';
|
||||
import { QuickInput } from '../quickinput';
|
||||
import { Editors } from '../editors';
|
||||
|
||||
export class Notebook {
|
||||
|
||||
constructor(private code: Code, private quickAccess: QuickAccess, private quickInput: QuickInput, private editors: Editors) {
|
||||
}
|
||||
|
||||
async openFile(fileName: string): Promise<void> {
|
||||
await this.quickAccess.openQuickAccess(fileName);
|
||||
|
||||
await this.quickInput.waitForQuickInputElements(names => names[0] === fileName);
|
||||
await this.code.dispatchKeybinding('enter');
|
||||
await this.editors.waitForActiveTab(fileName);
|
||||
await this.code.waitForElement('.notebookEditor');
|
||||
}
|
||||
}
|
||||
@@ -21,15 +21,15 @@ export class QueryEditor {
|
||||
|
||||
export class CommandBar {
|
||||
|
||||
private static readonly COMMAND_BAR_BUTTON = '.query-editor .carbon-taskbar ul>:nth-child(${INDEX})';
|
||||
private static readonly COMMAND_BAR_BUTTON = '.query-editor .carbon-taskbar li .${CLASS}';
|
||||
|
||||
constructor(private code: Code) { }
|
||||
|
||||
public async clickButton(index: number): Promise<void> {
|
||||
await this.code.waitAndClick(CommandBar.COMMAND_BAR_BUTTON.replace('${INDEX}', '' + index));
|
||||
public async run(): Promise<void> {
|
||||
await this.code.waitAndClick(CommandBar.COMMAND_BAR_BUTTON.replace('${CLASS}', 'start'));
|
||||
}
|
||||
|
||||
public async waitForButton(index: number, label: string): Promise<void> {
|
||||
await this.code.waitForTextContent(CommandBar.COMMAND_BAR_BUTTON.replace('${INDEX}', '' + index), label);
|
||||
public async connect(): Promise<void> {
|
||||
await this.code.waitAndClick(CommandBar.COMMAND_BAR_BUTTON.replace('${CLASS}', 'connect'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import { ConnectionDialog } from './sql/connectionDialog';
|
||||
import { Profiler } from './sql/profiler';
|
||||
import { QueryEditors } from './sql/queryEditors';
|
||||
import { QueryEditor } from './sql/queryEditor';
|
||||
import { Notebook as SqlNotebook } from './sql/notebook';
|
||||
// {{END}}
|
||||
|
||||
export interface Commands {
|
||||
@@ -56,6 +57,7 @@ export class Workbench {
|
||||
readonly profiler: Profiler;
|
||||
readonly queryEditors: QueryEditors;
|
||||
readonly queryEditor: QueryEditor;
|
||||
readonly sqlNotebbok: SqlNotebook;
|
||||
// {{END}}
|
||||
|
||||
constructor(code: Code, userDataPath: string) {
|
||||
@@ -79,6 +81,7 @@ export class Workbench {
|
||||
this.profiler = new Profiler(code, this.quickaccess);
|
||||
this.queryEditors = new QueryEditors(code, this.editors);
|
||||
this.queryEditor = new QueryEditor(code);
|
||||
this.sqlNotebbok = new SqlNotebook(code, this.quickaccess, this.quickinput, this.editors);
|
||||
// {{END}}
|
||||
this.notebook = new Notebook(this.quickaccess, code);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user