bring back kernel execute test

This commit is contained in:
rebornix
2022-08-03 10:14:45 -07:00
parent 82314b9ed5
commit 336373dfc5
2 changed files with 9 additions and 19 deletions

View File

@@ -287,7 +287,7 @@ const apiTestContentProvider: vscode.NotebookContentProvider = {
suiteDisposables.push(vscode.workspace.registerNotebookContentProvider('notebookCoreTest', apiTestContentProvider));
});
test.skip('provideCellStatusBarItems called on metadata change', async function () { // TODO@roblourens https://github.com/microsoft/vscode/issues/139324
test('provideCellStatusBarItems called on metadata change', async function () {
const provideCalled = asPromise(onDidCallProvide);
const notebook = await openRandomNotebookDocument();
await vscode.window.showNotebookDocument(notebook);
@@ -295,7 +295,7 @@ const apiTestContentProvider: vscode.NotebookContentProvider = {
const edit = new vscode.WorkspaceEdit();
edit.replaceNotebookCellMetadata(notebook.uri, 0, { inputCollapsed: true });
vscode.workspace.applyEdit(edit);
await vscode.workspace.applyEdit(edit);
await provideCalled;
});
});

View File

@@ -174,19 +174,7 @@ const apiTestContentProvider: vscode.NotebookContentProvider = {
await saveAllFilesAndCloseAll();
});
// TODO@rebornix this is wrong, `await vscode.commands.executeCommand('notebook.execute');` doesn't wait until the workspace edit is applied
test.skip('cell execute command takes arguments', async () => {
const notebook = await openRandomNotebookDocument();
await vscode.window.showNotebookDocument(notebook);
assert.strictEqual(vscode.window.activeNotebookEditor !== undefined, true, 'notebook first');
const editor = vscode.window.activeNotebookEditor!;
const cell = editor.notebook.cellAt(0);
await vscode.commands.executeCommand('notebook.execute');
assert.strictEqual(cell.outputs.length, 0, 'should not execute'); // not runnable, didn't work
});
test('cell execute command takes arguments 2', async () => {
test('cell execute command takes arguments', async () => {
const notebook = await openRandomNotebookDocument();
await vscode.window.showNotebookDocument(notebook);
assert.strictEqual(vscode.window.activeNotebookEditor !== undefined, true, 'notebook first');
@@ -217,11 +205,10 @@ const apiTestContentProvider: vscode.NotebookContentProvider = {
});
// #126371
test.skip('cell execute command takes arguments ICellRange[]', async () => {
test('cell execute command takes arguments', async () => {
const notebook = await openRandomNotebookDocument();
await vscode.window.showNotebookDocument(notebook);
vscode.commands.executeCommand('notebook.cell.execute', { ranges: [{ start: 0, end: 1 }, { start: 1, end: 2 }] });
let firstCellExecuted = false;
let secondCellExecuted = false;
let resolve: () => void;
@@ -242,6 +229,8 @@ const apiTestContentProvider: vscode.NotebookContentProvider = {
}
});
vscode.commands.executeCommand('notebook.cell.execute', { document: notebook.uri, ranges: [{ start: 0, end: 1 }, { start: 1, end: 2 }] });
await p;
listener.dispose();
await saveAllFilesAndCloseAll();
@@ -306,12 +295,11 @@ const apiTestContentProvider: vscode.NotebookContentProvider = {
});
});
test.skip('onDidChangeCellExecutionState is fired', async () => { // TODO@rebornix https://github.com/microsoft/vscode/issues/139350
test('onDidChangeCellExecutionState is fired', async () => {
const notebook = await openRandomNotebookDocument();
const editor = await vscode.window.showNotebookDocument(notebook);
const cell = editor.notebook.cellAt(0);
vscode.commands.executeCommand('notebook.cell.execute');
let eventCount = 0;
let resolve: () => void;
const p = new Promise<void>(r => resolve = r);
@@ -330,6 +318,8 @@ const apiTestContentProvider: vscode.NotebookContentProvider = {
eventCount++;
});
vscode.commands.executeCommand('notebook.cell.execute', { document: notebook.uri, ranges: [{ start: 0, end: 1 }] });
await p;
listener.dispose();
});