diff --git a/ui-tests/environment.yml b/ui-tests/env1.yml similarity index 61% rename from ui-tests/environment.yml rename to ui-tests/env1.yml index 709db9ec..71f277bc 100644 --- a/ui-tests/environment.yml +++ b/ui-tests/env1.yml @@ -1,6 +1,6 @@ -name: jupyterlite-xeus-tests +name: env1 channels: - - https://repo.mamba.pm/emscripten-forge + - https://repo.prefix.dev/emscripten-forge-dev - conda-forge dependencies: - xeus-python diff --git a/ui-tests/env2.yml b/ui-tests/env2.yml new file mode 100644 index 00000000..7b1542da --- /dev/null +++ b/ui-tests/env2.yml @@ -0,0 +1,6 @@ +name: env2 +channels: + - https://repo.prefix.dev/emscripten-forge-dev + - conda-forge +dependencies: + - xeus-python diff --git a/ui-tests/jupyter_lite_config.json b/ui-tests/jupyter_lite_config.json index 11bf9467..4a199ee5 100644 --- a/ui-tests/jupyter_lite_config.json +++ b/ui-tests/jupyter_lite_config.json @@ -1,5 +1,8 @@ { "LiteBuildConfig": { "output_dir": "dist" + }, + "XeusAddon": { + "environment_file": ["env1.yml", "env2.yml"] } } diff --git a/ui-tests/tests/jupyterlite_xeus.spec.ts b/ui-tests/tests/jupyterlite_xeus.spec.ts index 95f88817..159c733d 100644 --- a/ui-tests/tests/jupyterlite_xeus.spec.ts +++ b/ui-tests/tests/jupyterlite_xeus.spec.ts @@ -25,7 +25,9 @@ test.describe('General Tests', () => { test('xeus-python should execute some code', async ({ page }) => { await page.goto('lab/index.html'); - const xpython = page.locator('[title="Python 3.11 (XPython)"]').first(); + const xpython = page + .locator('[title="Python 3.13 (XPython) [env1]"]') + .first(); await xpython.click(); // Wait for kernel to be idle @@ -44,11 +46,40 @@ test.describe('General Tests', () => { ); }); + test('should support the same kernel from a second environment', async ({ + page + }) => { + await page.goto('lab/index.html'); + + const xpython = page + .locator('[title="Python 3.13 (XPython) [env2]"]') + .first(); + await xpython.click(); + + // Wait for kernel to be idle + await page.locator('#jp-main-statusbar').getByText('Idle').waitFor(); + + // xeus-python from env2 does not have bqplot installed. + await page.notebook.addCell('code', 'import bqplot'); + await page.notebook.runCell(1); + + // Wait for kernel to be idle + await page.locator('#jp-main-statusbar').getByText('Idle').waitFor(); + + const cell = await page.notebook.getCellOutput(1); + + expect(await cell?.screenshot()).toMatchSnapshot( + 'jupyter-xeus-execute-env2.png' + ); + }); + test('the kernel should have access to the file system', async ({ page }) => { await page.goto('lab/index.html'); // Create a Python notebook - const xpython = page.locator('[title="Python 3.11 (XPython)"]').first(); + const xpython = page + .locator('[title="Python 3.13 (XPython) [env1]"]') + .first(); await xpython.click(); await page.notebook.save(); diff --git a/ui-tests/tests/jupyterlite_xeus.spec.ts-snapshots/jupyter-xeus-execute-env2-crossoriginisolated-linux.png b/ui-tests/tests/jupyterlite_xeus.spec.ts-snapshots/jupyter-xeus-execute-env2-crossoriginisolated-linux.png new file mode 100644 index 00000000..7ca50447 Binary files /dev/null and b/ui-tests/tests/jupyterlite_xeus.spec.ts-snapshots/jupyter-xeus-execute-env2-crossoriginisolated-linux.png differ diff --git a/ui-tests/tests/jupyterlite_xeus.spec.ts-snapshots/jupyter-xeus-execute-env2-default-linux.png b/ui-tests/tests/jupyterlite_xeus.spec.ts-snapshots/jupyter-xeus-execute-env2-default-linux.png new file mode 100644 index 00000000..7ca50447 Binary files /dev/null and b/ui-tests/tests/jupyterlite_xeus.spec.ts-snapshots/jupyter-xeus-execute-env2-default-linux.png differ diff --git a/ui-tests/tests/jupyterlite_xeus.spec.ts-snapshots/jupyter-xeus-launcher-crossoriginisolated-linux.png b/ui-tests/tests/jupyterlite_xeus.spec.ts-snapshots/jupyter-xeus-launcher-crossoriginisolated-linux.png index fdc55792..65dbd619 100644 Binary files a/ui-tests/tests/jupyterlite_xeus.spec.ts-snapshots/jupyter-xeus-launcher-crossoriginisolated-linux.png and b/ui-tests/tests/jupyterlite_xeus.spec.ts-snapshots/jupyter-xeus-launcher-crossoriginisolated-linux.png differ diff --git a/ui-tests/tests/jupyterlite_xeus.spec.ts-snapshots/jupyter-xeus-launcher-default-linux.png b/ui-tests/tests/jupyterlite_xeus.spec.ts-snapshots/jupyter-xeus-launcher-default-linux.png index fdc55792..65dbd619 100644 Binary files a/ui-tests/tests/jupyterlite_xeus.spec.ts-snapshots/jupyter-xeus-launcher-default-linux.png and b/ui-tests/tests/jupyterlite_xeus.spec.ts-snapshots/jupyter-xeus-launcher-default-linux.png differ