Black Lives Matter. Support the Equal Justice Initiative and read our statement here.
Spectron icon

Spectron logo

An Electron Testing Framework

Test your app

An open source framework for easily writing integrations tests for your Electron app. Spectron sets up and tears down your app and allows it to be test-driven remotely with full support for the Electron APIs. Built on top of ChromeDriver and WebDriverIO.

CI Ready

Tests can run on continuous integration services such as Travis and AppVeyor.

Full API

Spectron makes the entire Chromium and Electron APIs available to your tests.

Multi Window

Interact with and verify the behavior of multiple windows from a single test.


Easily chain together async operations and assertions using standard Promises.


Add additional helpers specific to your app using the command API.


Can be used with any testing library like Mocha, Jasmine, AVA, and Chai.


$ npm install --save-dev spectron

Getting started

The example test below verifies that a visible window is opened with a title.

var Application = require('spectron').Application
var assert = require('assert')

var app = new Application({
  path: '/Applications/'

app.start().then(function () {
  // Check if the window is visible
  return app.browserWindow.isVisible()
}).then(function (isVisible) {
  // Verify the window is visible
  assert.equal(isVisible, true)
}).then(function () {
  // Get the window's title
  return app.client.getTitle()
}).then(function (title) {
  // Verify the window's title
  assert.equal(title, 'My App')
}).then(function () {
  // Stop the application
  return app.stop()
}).catch(function (error) {
  // Log any failures
  console.error('Test failed', error.message)

Dive deeper and read the API docs.

Keyboard Shortcuts

Key Action
/ Focus the search bar
Esc Focus the search bar and cleans it
Select the next search result
Select the previous search result
Enter Open the selected search result
cmdEnter Ctrl+Enter Open the selected search result in a new tab