From 20c3368272fd9054ae5aaaa08aa0cc2e62a6f825 Mon Sep 17 00:00:00 2001 From: Kiran Niranjan Date: Tue, 20 Feb 2018 14:50:21 +0530 Subject: [PATCH] Electron-308 1. Changed args name 2. Fixed copy config method --- tests/spectron/alwaysOnTop.spectron.js | 4 ++-- tests/spectron/full-screen.spectron.js | 4 ++-- tests/spectron/minimize-on-close.spectron.js | 4 ++-- tests/spectron/spectronSetup.js | 11 ++++++++++- tests/spectron/zoom-in-zoom-out.spectron.js | 4 ++-- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/tests/spectron/alwaysOnTop.spectron.js b/tests/spectron/alwaysOnTop.spectron.js index 87379d1c..9668e6f9 100644 --- a/tests/spectron/alwaysOnTop.spectron.js +++ b/tests/spectron/alwaysOnTop.spectron.js @@ -34,8 +34,8 @@ describe('Tests for Always on top', () => { return require('electron').remote.app.getPath('userData'); }) }); - app.client.getUserDataPath().then((path) => { - resolve(path.value + '/Symphony.config') + app.client.getUserDataPath().then((userConfigPath) => { + resolve(userConfigPath.value + '/Symphony.config') }).catch((err) => { reject(err); }); diff --git a/tests/spectron/full-screen.spectron.js b/tests/spectron/full-screen.spectron.js index 69e78055..3a50a915 100644 --- a/tests/spectron/full-screen.spectron.js +++ b/tests/spectron/full-screen.spectron.js @@ -37,8 +37,8 @@ describe('Tests for Full screen', () => { return require('electron').remote.app.getPath('userData'); }) }); - app.client.getUserDataPath().then((path) => { - resolve(path.value + '/Symphony.config') + app.client.getUserDataPath().then((userConfigPath) => { + resolve(userConfigPath.value + '/Symphony.config') }).catch((err) => { reject(err); }); diff --git a/tests/spectron/minimize-on-close.spectron.js b/tests/spectron/minimize-on-close.spectron.js index bb8fd9a2..7054e2e8 100644 --- a/tests/spectron/minimize-on-close.spectron.js +++ b/tests/spectron/minimize-on-close.spectron.js @@ -37,8 +37,8 @@ describe('Tests for Minimize on Close', () => { return require('electron').remote.app.getPath('userData'); }) }); - app.client.getUserDataPath().then((path) => { - resolve(path.value + '/Symphony.config') + app.client.getUserDataPath().then((userConfigPath) => { + resolve(userConfigPath.value + '/Symphony.config') }).catch((err) => { reject(err); }); diff --git a/tests/spectron/spectronSetup.js b/tests/spectron/spectronSetup.js index 7f45003a..cc0d05f8 100644 --- a/tests/spectron/spectronSetup.js +++ b/tests/spectron/spectronSetup.js @@ -44,7 +44,16 @@ class App { static readConfig(configPath) { if (!fs.existsSync(configPath)) { - return this.copyConfigPath(); + return new Promise(function (resolve) { + this.copyConfigPath().then(() => { + fs.readFile(configPath, 'utf-8', function (err, data) { + if (err) { + throw new Error("Unable to read user config file " + err); + } + resolve(JSON.parse(data)); + }); + }); + }); } return new Promise(function (resolve) { diff --git a/tests/spectron/zoom-in-zoom-out.spectron.js b/tests/spectron/zoom-in-zoom-out.spectron.js index 0100860a..bd01b4bc 100644 --- a/tests/spectron/zoom-in-zoom-out.spectron.js +++ b/tests/spectron/zoom-in-zoom-out.spectron.js @@ -37,8 +37,8 @@ describe('Tests for Zoom in and Zoom out', () => { return require('electron').remote.app.getPath('userData'); }) }); - app.client.getUserDataPath().then((path) => { - resolve(path.value + '/Symphony.config') + app.client.getUserDataPath().then((userConfigPath) => { + resolve(userConfigPath.value + '/Symphony.config') }).catch((err) => { reject(err); });