SymphonyElectron/tests/spectron/spectronSetup.js

40 lines
892 B
JavaScript
Raw Normal View History

const Application = require('spectron').Application;
const path = require('path');
class App {
constructor(options) {
this.options = options;
2017-07-06 06:36:16 -05:00
if (!this.options.path) {
this.options.path = App.getAppPath();
2017-07-06 04:39:50 -05:00
this.options.args = [path.join(__dirname, '..', '..', 'js/main.js')];
}
this.app = new Application(this.options);
}
startApplication() {
2017-07-06 06:36:16 -05:00
return this.app.start().then((app) => {
2017-07-06 04:39:50 -05:00
return app;
}).catch((err) => {
console.log(err);
});
}
static getAppPath() {
2017-07-06 04:39:50 -05:00
let electronPath = path.join(__dirname, '..', '..', 'node_modules', '.bin', 'electron');
if (process.platform === 'win32') {
electronPath += '.cmd';
}
return electronPath
}
2017-07-06 06:36:16 -05:00
static getTimeOut() {
return 90000
}
}
module.exports = App;