Skip to content

Commit 793e756

Browse files
authored
Merge pull request #172 from jupyterlab/fcollonval-patch-1
Add information on how examples are tested
2 parents 784a496 + 5d5d321 commit 793e756

File tree

19 files changed

+169
-127
lines changed

19 files changed

+169
-127
lines changed

README.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,34 @@
33
[![Github Actions Status](https://github.com/jupyterlab/extension-examples/workflows/CI/badge.svg)](https://github.com/jupyterlab/extension-examples/actions?query=workflow%3ACI)
44
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jupyterlab/extension-examples/master?urlpath=lab)
55

6+
1. [Goal](#tldr)
7+
2. [Develop by Examples](#develop-by-examples)
8+
1. [Commands](#commands)
9+
2. [Command Palette](#command-palette)
10+
3. [Context Menu](#context-menu)
11+
4. [Custom Log Console](#custom-log-console)
12+
5. [Datagrid](#datagrid)
13+
6. _[Hello World](#hello-world)_
14+
7. [Kernel Messaging](#kernel-messaging)
15+
8. [Kernel Output](#kernel-output)
16+
9. [Launcher](#launcher)
17+
10. [Log Messages](#log-messages)
18+
11. [Main Menu](#main-menu)
19+
12. [React Widget](#react-widget)
20+
13. _[Server Hello World](#server-hello-world)_
21+
14. [Settings](#settings)
22+
15. [Signals](#signals)
23+
16. [State](#state)
24+
17. [Toolbar Item](#toolbar-item)
25+
18. [Widgets](#widgets)
26+
3. [Prerequisites](#prerequisites)
27+
4. [Develop and Use the Examples](#develop-and-use-the-examples)
28+
5. [Test the Examples](#test-the-examples)
29+
6. [Install a Published Extension](#install-a-published-extension)
30+
7. [About JupyterLab](#about-jupyterlab)
31+
8. [Credits](#credits)
32+
9. [Community Guidelines and Code of Conduct](#community-guidelines-and-code-of-conduct)
33+
634
## TL;DR
735

836
The goal of this repository is to show how to develop extensions for [JupyterLab](https://github.com/jupyterlab/jupyterlab), presented as short tutorial series.
@@ -178,7 +206,7 @@ Use State persistence in an extension.
178206

179207
[![State](state/preview.gif)](state)
180208

181-
### [Toolbar item](toolbar-button)
209+
### [Toolbar Item](toolbar-button)
182210

183211
Add a new button to the notebook toolbar.
184212

@@ -275,6 +303,20 @@ and you can refresh your browser to see your changes.
275303

276304
We are using [embedme](https://github.com/zakhenry/embedme) to embed code snippets into the markdown READMEs. If you make changes to the source code, ensure you update the README and run `jlpm embedme` from the root of the repository to regenerate the READMEs.
277305

306+
## Test the Examples
307+
308+
The examples are automatically tested for:
309+
310+
- Homogeneous configuration:
311+
Configuration files are compared to the reference ones of the _hello-world_ example
312+
- TypeScript code lint
313+
- Installation in JupyterLab:
314+
The installation is checked by listing the installed extension and running JupyterLab with the helper `python -m jupyterlab.browser_check`
315+
- Integration test:
316+
Those tests are emulating user action in JupyterLab to check the extension is behaving as expected.
317+
The tests are defined in the `ui-tests` subfolder within each example.
318+
This is possible thanks to a tool called [playwright](https://playwright.dev/).
319+
278320
## Install a Published Extension
279321

280322
Once your extension is published on [pypi.org](https://pypi.org/) (outside of this scope), you can install it

command-palette/ui-tests/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The test will produce a video to help debugging and check what happened.
44

5-
To execute integration tests, you can two options:
5+
To execute integration tests, you have two options:
66

77
- use docker-compose (cons: needs to know and use docker) - this is a more reliable solution.
88
- run tests locally (cons: will interact with your JupyterLab user settings)
@@ -16,12 +16,12 @@ jlpm install
1616
jlpm run build:prod
1717
```
1818

19-
2. Execute the docker stack (`extension-path` needs to be set accordingly):
19+
2. Execute the docker stack in the example folder:
2020

2121
```
22-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env build
23-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm e2e
24-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env down
22+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env build
23+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm e2e
24+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env down
2525
```
2626

2727
## Test locally
@@ -63,7 +63,7 @@ jlpm run build:prod
6363
**Using docker**
6464

6565
```
66-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm -p 8888:8888 lab
66+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm -p 8888:8888 lab
6767
```
6868

6969
**Using local installation**
@@ -96,7 +96,7 @@ jlpm run build:prod
9696
**Using docker**
9797

9898
```
99-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm -p 8888:8888 lab
99+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm -p 8888:8888 lab
100100
```
101101

102102
**Using local installation**

commands/ui-tests/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The test will produce a video to help debugging and check what happened.
44

5-
To execute integration tests, you can two options:
5+
To execute integration tests, you have two options:
66

77
- use docker-compose (cons: needs to know and use docker) - this is a more reliable solution.
88
- run tests locally (cons: will interact with your JupyterLab user settings)
@@ -16,12 +16,12 @@ jlpm install
1616
jlpm run build:prod
1717
```
1818

19-
2. Execute the docker stack (`extension-path` needs to be set accordingly):
19+
2. Execute the docker stack in the example folder:
2020

2121
```
22-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env build
23-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm e2e
24-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env down
22+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env build
23+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm e2e
24+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env down
2525
```
2626

2727
## Test locally
@@ -63,7 +63,7 @@ jlpm run build:prod
6363
**Using docker**
6464

6565
```
66-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm -p 8888:8888 lab
66+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm -p 8888:8888 lab
6767
```
6868

6969
**Using local installation**
@@ -96,7 +96,7 @@ jlpm run build:prod
9696
**Using docker**
9797

9898
```
99-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm -p 8888:8888 lab
99+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm -p 8888:8888 lab
100100
```
101101

102102
**Using local installation**

context-menu/ui-tests/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The test will produce a video to help debugging and check what happened.
44

5-
To execute integration tests, you can two options:
5+
To execute integration tests, you have two options:
66

77
- use docker-compose (cons: needs to know and use docker) - this is a more reliable solution.
88
- run tests locally (cons: will interact with your JupyterLab user settings)
@@ -16,12 +16,12 @@ jlpm install
1616
jlpm run build:prod
1717
```
1818

19-
2. Execute the docker stack (`extension-path` needs to be set accordingly):
19+
2. Execute the docker stack in the example folder:
2020

2121
```
22-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env build
23-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm e2e
24-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env down
22+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env build
23+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm e2e
24+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env down
2525
```
2626

2727
## Test locally
@@ -63,7 +63,7 @@ jlpm run build:prod
6363
**Using docker**
6464

6565
```
66-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm -p 8888:8888 lab
66+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm -p 8888:8888 lab
6767
```
6868

6969
**Using local installation**
@@ -96,7 +96,7 @@ jlpm run build:prod
9696
**Using docker**
9797

9898
```
99-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm -p 8888:8888 lab
99+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm -p 8888:8888 lab
100100
```
101101

102102
**Using local installation**

custom-log-console/ui-tests/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The test will produce a video to help debugging and check what happened.
44

5-
To execute integration tests, you can two options:
5+
To execute integration tests, you have two options:
66

77
- use docker-compose (cons: needs to know and use docker) - this is a more reliable solution.
88
- run tests locally (cons: will interact with your JupyterLab user settings)
@@ -16,12 +16,12 @@ jlpm install
1616
jlpm run build:prod
1717
```
1818

19-
2. Execute the docker stack (`extension-path` needs to be set accordingly):
19+
2. Execute the docker stack in the example folder:
2020

2121
```
22-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env build
23-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm e2e
24-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env down
22+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env build
23+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm e2e
24+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env down
2525
```
2626

2727
## Test locally
@@ -63,7 +63,7 @@ jlpm run build:prod
6363
**Using docker**
6464

6565
```
66-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm -p 8888:8888 lab
66+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm -p 8888:8888 lab
6767
```
6868

6969
**Using local installation**
@@ -96,7 +96,7 @@ jlpm run build:prod
9696
**Using docker**
9797

9898
```
99-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm -p 8888:8888 lab
99+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm -p 8888:8888 lab
100100
```
101101

102102
**Using local installation**

datagrid/ui-tests/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The test will produce a video to help debugging and check what happened.
44

5-
To execute integration tests, you can two options:
5+
To execute integration tests, you have two options:
66

77
- use docker-compose (cons: needs to know and use docker) - this is a more reliable solution.
88
- run tests locally (cons: will interact with your JupyterLab user settings)
@@ -16,12 +16,12 @@ jlpm install
1616
jlpm run build:prod
1717
```
1818

19-
2. Execute the docker stack (`extension-path` needs to be set accordingly):
19+
2. Execute the docker stack in the example folder:
2020

2121
```
22-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env build
23-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm e2e
24-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env down
22+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env build
23+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm e2e
24+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env down
2525
```
2626

2727
## Test locally
@@ -63,7 +63,7 @@ jlpm run build:prod
6363
**Using docker**
6464

6565
```
66-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm -p 8888:8888 lab
66+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm -p 8888:8888 lab
6767
```
6868

6969
**Using local installation**
@@ -96,7 +96,7 @@ jlpm run build:prod
9696
**Using docker**
9797

9898
```
99-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm -p 8888:8888 lab
99+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm -p 8888:8888 lab
100100
```
101101

102102
**Using local installation**

hello-world/ui-tests/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The test will produce a video to help debugging and check what happened.
44

5-
To execute integration tests, you can two options:
5+
To execute integration tests, you have two options:
66

77
- use docker-compose (cons: needs to know and use docker) - this is a more reliable solution.
88
- run tests locally (cons: will interact with your JupyterLab user settings)
@@ -16,12 +16,12 @@ jlpm install
1616
jlpm run build:prod
1717
```
1818

19-
2. Execute the docker stack (`extension-path` needs to be set accordingly):
19+
2. Execute the docker stack in the example folder:
2020

2121
```
22-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env build
23-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm e2e
24-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env down
22+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env build
23+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm e2e
24+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env down
2525
```
2626

2727
## Test locally
@@ -63,7 +63,7 @@ jlpm run build:prod
6363
**Using docker**
6464

6565
```
66-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm -p 8888:8888 lab
66+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm -p 8888:8888 lab
6767
```
6868

6969
**Using local installation**
@@ -96,7 +96,7 @@ jlpm run build:prod
9696
**Using docker**
9797

9898
```
99-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm -p 8888:8888 lab
99+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm -p 8888:8888 lab
100100
```
101101

102102
**Using local installation**

kernel-messaging/ui-tests/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The test will produce a video to help debugging and check what happened.
44

5-
To execute integration tests, you can two options:
5+
To execute integration tests, you have two options:
66

77
- use docker-compose (cons: needs to know and use docker) - this is a more reliable solution.
88
- run tests locally (cons: will interact with your JupyterLab user settings)
@@ -16,12 +16,12 @@ jlpm install
1616
jlpm run build:prod
1717
```
1818

19-
2. Execute the docker stack (`extension-path` needs to be set accordingly):
19+
2. Execute the docker stack in the example folder:
2020

2121
```
22-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env build
23-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm e2e
24-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env down
22+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env build
23+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm e2e
24+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env down
2525
```
2626

2727
## Test locally
@@ -63,7 +63,7 @@ jlpm run build:prod
6363
**Using docker**
6464

6565
```
66-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm -p 8888:8888 lab
66+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm -p 8888:8888 lab
6767
```
6868

6969
**Using local installation**
@@ -96,7 +96,7 @@ jlpm run build:prod
9696
**Using docker**
9797

9898
```
99-
docker-compose -f ./end-to-end-tests/docker-compose.yml --env-file ./extension-path/ui-tests/.env run --rm -p 8888:8888 lab
99+
docker-compose -f ../end-to-end-tests/docker-compose.yml --env-file ./ui-tests/.env run --rm -p 8888:8888 lab
100100
```
101101

102102
**Using local installation**

0 commit comments

Comments
 (0)