Testing COSMOS
Playwright
Prerequesits
-
Install Yarn
npm install --global yarn
-
Clone the COSMOS Playwright repo
git clone https://github.com/OpenC3/cosmos-playwright
-
Install Playwright and dependencies
cosmos-playwright % yarn install
Playwright Testing
-
Start COSMOS
cosmos % openc3.sh start
-
Open COSMOS in your browser. At the login screen, set the password to "password".
-
Run tests (Note the --headed option visually displays tests, leave it off to run in the background)
cosmos-playwright % yarn playwright test --project=chromium --headed
-
[Optional] Fix istanbul/nyc coverage source lookups (use
fixwindows
if not on Linux).Tests will run successfully without this step and you will get coverage statistics, but line-by-line coverage won't work.
cosmos-playwright % yarn fixlinux
-
Generate code coverage
cosmos-playwright % yarn coverage
Code coverage reports can be viewed at openc3-playwright/coverage/index.html
Ruby Unit Tests
-
Navigate to cosmos/openc3 folder. Run the command:
cosmos/openc3 % rake build
cosmos/openc3 % bundle exec rspec
Code coverage reports can be found at cosmos/openc3/coverage/index.html
Python Unit Tests
-
Navigate to cosmos/openc3/python folder. Run the command:
cosmos/openc3/python % python -m pip install -r requirements-dev.txt
cosmos/openc3/python % python -m pip install -r requirements.txt
cosmos/openc3/python % coverage run -m pytest
cosmos/openc3/python % coverage html
Code coverage reports can be found at cosmos/openc3/python/coverage/index.html