Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/test/smoke/src/areas/notebook/notebook.test.ts
5251 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import * as cp from 'child_process';
7
import { Application, Logger } from '../../../../automation';
8
import { installAllHandlers } from '../../utils';
9
10
export function setup(logger: Logger) {
11
describe('Notebooks', () => { // https://github.com/microsoft/vscode/issues/140575
12
13
// Shared before/after handling
14
installAllHandlers(logger);
15
16
afterEach(async function () {
17
const app = this.app as Application;
18
await app.workbench.quickaccess.runCommand('workbench.action.files.save');
19
await app.workbench.quickaccess.runCommand('workbench.action.closeActiveEditor');
20
});
21
22
after(async function () {
23
const app = this.app as Application;
24
25
cp.execSync('git checkout . --quiet', { cwd: app.workspacePathOrFolder });
26
cp.execSync('git reset --hard HEAD --quiet', { cwd: app.workspacePathOrFolder });
27
});
28
29
// the heap snapshot fails to parse
30
it.skip('check heap leaks', async function () {
31
const app = this.app as Application;
32
await app.profiler.checkHeapLeaks(['NotebookTextModel', 'NotebookCellTextModel', 'NotebookEventDispatcher'], async () => {
33
await app.workbench.notebook.openNotebook();
34
await app.workbench.quickaccess.runCommand('workbench.action.files.save');
35
await app.workbench.quickaccess.runCommand('workbench.action.closeActiveEditor');
36
});
37
});
38
39
it.skip('check object leaks', async function () {
40
const app = this.app as Application;
41
await app.profiler.checkObjectLeaks(['NotebookTextModel', 'NotebookCellTextModel', 'NotebookEventDispatcher'], async () => {
42
await app.workbench.notebook.openNotebook();
43
await app.workbench.quickaccess.runCommand('workbench.action.files.save');
44
await app.workbench.quickaccess.runCommand('workbench.action.closeActiveEditor');
45
});
46
});
47
48
it.skip('inserts/edits code cell', async function () {
49
const app = this.app as Application;
50
await app.workbench.notebook.openNotebook();
51
await app.workbench.notebook.focusNextCell();
52
await app.workbench.notebook.insertNotebookCell('code');
53
await app.workbench.notebook.waitForTypeInEditor('// some code');
54
await app.workbench.notebook.stopEditingCell();
55
});
56
57
it.skip('inserts/edits markdown cell', async function () {
58
const app = this.app as Application;
59
await app.workbench.notebook.openNotebook();
60
await app.workbench.notebook.focusNextCell();
61
await app.workbench.notebook.insertNotebookCell('markdown');
62
await app.workbench.notebook.waitForTypeInEditor('## hello2! ');
63
await app.workbench.notebook.stopEditingCell();
64
// TODO: markdown row selectors haven't been updated to look in the webview
65
await app.workbench.notebook.waitForMarkdownContents('', '');
66
});
67
68
it.skip('moves focus as it inserts/deletes a cell', async function () {
69
const app = this.app as Application;
70
await app.workbench.notebook.openNotebook();
71
await app.workbench.notebook.focusFirstCell();
72
await app.workbench.notebook.insertNotebookCell('code');
73
await app.workbench.notebook.waitForActiveCellEditorContents('');
74
await app.workbench.notebook.waitForTypeInEditor('# added cell');
75
await app.workbench.notebook.focusFirstCell();
76
await app.workbench.notebook.insertNotebookCell('code');
77
await app.workbench.notebook.waitForActiveCellEditorContents('');
78
await app.workbench.notebook.deleteActiveCell();
79
await app.workbench.notebook.waitForActiveCellEditorContents('# added cell');
80
});
81
82
it.skip('moves focus in and out of output', async function () { // TODO@rebornix https://github.com/microsoft/vscode/issues/139270
83
const app = this.app as Application;
84
await app.workbench.notebook.openNotebook();
85
// first cell is a code cell that already has output
86
await app.workbench.notebook.focusInCellOutput();
87
await app.workbench.notebook.editCell();
88
await app.workbench.notebook.waitForActiveCellEditorContents('print(1)');
89
});
90
91
// broken: there is no kernel available to execute code
92
it.skip('cell action execution', async function () { // TODO@rebornix https://github.com/microsoft/vscode/issues/139270
93
const app = this.app as Application;
94
await app.workbench.notebook.openNotebook();
95
await app.workbench.notebook.insertNotebookCell('code');
96
await app.workbench.notebook.executeCellAction('.notebook-editor .monaco-list-row.focused div.monaco-toolbar .codicon-debug');
97
await app.workbench.notebook.waitForActiveCellEditorContents('test');
98
});
99
});
100
}
101
102