Add smoke test for manage packages wizard (#19018)

* start manage packages smoke test

* fix addpackage

* remove wait for loading spinner

* check cell output gone

* check wizard tab is done initializing
This commit is contained in:
Lucy Zhang
2022-04-13 07:50:15 -07:00
committed by GitHub
parent fcd4c6e15b
commit fb07ba9e04
4 changed files with 87 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------------------------
* 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 MANAGE_PACKAGES_DIALOG_TITLE = 'Manage Packages';
export class ManagePackagesDialog extends Dialog {
private static readonly dialogPage = '.modal .modal-body .dialogModal-pane';
constructor(code: Code) {
super(MANAGE_PACKAGES_DIALOG_TITLE, code);
}
async waitForManagePackagesDialog(): Promise<void> {
await this.waitForNewDialog();
}
async addNewPackage(packageName: string): Promise<void> {
const addNewTab = `${ManagePackagesDialog.dialogPage} div[class="tab-header"][aria-controls="dialogPane.Manage Packages.1"]`;
await this.code.waitAndClick(addNewTab);
const loadingSpinner = `${ManagePackagesDialog.dialogPage} div.modelview-loadingComponent-spinner`;
// Wait for "Search Pip packages" placeholder in the input box to know that the tab has finished initializing
const searchPipPackagesInput = `${ManagePackagesDialog.dialogPage} input[placeholder="Search Pip packages"]`;
await this.code.waitForElement(searchPipPackagesInput);
const searchInputBox = `${ManagePackagesDialog.dialogPage} .monaco-inputbox`;
await this.code.waitAndClick(searchInputBox);
const searchInputBoxEditor = `${searchInputBox} input.input`;
await this.code.waitForTypeInEditor(searchInputBoxEditor, packageName);
const searchButton = `${ManagePackagesDialog.dialogPage} a[class="monaco-button monaco-text-button"][aria-label="Search"][aria-disabled="false"]`;
await this.code.waitAndClick(searchButton);
const installButton = `${ManagePackagesDialog.dialogPage} a[class="monaco-button monaco-text-button"][aria-label="Install"][aria-disabled="false"]`;
await this.code.waitAndClick(installButton);
const installedTab = `${ManagePackagesDialog.dialogPage} div[class="tab-header"][aria-controls="dialogPane.Manage Packages.0"]`;
await this.code.waitAndClick(installedTab);
// The installed packages tab will reload once the package has been installed
await this.code.waitForElement(loadingSpinner);
await this.code.waitForElementGone(loadingSpinner);
const closeButton = '.modal .modal-footer a[class="monaco-button monaco-text-button"][aria-label="Close"][aria-disabled="false"]';
await this.code.waitAndClick(closeButton);
}
}

View File

@@ -162,6 +162,11 @@ export class Notebook {
// Cell Output Actions
async waitForJupyterErrorOutput(): Promise<void> {
const jupyterErrorOutput = `.notebook-cell.active .notebook-output mime-output[data-mime-type="application/vnd.jupyter.stderr"]`;
await this.code.waitForElement(jupyterErrorOutput);
}
async waitForActiveCellResults(): Promise<void> {
const outputComponent = '.notebook-cell.active .notebook-output';
await this.code.waitForElement(outputComponent);
@@ -281,6 +286,7 @@ export class NotebookToolbar {
private static readonly collapseCellsButtonSelector = `${NotebookToolbar.toolbarButtonSelector}.icon-collapse-cells`;
private static readonly expandCellsButtonSelector = `${NotebookToolbar.toolbarButtonSelector}.icon-expand-cells`;
private static readonly clearResultsButtonSelector = `${NotebookToolbar.toolbarButtonSelector}.icon-clear-results`;
private static readonly managePackagesButtonSelector = `${NotebookToolbar.toolbarButtonSelector}[title="Manage Packages"]`;
constructor(private code: Code) { }
@@ -344,6 +350,10 @@ export class NotebookToolbar {
async clearResults(): Promise<void> {
await this.code.waitAndClick(NotebookToolbar.clearResultsButtonSelector);
}
async managePackages(): Promise<void> {
await this.code.waitAndClick(NotebookToolbar.managePackagesButtonSelector);
}
}
export class NotebookTreeView {

View File

@@ -29,6 +29,7 @@ import { QueryEditors } from './sql/queryEditors';
import { QueryEditor } from './sql/queryEditor';
import { Notebook as SqlNotebook } from './sql/notebook';
import { ConfigurePythonDialog } from './sql/configurePythonDialog';
import { ManagePackagesDialog } from './sql/managePackagesDialog';
import { CreateBookDialog } from './sql/createBookDialog';
import { NotificationToast } from './sql/notificationToast';
import { AddRemoteBookDialog } from './sql/addRemoteBookDialog';
@@ -66,6 +67,7 @@ export class Workbench {
readonly sqlNotebook: SqlNotebook;
readonly createBookDialog: CreateBookDialog;
readonly configurePythonDialog: ConfigurePythonDialog;
readonly managePackagesDialog: ManagePackagesDialog;
readonly notificationToast: NotificationToast;
readonly addRemoteBookDialog: AddRemoteBookDialog;
// {{END}}
@@ -95,6 +97,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.managePackagesDialog = new ManagePackagesDialog(code);
this.addRemoteBookDialog = new AddRemoteBookDialog(code);
// {{END}}
this.notebook = new Notebook(this.quickaccess, code);