Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spectron launches 10 windows; hangs and fails with Client initialization failed after 10 attempts

Electron v1.8.2 Spectron v3.8.0

Adding spectron tests, but even an extremely basic test fails.

Attempting to run:

const { Application } = require('spectron');

const app = new Application({
  path: './dist/mac/ddev-ui.app/Contents/MacOS/ddev-ui',
});

app.start().then((myApp) => {
  console.log(myApp);
  console.log('Started');
});

Launches 10 instances of my application very quickly and fails out with message:

Client initialization failed after 10 attempts

I've tried downgrading to electron 1.7.9 with spectron 3.7.3 with the same results.

Strangely, setting connectionRetryTimeout to 3000000 does nothing. All app instances start one after each other immediately.

like image 949
Andrew Tran Avatar asked Mar 01 '18 22:03

Andrew Tran


1 Answers

In my case this problem was caused by using electron 6.x with spectron 9.x> Switching to spectron 8.x fixed the problem.

Each version of electron should be used with a matching version of Spectron as described in the Spectron documentation here

like image 63
Giorgio Avatar answered Oct 10 '22 23:10

Giorgio