Skip to content

Commit

Permalink
Update extension deps and UI test CI workflows (#1312)
Browse files Browse the repository at this point in the history
* deps: Upgrade npm dependencies for extension and ui-tests

Signed-off-by: Mahendra Paipuri <[email protected]>

* test: Update playwright tests and snapshots

Signed-off-by: Mahendra Paipuri <[email protected]>

* ci: Fix update playwright snapshots workflow

Signed-off-by: Mahendra Paipuri <[email protected]>

* ci: Add dependabot config to bump npm dependencies

Signed-off-by: Mahendra Paipuri <[email protected]>

* style: Fix lint errors

Signed-off-by: Mahendra Paipuri <[email protected]>

* Require jupyterlab 4.3.3 for extension tests

* Version 1.17.0-dev

---------

Signed-off-by: Mahendra Paipuri <[email protected]>
Co-authored-by: Mahendra Paipuri <[email protected]>
  • Loading branch information
mwouts and mahendrapaipuri authored Feb 16, 2025
1 parent 93cf493 commit 9aba222
Show file tree
Hide file tree
Showing 16 changed files with 115 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .ci/environment-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ channels:
- defaults
- conda-forge
dependencies:
- jupyterlab
- jupyterlab>=4.3.3
- nbformat>=5.1.2
- pandoc>=3.0
21 changes: 21 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "jupyterlab" # Location of package manifests
schedule:
interval: "weekly"

- package-ecosystem: "npm" # See documentation for possible values
directory: "jupyterlab/packages/jupyterlab-jupytext-extension" # Location of package manifests
schedule:
interval: "weekly"

- package-ecosystem: "npm" # See documentation for possible values
directory: "jupyterlab/packages/jupyterlab-jupytext-extension/ui-tests" # Location of package manifests
schedule:
interval: "weekly"
2 changes: 0 additions & 2 deletions .github/workflows/step_tests-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ jobs:
run: jlpm playwright install chromium

- name: Integration tests
# https://github.com/mwouts/jupytext/issues/1294
if: false
working-directory: jupyterlab/packages/jupyterlab-jupytext-extension/ui-tests
run: jlpm playwright test

Expand Down
23 changes: 11 additions & 12 deletions .github/workflows/update-playwright-snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,21 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install your project
- name: Install jupytext
run: |
# Execute the required installation command
HATCH_BUILD_HOOKS_ENABLE=true python -m pip install -e '.[test-ui]' jupyterlab
# Uninstall jupyter-fs as it overrides the original browser-test.js to
# check its own functionality (https://github.com/jpmorganchase/jupyter-fs/blob/main/jupyterfs/browser-test.js)
pip uninstall jupyter-fs -y
- name: Update snapshots
uses: jupyterlab/maintainer-tools/.github/actions/update-snapshots@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Test folder within your repository
test_folder: playwright-tests

# Optional npm scripts (the default values are displayed)
# Script to start the server or 'null' if Playwright is taking care of it
# If not `null`, you must provide a `server_url` to listen to.
start_server_script: start
# Server url to wait for before updating the snapshots
# See specification for https://github.com/iFaxity/wait-on-action `resource`
server_url: http-get://localhost:8888
update_script: test:update
test_folder: jupyterlab/packages/jupyterlab-jupytext-extension/ui-tests/tests

# Playwright knows how to start JupyterLab server
start_server_script: 'null'
npm_client: jlpm
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Jupytext ChangeLog
==================

1.17.0-dev
----------

**Changed**
- We have updated the JupyterLab extension dependencies ([#1300](https://github.com/mwouts/jupytext/pull/1300)). Thanks to [Mahendra Paipuri](https://github.com/mahendrapaipuri) for this PR!


1.16.7 (2025-02-09)
-------------------

Expand Down
34 changes: 17 additions & 17 deletions jupyterlab/packages/jupyterlab-jupytext-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,26 @@
}
},
"dependencies": {
"@jupyterlab/application": "^4.0.0",
"@jupyterlab/apputils": "^4.0.0",
"@jupyterlab/codeeditor": "^4.0.0",
"@jupyterlab/docregistry": "^4.0.0",
"@jupyterlab/filebrowser": "^4.0.0",
"@jupyterlab/launcher": "^4.0.0",
"@jupyterlab/nbformat": "^4.0.0",
"@jupyterlab/notebook": "^4.0.0",
"@jupyterlab/rendermime": "^4.0.0",
"@jupyterlab/settingregistry": "^4.0.0",
"@jupyterlab/translation": "^4.0.0",
"@jupyterlab/ui-components": "^4.0.0",
"@lumino/commands": "^2.0.0",
"@lumino/coreutils": "^2.0.0",
"@lumino/disposable": "^2.0.0",
"@jupyterlab/application": "^4.3.3",
"@jupyterlab/apputils": "^4.3.3",
"@jupyterlab/codeeditor": "^4.3.3",
"@jupyterlab/docregistry": "^4.3.3",
"@jupyterlab/filebrowser": "^4.3.3",
"@jupyterlab/launcher": "^4.3.3",
"@jupyterlab/nbformat": "^4.3.3",
"@jupyterlab/notebook": "^4.3.3",
"@jupyterlab/rendermime": "^4.3.3",
"@jupyterlab/settingregistry": "^4.3.3",
"@jupyterlab/translation": "^4.3.3",
"@jupyterlab/ui-components": "^4.3.3",
"@lumino/commands": "^2.3.1",
"@lumino/coreutils": "^2.2.0",
"@lumino/disposable": "^2.1.3",
"buffer": "^6.0.3",
"jupyterlab-rise": "^0.41.0"
"jupyterlab-rise": "^0.42.0"
},
"devDependencies": {
"@jupyterlab/builder": "^4.0.0",
"@jupyterlab/builder": "^4.3.3",
"npm-run-all": "^4.1.5",
"rimraf": "^4.4.1",
"typescript": "~5.0.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"test:update": "jlpm playwright test --update-snapshots"
},
"devDependencies": {
"@jupyterlab/galata": "^5.0.0",
"@playwright/test": "^1.32.0"
"@jupyterlab/galata": "^5.3.3",
"@playwright/test": "^1.48.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const pairMenuPaths = pairTests.map((format) => {
});

// Toggle metadata
const toggleMetadataPath = 'Jupytext>Include Metadata';
const toggleMetadataPath = 'File>Jupytext>Include Metadata';

// Name of notebook file
const fileName = 'notebook.ipynb';
Expand All @@ -66,7 +66,7 @@ async function populateNotebook(extension, page) {
await page.notebook.runCell(1, true);
// For bash, use shell code
if (extension === '.sh') {
await page.notebook.addCell('code', 'echo $HOME');
await page.notebook.addCell('code', 'echo "This is Bash Kernel"');
} else {
await page.notebook.addCell('code', '2 ** 3');
}
Expand All @@ -82,22 +82,28 @@ test.describe('Jupytext Create Text Notebooks from Menu Tests', () => {

// Wait for the kernel dialog and accept it
await page.waitForSelector('.jp-Dialog');
// For bash kernel, select appropriate kernel

const select = await page.$('.jp-Dialog-body >> select');
// Select appropriate kernel
let option: any;
if (paths.extension === '.sh') {
const select = await page.$('.jp-Dialog-body >> select');
const option = await select!.$('option:has-text("Bash")');
await select!.selectOption(option);
option = await select!.$('option:has-text("Bash")');
} else {
option = await select!.$('option:has-text("Python")');
}
await select!.selectOption(option);
await page.click('.jp-Dialog .jp-mod-accept');

// Populate page
await populateNotebook(paths.extension, page);

// Toggle Include Metadata. It is enabled by default.
// It is to avoid having Jupytext version in metadata in snapshot
// If we include it, for every version bump we need to update snapshots as
// version changes which will fail UI tests. Just do not include metadata
// which will ensure smooth version bumping
await page.menu.clickMenuItem(toggleMetadataPath);

// Save notebook
await page.notebook.save();

Expand All @@ -114,22 +120,25 @@ test.describe('Jupytext Create Text Notebooks from Menu Tests', () => {
test.describe('Jupytext Pair Python Notebooks from Menu Tests', () => {
// Before each test start a new notebook and add some cell data
test.beforeEach(async ({ page }) => {
await page.notebook.createNew(fileName);
await page.notebook.createNew(fileName, { kernel: 'python3' });
await populateNotebook('.py', page);
});

pairMenuPaths.forEach((paths) => {
test(`Open menu item ${paths.menuPath}`, async ({ page }) => {
// Click pairing command
await page.menu.clickMenuItem(paths.menuPath);

// Toggle Include Metadata. It is enabled by default.
// It is to avoid having Jupytext version in metadata in snapshot
// If we include it, for every version bump we need to update snapshots as
// version changes which will fail UI tests. Just do not include metadata
// which will ensure smooth version bumping
await page.menu.clickMenuItem(toggleMetadataPath);

// Wait until we save notebook. Once we save it, paired file appears
await page.notebook.save();

// Try to open paired file
await page.filebrowser.open(fileName.replace('.ipynb', paths.extension));

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9aba222

Please sign in to comment.