End to End (E2E) tests are high level tests that tests. Instead of testing lower level functionality, such as if components render correctly or functions take certain arguments, they test at the application level. These are typically the kinds of tests that you would run to check if you app works. We have chosen Testcafe as our testing framework. It is a much nicer alternative to webdriverio, spectron, and selenium.
Writing End to End Tests
By convention, all E2E test modules have the following filename suffix:
.e2e.js. An example of test module filename would be
Here's some examples of E2E tests:
- Testing if you app opens and closes
- Testing if the title bar has the expected text
- Testing if a popup shows after clicking a button
Here's an example of an E2E test:
Simply by reading this test, we can infer what it does:
- Gets the page title
- Asserts that it equals
'Hello Electron React!'
- Returns a promise
For more writing tests with Testcafe, refer to their docs.
After you have written E2E tests, we can now run tests. E2E tests must be built before running them. So we can run
yarn build-e2e to build the E2E tests and then
If you would like to run the E2E tests in the background without them opening (headlessly), run
START_MINIMIZED=true yarn build-e2e and then run the E2E tests:
Similar to watching component tests, can be watched as well. This can be done by running
testcafe --live is used to watch tests and run.