mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-13 17:22:15 -05:00
Add Remote Book dialog smoke test (#15932)
* Add Remote Book smoke test * fixes * distro * Try closing toasts (cherry picked from commit fd53c91375f4ba73554c801be3378375b2521d31)
This commit is contained in:
74
test/automation/src/sql/addRemoteBookDialog.ts
Normal file
74
test/automation/src/sql/addRemoteBookDialog.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* 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 ADD_REMOTE_BOOK_DIALOG_TITLE = 'New Jupyter Book (Preview)';
|
||||
|
||||
// The option inputs for this dialog are dynamically generated based on previous selections, so in order to ensure
|
||||
// that the option we want to select exists we wait on the option element to be created first and then select it.
|
||||
const LOCATION_SELECT_SELECTOR = '.modal .modal-body .select-container select[aria-label="Location"]';
|
||||
const LOCATION_OPTION_SELECTOR = (option: string) => `${LOCATION_SELECT_SELECTOR} option[value="${option}"]`;
|
||||
const REPO_URL_INPUT_SELECTOR = '.modal .modal-body input[aria-label="Repository URL"]';
|
||||
const SEARCH_BUTTON_SELECTOR = '.modal .modal-body a[aria-label="Search"]:not(.disabled)';
|
||||
const RELEASES_SELECT_SELECTOR = '.modal .modal-body .select-container select[aria-label="Releases"]';
|
||||
const RELEASES_OPTION_SELECTOR = (release: string) => `${RELEASES_SELECT_SELECTOR} option[value="${release}"]`;
|
||||
const JUPYTER_BOOK_SELECT_SELECTOR = '.modal .modal-body .select-container select[aria-label="Jupyter Book"]';
|
||||
const JUPYTER_BOOK_OPTION_SELECTOR = (jupyterBook: string) => `${JUPYTER_BOOK_SELECT_SELECTOR} option[value="${jupyterBook}"]`;
|
||||
const VERSION_SELECT_SELECTOR = '.modal .modal-body .select-container select[aria-label="Version"]';
|
||||
const VERSION_OPTION_SELECTOR = (version: string) => `${VERSION_SELECT_SELECTOR} option[value="${version}"]`;
|
||||
const LANGUAGE_SELECT_SELECTOR = '.modal .modal-body .select-container select[aria-label="Language"]';
|
||||
const LANGUAGE_OPTION_SELECTOR = (language: string) => `${LANGUAGE_SELECT_SELECTOR} option[value="${language}"]`;
|
||||
const ADD_BUTTON_SELECTOR = '.modal .modal-footer a[aria-label="Add"]:not(.disabled)';
|
||||
|
||||
export class AddRemoteBookDialog extends Dialog {
|
||||
|
||||
constructor(code: Code) {
|
||||
super(ADD_REMOTE_BOOK_DIALOG_TITLE, code);
|
||||
}
|
||||
|
||||
async waitForDialog(): Promise<void> {
|
||||
await this.waitForNewDialog();
|
||||
}
|
||||
|
||||
public async setLocation(location: string): Promise<void> {
|
||||
await this.code.waitForElement(LOCATION_OPTION_SELECTOR(location));
|
||||
await this.code.waitForSetValue(LOCATION_SELECT_SELECTOR, location);
|
||||
}
|
||||
|
||||
public async setRepoUrl(repoUrl: string): Promise<void> {
|
||||
await this.code.waitForSetValue(REPO_URL_INPUT_SELECTOR, repoUrl);
|
||||
}
|
||||
|
||||
public async search(): Promise<void> {
|
||||
await this.code.waitAndClick(SEARCH_BUTTON_SELECTOR);
|
||||
}
|
||||
|
||||
public async setRelease(release: string): Promise<void> {
|
||||
await this.code.waitForElement(RELEASES_OPTION_SELECTOR(release));
|
||||
await this.code.waitForSetValue(RELEASES_SELECT_SELECTOR, release);
|
||||
}
|
||||
|
||||
public async setJupyterBook(jupyterBook: string): Promise<void> {
|
||||
await this.code.waitForElement(JUPYTER_BOOK_OPTION_SELECTOR(jupyterBook));
|
||||
await this.code.waitForSetValue(JUPYTER_BOOK_SELECT_SELECTOR, jupyterBook);
|
||||
}
|
||||
|
||||
public async setVersion(version: string): Promise<void> {
|
||||
await this.code.waitForElement(VERSION_OPTION_SELECTOR(version));
|
||||
await this.code.waitForSetValue(VERSION_SELECT_SELECTOR, version);
|
||||
}
|
||||
|
||||
public async setLanguage(language: string): Promise<void> {
|
||||
await this.code.waitForElement(LANGUAGE_OPTION_SELECTOR(language));
|
||||
await this.code.waitForSetValue(LANGUAGE_SELECT_SELECTOR, language);
|
||||
}
|
||||
|
||||
async add(): Promise<void> {
|
||||
await this.code.waitAndClick(ADD_BUTTON_SELECTOR);
|
||||
await this.waitForDialogGone();
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import { Notebook as SqlNotebook } from './sql/notebook';
|
||||
import { ConfigurePythonDialog } from './sql/configurePythonDialog';
|
||||
import { CreateBookDialog } from './sql/createBookDialog';
|
||||
import { NotificationToast } from './sql/notificationToast';
|
||||
import { AddRemoteBookDialog } from './sql/addRemoteBookDialog';
|
||||
// {{END}}
|
||||
|
||||
export interface Commands {
|
||||
@@ -64,6 +65,7 @@ export class Workbench {
|
||||
readonly createBookDialog: CreateBookDialog;
|
||||
readonly configurePythonDialog: ConfigurePythonDialog;
|
||||
readonly notificationToast: NotificationToast;
|
||||
readonly addRemoteBookDialog: AddRemoteBookDialog;
|
||||
// {{END}}
|
||||
|
||||
constructor(code: Code, userDataPath: string) {
|
||||
@@ -91,6 +93,7 @@ export class Workbench {
|
||||
this.sqlNotebook = new SqlNotebook(code, this.quickaccess, this.quickinput, this.editors);
|
||||
this.createBookDialog = new CreateBookDialog(code);
|
||||
this.configurePythonDialog = new ConfigurePythonDialog(code);
|
||||
this.addRemoteBookDialog = new AddRemoteBookDialog(code);
|
||||
// {{END}}
|
||||
this.notebook = new Notebook(this.quickaccess, code);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user