An overview of testing within CHT-CORE. Check out the package.json for all the tests you can run.
They live in the tests
directories of each app. Run them with: npm run unit
.
They are located in tests/integration
. Run them with: npm run e2e-integration-local
We use Github Actions which runs npm run compile
every time some new code is pushed to GitHub.
- Follow the guide DEVELOPMENT.md
- JDK installed for Selenium.
- Docker to run couchdb.
- Run
npm ci
- Run
npm run build-dev-watch
- Run
npm run wdio-local
- Run
npx allure open
to view the test reports
- Download the CI run artifact zip file
- Extract it anyhere
- From your cht-core directory, run
npx allure open <path>/allure-report/
.
npm run ci-webdriver-default
is executed to run the Webdriver IO tests.
Please read the style guide for automated tests which provides editorial guidelines for anyone creating new automated test cases for CHT-Core.
Here are two ways to run individual tests and have your IDE break on the specific test.
When debugging it can be helpful to disable the headless browser mode so that you can see the browser window as the tests run. To do this, remove --headless
from the tests/e2e/default/wdio.conf.js.
To run just a single test file in WebdriverIO, update the specs
config in the wdio.confi.js
to refer to the desired test file.
- Default config:
tests/e2e/default/wdio.confi.js
- In a terminal, run
npm run build-dev-watch
- In Intellij, open the package.json file
- Scroll to the scripts section and click the ▶ button next to
wdio-local
- Select
Debug 'wdio-local'
GitHub actions will artifact all files in tests/logs. This is the directory any logs, results, images, etc... should save to if you want to review them if a build fails.
Our GitHub actions spin up an ubuntu-22.04 machine. Installs software and then launches Couchdb and Horticulturalist in a docker container. This is needed to run our applications in the specific node versions we support while allowing our test code to run in versions of node it they support. This creates a paradigm to keep in mind when writing tests. Tests run on the ubuntu machine. Any test code that starts a server or runs an executable is running outside of the horti container. The ports are exposed for all our services and horti has access to the cht-core root via a volume. Horti can also talk to the host by getting the gateway of the docker network.
wdio = WebdriverIo