Chapter 13. Testing applications with Spectron

This chapter covers

  • Using Spectron to test Electron applications
  • Understanding the relationship among Spectron, WebdriverIO, and Selenium WebDriver
  • Controlling Electron APIs within integration tests

At this point in the book, we’ve built a number of Electron applications. Testing these applications to make sure that they work as expected has been something of a manual process. Make a change, start the application, and click around to ensure that everything works. This is fine for small applications, but this method can become tedious in larger applications. What if a change in the code in one part of the application breaks some functionality elsewhere?

In these situations, it’s helpful to automate the tests. Let the computer do the boring, repetitive work, while you focus on the features that bring value to your customers. That sounds great, but how do we do that? In a traditional web application, you might point something like Selenium WebDriver to your website, make some assertions as to how the site should behave, and then have it click around and confirm that everything works as expected.

13.1. Introducing Spectron

13.2. Getting comfortable with Spectron and WebdriverIO

13.3. Setting up Spectron and the test runner

13.4. Writing asynchronous tests using Spectron