diff --git a/extensions/vscode-notebook-tests/package.json b/extensions/vscode-notebook-tests/package.json index 83f73669e0a..4ed7605f894 100644 --- a/extensions/vscode-notebook-tests/package.json +++ b/extensions/vscode-notebook-tests/package.json @@ -31,6 +31,11 @@ { "command": "vscode-notebook-tests.createNewNotebook", "title": "Create New Notebook" + }, + { + "command": "vscode-notebook-tests.debugAction", + "title": "Debug Notebook Test Cell Action", + "icon": "$(debug)" } ], "notebookProvider": [ @@ -63,6 +68,15 @@ "text/custom" ] } - ] + ], + "menus": { + "notebook/cell/title": [ + { + "command": "vscode-notebook-tests.debugAction", + "when": "notebookViewType == notebookSmokeTest", + "group": "inline@1" + } + ] + } } } diff --git a/extensions/vscode-notebook-tests/src/notebookSmokeTestMain.ts b/extensions/vscode-notebook-tests/src/notebookSmokeTestMain.ts index 05c87a16687..8c32dedc3bf 100644 --- a/extensions/vscode-notebook-tests/src/notebookSmokeTestMain.ts +++ b/extensions/vscode-notebook-tests/src/notebookSmokeTestMain.ts @@ -93,4 +93,15 @@ export function smokeTestActivate(context: vscode.ExtensionContext): any { return; }, })); + + context.subscriptions.push(vscode.commands.registerCommand('vscode-notebook-tests.debugAction', async (cell: vscode.NotebookCell) => { + if (cell) { + const edit = new vscode.WorkspaceEdit(); + const fullRange = new vscode.Range(0, 0, cell.document.lineCount - 1, cell.document.lineAt(cell.document.lineCount - 1).range.end.character); + edit.replace(cell.document.uri, fullRange, 'test'); + await vscode.workspace.applyEdit(edit); + } else { + throw new Error('Cell not set correctly'); + } + })); } diff --git a/test/automation/src/notebook.ts b/test/automation/src/notebook.ts index baa05e7cf78..0110e09385c 100644 --- a/test/automation/src/notebook.ts +++ b/test/automation/src/notebook.ts @@ -89,4 +89,8 @@ export class Notebook { async executeActiveCell(): Promise { await this.quickAccess.runCommand('notebook.cell.execute'); } + + async executeCellAction(selector: string): Promise { + await this.code.waitAndClick(selector); + } } diff --git a/test/smoke/src/areas/notebook/notebook.test.ts b/test/smoke/src/areas/notebook/notebook.test.ts index dbd6bdd3e56..217f8cb1cc3 100644 --- a/test/smoke/src/areas/notebook/notebook.test.ts +++ b/test/smoke/src/areas/notebook/notebook.test.ts @@ -62,5 +62,13 @@ export function setup() { await app.workbench.notebook.focusOutCellOutput(); await app.workbench.notebook.waitForActiveCellEditorContents('code()'); }); + + it('cell action execution', async function () { + const app = this.app as Application; + await app.workbench.notebook.openNotebook(); + await app.workbench.notebook.insertNotebookCell('code'); + await app.workbench.notebook.executeCellAction('.notebook-editor .monaco-list-row.focused div.monaco-toolbar .codicon-debug'); + await app.workbench.notebook.waitForActiveCellEditorContents('test'); + }); }); }