-
Notifications
You must be signed in to change notification settings - Fork 0
fix(ui): Set max width on notebook dropdown #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
7cbb8a9
e5972da
39a489d
ac84c1e
7b386ab
b66484a
6d80601
13bb29f
cdd8054
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,167 @@ | ||||||||||||||||||
| # Integration Testing | ||||||||||||||||||
|
|
||||||||||||||||||
| This folder contains the integration tests of the extension. | ||||||||||||||||||
|
|
||||||||||||||||||
| They are defined using [Playwright](https://playwright.dev/docs/intro) test runner | ||||||||||||||||||
| and [Galata](https://github.com/jupyterlab/jupyterlab/tree/main/galata) helper. | ||||||||||||||||||
|
|
||||||||||||||||||
| The Playwright configuration is defined in [playwright.config.js](./playwright.config.js). | ||||||||||||||||||
|
|
||||||||||||||||||
| The JupyterLab server configuration to use for the integration test is defined | ||||||||||||||||||
| in [jupyter_server_test_config.py](./jupyter_server_test_config.py). | ||||||||||||||||||
|
|
||||||||||||||||||
| The default configuration will produce video for failing tests and an HTML report. | ||||||||||||||||||
|
|
||||||||||||||||||
| > There is a UI mode that you may like; see [that video](https://www.youtube.com/watch?v=jF0yA-JLQW0). | ||||||||||||||||||
| ## Run the tests | ||||||||||||||||||
|
|
||||||||||||||||||
| > All commands are assumed to be executed from the root directory | ||||||||||||||||||
| To run the tests, you need to: | ||||||||||||||||||
|
|
||||||||||||||||||
| 1. Compile the extension: | ||||||||||||||||||
|
|
||||||||||||||||||
| ```sh | ||||||||||||||||||
| jlpm install | ||||||||||||||||||
| jlpm build:prod | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| > Check the extension is installed in JupyterLab. | ||||||||||||||||||
| 2. Install test dependencies (needed only once): | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Fix ordered-list numbering (MD029). Use "1." for all items to satisfy markdownlint and keep auto-numbering consistent. -2. Install test dependencies (needed only once):
+1. Install test dependencies (needed only once):
-3. Execute the [Playwright](https://playwright.dev/docs/intro) tests:
+1. Execute the [Playwright](https://playwright.dev/docs/intro) tests:
-2. Install test dependencies (needed only once):
+1. Install test dependencies (needed only once):
-3. Execute the [Playwright](https://playwright.dev/docs/intro) command:
+1. Execute the [Playwright](https://playwright.dev/docs/intro) command:
-2. Install test dependencies (needed only once):
+1. Install test dependencies (needed only once):
-3. Start the server:
+1. Start the server:
-4. Execute the [Playwright code generator](https://playwright.dev/docs/codegen) in **another terminal**:
+1. Execute the [Playwright code generator](https://playwright.dev/docs/codegen) in **another terminal**:
-2. Install test dependencies (needed only once):
+1. Install test dependencies (needed only once):
-3. Execute the Playwright tests in [debug mode](https://playwright.dev/docs/debug):
+1. Execute the Playwright tests in [debug mode](https://playwright.dev/docs/debug):Also applies to: 41-41, 69-69, 78-78, 105-105, 114-114, 121-121, 143-143, 152-152 🧰 Tools🪛 markdownlint-cli2 (0.17.2)32-32: Ordered list item prefix (MD029, ol-prefix) 🤖 Prompt for AI Agents
andyjakubowski marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
|
|
||||||||||||||||||
| ```sh | ||||||||||||||||||
| cd ./ui-tests | ||||||||||||||||||
| jlpm install | ||||||||||||||||||
| jlpm playwright install | ||||||||||||||||||
| cd .. | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| 3. Execute the [Playwright](https://playwright.dev/docs/intro) tests: | ||||||||||||||||||
|
|
||||||||||||||||||
| ```sh | ||||||||||||||||||
| cd ./ui-tests | ||||||||||||||||||
| jlpm playwright test | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| Test results will be shown in the terminal. In case of any test failures, the test report | ||||||||||||||||||
| will be opened in your browser at the end of the tests execution; see | ||||||||||||||||||
| [Playwright documentation](https://playwright.dev/docs/test-reporters#html-reporter) | ||||||||||||||||||
| for configuring that behavior. | ||||||||||||||||||
|
|
||||||||||||||||||
| ## Update the tests snapshots | ||||||||||||||||||
|
|
||||||||||||||||||
| > All commands are assumed to be executed from the root directory | ||||||||||||||||||
| If you are comparing snapshots to validate your tests, you may need to update | ||||||||||||||||||
| the reference snapshots stored in the repository. To do that, you need to: | ||||||||||||||||||
|
|
||||||||||||||||||
| 1. Compile the extension: | ||||||||||||||||||
|
|
||||||||||||||||||
| ```sh | ||||||||||||||||||
| jlpm install | ||||||||||||||||||
| jlpm build:prod | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| > Check the extension is installed in JupyterLab. | ||||||||||||||||||
| 2. Install test dependencies (needed only once): | ||||||||||||||||||
|
|
||||||||||||||||||
| ```sh | ||||||||||||||||||
| cd ./ui-tests | ||||||||||||||||||
| jlpm install | ||||||||||||||||||
| jlpm playwright install | ||||||||||||||||||
| cd .. | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| 3. Execute the [Playwright](https://playwright.dev/docs/intro) command: | ||||||||||||||||||
|
|
||||||||||||||||||
| ```sh | ||||||||||||||||||
| cd ./ui-tests | ||||||||||||||||||
| jlpm playwright test -u | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| > Some discrepancy may occurs between the snapshots generated on your computer and | ||||||||||||||||||
| > the one generated on the CI. To ease updating the snapshots on a PR, you can | ||||||||||||||||||
| > type `please update playwright snapshots` to trigger the update by a bot on the CI. | ||||||||||||||||||
| > Once the bot has computed new snapshots, it will commit them to the PR branch. | ||||||||||||||||||
|
Comment on lines
+85
to
+88
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Tighten wording/grammar. Minor copy fixes. -> Some discrepancy may occurs between the snapshots generated on your computer and
-> the one generated on the CI. To ease updating the snapshots on a PR, you can
+> Some discrepancies may occur between the snapshots generated on your computer and
+> the ones generated in CI. To ease updating snapshots on a PR, you can📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
| ## Create tests | ||||||||||||||||||
|
|
||||||||||||||||||
| > All commands are assumed to be executed from the root directory | ||||||||||||||||||
| To create tests, the easiest way is to use the code generator tool of playwright: | ||||||||||||||||||
|
|
||||||||||||||||||
| 1. Compile the extension: | ||||||||||||||||||
|
|
||||||||||||||||||
| ```sh | ||||||||||||||||||
| jlpm install | ||||||||||||||||||
| jlpm build:prod | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| > Check the extension is installed in JupyterLab. | ||||||||||||||||||
| 2. Install test dependencies (needed only once): | ||||||||||||||||||
|
|
||||||||||||||||||
| ```sh | ||||||||||||||||||
| cd ./ui-tests | ||||||||||||||||||
| jlpm install | ||||||||||||||||||
| jlpm playwright install | ||||||||||||||||||
| cd .. | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| 3. Start the server: | ||||||||||||||||||
|
|
||||||||||||||||||
| ```sh | ||||||||||||||||||
| cd ./ui-tests | ||||||||||||||||||
| jlpm start | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| 4. Execute the [Playwright code generator](https://playwright.dev/docs/codegen) in **another terminal**: | ||||||||||||||||||
|
|
||||||||||||||||||
| ```sh | ||||||||||||||||||
| cd ./ui-tests | ||||||||||||||||||
| jlpm playwright codegen localhost:8888 | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| ## Debug tests | ||||||||||||||||||
|
|
||||||||||||||||||
| > All commands are assumed to be executed from the root directory | ||||||||||||||||||
| To debug tests, a good way is to use the inspector tool of playwright: | ||||||||||||||||||
|
|
||||||||||||||||||
| 1. Compile the extension: | ||||||||||||||||||
|
|
||||||||||||||||||
| ```sh | ||||||||||||||||||
| jlpm install | ||||||||||||||||||
| jlpm build:prod | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| > Check the extension is installed in JupyterLab. | ||||||||||||||||||
| 2. Install test dependencies (needed only once): | ||||||||||||||||||
|
|
||||||||||||||||||
| ```sh | ||||||||||||||||||
| cd ./ui-tests | ||||||||||||||||||
| jlpm install | ||||||||||||||||||
| jlpm playwright install | ||||||||||||||||||
| cd .. | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| 3. Execute the Playwright tests in [debug mode](https://playwright.dev/docs/debug): | ||||||||||||||||||
|
|
||||||||||||||||||
| ```sh | ||||||||||||||||||
| cd ./ui-tests | ||||||||||||||||||
| jlpm playwright test --debug | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| ## Upgrade Playwright and the browsers | ||||||||||||||||||
|
|
||||||||||||||||||
| To update the web browser versions, you must update the package `@playwright/test`: | ||||||||||||||||||
|
|
||||||||||||||||||
| ```sh | ||||||||||||||||||
| cd ./ui-tests | ||||||||||||||||||
| jlpm up "@playwright/test" | ||||||||||||||||||
| jlpm playwright install | ||||||||||||||||||
| ``` | ||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,12 @@ | ||||||||||||||||||||||||||||||||
| """Server configuration for integration tests. | ||||||||||||||||||||||||||||||||
| !! Never use this configuration in production because it | ||||||||||||||||||||||||||||||||
| opens the server to the world and provide access to JupyterLab | ||||||||||||||||||||||||||||||||
| JavaScript objects through the global window variable. | ||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||
|
Comment on lines
+3
to
+6
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Docstring nits. -!! Never use this configuration in production because it
-opens the server to the world and provide access to JupyterLab
-JavaScript objects through the global window variable.
+!! Never use this configuration in production because it
+opens the server to the world and provides access to JupyterLab
+JavaScript objects through the global window variable.📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| from jupyterlab.galata import configure_jupyter_server | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| configure_jupyter_server(c) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Uncomment to set server log level to debug level | ||||||||||||||||||||||||||||||||
| # c.ServerApp.log_level = "DEBUG" | ||||||||||||||||||||||||||||||||
|
Comment on lines
+7
to
+12
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NameError: c is undefined. The config object -from jupyterlab.galata import configure_jupyter_server
+from jupyterlab.galata import configure_jupyter_server
+from traitlets.config import get_config
+
+c = get_config()
configure_jupyter_server(c)
# Uncomment to set server log level to debug level
# c.ServerApp.log_level = "DEBUG"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
andyjakubowski marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,15 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "name": "jupyterlab-deepnote-ui-tests", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "version": "1.0.0", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "description": "JupyterLab jupyterlab-deepnote Integration Tests", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "private": true, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "scripts": { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "start": "jupyter lab --config jupyter_server_test_config.py", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "test": "jlpm playwright test", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "test:update": "jlpm playwright test --update-snapshots" | ||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "devDependencies": { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "@jupyterlab/galata": "^5.0.5", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "@playwright/test": "^1.37.0" | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+6
to
+14
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Pin test deps to reduce CI drift; add engines and report script. Caret ranges can cause flaky upgrades. Pin versions and declare runtime expectations. "scripts": {
"start": "jupyter lab --config jupyter_server_test_config.py",
"test": "jlpm playwright test",
- "test:update": "jlpm playwright test --update-snapshots"
+ "test:update": "jlpm playwright test --update-snapshots",
+ "report": "jlpm playwright show-report"
},
+ "engines": {
+ "node": ">=18",
+ "yarn": ">=1.22"
+ },
"devDependencies": {
- "@jupyterlab/galata": "^5.0.5",
- "@playwright/test": "^1.37.0"
+ "@jupyterlab/galata": "5.0.5",
+ "@playwright/test": "1.37.0"
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /** | ||
| * Configuration for Playwright using default from @jupyterlab/galata | ||
| */ | ||
| const baseConfig = require('@jupyterlab/galata/lib/playwright-config'); | ||
|
|
||
| module.exports = { | ||
| ...baseConfig, | ||
| webServer: { | ||
| command: 'jlpm start', | ||
| url: 'http://localhost:8888/lab', | ||
| timeout: 120 * 1000, | ||
| reuseExistingServer: !process.env.CI | ||
| } | ||
andyjakubowski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,23 @@ | ||||||||||||||||||||||||||||||||||||||
| import { expect, test } from '@jupyterlab/galata'; | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||
| * Don't load JupyterLab webpage before running the tests. | ||||||||||||||||||||||||||||||||||||||
| * This is required to ensure we capture all log messages. | ||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||
| test.use({ autoGoto: false }); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| test('should emit an activation console message', async ({ page }) => { | ||||||||||||||||||||||||||||||||||||||
| const logs: string[] = []; | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| page.on('console', message => { | ||||||||||||||||||||||||||||||||||||||
| logs.push(message.text()); | ||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| await page.goto(); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| expect( | ||||||||||||||||||||||||||||||||||||||
| logs.filter( | ||||||||||||||||||||||||||||||||||||||
| s => s === 'JupyterLab extension jupyterlab-deepnote is activated!' | ||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||
| ).toHaveLength(1); | ||||||||||||||||||||||||||||||||||||||
|
Check failure on line 22 in ui-tests/tests/jupyterlab_deepnote.spec.ts
|
||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+16
to
+22
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Wait for the log to avoid flakiness.
- expect(
- logs.filter(
- s => s === 'JupyterLab extension jupyterlab-deepnote is activated!'
- )
- ).toHaveLength(1);
+ await expect
+ .poll(
+ () =>
+ logs.filter(
+ s => s === 'JupyterLab extension jupyterlab-deepnote is activated!'
+ ).length,
+ { timeout: 10000 }
+ )
+ .toBe(1);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
andyjakubowski marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.