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
3520 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
cp.execSync('git checkout . --quiet', { cwd: app.workspacePathOrFolder });
25
cp.execSync('git reset --hard HEAD --quiet', { cwd: app.workspacePathOrFolder });
26
});
27
28
it.skip('check heap leaks', async function () {
29
const app = this.app as Application;
30
await app.profiler.checkHeapLeaks(['NotebookTextModel', 'NotebookCellTextModel', 'NotebookEventDispatcher'], async () => {
31
await app.workbench.notebook.openNotebook();
32
await app.workbench.quickaccess.runCommand('workbench.action.files.save');
33
await app.workbench.quickaccess.runCommand('workbench.action.closeActiveEditor');
34
});
35
});
36
37
it.skip('check object leaks', async function () {
38
const app = this.app as Application;
39
await app.profiler.checkObjectLeaks(['NotebookTextModel', 'NotebookCellTextModel', 'NotebookEventDispatcher'], async () => {
40
await app.workbench.notebook.openNotebook();
41
await app.workbench.quickaccess.runCommand('workbench.action.files.save');
42
await app.workbench.quickaccess.runCommand('workbench.action.closeActiveEditor');
43
});
44
});
45
46
it.skip('inserts/edits code cell', async function () {
47
const app = this.app as Application;
48
await app.workbench.notebook.openNotebook();
49
await app.workbench.notebook.focusNextCell();
50
await app.workbench.notebook.insertNotebookCell('code');
51
await app.workbench.notebook.waitForTypeInEditor('// some code');
52
await app.workbench.notebook.stopEditingCell();
53
});
54
55
it.skip('inserts/edits markdown cell', async function () {
56
const app = this.app as Application;
57
await app.workbench.notebook.openNotebook();
58
await app.workbench.notebook.focusNextCell();
59
await app.workbench.notebook.insertNotebookCell('markdown');
60
await app.workbench.notebook.waitForTypeInEditor('## hello2! ');
61
await app.workbench.notebook.stopEditingCell();
62
await app.workbench.notebook.waitForMarkdownContents('h2', 'hello2!');
63
});
64
65
it.skip('moves focus as it inserts/deletes a cell', async function () {
66
const app = this.app as Application;
67
await app.workbench.notebook.openNotebook();
68
await app.workbench.notebook.insertNotebookCell('code');
69
await app.workbench.notebook.waitForActiveCellEditorContents('');
70
await app.workbench.notebook.stopEditingCell();
71
await app.workbench.notebook.deleteActiveCell();
72
await app.workbench.notebook.waitForMarkdownContents('p', 'Markdown Cell');
73
});
74
75
it.skip('moves focus in and out of output', async function () { // TODO@rebornix https://github.com/microsoft/vscode/issues/139270
76
const app = this.app as Application;
77
await app.workbench.notebook.openNotebook();
78
await app.workbench.notebook.executeActiveCell();
79
await app.workbench.notebook.focusInCellOutput();
80
await app.workbench.notebook.focusOutCellOutput();
81
await app.workbench.notebook.waitForActiveCellEditorContents('code()');
82
});
83
84
it.skip('cell action execution', async function () { // TODO@rebornix https://github.com/microsoft/vscode/issues/139270
85
const app = this.app as Application;
86
await app.workbench.notebook.openNotebook();
87
await app.workbench.notebook.insertNotebookCell('code');
88
await app.workbench.notebook.executeCellAction('.notebook-editor .monaco-list-row.focused div.monaco-toolbar .codicon-debug');
89
await app.workbench.notebook.waitForActiveCellEditorContents('test');
90
});
91
});
92
}
93
94