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