Testing COSMOS



  1. Install Yarn

    npm install --global yarn
  2. Clone the COSMOS Playwright repo

    git clone https://github.com/OpenC3/cosmos-playwright
  3. Install Playwright and dependencies

    cosmos-playwright % yarn install

Playwright Testing

  1. Start COSMOS

    cosmos % openc3.sh start
  2. Open COSMOS in your browser. At the login screen, set the password to “password”.

  3. 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
  4. [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
  5. Generate code coverage

    cosmos-playwright % yarn coverage

Code coverage reports can be viewed at openc3-playwright/coverage/index.html

Unit Tests

  1. 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