MCPcopy Index your code
hub / github.com/bqplot/bqplot / testCellOutputs

Function testCellOutputs

ui-tests/tests/bqplot.test.ts:14–51  ·  view source on GitHub ↗
(page: IJupyterLabPageFixture, tmpPath: string, theme: 'JupyterLab Light' | 'JupyterLab Dark')

Source from the content-addressed store, hash-verified

12}
13
14const testCellOutputs = async (page: IJupyterLabPageFixture, tmpPath: string, theme: 'JupyterLab Light' | 'JupyterLab Dark') => {
15 const paths = klaw(path.resolve(__dirname, './notebooks'), {filter: item => !filterUpdateNotebooks(item), nodir: true});
16 const notebooks = paths.map(item => path.basename(item.path));
17
18 const contextPrefix = theme == 'JupyterLab Light' ? 'light' : 'dark';
19 page.theme.setTheme(theme);
20
21 for (const notebook of notebooks) {
22 let results = [];
23
24 await page.notebook.openByPath(`${tmpPath}/${notebook}`);
25 await page.notebook.activate(notebook);
26
27 let numCellImages = 0;
28
29 const getCaptureImageName = (contextPrefix: string, notebook: string, id: number): string => {
30 return `${contextPrefix}-${notebook}-cell-${id}.png`;
31 };
32
33 await page.notebook.runCellByCell({
34 onAfterCellRun: async (cellIndex: number) => {
35 const cell = await page.notebook.getCellOutput(cellIndex);
36 if (cell) {
37 results.push(await cell.screenshot());
38 numCellImages++;
39 }
40 }
41 });
42
43 await page.notebook.save();
44
45 for (let c = 0; c < numCellImages; ++c) {
46 expect(results[c]).toMatchSnapshot(getCaptureImageName(contextPrefix, notebook, c), {threshold: 0.3});
47 }
48
49 await page.notebook.close(true);
50 }
51}
52
53const testPlotUpdates = async (page: IJupyterLabPageFixture, tmpPath: string, theme: 'JupyterLab Light' | 'JupyterLab Dark') => {
54 const paths = klaw(path.resolve(__dirname, './notebooks'), {filter: item => filterUpdateNotebooks(item), nodir: true});

Callers 1

bqplot.test.tsFile · 0.85

Calls 3

filterUpdateNotebooksFunction · 0.85
getCaptureImageNameFunction · 0.85
closeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…