From 767465edbf0b3036be167dda8edea6b969b3eb4a Mon Sep 17 00:00:00 2001 From: Lucy Zhang Date: Fri, 16 Oct 2020 09:59:03 -0700 Subject: [PATCH] wait for kernel change before running cell (#12949) --- test/automation/src/sql/configurePythonDialog.ts | 8 +++++++- test/automation/src/sql/notebook.ts | 9 +++++++++ test/smoke/src/sql/areas/notebook/notebook.test.ts | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/test/automation/src/sql/configurePythonDialog.ts b/test/automation/src/sql/configurePythonDialog.ts index ee19b27bb2..9feb8e3982 100644 --- a/test/automation/src/sql/configurePythonDialog.ts +++ b/test/automation/src/sql/configurePythonDialog.ts @@ -33,7 +33,13 @@ export class ConfigurePythonDialog extends Dialog { await this.code.waitForElement(installButton); await this.code.dispatchKeybinding('enter'); - return this.waitForDialogGone(); + await this.waitForDialogGone(); + return this._waitForInstallationComplete(); + } + + private async _waitForInstallationComplete(): Promise { + const installationCompleteNotification = '.notifications-toasts div[aria-label="Notebook dependencies installation is complete, source: Notebook Core Extensions (Extension), notification"]'; + await this.code.waitForElement(installationCompleteNotification); } } diff --git a/test/automation/src/sql/notebook.ts b/test/automation/src/sql/notebook.ts index 069460b059..5935f8ed32 100644 --- a/test/automation/src/sql/notebook.ts +++ b/test/automation/src/sql/notebook.ts @@ -46,6 +46,10 @@ export class Notebook { await this.toolbar.changeKernel(kernel); } + async waitForKernel(kernel: string): Promise { + await this.toolbar.waitForKernel(kernel); + } + async runActiveCell(): Promise { await this.code.dispatchKeybinding('F5'); } @@ -86,4 +90,9 @@ export class NotebookToolbar { await this.code.waitForSetValue(kernelDropdown, kernel); await this.code.dispatchKeybinding('enter'); } + + async waitForKernel(kernel: string): Promise { + const kernelDropdownValue = `${NotebookToolbar.toolbarSelector} select[id="kernel-dropdown"][title="${kernel}"]`; + await this.code.waitForElement(kernelDropdownValue); + } } diff --git a/test/smoke/src/sql/areas/notebook/notebook.test.ts b/test/smoke/src/sql/areas/notebook/notebook.test.ts index ebdf748aba..3f88f521ad 100644 --- a/test/smoke/src/sql/areas/notebook/notebook.test.ts +++ b/test/smoke/src/sql/areas/notebook/notebook.test.ts @@ -18,6 +18,7 @@ export function setup() { await app.workbench.sqlNotebook.changeKernel('Python 3'); await app.workbench.configurePythonDialog.waitForConfigurePythonDialog(); await app.workbench.configurePythonDialog.installPython(); + await app.workbench.sqlNotebook.waitForKernel('Python 3'); await app.workbench.sqlNotebook.runActiveCell(); await app.workbench.sqlNotebook.waitForResults();