Hey I am trying to set up spectron but it seems I am doing something wrong. It would be greate if someone could point me into the correct direction.
here is my code:
const Application = require('spectron').Application;
const electronPath = require('electron'); // Require Electron from the binaries included in node_modules.
const path = require('path');
const assert = require('assert');
const app = new Application({
path: electronPath,
args: [path.join(__dirname, '..')],
});
describe('Testing', function () {
this.timeout(10000);
beforeEach(() => {
console.log(app); // this is executed
return app.start(); // troubling line
});
afterEach(() => {
if (app && app.isRunning()) {
return app.stop();
}
});
it('shows an initial window', function () {
console.log('count'); // this is not executed
// const count = app.client.getWindowCount();
// return assert.equal(count, 1);
assert(1,1)
});
})
Here is my error message:
Testing
Application {
host: '127.0.0.1',
port: 9515,
quitTimeout: 1000,
startTimeout: 5000,
waitTimeout: 5000,
connectionRetryCount: 10,
connectionRetryTimeout: 30000,
nodePath: 'C:\\Program Files\\nodejs\\node.exe',
path: 'C:\\Users\\vabis\\Desktop\\Playground\\projects\\app\\node_modules\\electron\\dist\\electron.exe',
args: [ 'C:\\Users\\vabis\\Desktop\\Playground\\projects\\app' ],
chromeDriverArgs: [],
env: {},
workingDirectory: 'C:\\Users\\vabis\\Desktop\\Playground\\projects\\app',
debuggerAddress: undefined,
chromeDriverLogPath: undefined,
webdriverLogPath: undefined,
webdriverOptions: {},
0 passing (8s)
1 failing
1) Testing
"before each" hook for "shows an initial window":
javascript error: javascript error: Cannot convert undefined or null to object
(Session info: chrome=85.0.4183.121)