Skip to content

Commit

Permalink
debug CI
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc committed Nov 6, 2023
1 parent 53742ff commit d7e38c4
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
python -m pip install ".[test]"
jlpm run build
jlpm run develop
jupyter labextension develop . --overwrite
jupyter labextension list
cd ui-tests
jlpm install
Expand Down
82 changes: 41 additions & 41 deletions ui-tests/tests/extension.test.ts
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
// // Copyright (c) Jupyter Development Team.
// // Distributed under the terms of the Modified BSD License.

import { expect, test, APIRequestContext, Page } from '@playwright/test';
// import { expect, test, APIRequestContext, Page } from '@playwright/test';

async function beforeEach(
page: Page,
request: APIRequestContext
): Promise<void> {
page.setDefaultTimeout(600000);
page.setViewportSize({ width: 1920, height: 1080 });
page.on('console', (message) => {
console.log('CONSOLE MSG ---', message.text());
});
}
// async function beforeEach(
// page: Page,
// request: APIRequestContext
// ): Promise<void> {
// page.setDefaultTimeout(600000);
// page.setViewportSize({ width: 1920, height: 1080 });
// page.on('console', (message) => {
// console.log('CONSOLE MSG ---', message.text());
// });
// }

test.describe('JupyterLab extension tests', () => {
test.beforeEach(({ page, request }) => void beforeEach(page, request));
// test.describe('JupyterLab extension tests', () => {
// test.beforeEach(({ page, request }) => void beforeEach(page, request));

test('Render iris_example.ipynb', async ({ page }) => {
const notebookName = 'iris_example';
await page.goto(`/lab/tree/${notebookName}.ipynb?reset`);
// wait for the widgets to load
await page
.getByRole('button', { name: 'Open with Voilà GridStack editor' })
.click();
await page.waitForTimeout(500);
expect(await page.screenshot()).toMatchSnapshot(`${notebookName}.png`);
// test('Render iris_example.ipynb', async ({ page }) => {
// const notebookName = 'iris_example';
// await page.goto(`/lab/tree/${notebookName}.ipynb?reset`);
// // wait for the widgets to load
// await page
// .getByRole('button', { name: 'Open with Voilà GridStack editor' })
// .click();
// await page.waitForTimeout(500);
// expect(await page.screenshot()).toMatchSnapshot(`${notebookName}.png`);

await page.getByText('File', { exact: true }).click();
await page.locator('#jp-mainmenu-file').getByText('Close All Tabs').click();
});
// await page.getByText('File', { exact: true }).click();
// await page.locator('#jp-mainmenu-file').getByText('Close All Tabs').click();
// });

test('Render scotch_dashboard.ipynb', async ({ page }) => {
const notebookName = 'scotch_dashboard';
await page.goto(`/lab/tree/${notebookName}.ipynb?reset`);
// wait for the widgets to load
await page
.getByRole('button', { name: 'Open with Voilà GridStack editor' })
.click();
await page.locator('.gridstack-toolbar-button');
await page.waitForTimeout(2500);
expect(await page.screenshot()).toMatchSnapshot(`${notebookName}.png`);
await page.getByText('File', { exact: true }).click();
await page.locator('#jp-mainmenu-file').getByText('Close All Tabs').click();
});
});
// test('Render scotch_dashboard.ipynb', async ({ page }) => {
// const notebookName = 'scotch_dashboard';
// await page.goto(`/lab/tree/${notebookName}.ipynb?reset`);
// // wait for the widgets to load
// await page
// .getByRole('button', { name: 'Open with Voilà GridStack editor' })
// .click();
// await page.locator('.gridstack-toolbar-button');
// await page.waitForTimeout(2500);
// expect(await page.screenshot()).toMatchSnapshot(`${notebookName}.png`);
// await page.getByText('File', { exact: true }).click();
// await page.locator('#jp-mainmenu-file').getByText('Close All Tabs').click();
// });
// });
16 changes: 8 additions & 8 deletions ui-tests/tests/template.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ test.describe('Template tests', () => {
expect(await page.screenshot()).toMatchSnapshot(`${notebookName}.png`);
});

test('Render scotch_dashboard.ipynb', async ({ page }) => {
const notebookName = 'scotch_dashboard';
await page.goto(`/voila/render/${notebookName}.ipynb?template=gridstack`);
// wait for the widgets to load
await page.waitForSelector('div.lm-Widget.bqplot.figure.jupyter-widgets');
await page.waitForTimeout(500);
expect(await page.screenshot()).toMatchSnapshot(`${notebookName}.png`);
});
// test('Render scotch_dashboard.ipynb', async ({ page }) => {
// const notebookName = 'scotch_dashboard';
// await page.goto(`/voila/render/${notebookName}.ipynb?template=gridstack`);
// // wait for the widgets to load
// await page.waitForSelector('div.lm-Widget.bqplot.figure.jupyter-widgets');
// await page.waitForTimeout(500);
// expect(await page.screenshot()).toMatchSnapshot(`${notebookName}.png`);
// });
});
2 changes: 2 additions & 0 deletions voila_gridstack/template/gridstack.js.j2
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@
window.onload = async function () {
const node = document.getElementById('rendered_cells');
while (!window.themeLoaded || !window.cellLoaded || node.offsetHeight < 30) {
console.log('waiting', window.themeLoaded, window.cellLoaded, node.offsetHeight)
await delay(100);
}
console.log('done', window.themeLoaded, window.cellLoaded, node.offsetHeight)
initGrid();
};
Expand Down

0 comments on commit d7e38c4

Please sign in to comment.