Remove move cell integration test (#156825)

* Remove move cell integration test

* 💄

* test didn't really run locally
This commit is contained in:
Peng Lyu 2022-08-01 13:54:49 -07:00 committed by GitHub
parent f9bee281e0
commit f31a88e161
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 51 deletions

View file

@ -212,9 +212,9 @@ const apiTestContentProvider: vscode.NotebookContentProvider = {
addedCells: [editor.notebook.cellAt(1)]
});
const moveCellEvent = asPromise<vscode.NotebookDocumentChangeEvent>(vscode.workspace.onDidChangeNotebookDocument);
await vscode.commands.executeCommand('notebook.cell.moveUp');
await moveCellEvent;
// const moveCellEvent = asPromise<vscode.NotebookDocumentChangeEvent>(vscode.workspace.onDidChangeNotebookDocument);
// await vscode.commands.executeCommand('notebook.cell.moveUp');
// await moveCellEvent;
const cellOutputChange = asPromise<vscode.NotebookDocumentChangeEvent>(vscode.workspace.onDidChangeNotebookDocument);
await vscode.commands.executeCommand('notebook.cell.execute');
@ -393,57 +393,10 @@ const apiTestContentProvider: vscode.NotebookContentProvider = {
activeCell = getFocusedCell(editor);
assert.strictEqual(editor.notebook.getCells().indexOf(activeCell!), 0);
// ---- move up and down ---- //
await vscode.commands.executeCommand('notebook.cell.moveDown');
assert.strictEqual(editor.notebook.getCells().indexOf(getFocusedCell(editor)!), 1,
`first move down, active cell ${getFocusedCell(editor)!.document.uri.toString()}, ${getFocusedCell(editor)!.document.getText()}`);
await vscode.commands.executeCommand('workbench.action.files.save');
await vscode.commands.executeCommand('workbench.action.closeActiveEditor');
});
test('editor move command - event and move cells will not recreate cells in ExtHost (#98126)', async function () {
const notebook = await openRandomNotebookDocument();
const editor = await vscode.window.showNotebookDocument(notebook);
const activeCell = getFocusedCell(editor);
assert.strictEqual(activeCell?.index, 0);
const notebookChangeEvent = asPromise(vscode.workspace.onDidChangeNotebookDocument);
await vscode.commands.executeCommand('notebook.cell.moveDown');
assert.ok(await notebookChangeEvent);
const newActiveCell = getFocusedCell(editor);
assert.strictEqual(newActiveCell?.index, 1);
assert.deepStrictEqual(activeCell, newActiveCell);
});
// test('document runnable based on kernel count', async () => {
// const resource = await createRandomNotebookFile();
// await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
// assert.strictEqual(vscode.window.activeNotebookEditor !== undefined, true, 'notebook first');
// const editor = vscode.window.activeNotebookEditor!;
// const cell = editor.notebook.cellAt(0);
// assert.strictEqual(cell.outputs.length, 0);
// currentKernelProvider.setHasKernels(false);
// await vscode.commands.executeCommand('notebook.execute');
// assert.strictEqual(cell.outputs.length, 0, 'should not execute'); // not runnable, didn't work
// currentKernelProvider.setHasKernels(true);
// await withEvent<vscode.NotebookCellOutputsChangeEvent>(vscode.notebooks.onDidChangeCellOutputs, async (event) => {
// await vscode.commands.executeCommand('notebook.execute');
// await event;
// assert.strictEqual(cell.outputs.length, 1, 'should execute'); // runnable, it worked
// });
// await saveAllFilesAndCloseAll(undefined);
// });
// 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();

View file

@ -24,8 +24,11 @@ suite('CellOperations', () => {
],
async (editor, viewModel) => {
viewModel.updateSelectionsState({ kind: SelectionStateType.Index, focus: { start: 1, end: 2 }, selections: [{ start: 1, end: 2 }] });
await moveCellRange({ notebookEditor: editor, cell: viewModel.cellAt(1)! }, 'down');
const cell = viewModel.cellAt(1);
assert.ok(cell);
await moveCellRange({ notebookEditor: editor, cell: cell }, 'down');
assert.strictEqual(viewModel.cellAt(2)?.getText(), 'var b = 1;');
assert.strictEqual(cell, viewModel.cellAt(2));
});
});