From 6ddbcb0caa2e6f4487be8ca2bb71f9c8999a007f Mon Sep 17 00:00:00 2001 From: martinRenou Date: Wed, 6 Dec 2023 15:56:19 +0100 Subject: [PATCH] Update galata setup (copying from bqplot's ui-tests) --- .github/workflows/ui-tests.yml | 14 ++------------ ui-tests/jupyter_server_config.py | 10 +++------- ui-tests/package.json | 11 +++++------ ui-tests/playwright.config.js | 5 +++++ ui-tests/yarn.lock | 6 +++--- 5 files changed, 18 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index 3d5acc5ec..6e364dc19 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -34,21 +34,11 @@ jobs: - name: Install browser run: | jlpm install - jlpm playwright install chromium + npx playwright install chromium working-directory: ui-tests - - name: Launch JupyterLab - run: jlpm start:detached > /tmp/jupyterlab_server.log 2>&1 - working-directory: ui-tests - - - name: Wait for JupyterLab - uses: ifaxity/wait-on-action@v1 - with: - resource: http-get://localhost:8888/ - timeout: 360000 - - name: Widget rendering tests - run: jlpm run test + run: npx playwright test working-directory: ui-tests - name: Upload Playwright Test assets diff --git a/ui-tests/jupyter_server_config.py b/ui-tests/jupyter_server_config.py index 7cef023b8..48c6f0911 100644 --- a/ui-tests/jupyter_server_config.py +++ b/ui-tests/jupyter_server_config.py @@ -1,7 +1,3 @@ -c.ServerApp.port = 8888 -c.ServerApp.token = "" -c.ServerApp.password = "" -c.ServerApp.disable_check_xsrf = True -c.ServerApp.open_browser = False -c.LabApp.open_browser = False -c.LabApp.expose_app_in_browser = True +from jupyterlab.galata import configure_jupyter_server + +configure_jupyter_server(c) # noqa F821 \ No newline at end of file diff --git a/ui-tests/package.json b/ui-tests/package.json index 26f1139c3..05a88f43c 100644 --- a/ui-tests/package.json +++ b/ui-tests/package.json @@ -4,19 +4,18 @@ "description": "ipyleaflet UI Tests", "private": true, "scripts": { - "start": "jupyter labextension disable '@jupyterlab/apputils-extension:announcements' && jupyter lab --config ./jupyter_server_config.py", - "start:detached": "yarn run start&", + "start": "jupyter lab --config jupyter_server_config.py", "clean": "rimraf tests/notebooks/.ipynb_checkpoints && rimraf test-output", - "test": "yarn run clean && playwright test", - "test:debug": "yarn run clean && PWDEBUG=1 playwright test", - "test:update": "playwright test --update-snapshots" + "test": "npx playwright test", + "test:debug": "yarn run clean && PWDEBUG=1 npx playwright test", + "test:update": "npx playwright test --update-snapshots" }, "author": "ipyleaflet", "license": "MIT", "dependencies": { "@jupyterlab/galata": "^4.3.5", + "@playwright/test": "^1.32.0", "klaw-sync": "^6.0.0", - "playwright": "^1.40.1", "rimraf": "^3.0.2" } } diff --git a/ui-tests/playwright.config.js b/ui-tests/playwright.config.js index ade71f156..7e893f349 100644 --- a/ui-tests/playwright.config.js +++ b/ui-tests/playwright.config.js @@ -5,6 +5,11 @@ module.exports = { expect: { toMatchSnapshot: { threshold: 0.33 }, }, + webServer: { + command: 'jlpm start', + url: 'http://localhost:8888/lab', + reuseExistingServer: !process.env.CI + }, preserveOutput: 'failures-only', retries: 0, timeout: 600000, diff --git a/ui-tests/yarn.lock b/ui-tests/yarn.lock index 6d2a1b0b1..6d1ca2723 100644 --- a/ui-tests/yarn.lock +++ b/ui-tests/yarn.lock @@ -959,7 +959,7 @@ __metadata: languageName: node linkType: hard -"@playwright/test@npm:^1.16.2": +"@playwright/test@npm:^1.16.2, @playwright/test@npm:^1.32.0": version: 1.40.1 resolution: "@playwright/test@npm:1.40.1" dependencies: @@ -2619,8 +2619,8 @@ __metadata: resolution: "ipyleaflet-ui-tests@workspace:." dependencies: "@jupyterlab/galata": ^4.3.5 + "@playwright/test": ^1.32.0 klaw-sync: ^6.0.0 - playwright: ^1.40.1 rimraf: ^3.0.2 languageName: unknown linkType: soft @@ -3367,7 +3367,7 @@ __metadata: languageName: node linkType: hard -"playwright@npm:1.40.1, playwright@npm:^1.40.1": +"playwright@npm:1.40.1": version: 1.40.1 resolution: "playwright@npm:1.40.1" dependencies: