mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
* #4586: Clear all outputs feature * text change * Adding extensible method with integration tests * Misc change * Misc change * Adding more logging * Change to test * Adding outputs confition in integration tests
This commit is contained in:
@@ -43,6 +43,40 @@ if (context.RunTest) {
|
||||
// console.log('Python3 NB done');
|
||||
// });
|
||||
|
||||
// test('Clear all outputs - Python3 notebook ', async function () {
|
||||
// let notebook = await openNotebook(pySparkNotebookContent, pythonKernelMetadata);
|
||||
// //Check if at least one cell with output
|
||||
// let cellWithOutputs = notebook.document.cells.find(cell => cell.contents && cell.contents.outputs && cell.contents.outputs.length > 0);
|
||||
// console.log("Before clearing cell outputs");
|
||||
// if (cellWithOutputs) {
|
||||
// let clearedOutputs = await notebook.clearAllOutputs();
|
||||
// let cells = notebook.document.cells;
|
||||
// cells.forEach(cell => {
|
||||
// assert(cell.contents && cell.contents.outputs && cell.contents.outputs.length === 0, `Expected Output: 0, Acutal: '${cell.contents.outputs.length}'`);
|
||||
// });
|
||||
// assert(clearedOutputs, 'Outputs of all the code cells from Python notebook should be cleared');
|
||||
// console.log("After clearing cell outputs");
|
||||
// }
|
||||
// assert(cellWithOutputs === undefined, 'Could not find notebook cells with outputs');
|
||||
// });
|
||||
|
||||
test('Clear all outputs - SQL notebook ', async function () {
|
||||
let notebook = await openNotebook(sqlNotebookContent, sqlKernelMetadata);
|
||||
let cellWithOutputs = notebook.document.cells.find(cell => cell.contents && cell.contents.outputs && cell.contents.outputs.length > 0);
|
||||
console.log("Before clearing cell outputs");
|
||||
if (cellWithOutputs) {
|
||||
let clearedOutputs = await notebook.clearAllOutputs();
|
||||
let cells = notebook.document.cells;
|
||||
cells.forEach(cell => {
|
||||
assert(cell.contents && cell.contents.outputs && cell.contents.outputs.length === 0, `Expected Output: 0, Acutal: '${cell.contents.outputs.length}'`);
|
||||
});
|
||||
assert(clearedOutputs, 'Outputs of all the code cells from SQL notebook should be cleared');
|
||||
console.log("After clearing cell outputs");
|
||||
}
|
||||
assert(cellWithOutputs === undefined, 'Could not find notebook cells with outputs');
|
||||
});
|
||||
|
||||
|
||||
// test('PySpark3 notebook test', async function () {
|
||||
// this.timeout(12000);
|
||||
// let notebook = await openNotebook(pySparkNotebookContent, pySpark3KernelMetadata);
|
||||
|
||||
Reference in New Issue
Block a user