Path: blob/main/test/smoke/src/areas/notebook/notebook.test.ts
5251 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import * as cp from 'child_process';6import { Application, Logger } from '../../../../automation';7import { installAllHandlers } from '../../utils';89export function setup(logger: Logger) {10describe('Notebooks', () => { // https://github.com/microsoft/vscode/issues/1405751112// Shared before/after handling13installAllHandlers(logger);1415afterEach(async function () {16const app = this.app as Application;17await app.workbench.quickaccess.runCommand('workbench.action.files.save');18await app.workbench.quickaccess.runCommand('workbench.action.closeActiveEditor');19});2021after(async function () {22const app = this.app as Application;2324cp.execSync('git checkout . --quiet', { cwd: app.workspacePathOrFolder });25cp.execSync('git reset --hard HEAD --quiet', { cwd: app.workspacePathOrFolder });26});2728// the heap snapshot fails to parse29it.skip('check heap leaks', async function () {30const app = this.app as Application;31await app.profiler.checkHeapLeaks(['NotebookTextModel', 'NotebookCellTextModel', 'NotebookEventDispatcher'], async () => {32await app.workbench.notebook.openNotebook();33await app.workbench.quickaccess.runCommand('workbench.action.files.save');34await app.workbench.quickaccess.runCommand('workbench.action.closeActiveEditor');35});36});3738it.skip('check object leaks', async function () {39const app = this.app as Application;40await app.profiler.checkObjectLeaks(['NotebookTextModel', 'NotebookCellTextModel', 'NotebookEventDispatcher'], async () => {41await app.workbench.notebook.openNotebook();42await app.workbench.quickaccess.runCommand('workbench.action.files.save');43await app.workbench.quickaccess.runCommand('workbench.action.closeActiveEditor');44});45});4647it.skip('inserts/edits code cell', async function () {48const app = this.app as Application;49await app.workbench.notebook.openNotebook();50await app.workbench.notebook.focusNextCell();51await app.workbench.notebook.insertNotebookCell('code');52await app.workbench.notebook.waitForTypeInEditor('// some code');53await app.workbench.notebook.stopEditingCell();54});5556it.skip('inserts/edits markdown cell', async function () {57const app = this.app as Application;58await app.workbench.notebook.openNotebook();59await app.workbench.notebook.focusNextCell();60await app.workbench.notebook.insertNotebookCell('markdown');61await app.workbench.notebook.waitForTypeInEditor('## hello2! ');62await app.workbench.notebook.stopEditingCell();63// TODO: markdown row selectors haven't been updated to look in the webview64await app.workbench.notebook.waitForMarkdownContents('', '');65});6667it.skip('moves focus as it inserts/deletes a cell', async function () {68const app = this.app as Application;69await app.workbench.notebook.openNotebook();70await app.workbench.notebook.focusFirstCell();71await app.workbench.notebook.insertNotebookCell('code');72await app.workbench.notebook.waitForActiveCellEditorContents('');73await app.workbench.notebook.waitForTypeInEditor('# added cell');74await app.workbench.notebook.focusFirstCell();75await app.workbench.notebook.insertNotebookCell('code');76await app.workbench.notebook.waitForActiveCellEditorContents('');77await app.workbench.notebook.deleteActiveCell();78await app.workbench.notebook.waitForActiveCellEditorContents('# added cell');79});8081it.skip('moves focus in and out of output', async function () { // TODO@rebornix https://github.com/microsoft/vscode/issues/13927082const app = this.app as Application;83await app.workbench.notebook.openNotebook();84// first cell is a code cell that already has output85await app.workbench.notebook.focusInCellOutput();86await app.workbench.notebook.editCell();87await app.workbench.notebook.waitForActiveCellEditorContents('print(1)');88});8990// broken: there is no kernel available to execute code91it.skip('cell action execution', async function () { // TODO@rebornix https://github.com/microsoft/vscode/issues/13927092const app = this.app as Application;93await app.workbench.notebook.openNotebook();94await app.workbench.notebook.insertNotebookCell('code');95await app.workbench.notebook.executeCellAction('.notebook-editor .monaco-list-row.focused div.monaco-toolbar .codicon-debug');96await app.workbench.notebook.waitForActiveCellEditorContents('test');97});98});99}100101102