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

Function testPlotUpdates

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

Source from the content-addressed store, hash-verified

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});
55 const notebooks = paths.map(item => path.basename(item.path));
56
57 const contextPrefix = theme == 'JupyterLab Light' ? 'light' : 'dark';
58 page.theme.setTheme(theme);
59
60 for (const notebook of notebooks) {
61 let results = [];
62
63 await page.notebook.openByPath(`${tmpPath}/${notebook}`);
64 await page.notebook.activate(notebook);
65
66 const getCaptureImageName = (contextPrefix: string, notebook: string, id: number): string => {
67 return `${contextPrefix}-${notebook}-cell-${id}.png`;
68 };
69
70 let cellCount = 0;
71 await page.notebook.runCellByCell({
72 onAfterCellRun: async (cellIndex: number) => {
73 // Always get first cell output which must contain the plot
74 const cell = await page.notebook.getCellOutput(0);
75 if (cell) {
76 results.push(await cell.screenshot());
77 cellCount++;
78 }
79 }
80 });
81
82 await page.notebook.save();
83
84 for (let i = 0; i < cellCount; i++) {
85 expect(results[i]).toMatchSnapshot(getCaptureImageName(contextPrefix, notebook, i), {threshold: 0.3});
86 }
87
88 await page.notebook.close(true);
89 }
90};
91
92test.describe('bqplot Visual Regression', () => {
93 test.beforeEach(async ({ page, tmpPath }) => {

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…