Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 36 additions & 18 deletions ui-tests/tests/jupytereverywhere.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,31 +529,49 @@
await page.locator('.je-KernelSwitcherDropdownButton-menu').screenshot()
).toMatchSnapshot('kernel-switcher-menu.png');
});
});

test('Should switch to R kernel and run R code', async ({ page }) => {
await page.goto('lab/index.html');
await page.waitForSelector('.jp-NotebookPanel');
test('Should switch to R kernel and run R code', async ({ page }) => {
await page.goto('lab/index.html');
await page.waitForSelector('.jp-NotebookPanel');

await runCommand(page, 'jupytereverywhere:switch-kernel', { kernel: 'xr' });
await page.waitForTimeout(10000);
await runCommand(page, 'notebook:insert-cell-below');

await runCommand(page, 'jupytereverywhere:switch-kernel', { kernel: 'xr' });
await page.waitForTimeout(10000);
await runCommand(page, 'notebook:insert-cell-below');
const code = 'lm(mpg ~ wt + hp + disp + cyl, data=mtcars)';
const cell = page.locator('.jp-Cell').last();
await cell.getByRole('textbox').fill(code);

const code = 'lm(mpg ~ wt + hp + disp + cyl, data=mtcars)';
const cell = page.locator('.jp-Cell').last();
await cell.getByRole('textbox').fill(code);
await runCommand(page, 'notebook:run-cell');

await runCommand(page, 'notebook:run-cell');
const output = cell.locator('.jp-Cell-outputArea');
await expect(output).toBeVisible({
timeout: 20000 // shouldn't take too long to run but just to be safe
});

const output = cell.locator('.jp-Cell-outputArea');
await expect(output).toBeVisible({
timeout: 20000 // shouldn't take too long to run but just to be safe
const text = await output.textContent();
expect(text).toContain('Call');
// Add a snapshot of the output area
expect(await output.screenshot()).toMatchSnapshot('r-output.png');
});
});

test.describe('Default (Python) kernel environment', () => {
test('Should be able to import geopandas', async ({ page }) => {
await page.waitForSelector('.jp-NotebookPanel');

const code = 'import geopandas; geopandas.GeoSeries()';
const cell = page.locator('.jp-Cell').first();
await cell.getByRole('textbox').fill(code);

const text = await output.textContent();
expect(text).toContain('Call');
// Add a snapshot of the output area
expect(await output.screenshot()).toMatchSnapshot('r-output.png');
await runCommand(page, 'notebook:run-cell');

const output = cell.locator('.jp-Cell-outputArea');
await expect(output).toBeVisible({ timeout: 20000 });

const text = await output.textContent();
expect(text).toContain('dtype: geometry');

Check failure on line 573 in ui-tests/tests/jupytereverywhere.spec.ts

View workflow job for this annotation

GitHub Actions / Integration tests

[chromium] › tests/jupytereverywhere.spec.ts:560:7 › Default (Python) kernel environment › Should be able to import geopandas

1) [chromium] › tests/jupytereverywhere.spec.ts:560:7 › Default (Python) kernel environment › Should be able to import geopandas Error: expect(received).toContain(expected) // indexOf Expected substring: "dtype: geometry" Received string: "--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) Cell In[1], line 1 ----> 1 import geopandas; geopandas.GeoSeries()· ModuleNotFoundError: No module named 'geopandas'" 571 | 572 | const text = await output.textContent(); > 573 | expect(text).toContain('dtype: geometry'); | ^ 574 | }); 575 | }); 576 | at /home/runner/work/jupyterlite-extension/jupyterlite-extension/ui-tests/tests/jupytereverywhere.spec.ts:573:18
});
});

test.describe('Kernel networking', () => {
Expand Down
Loading