Skip to content

Commit 5e96337

Browse files
committed
re microsoft#93070. test for command arguments.
1 parent d17550f commit 5e96337

4 files changed

Lines changed: 38 additions & 1 deletion

File tree

extensions/vscode-notebook-tests/package.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
{
3232
"command": "vscode-notebook-tests.createNewNotebook",
3333
"title": "Create New Notebook"
34+
},
35+
{
36+
"command": "vscode-notebook-tests.debugAction",
37+
"title": "Debug Notebook Test Cell Action",
38+
"icon": "$(debug)"
3439
}
3540
],
3641
"notebookProvider": [
@@ -63,6 +68,15 @@
6368
"text/custom"
6469
]
6570
}
66-
]
71+
],
72+
"menus": {
73+
"notebook/cell/title": [
74+
{
75+
"command": "vscode-notebook-tests.debugAction",
76+
"when": "notebookViewType == notebookSmokeTest",
77+
"group": "inline@1"
78+
}
79+
]
80+
}
6781
}
6882
}

extensions/vscode-notebook-tests/src/notebookSmokeTestMain.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,15 @@ export function smokeTestActivate(context: vscode.ExtensionContext): any {
9393
return;
9494
},
9595
}));
96+
97+
context.subscriptions.push(vscode.commands.registerCommand('vscode-notebook-tests.debugAction', async (cell: vscode.NotebookCell) => {
98+
if (cell) {
99+
const edit = new vscode.WorkspaceEdit();
100+
const fullRange = new vscode.Range(0, 0, cell.document.lineCount - 1, cell.document.lineAt(cell.document.lineCount - 1).range.end.character);
101+
edit.replace(cell.document.uri, fullRange, 'test');
102+
await vscode.workspace.applyEdit(edit);
103+
} else {
104+
throw new Error('Cell not set correctly');
105+
}
106+
}));
96107
}

test/automation/src/notebook.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,8 @@ export class Notebook {
8989
async executeActiveCell(): Promise<void> {
9090
await this.quickAccess.runCommand('notebook.cell.execute');
9191
}
92+
93+
async executeCellAction(selector: string): Promise<void> {
94+
await this.code.waitAndClick(selector);
95+
}
9296
}

test/smoke/src/areas/notebook/notebook.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,13 @@ export function setup() {
6262
await app.workbench.notebook.focusOutCellOutput();
6363
await app.workbench.notebook.waitForActiveCellEditorContents('code()');
6464
});
65+
66+
it('cell action execution', async function () {
67+
const app = this.app as Application;
68+
await app.workbench.notebook.openNotebook();
69+
await app.workbench.notebook.insertNotebookCell('code');
70+
await app.workbench.notebook.executeCellAction('.notebook-editor .monaco-list-row.focused div.monaco-toolbar .codicon-debug');
71+
await app.workbench.notebook.waitForActiveCellEditorContents('test');
72+
});
6573
});
6674
}

0 commit comments

Comments
 (0)