Skip to content

Commit

Permalink
Add integration test and dependencies for Binder setup
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Feb 21, 2024
1 parent e45c543 commit 78f8d98
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
- name: Install the extension
run: |
set -eux
python -m pip install "jupyterlab>=4.0.0,<5" jupyterlab_nebari_mode*.whl
python -m pip install "jupyterlab>=4.0.0,<5" jupyterlab_nebari_mode*.whl[integration-test]
- name: Install dependencies
working-directory: ui-tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
run: |
set -eux
jlpm
python -m pip install .
python -m pip install .[integration-test]
- uses: jupyterlab/maintainer-tools/.github/actions/update-snapshots@v1
with:
Expand Down
5 changes: 3 additions & 2 deletions binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ dependencies:
- nodejs >=18,<19
- pip
- wheel
# additional packages for demos
# - ipywidgets
- pip:
- jupyter-server-proxy
- jupyter-vscode-proxy
2 changes: 2 additions & 0 deletions binder/postBuild
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ _("jupyter", "server", "extension", "list")
# initially list installed extensions to determine if there are any surprises
_("jupyter", "labextension", "list")

_("mkdir", "-p", "$NB_PYTHON_PREFIX/share/jupyter/lab/settings/")
_("cp", "binder/overrides.json", "$NB_PYTHON_PREFIX/share/jupyter/lab/settings/")

print("JupyterLab with jupyterlab_nebari_mode is ready to run with:\n")
print("\tjupyter lab\n")
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ dependencies = [
]
dynamic = ["version", "description", "authors", "urls", "keywords"]

[project.optional-dependencies]
integration-test = [
"jupyter-server-proxy",
"jupyter-vscode-proxy"
]

[tool.hatch.version]
source = "nodejs"

Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const commandsPlugin: JupyterFrontEndPlugin<void> = {
window.location.href = url;
}
},
isVisible: (args: IOpenProxyArgs) => {
isEnabled: (args: IOpenProxyArgs) => {
const processs = findProcess(args.name);
return !!processs;
},
Expand Down
20 changes: 20 additions & 0 deletions ui-tests/tests/jupyterlab_nebari_mode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,23 @@ test('should swap Jupyter logo with clickable Nebari logo', async ({
await link.focus();
expect(await link.screenshot()).toMatchSnapshot('nebari-logo-focus.png');
});

test('should register custom commands', async ({ page }) => {
const openVScodeProxy = await page.evaluate(async () => {
const registry = window.jupyterapp.commands;
const id = 'nebari:open-proxy';
const args = { name: 'vscode' };

return {
id,
label: registry.label(id, args),
isEnabled: registry.isEnabled(id, args)
};
});

// Should set correct label for given command
expect(openVScodeProxy.label).toBe('Open VS Code');

// Should be enabled when `jupyter-vscode-proxy` is installed
expect(openVScodeProxy.isEnabled).toBe(true);
});

0 comments on commit 78f8d98

Please sign in to comment.