v5

Testing COSMOS

Cypress

Prerequesits

  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 add the –headed option to visually watch tests)

    cosmos-playwright % yarn playwright test --project=chromium
    
  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 % bundle exec rspec
    

Code coverage reports can be found at cosmos/openc3/coverage/index.html