mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
ELECTRON-357 (#321)
- Skipping npm rebuild every time and only running it once. - Changed the time-out to 60000ms - Moved the require to global - Added done fail in all the catch functions - Removed unwanted require
This commit is contained in:
committed by
Vishwas Shashidhar
parent
191ca0c05e
commit
55e75cf5e5
@@ -1,10 +1,8 @@
|
||||
const Application = require('./spectronSetup');
|
||||
const {isMac} = require('../../js/utils/misc.js');
|
||||
const childProcess = require('child_process');
|
||||
const constants = require('./spectronConstants');
|
||||
const robot = require('robotjs');
|
||||
|
||||
let app = new Application({});
|
||||
let robot;
|
||||
let configPath;
|
||||
let mIsAlwaysOnTop;
|
||||
|
||||
@@ -14,23 +12,16 @@ describe('Tests for Always on top', () => {
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
||||
|
||||
beforeAll((done) => {
|
||||
childProcess.exec(`npm rebuild robotjs --target=${process.version} --build-from-source`, function () {
|
||||
robot = require('robotjs');
|
||||
return app.startApplication().then((startedApp) => {
|
||||
app = startedApp;
|
||||
getConfigPath().then((config) => {
|
||||
configPath = config;
|
||||
done();
|
||||
}).catch((err) => {
|
||||
console.error(`Unable to get user config path error: ${err}`);
|
||||
expect(err).toBeNull();
|
||||
done();
|
||||
});
|
||||
}).catch((err) => {
|
||||
console.error(`Unable to start application error: ${err}`);
|
||||
expect(err).toBeNull();
|
||||
return app.startApplication().then((startedApp) => {
|
||||
app = startedApp;
|
||||
getConfigPath().then((config) => {
|
||||
configPath = config;
|
||||
done();
|
||||
}).catch((err) => {
|
||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -57,8 +48,7 @@ describe('Tests for Always on top', () => {
|
||||
done();
|
||||
}).catch((err) => {
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
|
||||
expect(err).toBeNull();
|
||||
done();
|
||||
done.fail(new Error(`alwaysOnTop failed in afterAll with error: ${err}`));
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -70,23 +60,25 @@ describe('Tests for Always on top', () => {
|
||||
done();
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`alwaysOnTop failed in waitUntilWindowLoaded with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should check window count', () => {
|
||||
it('should check window count', (done) => {
|
||||
return app.client.getWindowCount().then((count) => {
|
||||
expect(count === 1).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`alwaysOnTop failed in getWindowCount with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should check browser window visibility', () => {
|
||||
it('should check browser window visibility', (done) => {
|
||||
return app.browserWindow.isVisible().then((isVisible) => {
|
||||
expect(isVisible).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`alwaysOnTop failed in isVisible with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -116,25 +108,28 @@ describe('Tests for Always on top', () => {
|
||||
});
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`alwaysOnTop failed in setAlwaysOnTop with error: ${err}`));
|
||||
});
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
it('should check is always on top', () => {
|
||||
it('should check is always on top', (done) => {
|
||||
return Application.readConfig(configPath).then((userData) => {
|
||||
return app.browserWindow.isAlwaysOnTop().then((isAlwaysOnTop) => {
|
||||
mIsAlwaysOnTop = isAlwaysOnTop;
|
||||
if (userData.alwaysOnTop) {
|
||||
expect(isAlwaysOnTop).toBeTruthy();
|
||||
done();
|
||||
} else {
|
||||
expect(isAlwaysOnTop).toBeFalsy();
|
||||
done();
|
||||
}
|
||||
done();
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`alwaysOnTop failed in readConfig with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -169,23 +164,25 @@ describe('Tests for Always on top', () => {
|
||||
done();
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`alwaysOnTop failed in getBounds with error: ${err}`));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it('should check is always on top to be true', () => {
|
||||
it('should check is always on top to be true', (done) => {
|
||||
if (!mIsAlwaysOnTop) {
|
||||
return app.browserWindow.isAlwaysOnTop().then((isAlwaysOnTop) => {
|
||||
expect(isAlwaysOnTop).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`alwaysOnTop failed in isAlwaysOnTop with error: ${err}`));
|
||||
});
|
||||
} else {
|
||||
return app.browserWindow.isAlwaysOnTop().then((isAlwaysOnTop) => {
|
||||
expect(isAlwaysOnTop).toBeFalsy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`alwaysOnTop failed in isAlwaysOnTop with error: ${err}`));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -13,9 +13,7 @@ describe('Tests for Bring to front', () => {
|
||||
app = startedApp;
|
||||
done();
|
||||
}).catch((err) => {
|
||||
console.error(`Unable to start application error: ${err}`);
|
||||
expect(err).toBeNull();
|
||||
done();
|
||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -36,51 +34,55 @@ describe('Tests for Bring to front', () => {
|
||||
expect(count === 1).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`bringToFront failed in getWindowCount with error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`bringToFront failed in waitUntilWindowLoaded with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should minimize the app', () => {
|
||||
it('should minimize the app', (done) => {
|
||||
return app.browserWindow.minimize().then(() => {
|
||||
return app.browserWindow.isMinimized().then((isMinimized) => {
|
||||
expect(isMinimized).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`bringToFront failed in isMinimized with error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`bringToFront failed in minimize with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should not be focused', () => {
|
||||
it('should not be focused', (done) => {
|
||||
return app.browserWindow.isFocused().then((isFocused) => {
|
||||
expect(isFocused).toBeFalsy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`bringToFront failed in isFocused with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should maximize browser window', () => {
|
||||
it('should maximize browser window', (done) => {
|
||||
return app.browserWindow.restore().then(() => {
|
||||
return app.browserWindow.isMinimized().then((isMinimized) => {
|
||||
expect(isMinimized).toBeFalsy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`bringToFront failed in isMinimized with error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`bringToFront failed in restore with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should be focused', () => {
|
||||
it('should be focused', (done) => {
|
||||
return app.browserWindow.isFocused().then((isFocused) => {
|
||||
expect(isFocused).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`bringToFront failed in isFocused with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const Application = require('./spectronSetup');
|
||||
const path = require('path');
|
||||
const constants = require('./spectronConstants');
|
||||
|
||||
let app = new Application({});
|
||||
|
||||
@@ -14,9 +13,7 @@ describe('Tests for clipboard', () => {
|
||||
app = startedApp;
|
||||
done();
|
||||
}).catch((err) => {
|
||||
console.error(`Unable to start application error: ${err}`);
|
||||
expect(err).toBeNull();
|
||||
done();
|
||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -37,10 +34,10 @@ describe('Tests for clipboard', () => {
|
||||
expect(count === 1).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeFalsy();
|
||||
done.fail(new Error(`clipboard failed in getWindowCount with error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeFalsy();
|
||||
done.fail(new Error(`clipboard failed in waitUntilWindowLoaded with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -75,4 +72,4 @@ describe('Tests for clipboard', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
const Application = require('./spectronSetup');
|
||||
const constants = require('./spectronConstants');
|
||||
|
||||
let app = new Application({});
|
||||
|
||||
describe('Tests for Close', () => {
|
||||
|
||||
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 90000;
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
||||
|
||||
beforeAll((done) => {
|
||||
return app.startApplication().then((startedApp) => {
|
||||
app = startedApp;
|
||||
done();
|
||||
}).catch((err) => {
|
||||
console.error(`Unable to start application error: ${err}`);
|
||||
expect(err).toBeNull();
|
||||
done();
|
||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -38,26 +35,28 @@ describe('Tests for Close', () => {
|
||||
expect(count === 1).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`close failed in getWindowCount with error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`close failed in waitUntilWindowLoaded with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should check window count', () => {
|
||||
it('should check window count', (done) => {
|
||||
return app.client.getWindowCount().then((count) => {
|
||||
expect(count === 1).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`close failed in getWindowCount with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should check browser window visibility', () => {
|
||||
it('should check browser window visibility', (done) => {
|
||||
return app.browserWindow.isVisible().then((isVisible) => {
|
||||
expect(isVisible).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`close failed in isVisible with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -69,4 +68,4 @@ describe('Tests for Close', () => {
|
||||
expect(app.isRunning()).toBe(false);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,35 +1,26 @@
|
||||
const childProcess = require('child_process');
|
||||
const Application = require('./spectronSetup');
|
||||
const { isMac } = require('../../js/utils/misc');
|
||||
const constants = require('./spectronConstants');
|
||||
const robot = require('robotjs');
|
||||
|
||||
let robot;
|
||||
let configPath;
|
||||
let app = new Application({});
|
||||
|
||||
describe('Tests for Full screen', () => {
|
||||
|
||||
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 90000;
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
||||
|
||||
beforeAll((done) => {
|
||||
childProcess.exec(`npm rebuild robotjs --target=${process.version} --build-from-source`, function () {
|
||||
robot = require('robotjs');
|
||||
return app.startApplication().then((startedApp) => {
|
||||
app = startedApp;
|
||||
getConfigPath().then((config) => {
|
||||
configPath = config;
|
||||
done();
|
||||
}).catch((err) => {
|
||||
console.error(`Unable to get user config path error: ${err}`);
|
||||
expect(err).toBeNull();
|
||||
done();
|
||||
});
|
||||
}).catch((err) => {
|
||||
console.error(`Unable to start application error: ${err}`);
|
||||
expect(err).toBeNull();
|
||||
return app.startApplication().then((startedApp) => {
|
||||
app = startedApp;
|
||||
getConfigPath().then((config) => {
|
||||
configPath = config;
|
||||
done();
|
||||
}).catch((err) => {
|
||||
done.fail(new Error(`full-screen failed in getConfigPath with error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -73,26 +64,28 @@ describe('Tests for Full screen', () => {
|
||||
expect(count === 1).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`full-screen failed in getWindowCount with error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`full-screen failed in waitUntilWindowLoaded with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should check window count', () => {
|
||||
it('should check window count', (done) => {
|
||||
return app.client.getWindowCount().then((count) => {
|
||||
expect(count === 1).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`full-screen failed in getWindowCount with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should check browser window visibility', () => {
|
||||
it('should check browser window visibility', (done) => {
|
||||
return app.browserWindow.isVisible().then((isVisible) => {
|
||||
expect(isVisible).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`full-screen failed in getWindowCount with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -105,7 +98,7 @@ describe('Tests for Full screen', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should set the app full screen and check whether it is in full screen', () => {
|
||||
it('should set the app full screen and check whether it is in full screen', (done) => {
|
||||
if (isMac) {
|
||||
robot.setMouseDelay(100);
|
||||
robot.moveMouseSmooth(205, 10);
|
||||
@@ -121,8 +114,9 @@ describe('Tests for Full screen', () => {
|
||||
|
||||
return app.browserWindow.isFullScreen().then((fullscreen) => {
|
||||
expect(fullscreen).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`full-screen failed in isFullScreen with error: ${err}`));
|
||||
})
|
||||
} else {
|
||||
return app.browserWindow.getBounds().then((bounds) => {
|
||||
@@ -136,10 +130,11 @@ describe('Tests for Full screen', () => {
|
||||
|
||||
return app.browserWindow.isFullScreen().then((fullscreen) => {
|
||||
expect(fullscreen).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`full-screen failed in isFullScreen with error: ${err}`));
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const Application = require('./spectronSetup');
|
||||
const path = require('path');
|
||||
const { buildNumber } = require('../../package');
|
||||
const electronVersion = require('../../package').devDependencies.electron;
|
||||
const bluebird = require('bluebird');
|
||||
|
||||
let app = new Application({});
|
||||
@@ -15,9 +16,7 @@ describe('Tests for getVersionInfo API', () => {
|
||||
app = startedApp;
|
||||
done();
|
||||
}).catch((err) => {
|
||||
console.error(`Unable to start application error: ${err}`);
|
||||
expect(err).toBeNull();
|
||||
done();
|
||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -38,10 +37,10 @@ describe('Tests for getVersionInfo API', () => {
|
||||
expect(count === 1).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`getVersionInfo failed in getWindowCount with error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`getVersionInfo failed in waitUntilWindowLoaded with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -63,9 +62,9 @@ describe('Tests for getVersionInfo API', () => {
|
||||
}).then((values) => {
|
||||
expect(values[ 0 ]).toBe('1.0.0');
|
||||
expect(values[ 1 ]).toBe('Electron');
|
||||
expect(values[ 2 ]).toBe('1.8.3');
|
||||
expect(values[ 2 ]).toBe(electronVersion);
|
||||
expect(values[ 3 ]).toBe(buildNumber);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,35 +1,26 @@
|
||||
const childProcess = require('child_process');
|
||||
const Application = require('./spectronSetup');
|
||||
const { isMac } = require('../../js/utils/misc');
|
||||
const constants = require('./spectronConstants');
|
||||
const robot = require('robotjs');
|
||||
|
||||
let robot;
|
||||
let configPath;
|
||||
let app = new Application({});
|
||||
|
||||
describe('Tests for Minimize on Close', () => {
|
||||
|
||||
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 90000;
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
||||
|
||||
beforeAll((done) => {
|
||||
childProcess.exec(`npm rebuild robotjs --target=${process.version} --build-from-source`, function () {
|
||||
robot = require('robotjs');
|
||||
return app.startApplication().then((startedApp) => {
|
||||
app = startedApp;
|
||||
getConfigPath().then((config) => {
|
||||
configPath = config;
|
||||
done();
|
||||
}).catch((err) => {
|
||||
console.error(`Unable to get user config path error: ${err}`);
|
||||
expect(err).toBeNull();
|
||||
done();
|
||||
});
|
||||
}).catch((err) => {
|
||||
console.error(`Unable to start application error: ${err}`);
|
||||
expect(err).toBeNull();
|
||||
return app.startApplication().then((startedApp) => {
|
||||
app = startedApp;
|
||||
getConfigPath().then((config) => {
|
||||
configPath = config;
|
||||
done();
|
||||
}).catch((err) => {
|
||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -73,26 +64,28 @@ describe('Tests for Minimize on Close', () => {
|
||||
expect(count === 1).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`minimize-on-close failed in getWindowCount with error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`minimize-on-close failed in waitUntilWindowLoaded with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should check window count', () => {
|
||||
it('should check window count', (done) => {
|
||||
return app.client.getWindowCount().then((count) => {
|
||||
expect(count === 1).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`minimize-on-close failed in getWindowCount with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should check browser window visibility', () => {
|
||||
it('should check browser window visibility', (done) => {
|
||||
return app.browserWindow.isVisible().then((isVisible) => {
|
||||
expect(isVisible).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`minimize-on-close failed in isVisible with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -117,8 +110,7 @@ describe('Tests for Minimize on Close', () => {
|
||||
expect(minimized).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done();
|
||||
done.fail(new Error(`minimize-on-close failed in isMinimized with error: ${err}`));
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -141,8 +133,7 @@ describe('Tests for Minimize on Close', () => {
|
||||
expect(minimized).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done();
|
||||
done.fail(new Error(`minimize-on-close failed in isMinimized with error: ${err}`));
|
||||
});
|
||||
}
|
||||
} else {
|
||||
@@ -167,8 +158,7 @@ describe('Tests for Minimize on Close', () => {
|
||||
expect(minimized).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done();
|
||||
done.fail(new Error(`minimize-on-close failed in isMinimized with error: ${err}`));
|
||||
});
|
||||
});
|
||||
} else {
|
||||
@@ -185,16 +175,14 @@ describe('Tests for Minimize on Close', () => {
|
||||
expect(minimized).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done();
|
||||
done.fail(new Error(`minimize-on-close failed in isMinimized with error: ${err}`));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done();
|
||||
done.fail(new Error(`minimize-on-close failed in readConfig with error: ${err}`));
|
||||
})
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const Application = require('./spectronSetup');
|
||||
const path = require('path');
|
||||
const { isMac } = require('../../js/utils/misc');
|
||||
const constants = require('./spectronConstants');
|
||||
|
||||
let app = new Application({});
|
||||
|
||||
@@ -15,9 +14,7 @@ describe('Tests for Notification position', () => {
|
||||
app = startedApp;
|
||||
done();
|
||||
}).catch((err) => {
|
||||
console.error(`Unable to start application error: ${err}`);
|
||||
expect(err).toBeNull();
|
||||
done();
|
||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -38,10 +35,10 @@ describe('Tests for Notification position', () => {
|
||||
expect(count === 1).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`notificationPosition failed in getWindowCount with error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`notificationPosition failed in waitUntilWindowLoaded with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -49,15 +46,16 @@ describe('Tests for Notification position', () => {
|
||||
return app.client.url('file:///' + path.join(__dirname, '..', '..', 'demo/index.html'));
|
||||
});
|
||||
|
||||
it('should load demo html', () => {
|
||||
it('should load demo html', (done) => {
|
||||
return app.client.waitUntilWindowLoaded().then(() => {
|
||||
return app.client.getTitle().then((title) => {
|
||||
expect(title === '').toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`notificationPosition failed in getTitle with error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`notificationPosition failed in waitUntilWindowLoaded with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -72,32 +70,35 @@ describe('Tests for Notification position', () => {
|
||||
.windowByIndex(1)
|
||||
});
|
||||
|
||||
it('should check notification position', () => {
|
||||
it('should check notification position', (done) => {
|
||||
return app.browserWindow.getBounds().then((bounds) => {
|
||||
expect(bounds.x === 0).toBeTruthy();
|
||||
if (isMac) {
|
||||
expect(bounds.y > 0).toBeTruthy();
|
||||
done();
|
||||
} else {
|
||||
expect(bounds.y === 0).toBeTruthy();
|
||||
done();
|
||||
}
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`notificationPosition failed in getBounds with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should change the window', () => {
|
||||
it('should change the window', (done) => {
|
||||
return app.client.windowByIndex(0).then(() => {
|
||||
return app.browserWindow.getTitle().then((title) => {
|
||||
expect(title === 'Symphony | Secure Seamless Communication').toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`notificationPosition failed in getTitle with error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`notificationPosition failed in windowByIndex with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should change notification position to lower-right', () => {
|
||||
it('should change notification position to lower-right', (done) => {
|
||||
return app.client
|
||||
.click('#open-config-win')
|
||||
.windowByIndex(2)
|
||||
@@ -108,36 +109,39 @@ describe('Tests for Notification position', () => {
|
||||
.windowByIndex(1).then(() => {
|
||||
return app.browserWindow.getTitle().then((title) => {
|
||||
expect(title === 'Electron').toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`notificationPosition failed in getTitle with error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`notificationPosition failed in windowByIndex with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should check notification position and equal to lower-right', () => {
|
||||
it('should check notification position and equal to lower-right', (done) => {
|
||||
return app.browserWindow.getBounds().then((bounds) => {
|
||||
expect(bounds.x > 0).toBeTruthy();
|
||||
expect(bounds.y > 0).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`notificationPosition failed in getBounds with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should change the window', () => {
|
||||
it('should change the window', (done) => {
|
||||
return app.client.windowByIndex(0).then(() => {
|
||||
return app.browserWindow.getTitle().then((title) => {
|
||||
expect(title === 'Symphony | Secure Seamless Communication').toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`notificationPosition failed in getTitle with error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`notificationPosition failed in windowByIndex with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should change notification position to upper-right', () => {
|
||||
it('should change notification position to upper-right', (done) => {
|
||||
return app.client
|
||||
.click('#open-config-win')
|
||||
.windowByIndex(2)
|
||||
@@ -148,57 +152,63 @@ describe('Tests for Notification position', () => {
|
||||
.windowByIndex(1).then(() => {
|
||||
return app.browserWindow.getTitle().then((title) => {
|
||||
expect(title === 'Electron').toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`notificationPosition failed in getTitle with error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`notificationPosition failed in windowByIndex with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should check notification position and equal to upper-right', () => {
|
||||
it('should check notification position and equal to upper-right', (done) => {
|
||||
return app.browserWindow.getBounds().then((bounds) => {
|
||||
expect(bounds.x > 0).toBeTruthy();
|
||||
if (isMac) {
|
||||
expect(bounds.y > 0).toBeTruthy();
|
||||
done();
|
||||
} else {
|
||||
expect(bounds.y === 0).toBeTruthy();
|
||||
done();
|
||||
}
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`notificationPosition failed in getBounds with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should change the window to main', () => {
|
||||
it('should change the window to main', (done) => {
|
||||
return app.client.windowByIndex(0).then(() => {
|
||||
return app.browserWindow.getTitle().then((title) => {
|
||||
expect(title === 'Symphony | Secure Seamless Communication').toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`notificationPosition failed in getTitle with error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`notificationPosition failed in windowByIndex with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should open notification and close', () => {
|
||||
it('should open notification and close', (done) => {
|
||||
return app.client
|
||||
.windowByIndex(0)
|
||||
.click('#notf')
|
||||
.getWindowCount().then((count) => {
|
||||
expect(count === 3).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`notificationPosition failed in getWindowCount with error: ${err}`));
|
||||
})
|
||||
.windowByIndex(1).then(() => {
|
||||
return app.browserWindow.getTitle().then((title) => {
|
||||
expect(title === 'Electron').toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`notificationPosition failed in getTitle with error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`notificationPosition failed in windowByIndex with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -113,4 +113,4 @@ class App {
|
||||
|
||||
}
|
||||
|
||||
module.exports = App;
|
||||
module.exports = App;
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
const Application = require('./spectronSetup');
|
||||
const path = require('path');
|
||||
const {isMac} = require('../../js/utils/misc.js');
|
||||
const childProcess = require('child_process');
|
||||
const constants = require('./spectronConstants');
|
||||
|
||||
const robot = require('robotjs');
|
||||
let app = new Application({});
|
||||
let robot;
|
||||
|
||||
describe('Tests for spellChecker', () => {
|
||||
|
||||
@@ -13,16 +10,11 @@ describe('Tests for spellChecker', () => {
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
||||
|
||||
beforeAll((done) => {
|
||||
childProcess.exec(`npm rebuild robotjs --target=${process.version} --build-from-source`, () => {
|
||||
robot = require('robotjs');
|
||||
app.startApplication().then((startedApp) => {
|
||||
app = startedApp;
|
||||
done();
|
||||
}).catch((err) => {
|
||||
console.error(`Unable to start application error: ${err}`);
|
||||
expect(err).toBeNull();
|
||||
done();
|
||||
});
|
||||
app.startApplication().then((startedApp) => {
|
||||
app = startedApp;
|
||||
done();
|
||||
}).catch((err) => {
|
||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -43,12 +35,10 @@ describe('Tests for spellChecker', () => {
|
||||
expect(count === 1).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeFalsy();
|
||||
done();
|
||||
done.fail(new Error(`spellChecker failed in getWindowCount with error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeFalsy();
|
||||
done();
|
||||
done.fail(new Error(`spellChecker failed in waitUntilWindowLoaded with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -122,4 +112,4 @@ describe('Tests for spellChecker', () => {
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
const childProcess = require('child_process');
|
||||
const Application = require('./spectronSetup');
|
||||
const { isMac } = require('../../js/utils/misc');
|
||||
const constants = require('./spectronConstants');
|
||||
const robot = require('robotjs');
|
||||
|
||||
let robot;
|
||||
let configPath;
|
||||
|
||||
let app = new Application({});
|
||||
@@ -11,26 +9,19 @@ let app = new Application({});
|
||||
describe('Tests for Zoom in and Zoom out', () => {
|
||||
|
||||
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 90000;
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
||||
|
||||
beforeAll((done) => {
|
||||
childProcess.exec(`npm rebuild robotjs --target=${process.version} --build-from-source`, function () {
|
||||
robot = require('robotjs');
|
||||
return app.startApplication().then((startedApp) => {
|
||||
app = startedApp;
|
||||
getConfigPath().then((config) => {
|
||||
configPath = config;
|
||||
done();
|
||||
}).catch((err) => {
|
||||
console.error(`Unable to get user config path error: ${err}`);
|
||||
expect(err).toBeNull();
|
||||
done();
|
||||
});
|
||||
}).catch((err) => {
|
||||
console.error(`Unable to start application error: ${err}`);
|
||||
expect(err).toBeNull();
|
||||
return app.startApplication().then((startedApp) => {
|
||||
app = startedApp;
|
||||
getConfigPath().then((config) => {
|
||||
configPath = config;
|
||||
done();
|
||||
}).catch((err) => {
|
||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -74,26 +65,28 @@ describe('Tests for Zoom in and Zoom out', () => {
|
||||
expect(count === 1).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`zoom-in-zoom-out failed in getWindowCount with error: ${err}`));
|
||||
});
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`zoom-in-zoom-out failed in waitUntilWindowLoaded with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should check window count', () => {
|
||||
it('should check window count', (done) => {
|
||||
return app.client.getWindowCount().then((count) => {
|
||||
expect(count === 1).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`zoom-in-zoom-out failed in waitUntilWindowLoaded with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
it('should check browser window visibility', () => {
|
||||
it('should check browser window visibility', (done) => {
|
||||
return app.browserWindow.isVisible().then((isVisible) => {
|
||||
expect(isVisible).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`zoom-in-zoom-out failed in isVisible with error: ${err}`));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -106,7 +99,7 @@ describe('Tests for Zoom in and Zoom out', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should zoom in the app and check whether it is zoomed in', () => {
|
||||
it('should zoom in the app and check whether it is zoomed in', (done) => {
|
||||
robot.setKeyboardDelay(500);
|
||||
if (isMac) {
|
||||
|
||||
@@ -122,8 +115,9 @@ describe('Tests for Zoom in and Zoom out', () => {
|
||||
|
||||
return app.electron.webFrame.getZoomFactor().then((zoomFactor) => {
|
||||
expect(zoomFactor > 1).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`zoom-in-zoom-out failed in getZoomFactor with error: ${err}`));
|
||||
})
|
||||
} else {
|
||||
return app.browserWindow.getBounds().then((bounds) => {
|
||||
@@ -146,8 +140,9 @@ describe('Tests for Zoom in and Zoom out', () => {
|
||||
|
||||
return app.electron.webFrame.getZoomFactor().then((zoomFactor) => {
|
||||
expect(zoomFactor > 1).toBeTruthy();
|
||||
done();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
done.fail(new Error(`zoom-in-zoom-out failed in getBounds with error: ${err}`));
|
||||
})
|
||||
});
|
||||
}
|
||||
@@ -200,4 +195,4 @@ describe('Tests for Zoom in and Zoom out', () => {
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user