mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Add python configuration step to each python smoke test so they can be run independently. (#19807)
This commit is contained in:
@@ -64,7 +64,39 @@ export function setup(opts: minimist.ParsedArgs) {
|
||||
});
|
||||
|
||||
|
||||
// Python Notebooks
|
||||
describe('Python notebooks', function () {
|
||||
let pythonConfigured: boolean;
|
||||
async function configurePython(app: Application): Promise<void> {
|
||||
// Skip setting up python again if another test has already completed this configuration step
|
||||
if (!pythonConfigured) {
|
||||
await app.workbench.configurePythonDialog.waitForConfigurePythonDialog();
|
||||
await app.workbench.configurePythonDialog.waitForPageOneLoaded();
|
||||
await app.workbench.configurePythonDialog.next();
|
||||
await app.workbench.configurePythonDialog.waitForPageTwoLoaded();
|
||||
await app.workbench.configurePythonDialog.install();
|
||||
// Close notification toasts, since they can interfere with the Manage Packages Dialog test
|
||||
await app.workbench.notificationToast.closeNotificationToasts();
|
||||
pythonConfigured = true;
|
||||
}
|
||||
}
|
||||
|
||||
async function openAndRunNotebook(app: Application, filename: string): Promise<void> {
|
||||
await app.workbench.sqlNotebook.openFile(filename);
|
||||
await configurePython(app);
|
||||
await app.workbench.sqlNotebook.notebookToolbar.waitForKernel('Python 3');
|
||||
|
||||
await app.workbench.sqlNotebook.notebookToolbar.clearResults();
|
||||
await app.workbench.sqlNotebook.waitForAllResultsGone();
|
||||
await app.workbench.sqlNotebook.runAllCells();
|
||||
await app.workbench.sqlNotebook.waitForAllResults();
|
||||
|
||||
await app.workbench.quickaccess.runCommand('workbench.action.files.save');
|
||||
await app.workbench.quickaccess.runCommand('workbench.action.closeActiveEditor');
|
||||
|
||||
await app.workbench.sqlNotebook.openFile(filename);
|
||||
await app.workbench.sqlNotebook.notebookToolbar.waitForKernel('Python 3');
|
||||
await app.workbench.sqlNotebook.waitForAllResults();
|
||||
}
|
||||
|
||||
it('can open new notebook, configure Python, and execute one cell', async function () {
|
||||
this.timeout(600000); // set timeout to 10 minutes to ensure test does not timeout during python installation
|
||||
@@ -75,11 +107,7 @@ export function setup(opts: minimist.ParsedArgs) {
|
||||
await app.workbench.sqlNotebook.notebookToolbar.waitForKernel('SQL');
|
||||
|
||||
await app.workbench.sqlNotebook.notebookToolbar.changeKernel('Python 3');
|
||||
await app.workbench.configurePythonDialog.waitForConfigurePythonDialog();
|
||||
await app.workbench.configurePythonDialog.waitForPageOneLoaded();
|
||||
await app.workbench.configurePythonDialog.next();
|
||||
await app.workbench.configurePythonDialog.waitForPageTwoLoaded();
|
||||
await app.workbench.configurePythonDialog.install();
|
||||
await configurePython(app);
|
||||
await app.workbench.sqlNotebook.notebookToolbar.waitForKernel('Python 3');
|
||||
|
||||
await app.workbench.sqlNotebook.runActiveCell();
|
||||
@@ -91,6 +119,7 @@ export function setup(opts: minimist.ParsedArgs) {
|
||||
await app.workbench.sqlNotebook.newUntitledNotebook();
|
||||
await app.workbench.sqlNotebook.notebookToolbar.waitForKernel('SQL');
|
||||
await app.workbench.sqlNotebook.notebookToolbar.changeKernel('Python 3');
|
||||
await configurePython(app);
|
||||
await app.workbench.sqlNotebook.notebookToolbar.waitForKernel('Python 3');
|
||||
|
||||
await app.workbench.sqlNotebook.addCell('code');
|
||||
@@ -123,6 +152,7 @@ export function setup(opts: minimist.ParsedArgs) {
|
||||
const app = this.app as Application;
|
||||
await openAndRunNotebook(app, 'helloWithEscapedSpaces.ipynb');
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(async function () {
|
||||
const app = this.app as Application;
|
||||
@@ -505,20 +535,3 @@ async function verifyElementRendered(app: Application, markdownString: string, e
|
||||
await app.code.dispatchKeybinding('escape');
|
||||
await app.code.waitForElement(element);
|
||||
}
|
||||
|
||||
async function openAndRunNotebook(app: Application, filename: string): Promise<void> {
|
||||
await app.workbench.sqlNotebook.openFile(filename);
|
||||
await app.workbench.sqlNotebook.notebookToolbar.waitForKernel('Python 3');
|
||||
|
||||
await app.workbench.sqlNotebook.notebookToolbar.clearResults();
|
||||
await app.workbench.sqlNotebook.waitForAllResultsGone();
|
||||
await app.workbench.sqlNotebook.runAllCells();
|
||||
await app.workbench.sqlNotebook.waitForAllResults();
|
||||
|
||||
await app.workbench.quickaccess.runCommand('workbench.action.files.save');
|
||||
await app.workbench.quickaccess.runCommand('workbench.action.closeActiveEditor');
|
||||
|
||||
await app.workbench.sqlNotebook.openFile(filename);
|
||||
await app.workbench.sqlNotebook.notebookToolbar.waitForKernel('Python 3');
|
||||
await app.workbench.sqlNotebook.waitForAllResults();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user