From 8f548fdf2e7e68aa03303bc96b3a5d105c95fb20 Mon Sep 17 00:00:00 2001 From: Frederic COLLONVAL Date: Tue, 15 Aug 2023 15:47:07 +0200 Subject: [PATCH] Configure test for notebook 7 --- ui-tests/jupyter_server_test_config.py | 6 ++++++ ui-tests/playwright-notebook.config.js | 21 +++++++++++++++++++++ ui-tests/tests/jupyter-archive.spec.ts | 11 +++++++++++ 3 files changed, 38 insertions(+) create mode 100644 ui-tests/playwright-notebook.config.js diff --git a/ui-tests/jupyter_server_test_config.py b/ui-tests/jupyter_server_test_config.py index f2a9478..d4abf4c 100644 --- a/ui-tests/jupyter_server_test_config.py +++ b/ui-tests/jupyter_server_test_config.py @@ -8,5 +8,11 @@ configure_jupyter_server(c) +# Option specific for notebook v7+ +import jupyterlab +from pathlib import Path +c.JupyterNotebookApp.expose_app_in_browser = True +c.LabServerApp.extra_labextensions_path = str(Path(jupyterlab.__file__).parent / "galata") + # Uncomment to set server log level to debug level # c.ServerApp.log_level = "DEBUG" diff --git a/ui-tests/playwright-notebook.config.js b/ui-tests/playwright-notebook.config.js new file mode 100644 index 0000000..d46241a --- /dev/null +++ b/ui-tests/playwright-notebook.config.js @@ -0,0 +1,21 @@ +/** + * Configuration for Playwright using default from @jupyterlab/galata + */ +const baseConfig = require('@jupyterlab/galata/lib/playwright-config'); + +// Trick to customize the fixture `waitForApplication` +process.env.IS_NOTEBOOK='1'; + +module.exports = { + ...baseConfig, + use: { + ...baseConfig.use, + appPath: '', + }, + webServer: { + command: 'jlpm start', + url: 'http://localhost:8888/lab', + timeout: 120 * 1000, + reuseExistingServer: !process.env.CI + } +}; diff --git a/ui-tests/tests/jupyter-archive.spec.ts b/ui-tests/tests/jupyter-archive.spec.ts index cc74fa9..3e850d9 100644 --- a/ui-tests/tests/jupyter-archive.spec.ts +++ b/ui-tests/tests/jupyter-archive.spec.ts @@ -3,6 +3,17 @@ import * as path from 'path'; const fileName = 'folder.tar.xz'; +if (process.env.IS_NOTEBOOK){ + test.use({ + waitForApplication: async ({ baseURL }, use, testInfo) => { + const waitIsReady = async (page): Promise => { + await page.waitForSelector('#main-panel'); + }; + await use(waitIsReady); + } + }); +} + test('should download a folder as an archive', async ({ page }) => { await page.locator('.jp-DirListing-content').click({ button: 'right'