Skip to content

Commit

Permalink
Update test for widgets inside box
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc authored and jtpio committed Nov 10, 2021
1 parent 5d9d301 commit 64a0707
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
41 changes: 38 additions & 3 deletions ui-tests/stability_test/stability.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ test.describe('Voila stability Tests', () => {
);
expect(await page.screenshot()).toMatchSnapshot(`${notebookName}.png`);
});
test('Should render notebook with missing module in a box', async ({

test('Should not render notebook with missing module in a box', async ({
page,
browserName
}, testInfo) => {
const notebookName = 'missing_module_inside_box';
await page.goto(`render/${notebookName}.ipynb`);
await page.waitForSelector('button');
await page.$('text=Typesetting math: 100%');
// await page.waitForSelector('button');
// await page.$('text=Typesetting math: 100%');
await page.waitForSelector('#MathJax_Message', { state: 'hidden' });
expect(errorLogs).toContain(
'Class ModuleImportErrorModel not found in module widget_lib@^0.1.0'
Expand All @@ -59,6 +60,17 @@ test.describe('Voila stability Tests', () => {
expect(await page.screenshot()).toMatchSnapshot(`${notebookName}.png`);
});

test('Should not render notebook with model error in a box', async ({
page,
browserName
}, testInfo) => {
const notebookName = 'module_error_inside_box';
await page.goto(`render/${notebookName}.ipynb`);
await page.waitForSelector('#MathJax_Message', { state: 'hidden' });
expect(errorLogs).toContain('Error: Failed to initialize model.');
expect(await page.screenshot()).toMatchSnapshot(`${notebookName}.png`);
});

test('Should render notebook with render error', async ({
page,
browserName
Expand All @@ -71,6 +83,16 @@ test.describe('Voila stability Tests', () => {
expect(errorLogs).toContain('Error: Could not create view');
expect(await page.screenshot()).toMatchSnapshot(`${notebookName}.png`);
});
test('Should not render notebook with render error in a box', async ({
page,
browserName
}, testInfo) => {
const notebookName = 'render_error_inside_box';
await page.goto(`render/${notebookName}.ipynb`);
await page.waitForSelector('#MathJax_Message', { state: 'hidden' });
expect(errorLogs).toContain('Error: Could not create a view');
expect(await page.screenshot()).toMatchSnapshot(`${notebookName}.png`);
});

test('Should render notebook with semver error', async ({
page,
Expand All @@ -86,4 +108,17 @@ test.describe('Voila stability Tests', () => {
);
expect(await page.screenshot()).toMatchSnapshot(`${notebookName}.png`);
});

test('Should not render notebook with semver error in a box', async ({
page,
browserName
}, testInfo) => {
const notebookName = 'wrong_semver_inside_box';
await page.goto(`render/${notebookName}.ipynb`);
await page.waitForSelector('#MathJax_Message', { state: 'hidden' });
expect(errorLogs).toContain(
'Error: Module @jupyter-widgets/controls, semver range 0.0 is not registered as a widget module'
);
expect(await page.screenshot()).toMatchSnapshot(`${notebookName}.png`);
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 64a0707

Please sign in to comment.