mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
Electron-336 (Update bring to front logic on Windows) (#325)
- Added an arg which prevents window from getting focus when it is set to false - Update bring to front logic - Rename "Bring to Front on Notifications" to Flash Notification in Taskbar for Windows - Update Spectron test cases
This commit is contained in:
parent
9856548e82
commit
ecb0f88660
4
installer/win/Symphony-x64.aip
Normal file → Executable file
4
installer/win/Symphony-x64.aip
Normal file → Executable file
@ -392,7 +392,7 @@
|
|||||||
<ROW Dialog_="FolderDlg" Control="LaunchOnStartupCheckBox" Type="CheckBox" X="172" Y="174" Width="98" Height="13" Attributes="3" Property="AUTO_START_CB" Text="Launch On Startup" Order="1600"/>
|
<ROW Dialog_="FolderDlg" Control="LaunchOnStartupCheckBox" Type="CheckBox" X="172" Y="174" Width="98" Height="13" Attributes="3" Property="AUTO_START_CB" Text="Launch On Startup" Order="1600"/>
|
||||||
<ROW Dialog_="FolderDlg" Control="AlwaysOnTopCheckBox" Type="CheckBox" X="20" Y="174" Width="98" Height="13" Attributes="3" Property="ALWAYS_ON_TOP_CB" Text="Always On Top" Order="1700"/>
|
<ROW Dialog_="FolderDlg" Control="AlwaysOnTopCheckBox" Type="CheckBox" X="20" Y="174" Width="98" Height="13" Attributes="3" Property="ALWAYS_ON_TOP_CB" Text="Always On Top" Order="1700"/>
|
||||||
<ROW Dialog_="FolderDlg" Control="Edit_1" Type="Edit" X="360" Y="143" Width="2" Height="9" Attributes="2" Property="INVALID_POD_URL" Text="{260}" Order="1800"/>
|
<ROW Dialog_="FolderDlg" Control="Edit_1" Type="Edit" X="360" Y="143" Width="2" Height="9" Attributes="2" Property="INVALID_POD_URL" Text="{260}" Order="1800"/>
|
||||||
<ROW Dialog_="FolderDlg" Control="BringToFrontCheckBox" Type="CheckBox" X="172" Y="199" Width="132" Height="13" Attributes="3" Property="BRING_TO_FRONT_CB" Text="Bring to Front on Notifications" Order="1900"/>
|
<ROW Dialog_="FolderDlg" Control="BringToFrontCheckBox" Type="CheckBox" X="172" Y="199" Width="132" Height="13" Attributes="3" Property="BRING_TO_FRONT_CB" Text="Flash Notification in Taskbar" Order="1900"/>
|
||||||
<ROW Dialog_="InstallTypeDlg" Control="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" Attributes="1048576" Text="[DialogBitmap]" Order="100" MsiKey="InstallTypeDlg#BannerBitmap"/>
|
<ROW Dialog_="InstallTypeDlg" Control="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" Attributes="1048576" Text="[DialogBitmap]" Order="100" MsiKey="InstallTypeDlg#BannerBitmap"/>
|
||||||
<ROW Dialog_="InstallTypeDlg" Control="Bitmap_background" Type="Bitmap" X="0" Y="0" Width="370" Height="234" Attributes="1" Text="[DialogBitmap]" Order="200"/>
|
<ROW Dialog_="InstallTypeDlg" Control="Bitmap_background" Type="Bitmap" X="0" Y="0" Width="370" Height="234" Attributes="1" Text="[DialogBitmap]" Order="200"/>
|
||||||
<ROW Dialog_="InstallTypeDlg" Control="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Attributes="3" Text="[ButtonText_Next]" Order="300" TextLocId="-" MsiKey="InstallTypeDlg#Next" Options="1"/>
|
<ROW Dialog_="InstallTypeDlg" Control="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Attributes="3" Text="[ButtonText_Next]" Order="300" TextLocId="-" MsiKey="InstallTypeDlg#Next" Options="1"/>
|
||||||
@ -465,7 +465,7 @@
|
|||||||
<ROW Dialog_="VerifyDlg" Control="Text_5" Type="Text" X="25" Y="139" Width="76" Height="13" Attributes="65539" Property="TEXT_3_PROP_1" Text="Launch on Startup : " Order="1400"/>
|
<ROW Dialog_="VerifyDlg" Control="Text_5" Type="Text" X="25" Y="139" Width="76" Height="13" Attributes="65539" Property="TEXT_3_PROP_1" Text="Launch on Startup : " Order="1400"/>
|
||||||
<ROW Dialog_="VerifyDlg" Control="Text_7" Type="Text" X="25" Y="164" Width="76" Height="13" Attributes="65539" Property="TEXT_3_PROP_1_1" Text="Minimize on Close : " Order="1500"/>
|
<ROW Dialog_="VerifyDlg" Control="Text_7" Type="Text" X="25" Y="164" Width="76" Height="13" Attributes="65539" Property="TEXT_3_PROP_1_1" Text="Minimize on Close : " Order="1500"/>
|
||||||
<ROW Dialog_="VerifyDlg" Control="Text_9" Type="Text" X="25" Y="60" Width="321" Height="25" Attributes="65539" Property="TEXT_9_PROP" Text="You seem to have entered an invalid pod url. Please go back to the previous screen and rectify it." Order="1600"/>
|
<ROW Dialog_="VerifyDlg" Control="Text_9" Type="Text" X="25" Y="60" Width="321" Height="25" Attributes="65539" Property="TEXT_9_PROP" Text="You seem to have entered an invalid pod url. Please go back to the previous screen and rectify it." Order="1600"/>
|
||||||
<ROW Dialog_="VerifyDlg" Control="Text_10" Type="Text" X="25" Y="189" Width="76" Height="21" Attributes="65539" Property="TEXT_3_PROP_1_1_1" Text="Bring to Front on Notifications : " Order="1700"/>
|
<ROW Dialog_="VerifyDlg" Control="Text_10" Type="Text" X="25" Y="189" Width="76" Height="21" Attributes="65539" Property="TEXT_3_PROP_1_1_1" Text="Flash Notification in Taskbar :" Order="1700"/>
|
||||||
<ROW Dialog_="VerifyDlg" Control="BringToFrontLabel" Type="Text" X="110" Y="194" Width="145" Height="10" Attributes="65539" Property="BRING_TO_FRONT" Text="[BRING_TO_FRONT]" Order="1800"/>
|
<ROW Dialog_="VerifyDlg" Control="BringToFrontLabel" Type="Text" X="110" Y="194" Width="145" Height="10" Attributes="65539" Property="BRING_TO_FRONT" Text="[BRING_TO_FRONT]" Order="1800"/>
|
||||||
<ROW Dialog_="VerifyDlg" Control="AutoStartLabel" Type="Text" X="110" Y="139" Width="145" Height="10" Attributes="65539" Property="AUTO_START" Text="[AUTO_START]" Order="1900"/>
|
<ROW Dialog_="VerifyDlg" Control="AutoStartLabel" Type="Text" X="110" Y="139" Width="145" Height="10" Attributes="65539" Property="AUTO_START" Text="[AUTO_START]" Order="1900"/>
|
||||||
<ROW Dialog_="VerifyDlg" Control="MinimizeOnCloseLabel" Type="Text" X="110" Y="164" Width="145" Height="10" Attributes="65539" Property="MINIMIZE_ON_CLOSE" Text="[MINIMIZE_ON_CLOSE]" Order="2000"/>
|
<ROW Dialog_="VerifyDlg" Control="MinimizeOnCloseLabel" Type="Text" X="110" Y="164" Width="145" Height="10" Attributes="65539" Property="MINIMIZE_ON_CLOSE" Text="[MINIMIZE_ON_CLOSE]" Order="2000"/>
|
||||||
|
4
installer/win/Symphony-x86.aip
Normal file → Executable file
4
installer/win/Symphony-x86.aip
Normal file → Executable file
@ -375,7 +375,7 @@
|
|||||||
<ROW Dialog_="FolderDlg" Control="LaunchOnStartupCheckBox" Type="CheckBox" X="172" Y="174" Width="98" Height="13" Attributes="3" Property="AUTO_START_CB" Text="Launch On Startup" Order="1600"/>
|
<ROW Dialog_="FolderDlg" Control="LaunchOnStartupCheckBox" Type="CheckBox" X="172" Y="174" Width="98" Height="13" Attributes="3" Property="AUTO_START_CB" Text="Launch On Startup" Order="1600"/>
|
||||||
<ROW Dialog_="FolderDlg" Control="AlwaysOnTopCheckBox" Type="CheckBox" X="20" Y="174" Width="98" Height="13" Attributes="3" Property="ALWAYS_ON_TOP_CB" Text="Always On Top" Order="1700"/>
|
<ROW Dialog_="FolderDlg" Control="AlwaysOnTopCheckBox" Type="CheckBox" X="20" Y="174" Width="98" Height="13" Attributes="3" Property="ALWAYS_ON_TOP_CB" Text="Always On Top" Order="1700"/>
|
||||||
<ROW Dialog_="FolderDlg" Control="Edit_1" Type="Edit" X="360" Y="143" Width="2" Height="9" Attributes="2" Property="INVALID_POD_URL" Text="{260}" Order="1800"/>
|
<ROW Dialog_="FolderDlg" Control="Edit_1" Type="Edit" X="360" Y="143" Width="2" Height="9" Attributes="2" Property="INVALID_POD_URL" Text="{260}" Order="1800"/>
|
||||||
<ROW Dialog_="FolderDlg" Control="BringToFrontCheckBox" Type="CheckBox" X="172" Y="199" Width="132" Height="13" Attributes="3" Property="BRING_TO_FRONT_CB" Text="Bring to Front on Notifications" Order="1900"/>
|
<ROW Dialog_="FolderDlg" Control="BringToFrontCheckBox" Type="CheckBox" X="172" Y="199" Width="132" Height="13" Attributes="3" Property="BRING_TO_FRONT_CB" Text="Flash Notification in Taskbar" Order="1900"/>
|
||||||
<ROW Dialog_="InstallTypeDlg" Control="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" Attributes="1048576" Text="[DialogBitmap]" Order="100" MsiKey="InstallTypeDlg#BannerBitmap"/>
|
<ROW Dialog_="InstallTypeDlg" Control="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" Attributes="1048576" Text="[DialogBitmap]" Order="100" MsiKey="InstallTypeDlg#BannerBitmap"/>
|
||||||
<ROW Dialog_="InstallTypeDlg" Control="Bitmap_background" Type="Bitmap" X="0" Y="0" Width="370" Height="234" Attributes="1" Text="[DialogBitmap]" Order="200"/>
|
<ROW Dialog_="InstallTypeDlg" Control="Bitmap_background" Type="Bitmap" X="0" Y="0" Width="370" Height="234" Attributes="1" Text="[DialogBitmap]" Order="200"/>
|
||||||
<ROW Dialog_="InstallTypeDlg" Control="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Attributes="3" Text="[ButtonText_Next]" Order="300" TextLocId="-" MsiKey="InstallTypeDlg#Next" Options="1"/>
|
<ROW Dialog_="InstallTypeDlg" Control="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Attributes="3" Text="[ButtonText_Next]" Order="300" TextLocId="-" MsiKey="InstallTypeDlg#Next" Options="1"/>
|
||||||
@ -450,7 +450,7 @@
|
|||||||
<ROW Dialog_="VerifyDlg" Control="Text_7" Type="Text" X="25" Y="164" Width="76" Height="13" Attributes="65539" Property="TEXT_3_PROP_1_1" Text="Minimize on Close : " Order="1600"/>
|
<ROW Dialog_="VerifyDlg" Control="Text_7" Type="Text" X="25" Y="164" Width="76" Height="13" Attributes="65539" Property="TEXT_3_PROP_1_1" Text="Minimize on Close : " Order="1600"/>
|
||||||
<ROW Dialog_="VerifyDlg" Control="MinimizeOnCloseLabel" Type="Text" X="110" Y="164" Width="145" Height="10" Attributes="65539" Property="MINIMIZE_ON_CLOSE" Text="[MINIMIZE_ON_CLOSE]" Order="1700"/>
|
<ROW Dialog_="VerifyDlg" Control="MinimizeOnCloseLabel" Type="Text" X="110" Y="164" Width="145" Height="10" Attributes="65539" Property="MINIMIZE_ON_CLOSE" Text="[MINIMIZE_ON_CLOSE]" Order="1700"/>
|
||||||
<ROW Dialog_="VerifyDlg" Control="Text_9" Type="Text" X="25" Y="60" Width="321" Height="25" Attributes="65539" Property="TEXT_9_PROP" Text="You seem to have entered an invalid pod url. Please go back to the previous screen and rectify it." Order="1800"/>
|
<ROW Dialog_="VerifyDlg" Control="Text_9" Type="Text" X="25" Y="60" Width="321" Height="25" Attributes="65539" Property="TEXT_9_PROP" Text="You seem to have entered an invalid pod url. Please go back to the previous screen and rectify it." Order="1800"/>
|
||||||
<ROW Dialog_="VerifyDlg" Control="Text_10" Type="Text" X="25" Y="189" Width="76" Height="21" Attributes="65539" Property="TEXT_3_PROP_1_1_1" Text="Bring to Front on Notifications : " Order="1900"/>
|
<ROW Dialog_="VerifyDlg" Control="Text_10" Type="Text" X="25" Y="189" Width="76" Height="21" Attributes="65539" Property="TEXT_3_PROP_1_1_1" Text="Flash Notification in Taskbar :" Order="1900"/>
|
||||||
<ROW Dialog_="VerifyDlg" Control="BringToFrontLabel" Type="Text" X="110" Y="189" Width="145" Height="10" Attributes="65539" Property="BRING_TO_FRONT" Text="[BRING_TO_FRONT]" Order="2000"/>
|
<ROW Dialog_="VerifyDlg" Control="BringToFrontLabel" Type="Text" X="110" Y="189" Width="145" Height="10" Attributes="65539" Property="BRING_TO_FRONT" Text="[BRING_TO_FRONT]" Order="2000"/>
|
||||||
<ROW Dialog_="VerifyReadyDlg" Control="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" Attributes="1048577" Text="[BannerBitmap]" Order="300" MsiKey="VerifyReadyDlg#BannerBitmap"/>
|
<ROW Dialog_="VerifyReadyDlg" Control="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" Attributes="1048577" Text="[BannerBitmap]" Order="300" MsiKey="VerifyReadyDlg#BannerBitmap"/>
|
||||||
<ROW Dialog_="VerifyReadyDlg" Control="Logo" Type="Text" X="5" Y="228" Width="39" Height="12" Attributes="1" Text="Symphony" Order="500" TextLocId="Control.Text.VerifyReadyDlg#Logo" MsiKey="VerifyReadyDlg#Logo"/>
|
<ROW Dialog_="VerifyReadyDlg" Control="Logo" Type="Text" X="5" Y="228" Width="39" Height="12" Attributes="1" Text="Symphony" Order="500" TextLocId="Control.Text.VerifyReadyDlg#Logo" MsiKey="VerifyReadyDlg#Logo"/>
|
||||||
|
@ -17,7 +17,7 @@ function bringToFront(windowName, reason) {
|
|||||||
.then((bringToFrontSetting) => {
|
.then((bringToFrontSetting) => {
|
||||||
if (typeof bringToFrontSetting === 'boolean' && bringToFrontSetting) {
|
if (typeof bringToFrontSetting === 'boolean' && bringToFrontSetting) {
|
||||||
log.send(logLevels.INFO, 'Window has been activated for: ' + reason);
|
log.send(logLevels.INFO, 'Window has been activated for: ' + reason);
|
||||||
windowMgr.activate(windowName || 'main');
|
windowMgr.activate(windowName || 'main', false);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
@ -266,7 +266,7 @@ function getTemplate(app) {
|
|||||||
|
|
||||||
// Window menu -> bringToFront
|
// Window menu -> bringToFront
|
||||||
template[index].submenu.push({
|
template[index].submenu.push({
|
||||||
label: 'Bring to Front on Notifications',
|
label: isWindowsOS ? 'Flash Notification in Taskbar' : 'Bring to Front on Notifications',
|
||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
checked: bringToFront,
|
checked: bringToFront,
|
||||||
click: function(item) {
|
click: function(item) {
|
||||||
|
@ -20,7 +20,7 @@ const notify = require('./notify/electron-notify.js');
|
|||||||
const eventEmitter = require('./eventEmitter');
|
const eventEmitter = require('./eventEmitter');
|
||||||
const throttle = require('./utils/throttle.js');
|
const throttle = require('./utils/throttle.js');
|
||||||
const { getConfigField, updateConfigField, getGlobalConfigField } = require('./config.js');
|
const { getConfigField, updateConfigField, getGlobalConfigField } = require('./config.js');
|
||||||
const { isMac, isNodeEnv, isWindows10 } = require('./utils/misc');
|
const { isMac, isNodeEnv, isWindows10, isWindowsOS } = require('./utils/misc');
|
||||||
const { deleteIndexFolder } = require('./search/search.js');
|
const { deleteIndexFolder } = require('./search/search.js');
|
||||||
const { isWhitelisted } = require('./utils/whitelistHandler');
|
const { isWhitelisted } = require('./utils/whitelistHandler');
|
||||||
|
|
||||||
@ -603,23 +603,35 @@ function setIsOnline(status) {
|
|||||||
/**
|
/**
|
||||||
* Tries finding a window we have created with given name. If found, then
|
* Tries finding a window we have created with given name. If found, then
|
||||||
* brings to front and gives focus.
|
* brings to front and gives focus.
|
||||||
* @param {String} windowName Name of target window. Note: main window has
|
* @param {String} windowName Name of target window. Note: main window has
|
||||||
* name 'main'.
|
* name 'main'.
|
||||||
|
* @param {Boolean} shouldFocus whether to get window to focus or just show
|
||||||
|
* without giving focus
|
||||||
*/
|
*/
|
||||||
function activate(windowName) {
|
function activate(windowName, shouldFocus = true) {
|
||||||
let keys = Object.keys(windows);
|
let keys = Object.keys(windows);
|
||||||
for (let i = 0, len = keys.length; i < len; i++) {
|
for (let i = 0, len = keys.length; i < len; i++) {
|
||||||
let window = windows[keys[i]];
|
let window = windows[keys[i]];
|
||||||
if (window && !window.isDestroyed() && window.winName === windowName) {
|
if (window && !window.isDestroyed() && window.winName === windowName) {
|
||||||
if (window.isMinimized()) {
|
|
||||||
window.restore();
|
// Flash task bar icon in Windows
|
||||||
window.focus();
|
if (isWindowsOS && !shouldFocus) {
|
||||||
} else {
|
return window.flashFrame(true);
|
||||||
window.show();
|
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
|
// brings window without giving focus on mac
|
||||||
|
if (isMac && !shouldFocus) {
|
||||||
|
return window.showInactive();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window.isMinimized()) {
|
||||||
|
return window.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
return window.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
const Application = require('./spectronSetup');
|
const Application = require('./spectronSetup');
|
||||||
const constants = require('./spectronConstants');
|
const bluebird = require('bluebird');
|
||||||
|
const { isMac, isWindowsOS } = require('../../js/utils/misc');
|
||||||
|
const robot = require('robotjs');
|
||||||
|
|
||||||
let app = new Application({});
|
let app = new Application({});
|
||||||
|
|
||||||
|
function blurBrowserWindow() {
|
||||||
|
robot.setMouseDelay(200);
|
||||||
|
robot.moveMouse(0, 100);
|
||||||
|
robot.mouseClick();
|
||||||
|
}
|
||||||
|
|
||||||
describe('Tests for Bring to front', () => {
|
describe('Tests for Bring to front', () => {
|
||||||
|
|
||||||
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
||||||
@ -28,7 +36,7 @@ describe('Tests for Bring to front', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should launch the app', (done) => {
|
it('should launch the app and verify window count', (done) => {
|
||||||
return app.client.waitUntilWindowLoaded().then(() => {
|
return app.client.waitUntilWindowLoaded().then(() => {
|
||||||
return app.client.getWindowCount().then((count) => {
|
return app.client.getWindowCount().then((count) => {
|
||||||
expect(count === 1).toBeTruthy();
|
expect(count === 1).toBeTruthy();
|
||||||
@ -41,7 +49,7 @@ describe('Tests for Bring to front', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should minimize the app', (done) => {
|
it('should minimize the app and verify if the window isMinimized', (done) => {
|
||||||
return app.browserWindow.minimize().then(() => {
|
return app.browserWindow.minimize().then(() => {
|
||||||
return app.browserWindow.isMinimized().then((isMinimized) => {
|
return app.browserWindow.isMinimized().then((isMinimized) => {
|
||||||
expect(isMinimized).toBeTruthy();
|
expect(isMinimized).toBeTruthy();
|
||||||
@ -49,40 +57,62 @@ describe('Tests for Bring to front', () => {
|
|||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
done.fail(new Error(`bringToFront failed in isMinimized with error: ${err}`));
|
done.fail(new Error(`bringToFront failed in isMinimized with error: ${err}`));
|
||||||
});
|
});
|
||||||
}).catch((err) => {
|
|
||||||
done.fail(new Error(`bringToFront failed in minimize with error: ${err}`));
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not be focused', (done) => {
|
it('should restore the browser window and verify window focus', (done) => {
|
||||||
return app.browserWindow.isFocused().then((isFocused) => {
|
bluebird.all([
|
||||||
expect(isFocused).toBeFalsy();
|
blurBrowserWindow,
|
||||||
|
app.browserWindow.restore,
|
||||||
|
app.browserWindow.isMinimized,
|
||||||
|
app.browserWindow.isFocused,
|
||||||
|
]).mapSeries((method) => {
|
||||||
|
return method();
|
||||||
|
}).then((results) => {
|
||||||
|
if (isMac) {
|
||||||
|
expect(results[2]).toBe(false);
|
||||||
|
expect(results[3]).toBe(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isWindowsOS) {
|
||||||
|
expect(results[2]).toBe(false);
|
||||||
|
expect(results[3]).toBe(true);
|
||||||
|
}
|
||||||
done();
|
done();
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
done.fail(new Error(`bringToFront failed in isFocused with error: ${err}`));
|
done.fail(new Error(`bringToFront failed to restore with error: ${err}`));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should maximize browser window', (done) => {
|
it('should minimize and verify if the window isMinimized again', function () {
|
||||||
return app.browserWindow.restore().then(() => {
|
return app.browserWindow.minimize().then(() => {
|
||||||
return app.browserWindow.isMinimized().then((isMinimized) => {
|
return app.browserWindow.isMinimized().then((isMinimized) => {
|
||||||
expect(isMinimized).toBeFalsy();
|
expect(isMinimized).toBeTruthy();
|
||||||
done();
|
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
done.fail(new Error(`bringToFront failed in isMinimized with error: ${err}`));
|
done.fail(new Error(`bringToFront failed to minimize with error: ${err}`));
|
||||||
});
|
});
|
||||||
}).catch((err) => {
|
|
||||||
done.fail(new Error(`bringToFront failed in restore with error: ${err}`));
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be focused', (done) => {
|
it('should show the browser window and verify window focus', (done) => {
|
||||||
return app.browserWindow.isFocused().then((isFocused) => {
|
bluebird.all([
|
||||||
expect(isFocused).toBeTruthy();
|
blurBrowserWindow,
|
||||||
|
app.browserWindow.showInactive,
|
||||||
|
app.browserWindow.isFocused
|
||||||
|
]).mapSeries((method) => {
|
||||||
|
return method();
|
||||||
|
}).then((results) => {
|
||||||
|
if (isMac) {
|
||||||
|
expect(results[2]).toBe(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isWindowsOS) {
|
||||||
|
expect(results[2]).toBe(true);
|
||||||
|
}
|
||||||
done();
|
done();
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
done.fail(new Error(`bringToFront failed in isFocused with error: ${err}`));
|
done.fail(new Error(`bringToFront failed to focus with error: ${err}`));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user