You can find a code example on the official Github page
To get started, have a look at this code snippet:
# Install Spectron
$ npm install --save-dev spectron
A simple test to verify a visible window is opened with a title
var Application = require('spectron').Application
var assert = require('assert')
var app = new Application({
path: '/MyApp'
})
app.start().then(function () {
return app.browserWindow.isVisible()
}).then(function (isVisible) {
// Verify the window is visible
assert.equal(isVisible, true)
}.catch(function (error) {
console.error('Test failed', error.message)
})
This is an extract taken from the official site.
You want to install chai and chai-as-promised as well.
npm install --save-dev chai
npm install --save-dev chai-as-promised
Chai is a BDD / TDD assertion library for node and the second one extends it with assertions about promises.
Inspect.exe
can see the controls it might be useful.