@@ -102,14 +102,62 @@ a set of helpers and fixtures for JupyterLab UI exclusively in TypeScript.
1021021. MATLAB (Version >= `R2020b`) in the system path
1031032. NodeJS version 18 or higher.
1041043. [MATLAB Proxy](https://github.com/mathworks/matlab-proxy) requirements
105- 4. MATLAB Proxy should be unlicensed
106- 6. Jupyter MATLAB Proxy requirements
107- 7. Valid MathWorks Account credentials
105+ 4. Jupyter MATLAB Proxy requirements
106+ 5. A way to license MATLAB
108107
109108
110- ### How to run the end-to-end tests
111- * Set the environment variables TEST_USERNAME and TEST_PASSWORD to be your
112- MathWorks Account user credentials
109+ ### Run the end-to-end tests
110+ #### Licensing Information
111+ The end-to-end tests require a licensed MATLAB to function.
112+
113+ The simplest option is to ensure the MATLAB is licensed before you start the
114+ JupyterLab fixture, and set the environment variable
115+ `MWI_USE_EXISTING_LICENSE=true` before starting it.
116+
117+ Another option is to license the MATLAB using the jupyter-matlab-proxy interface
118+ manually or by using the helper methods provided.
119+ These helper methods license the MATLAB via the matlab-proxy interface using
120+ online licensing.
121+ This approach is suitable for automation and can be used in CI systems.
122+ See the GitHub Actions Workflows in this repository for an example of how to do this.
123+
124+ #### Setup
125+ * From the root directory of this project, install jupyter-matlab-proxy and
126+ JupyterLab:
127+ ```
128+ pip install ".[ dev] " "jupyterlab>=3.1.0,<4.0.0"
129+ ```
130+ MathWorks recommends using a Python virtual environment such as venv or conda.
131+ * From this repository's directory `tests/e2e`, install the node packages:
132+ ```
133+ npm install
134+ ```
135+ or to use the exact package version in the package-lock.json, use the command
136+ `npm ci` instead.
137+ * Install the Playwright browsers:
138+ ```
139+ npx playwright install
140+ ```
141+
142+ #### Start the JupyterLab fixture
143+ The steps for starting the JupyterLab fixture depend on your licensing method.
144+ All steps assume you run them from the `tests/e2e` directory.
145+
146+ If you are using an already licensed MATLAB:
147+ - Ensure you set the environment variable `MWI_USE_EXISTING_LICENSE=true` before
148+ starting the JupyterLab instance.
149+ - Run the command `npm start`
150+ - Then run the tests: `npm test`
151+
152+ If you are going to license the MATLAB using online licensing after starting the JupyterLab instance
153+ - Start the JupyterLab fixture:
154+ ```
155+ npm start
156+ ```
157+ - License the MATLAB manually using the JupyterLab instance via the UI or by using the
158+ helper methods provided. The steps for using the helper methods is outlined:
159+ - Set the environment variables `TEST_USERNAME` and `TEST_PASSWORD` to your
160+ MathWorks Account user credentials
113161 - Using a `.env` file (recommended):
114162 - Create a file called `.env` at the base of this repository, with the
115163 following lines:
@@ -123,37 +171,29 @@ a set of helpers and fixtures for JupyterLab UI exclusively in TypeScript.
123171 ```
124172 (if you don't want to use 'export' you can pass the environment
125173 variables in by prepending them to the Playwright test command below)
126- - Powershell (Windows):
174+ - PowerShell (Windows):
127175 ```powershell
128176 $env:TEST_USERNAME="some-username"; $env:TEST_PASSWORD="some-password"
129177 ```
130- * From the root directory of this project, install jupyter-matlab-proxy and
131- JupyterLab with the command:
178+ - Use the helper functions provided:
132179 ```
133- pip install ".[dev]" "jupyterlab>=3.1.0,<4.0.0"
180+ python3 -m pip install pytest-playwright
181+ python3 -m playwright install
182+ python3 -c "from tests.utils.licensing import *; license_with_online_licensing()"
134183 ```
135- * From this repository's directory `/tests/e2e`, install the node packages using:
136- ```
137- npm install
138- ```
139- or to use the exact package version in the package-lock.json, use the command
140- `npm ci` instead.
141- * Install the Playwright browsers with the command:
142- ```
143- npx playwright install
144- ```
145- * Run the Playwright tests:
146- ```
147- npx playwright test
148- ```
149- If you don't want to use 'export' on your bash environment variables, you can pass in the
150- variables like this:
184+
185+ #### Stop the JupyterLab Fixture
186+ * After testing has finished, stop the JupyterLab fixture by running the command
151187 ```
152- TEST_USERNAME="some-username" TEST_PASSWORD="some-password" npx playwright test
188+ npm stop
153189 ```
190+ or by using the JupyterLab UI.
191+
192+ The default behaviour is for the logs of the JupyterLab instance to be written to
193+ a`jupyterlab.log` file in the `tests/e2e` directory.
154194
155195----
156196
157- Copyright 2023 The MathWorks, Inc.
197+ Copyright 2023-2024 The MathWorks, Inc.
158198
159199----
0 commit comments