To run the tests in this directory you need the following prerequisites:
- Python >= 3.9
- mamba (or conda)
- Your system must also meet the Playwright system requirements
You can run tests locally on your machine, or remotely in the cloud.
Note At the time of this writing, we have configured the tests to only run with Chromium, but you can extend these tests to cover other browsers by modifying the
playwright.config.ts
file.
Tip This is the recommended way to run the tests against JupyterLab.
-
Go to the JupyterLab accessibility testing workflow on the GitHub Actions UI.
-
Click on the Run Workflow button. This should open a dropdown form.
-
In the dropdown form, enter the following inputs:
Variable Description Default value Required repository
The JupyterLab repository or fork that you want to test in the form of <organisation or username>/<repository>
.jupyterlab/jupyterlab
Yes ref
A valid reference to check the repository against should be one of:
-branch
: a valid repository branch
-SHA
: for example4b4b0387febeff95780a3fdb100f4cd6848d29a2
-tag
: for examplev1.0.0
main
1Yes test_project
The name of the tests to run, should be one of: ""
(runs all tests) orregression
(runs only the accessibility regression tests)""
No external_pkg_repo
A valid repository or fork to link to JupyterLab2 in the form of <organisation or username>/<repository>
for example:jupyterlab/lumino
""
No external_pkg_ref
A valid reference for the external package or extension defined in Step 4. Should be one of:
-branch
-tag
-SHA
""
No -
Once you have entered all the information, click on the Run workflow button.
Once the accessibility tests have been completed you can use the following to inspect the test results:
- Markdown summary: scroll to the bottom of the GitHub actions UI, where you can find the workflow run Summary. From here you can use the links to read the manual test scripts for the test cases run.
- Zipped
json
andHTML
reports: these can be downloaded from the GitHub actions UI. Thejson
report can be used to generate a custom report using the Playwright Reporter. TheHTML
report can be opened in a browser to view the test results. - Annotations: this will appear directly in the GitHub actions UI.
Follow these steps to download and read the reports locally:
-
Scroll to the bottom of the GitHub actions UI and right-click on the test results' artifact.
-
Unzip the downloaded file. Ideally in a folder where you have
npm
andplaywright
installed. For example, in thetesting/jupyterlab
directory.Tip See the instructions in Running the tests locally to install the corresponding dependencies.
-
Using the command line, change to the directory where you unzipped the test results.
-
Use the following command to open the
HTML
report in your browser:npx playwright show-report <name-of-my-extracted-playwright-report>
This will serve up the report in your web browser.
-
Make sure you are in the correct directory - the one containing the
playwright.config.ts
file:cd testing/jupyterlab
-
Install Node.js and the needed Python dependencies:
# if using conda conda env create -f environment.yml # if using mamba mamba env create -f environment.yml
-
Activate the new
conda
environment:conda activate a11y-tests
-
Install JupyterLab version 3 or 4. There are several ways to do this.
- You can install a pre-built version of JupyterLab.
- Or you can build JupyterLab from source.
When you've finished, you should be able to run
jupyter lab --version
from the command line.
-
Install the Node.js dependencies (
package.json
):npm install
-
Install the browsers needed by Playwright:
npx playwright install
Note If your system doesn't already have some dependencies that the browsers expect, you may need to install the system dependencies first. This step probably isn't necessary if you're working on a machine that already has Chrome or other browsers on it:
npx playwright install-deps
. Visit Playwright docs - Command line tools for more info. -
Run the tests:
npm test
Note If you only want to run the regression tests:
npm test -- --project=regression
Your console should output a local URL that you can open in your browser to see the test results: typically http://127.0.0.1:9323
If a test fails, Playwright should attach a video and possibly other files to that test, which could help debug or explain why the test failed.
Footnotes
-
main
is the default branch for JupyterLab hence this is the default value for theref
parameter. ↩ -
This is useful if you want to test the accessibility of a package that is not part of the JupyterLab repository. See the Testing Changes to External Pages section of JupyterLab's documentation for more information. ↩