Electron-93

1. Implemented Robotjs for windows
2. Implemented a method to copy config for both windows and mac
3. Removed a conflict in config file
This commit is contained in:
Kiran Niranjan 2017-07-10 20:30:24 +05:30 committed by Kiran Niranjan
parent 3c37591de9
commit 8d0f9423a9
4 changed files with 51 additions and 3 deletions

View File

@ -3,7 +3,6 @@
"minimizeOnClose" : false,
"launchOnStartup" : true,
"alwaysOnTop" : false,
"launchOnStartup" : true,
"notificationSettings": {
"position": "upper-right",
"display": ""

View File

@ -15,9 +15,8 @@
"prebuild": "npm run rebuild && npm run browserify-preload",
"browserify-preload": "browserify -o js/preload/_preloadMain.js -x electron --insert-global-vars=__filename,__dirname js/preload/preloadMain.js",
"rebuild": "electron-rebuild -f",
"test": "npm run lint && npm run copy-config && jest --verbose --testPathPattern test --runInBand",
"test": "npm run lint && jest --verbose --testPathPattern test --runInBand",
"lint": "eslint --ext .js js/",
"copy-config": "ncp 'config' 'node_modules/electron/dist/Electron.app/Contents/config'",
"rename-exe": "cd dist/win-unpacked && ren Symphony.exe Symphony-Electron.exe"
},
"jest": {

View File

@ -110,6 +110,21 @@ describe('Tests for Always on top', () => {
setTimeout(() => {
done();
}, 5000)
} else {
app.browserWindow.getBounds().then((bounds) => {
robot.setMouseDelay(200);
let x = bounds.x + 95;
let y = bounds.x + 95;
robot.moveMouse(x, y);
robot.mouseClick();
for (let i = 0; i < 4; i++) {
robot.keyTap('down');
}
robot.keyTap('enter');
setTimeout(() => {
done();
}, 5000)
});
}
});
@ -143,6 +158,21 @@ describe('Tests for Always on top', () => {
setTimeout(() => {
done();
}, 5000);
} else {
app.browserWindow.getBounds().then((bounds) => {
robot.setMouseDelay(200);
let x = bounds.x + 95;
let y = bounds.x + 95;
robot.moveMouse(x, y);
robot.mouseClick();
for (let i = 0; i < 4; i++) {
robot.keyTap('down');
}
robot.keyTap('enter');
setTimeout(() => {
done();
}, 5000)
});
}
});

View File

@ -1,6 +1,8 @@
const Application = require('spectron').Application;
const path = require('path');
const fs = require('fs');
const childProcess = require('child_process');
const { isMac } = require('../../js/utils/misc');
class App {
@ -13,6 +15,8 @@ class App {
this.options.args = [path.join(__dirname, '..', '..', 'js/main.js')];
}
App.copyConfigPath();
this.app = new Application(this.options);
}
@ -47,6 +51,22 @@ class App {
});
}
static copyConfigPath(){
if (isMac) {
childProcess.exec(`ncp 'config' 'node_modules/electron/dist/Electron.app/Contents/config'`, function (err) {
if (err){
throw(err);
}
});
} else {
childProcess.exec(`ncp config node_modules/electron/dist/config`, function (err) {
if (err){
throw(err);
}
});
}
}
}
module.exports = App;