For most changes that happen to the desktop app, consider writing an automated test to ensure that the change or fix is maintained in the codebase. Depending on the nature of the change, you will write either a unit test or an E2E test.
The Jest test runner is used to run unit tests in the desktop app. You can run the following command to run the tests:
npm run test:unit. You can also run subsets of the tests by filtering using
testPathPattern on the
Unit tests are usually written for parts of the
main modules, and usually cover individual functions or classes.
We should endeavor to write our code such that it allows for simple testing, and any new features or bug fixes should likely have an associated unit test if possible. Check out [MM-40146][MM-40147] Unit tests for authManager and certificateManager #1874, which is an example of a unit test pull request (PR).
In order to ensure that most of the app is covered, we try to maintain 70% coverage of the
You can view a coverage map by running this command:
npm run test:coverage.
We use a combination of two technologies to facilitate E2E testing in the desktop app:
To build the app and run the E2E tests, you can run the following command:
npm run test:e2e. You can also run this command to build the tests without rebuilding the app:
npm run test:e2e:nobuild. You can also run subsets of the tests by filtering using
grep, for example:
npm run test:e2e:run -- --grep back_button.
E2E tests are usually written to cover parts of the
renderer module and should generally cover complete workflows, such as creating and editing a server. You will generally need a combination of both Playwright and RobotJS APIs to test most workflows.
An example of an E2E test PR is [MM-39680] E2E Test for Deep Linking #1843.
There are many interactions (i.e. things that integrate with the operating system), such as notifications, that cannot be adequately tested using the automation frameworks we have. If this is the case, we will generally create a script to test in Rainforest, our crowd-sourced QA platform to perform these tests manually.