Skip to content

Commit a44cb16

Browse files
Test for stop all
1 parent c154ee6 commit a44cb16

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

apps/client-e2e/src/tests/notebooks/_notebook-runner.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { NotebookFormats_1_0_0 } from './notebook-formats-1.0.0';
1010
import { NotebookFormats_2_0_0 } from './notebook-formats-2.0.0';
1111
import { RunNotebookReset } from './notebook-reset';
1212
import { RunNotebookStop } from './notebook-stop';
13+
import { RunNotebookStopAll } from './notebook-stop-all';
1314
import { NotebookToProCodeAllCells } from './notebook-to-pro-code-all-cells';
1415
import { NotebookToProCodeAllCells2 } from './notebook-to-pro-code-all-cells-2';
1516
import { NotebookToProCodeOnlyCode } from './notebook-to-pro-code-only-code';
@@ -223,6 +224,13 @@ NOTEBOOK_RUNNER.addTest({
223224
critical: true,
224225
});
225226

227+
// stop all notebooks
228+
NOTEBOOK_RUNNER.addTest({
229+
name: 'Stop all does the right thing',
230+
fn: RunNotebookStopAll,
231+
critical: true,
232+
});
233+
226234
// stop at the end to make sure the process exits
227235
NOTEBOOK_RUNNER.addTest({
228236
name: 'Stop does the right thing',
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { GetExtensionPath, IDL_COMMANDS, Sleep } from '@idl/shared';
2+
import { OpenNotebookInVSCode, VSCODE_COMMANDS } from '@idl/vscode/shared';
3+
import expect from 'expect';
4+
import * as vscode from 'vscode';
5+
6+
import { RunnerFunction } from '../runner.interface';
7+
8+
/**
9+
* Stop all notebooks
10+
*/
11+
export const RunNotebookStopAll: RunnerFunction = async (init) => {
12+
/**
13+
* Get the file we are going to open
14+
*/
15+
const file = GetExtensionPath(
16+
'idl/test/client-e2e/notebooks/stop-notebook.idlnb'
17+
);
18+
19+
/**
20+
* Open the notebook
21+
*/
22+
const nb = await OpenNotebookInVSCode(file);
23+
24+
// trigger a run to start IDL
25+
await vscode.commands.executeCommand(VSCODE_COMMANDS.NOTEBOOK_RUN_ALL);
26+
27+
// make sure launched
28+
expect(init.notebooks.controller.isStarted(nb)).toBeTruthy();
29+
30+
// stop all notebooks
31+
await vscode.commands.executeCommand(IDL_COMMANDS.NOTEBOOKS.STOP_ALL_KERNELS);
32+
33+
// short pause
34+
await Sleep(500);
35+
36+
// make sure stopped
37+
expect(init.notebooks.controller.isStarted(nb)).toBeFalsy();
38+
};

0 commit comments

Comments
 (0)