Testing
Testing is done using Selenium WebDriver for automating browser tests. Tox is used to execute testing procedures.
Before running all tests locally, ChromeDriver (for testing on Chrome) and GeckoDriver (for testing on Firefox) are required.
Install Tox via pip:
pip install tox
Download and setup the ChromeDriver:
# Get the latest version from https://sites.google.com/a/chromium.org/chromedriver/
wget -N https://chromedriver.storage.googleapis.com/87.0.4280.88/chromedriver_linux64.zip -P ~/
unzip ~/chromedriver_linux64.zip -d ~/
rm ~/chromedriver_linux64.zip
sudo mv -f ~/chromedriver /usr/local/bin/
sudo chmod +x /usr/local/bin/chromedriver
Download and setup the GeckoDriver:
VERSION=v0.32.0
wget -N https://github.com/mozilla/geckodriver/releases/download/${VERSION}/geckodriver-${VERSION}-linux64.tar.gz -P ~/
tar xvzf ~/geckodriver-${VERSION}-linux64.tar.gz -C ~/
rm ~/geckodriver-${VERSION}-linux64.tar.gz
sudo mv -f ~/geckodriver /usr/local/bin/
sudo chmod +x /usr/local/bin/geckodriver
To run the full test suite against your changes, simply run Tox. Tox should return without any errors. You can run Tox against all of our environments and both browsers by running:
tox
To run tests with a specific environment and for both browsers:
tox -e py36-sphinx20
To run tests with a specific environment and for a specified browser:
tox -e py36-sphinx20 -- --driver Chrome # run tests with Python 3.6 and Sphinx < 2.1 with Chrome browser
tox -e py36-sphinx20 -- --driver Firefox # run tests with Python 3.6 and Sphinx < 2.1 with Firefox browser
To run tests against all environments but with a specified browser:
tox -- --driver Chrome # run tests with all environments with Chrome browser
tox -- --driver Firefox # run tests with all environments with Firefox browser
Internet Explorer and Edge
Internet Explorer and Edge don’t support headless mode, but we can check that everything works with https://saucelabs.com/.