|
| 1 | +# Test |
| 2 | + |
| 3 | +The test will produce a video to help debugging and check what happened. |
| 4 | + |
| 5 | +To execute integration tests, you have two options: |
| 6 | + |
| 7 | +- use docker-compose (cons: needs to know and use docker) - this is a more reliable solution. |
| 8 | +- run tests locally (cons: will interact with your JupyterLab user settings) |
| 9 | + |
| 10 | +## Test on docker |
| 11 | + |
| 12 | +1. Compile the extension: |
| 13 | + |
| 14 | +``` |
| 15 | +jlpm install |
| 16 | +``` |
| 17 | + |
| 18 | +2. Execute the docker stack in the ui-tests folder: |
| 19 | + |
| 20 | +``` |
| 21 | +docker-compose -f ./docker/docker-compose.yml build --no-cache |
| 22 | +docker-compose -f ./docker/docker-compose.yml run --rm e2e |
| 23 | +docker-compose -f ./docker/docker-compose.yml down |
| 24 | +``` |
| 25 | + |
| 26 | +## Test locally |
| 27 | + |
| 28 | +1. Compile the extension: |
| 29 | + |
| 30 | +``` |
| 31 | +jlpm install |
| 32 | +jlpm run build:prod |
| 33 | +``` |
| 34 | + |
| 35 | +2. Start JupyterLab _with the extension installed_ without any token or password |
| 36 | + |
| 37 | +``` |
| 38 | +jupyter lab --ServerApp.token= --ServerApp.password= |
| 39 | +``` |
| 40 | + |
| 41 | +3. Execute in another console the [Playwright](https://playwright.dev/docs/intro) tests: |
| 42 | + |
| 43 | +``` |
| 44 | +cd ui-tests |
| 45 | +jlpm install |
| 46 | +npx playwright install |
| 47 | +npx playwright test |
| 48 | +``` |
| 49 | + |
| 50 | +# Create tests |
| 51 | + |
| 52 | +To create tests, the easiest way is to use the code generator tool of playwright: |
| 53 | + |
| 54 | +1. Compile the extension: |
| 55 | + |
| 56 | +``` |
| 57 | +jlpm install |
| 58 | +jlpm run build:prod |
| 59 | +``` |
| 60 | + |
| 61 | +2. Start JupyterLab _with the extension installed_ without any token or password: |
| 62 | + |
| 63 | +**Using docker** |
| 64 | + |
| 65 | +``` |
| 66 | +docker-compose -f ./docker/docker-compose.yml run --rm -p 8888:8888 lab |
| 67 | +``` |
| 68 | + |
| 69 | +**Using local installation** |
| 70 | + |
| 71 | +``` |
| 72 | +jupyter lab --ServerApp.token= --ServerApp.password= |
| 73 | +``` |
| 74 | + |
| 75 | +3. Launch the code generator tool: |
| 76 | + |
| 77 | +``` |
| 78 | +cd ui-tests |
| 79 | +jlpm install |
| 80 | +npx playwright install |
| 81 | +npx playwright codegen localhost:8888 |
| 82 | +``` |
| 83 | + |
| 84 | +# Debug tests |
| 85 | + |
| 86 | +To debug tests, a good way is to use the inspector tool of playwright: |
| 87 | + |
| 88 | +1. Compile the extension: |
| 89 | + |
| 90 | +``` |
| 91 | +jlpm install |
| 92 | +jlpm run build:prod |
| 93 | +``` |
| 94 | + |
| 95 | +2. Start JupyterLab _with the extension installed_ without any token or password: |
| 96 | + |
| 97 | +**Using docker** |
| 98 | + |
| 99 | +``` |
| 100 | +docker-compose -f ./docker/docker-compose.yml run --rm -p 8888:8888 lab |
| 101 | +``` |
| 102 | + |
| 103 | +**Using local installation** |
| 104 | + |
| 105 | +``` |
| 106 | +jupyter lab --ServerApp.token= --ServerApp.password= |
| 107 | +``` |
| 108 | + |
| 109 | +3. Launch the debug tool: |
| 110 | + |
| 111 | +``` |
| 112 | +cd ui-tests |
| 113 | +jlpm install |
| 114 | +npx playwright install |
| 115 | +PWDEBUG=1 npx playwright test |
| 116 | +``` |
0 commit comments