Add smoke test for Create Book dialog (#15714)

* Add smoke test for Create Book dialog

* Add comment

* Update distro

* update distro 2

* distro
This commit is contained in:
Charles Gagnon
2021-06-16 10:54:04 -07:00
committed by GitHub
parent 4c039f7a88
commit be1ff8e37b
7 changed files with 100 additions and 1 deletions

View File

@@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------------------------
* 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 { Dialog } from './dialog';
const CREATE_BOOK_DIALOG_TITLE = 'New Jupyter Book (Preview)';
const NAME_INPUT_SELECTOR = '.modal .modal-body input[aria-label="Name. Please fill out this field."]';
const LOCATION_INPUT_SELECTOR = '.modal .modal-body input[title="Browse locations..."]';
const CONTENT_FOLDER_INPUT_SELECTOR = '.modal .modal-body input[title="Select content folder"]';
const CREATE_BUTTON_SELECTOR = '.modal .modal-footer a[aria-label="Create"]:not(.disabled)';
export class CreateBookDialog extends Dialog {
constructor(code: Code) {
super(CREATE_BOOK_DIALOG_TITLE, code);
}
async waitForDialog(): Promise<void> {
await this.waitForNewDialog();
}
public async setName(name: string): Promise<void> {
await this.code.waitForSetValue(NAME_INPUT_SELECTOR, name);
}
public async setLocation(location: string): Promise<void> {
await this.code.waitForSetValue(LOCATION_INPUT_SELECTOR, location);
}
public async setContentFolder(contentFolder: string): Promise<void> {
await this.code.waitForSetValue(CONTENT_FOLDER_INPUT_SELECTOR, contentFolder);
}
async create(): Promise<void> {
await this.code.waitAndClick(CREATE_BUTTON_SELECTOR);
await this.waitForDialogGone();
}
}

View File

@@ -28,6 +28,7 @@ import { QueryEditors } from './sql/queryEditors';
import { QueryEditor } from './sql/queryEditor';
import { Notebook as SqlNotebook } from './sql/notebook';
import { ConfigurePythonDialog } from './sql/configurePythonDialog';
import { CreateBookDialog } from './sql/createBookDialog';
import { NotificationToast } from './sql/notificationToast';
// {{END}}
@@ -60,6 +61,7 @@ export class Workbench {
readonly queryEditors: QueryEditors;
readonly queryEditor: QueryEditor;
readonly sqlNotebook: SqlNotebook;
readonly createBookDialog: CreateBookDialog;
readonly configurePythonDialog: ConfigurePythonDialog;
readonly notificationToast: NotificationToast;
// {{END}}
@@ -87,6 +89,7 @@ export class Workbench {
this.queryEditors = new QueryEditors(code, this.editors);
this.queryEditor = new QueryEditor(code);
this.sqlNotebook = new SqlNotebook(code, this.quickaccess, this.quickinput, this.editors);
this.createBookDialog = new CreateBookDialog(code);
this.configurePythonDialog = new ConfigurePythonDialog(code);
// {{END}}
this.notebook = new Notebook(this.quickaccess, code);