You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* add basic e2e testing setup
* adjust execute test step name
* test sidebar chat icon, add testing class
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add sidebar snapshot
* test chat sidepanel, extend helper class
* adjust welcome message test, add snapshot
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* adjust naming
* removeempty line
* move ui-tests to packages/jupyter-ai/
* update e2e ci workflow for ui-tests folder move
* update ui-tests folder location for yarn.lock hash
* run lint locally
* Add "Update Playwright Snapshots" CI workflow
* change if clause
* specify npm client
* remove report and artifact specifiers
* Update README.md to have correct commands and folders
* update e2e/integration test README
* Add Integration / E2E testing section to the docs
* update wording of docs on snapshots
* Ignore all non-linux snapshots
* Update packages/jupyter-ai/ui-tests/README.md
Co-authored-by: Piyush Jain <piyushjain@duck.com>
* remove cd command that would return users back to root
* remove cd ../../../
* Remove repeating setup instructions
* Add suggestion to generate snapshots before the 1st run
* remove unnecessary link anchor
* remove rudimentary jlpm build
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Piyush Jain <piyushjain@duck.com>
Copy file name to clipboardExpand all lines: docs/source/contributors/index.md
+35Lines changed: 35 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -117,3 +117,38 @@ To uninstall your Jupyter AI development environment, deactivate and remove the
117
117
conda deactivate
118
118
conda env remove -n jupyter-ai
119
119
```
120
+
121
+
## Testing
122
+
123
+
### Integration / E2E tests
124
+
125
+
This extension uses Playwright for the integration / E2E tests (user-level tests).
126
+
More precisely, the JupyterLab helper
127
+
[Galata](https://github.com/jupyterlab/jupyterlab/tree/master/galata) is used to
128
+
test the extension in JupyterLab.
129
+
130
+
Install test dependencies (needed only once):
131
+
132
+
```sh
133
+
cd ./packages/jupyter-ai/ui-tests/
134
+
jlpm install
135
+
jlpm playwright install
136
+
```
137
+
138
+
Tests involve snapshot comparisons against a reference snapshots generated by the Github CI. If you are using an OS other than Linux, you will need to generate local snapshots before running the tests locally for the first time. To do this, execute the command:
Copy file name to clipboardExpand all lines: packages/jupyter-ai/ui-tests/README.md
+30-56Lines changed: 30 additions & 56 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,35 +12,37 @@ in [jupyter_server_test_config.py](./jupyter_server_test_config.py).
12
12
13
13
The default configuration will produce video for failing tests and an HTML report.
14
14
15
-
## Run the tests
15
+
> There is a new experimental UI mode that you may fall in love with; see [that video](https://www.youtube.com/watch?v=jF0yA-JLQW0).
16
16
17
17
> All commands are assumed to be executed from the root directory
18
18
19
+
## Run the tests
20
+
19
21
To run the tests, you need to:
20
22
21
23
1. Compile the extension:
22
24
23
25
```sh
24
-
jlpm install
25
-
jlpm build:prod
26
+
./scripts/install.sh
26
27
```
27
28
28
29
> Check the extension is installed in JupyterLab.
29
30
30
31
2. Install test dependencies (needed only once):
31
32
32
33
```sh
33
-
cd ./ui-tests
34
+
cd ./packages/jupyter-ai/ui-tests/
34
35
jlpm install
35
36
jlpm playwright install
36
-
cd ..
37
37
```
38
38
39
+
> Tests involve snapshot comparisons against a reference snapshots generated by the Github CI. If you are using an OS other than Linux, you will need to generate local snapshots before running the tests locally for the first time. See [Update the tests snapshots](#update-the-tests-snapshots) section for the instructions.
40
+
39
41
3. Execute the [Playwright](https://playwright.dev/docs/intro) tests:
40
42
41
43
```sh
42
-
cd ./ui-tests
43
-
jlpm playwright test
44
+
cd ./packages/jupyter-ai/ui-tests/
45
+
jlpm test
44
46
```
45
47
46
48
Test results will be shown in the terminal. In case of any test failures, the test report
@@ -50,34 +52,12 @@ for configuring that behavior.
50
52
51
53
## Update the tests snapshots
52
54
53
-
> All commands are assumed to be executed from the root directory
54
-
55
55
If you are comparing snapshots to validate your tests, you may need to update
56
-
the reference snapshots stored in the repository. To do that, you need to:
57
-
58
-
1. Compile the extension:
59
-
60
-
```sh
61
-
jlpm install
62
-
jlpm build:prod
63
-
```
64
-
65
-
> Check the extension is installed in JupyterLab.
66
-
67
-
2. Install test dependencies (needed only once):
56
+
the reference snapshots stored in the repository. To do that, you need to execute the [Playwright](https://playwright.dev/docs/intro) command:
68
57
69
58
```sh
70
-
cd ./ui-tests
71
-
jlpm install
72
-
jlpm playwright install
73
-
cd ..
74
-
```
75
-
76
-
3. Execute the [Playwright](https://playwright.dev/docs/intro) command:
77
-
78
-
```sh
79
-
cd ./ui-tests
80
-
jlpm playwright test -u
59
+
cd ./packages/jupyter-ai/ui-tests/
60
+
jlpm test:update
81
61
```
82
62
83
63
> Some discrepancy may occurs between the snapshots generated on your computer and
@@ -87,39 +67,24 @@ jlpm playwright test -u
87
67
88
68
## Create tests
89
69
90
-
> All commands are assumed to be executed from the root directory
91
-
92
70
To create tests, the easiest way is to use the code generator tool of playwright:
93
71
94
-
1.Compile the extension:
72
+
1.Start the server:
95
73
96
74
```sh
97
-
jlpm install
98
-
jlpm build:prod
75
+
cd ./packages/jupyter-ai/ui-tests/
76
+
jlpm start
99
77
```
100
78
101
-
> Check the extension is installed in JupyterLab.
102
-
103
-
2. Install test dependencies (needed only once):
79
+
2. Execute the [Playwright code generator](https://playwright.dev/docs/codegen) in **another terminal**:
104
80
105
81
```sh
106
-
cd ./ui-tests
107
-
jlpm install
108
-
jlpm playwright install
109
-
cd ..
110
-
```
111
-
112
-
3. Execute the [Playwright code generator](https://playwright.dev/docs/codegen):
113
-
114
-
```sh
115
-
cd ./ui-tests
82
+
cd ./packages/jupyter-ai/ui-tests/
116
83
jlpm playwright codegen localhost:8888
117
84
```
118
85
119
86
## Debug tests
120
87
121
-
> All commands are assumed to be executed from the root directory
122
-
123
88
To debug tests, a good way is to use the inspector tool of playwright:
124
89
125
90
1. Compile the extension:
@@ -134,15 +99,24 @@ jlpm build:prod
134
99
2. Install test dependencies (needed only once):
135
100
136
101
```sh
137
-
cd ./ui-tests
102
+
cd ./packages/jupyter-ai/ui-tests/
138
103
jlpm install
139
104
jlpm playwright install
140
-
cd ..
141
105
```
142
106
143
107
3. Execute the Playwright tests in [debug mode](https://playwright.dev/docs/debug):
144
108
145
109
```sh
146
-
cd ./ui-tests
147
-
PWDEBUG=1 jlpm playwright test
110
+
cd ./packages/jupyter-ai/ui-tests/
111
+
jlpm playwright test --debug
112
+
```
113
+
114
+
## Upgrade Playwright and the browsers
115
+
116
+
To update the web browser versions, you must update the package `@playwright/test`:
0 commit comments