3

We have a Desktop App which has been built using electron and is chrome underneath. We want an automation tool for it. Could anybody tell me what are the options to automate it?

I found Spectron which is developed by Electron community only. However I am not getting anything how to start. I am not getting any good documentation or YouTube videos. Please help.

2

2 Answers 2

1

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.

1

Along with other answers as mentioned, i will suggest Jasmine framework for spectron. I have tried mocha but faced some issues during automation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.