Login Sign up

Tuesday Oct. 13, 2020, 5:45 p.m.–Oct. 13, 2020, 6 p.m. in Jupyter Community: Practices

assert browserTest == True # Frontend Testing JupyterLab Extensions With Selenium

Shreyas Cholia, Labanya Mukhopadhyay, Rollin Thomas

Audience level:

Brief Summary

Using Selenium to run front-end browser tests for JupyterLab Extensions: Our work will demonstrate the value of a browser-based approach to testing JupyterLab Extensions using the Selenium automation framework, both locally, as well as in a Continuous Integration environment like Github + Travis CI. This ensures that Extensions continue to work in the context of the integrated JupyterLab UI.


JupyterLab extensions are tricky to test since they are baked into the Browser UI, and unit tests may not be sufficient to address the more complex interactions resulting from an integrated user interface. Since we support multiple Lab Extensions for our users at NERSC and LBL (as well as the broader Jupyter Community), it was important for us to enable a set of tests that would give us confidence that submitted code changes and library dependency changes did not break existing functionality.

The Selenium automation framework allows us to test end-to-end functionality from the browser itself. Selenium simulates user actions through a running browser and triggers the corresponding behavior in the browser. This is particularly useful as a means to test functionality that is integrated into a complex user interface. We discuss our overall approach and experiences using Selenium. This talk will cover the following topics: - The case for using Selenium - How to setup your environment to enable Selenium Tests. - Use of Selenium IDE to record user interactions with JupyterLab as Python Code - Running Selenium tests locally with pytest - Integration with a Continuous Integration environment (Travis CI + Github) to run headless browser tests

We will use the Jupyterlab Favorites extension as a motivating example - https://github.com/NERSC/jupyterlab-favorites