The purpose of this module is to allow tests to run against the installed Electron run app.
Slices of the tests will be selected as candidates for automation and then performed against the Opentrons run app executable on [Windows,Mac,Linux] and various robot configurations [Real Robot, Emulation, No Robot].
- This folder is not plugged into the global Make ecosystem of the Opentrons mono repository. This is intentional, the tools in this folder are independent and will likely be used by only a few and are in no way a dependency of any other part of this repository.
- Have pyenv installed per DEV_SETUP.md
- Install python 3.11
- Install the Opentrons application on your machine.
- https://opentrons.com/ot-app/
- This could also be done by building the installer on a branch and installing the App.
- for Mac
make -C app-shell dist-osx
- for Mac
- Install Chromedriver
= 1. in the app-testing directory 1.
sudo ./ci-tools/mac_get_chromedriver.sh 21.3.1
per the version of electron in the repository root package.json (/opentrons/package.json
) for electron 1. Windowssudo .\ci-tools\windows_get_chromedriver.ps1 -version 21.3.1
1. if you experiencewget: command not found
1. brew install wget and try again 2. when you runchromedriver --version
1. It should work 2. It should output the below. The chromedriver version must match Electron version we build into the App. 1. ChromeDriver 106.0.5249.181 (7e86549ea18ccbc17d7b600e3cd4190f45db35c7-refs/heads/main@{#1045491}) - Create .env from example.env
cp example.env .env
- Fill in values (if there are secrets)
- Make sure the paths work on your machine
- Install pipenv globally against the python version you are using in this module.
- pip install -U pipenv
- In the app-testing directory (make, python, pipenv required on your path)
make teardown
make setup
- Run all tests
make test
- Run specific test(s)
pipenv run python -m pytest -k test_labware_landing
python 3.11.0 - manage python with pyenv pipenv
Using the python REPL we can launch the app and in real time compose element locator strategies. Then we can execute them, proving they work. This alleviates having to run tests over and over to validate element locator strategies.
Using this tool is imperative to reduce time of development when creating/troubleshooting element locators.
From the app-testing directory
pipenv run python -i locators.py
clean_exit()
should be used to exit the REPL.- when you add a new Page Object (PO) you must add it to the imports, list of POs, and reload method so that you can change it and then call
reload()
to use the changes without exiting and restarting the REPL. reload()
will allow the app to stay open but changes in your PO to be reflected.
sometimes chromedriver does not cleanly exit.
pkill -x chromedriver
We have made the choice to setup all test runs local and in CI against this emulator config
To use locally setup the emulator
run our expected config
make run file_path=$MONOREPOPATH/app-testing/ci-tools/ot2_with_all_modules.yaml
ctrl-c to stop
remove the containers (this resets calibration, stopping them does not)
make remove file_path=$MONOREPOPATH/app-testing/ci-tools/ot2_with_all_modules.yaml
- Only have 1 robot connected at once.
- Build locators like you have more than 1 to future proof.
The analysis test pipenv run pytest -k test_analyses
is driven by the comma delimited string variable APP_ANALYSIS_TEST_PROTOCOLS
in .env
This allows us to run one or many.
- add the protocol file named according to the naming convention in the files/protocols appropriate folder
- add the protocol stem to
protocol_files.py
- add the protocol data as a property to
protocols.py
- run
make print-protocols