mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-11-23 01:16:24 -06:00
resolve conflict
This commit is contained in:
parent
d056c153f5
commit
39d0ce0015
@ -1,118 +1,55 @@
|
|||||||
const Application = require('./spectronSetup');
|
const Application = require('./spectronSetup');
|
||||||
const bluebird = require('bluebird');
|
const specconst = require('./spectronConstants.js');
|
||||||
const { isMac, isWindowsOS } = require('../../js/utils/misc');
|
const WindowsAction = require('./spectronWindowsActions');
|
||||||
const robot = require('robotjs');
|
let windowAction;
|
||||||
|
|
||||||
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;
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
||||||
|
beforeAll(async (done) => {
|
||||||
beforeAll((done) => {
|
try {
|
||||||
return app.startApplication().then((startedApp) => {
|
app = await new Application({}).startApplication({ testedHost: specconst.TESTED_HOST, alwaysOnTop: true });
|
||||||
app = startedApp;
|
windowAction = await new WindowsAction(app);
|
||||||
done();
|
done();
|
||||||
}).catch((err) => {
|
} catch (err) {
|
||||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
done.fail(new Error(`Unable to start application error: ${err}`));
|
||||||
});
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll((done) => {
|
afterAll(async (done) => {
|
||||||
|
try {
|
||||||
if (app && app.isRunning()) {
|
if (app && app.isRunning()) {
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = await originalTimeout;
|
||||||
app.stop().then(() => {
|
await app.stop();
|
||||||
|
await webdriver.quit();
|
||||||
done();
|
done();
|
||||||
}).catch((err) => {
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
done.fail(new Error(`Failed at post-condition: ${err}`));
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should launch the app and verify window count', (done) => {
|
it('should show the browser window and verify window focus', async (done) => {
|
||||||
return app.client.waitUntilWindowLoaded().then(() => {
|
await windowAction.blurBrowserWindow()
|
||||||
return app.client.getWindowCount().then((count) => {
|
await app.browserWindow.minimize();
|
||||||
expect(count === 1).toBeTruthy();
|
let isMinimized = await app.browserWindow.isMinimized();
|
||||||
|
await expect(isMinimized).toBe(true);
|
||||||
|
await app.browserWindow.showInactive();
|
||||||
|
let isFocused = await app.browserWindow.isFocused();
|
||||||
|
await expect(isFocused).toBe(false);
|
||||||
done();
|
done();
|
||||||
}).catch((err) => {
|
|
||||||
done.fail(new Error(`bringToFront failed in getWindowCount with error: ${err}`));
|
|
||||||
});
|
|
||||||
}).catch((err) => {
|
|
||||||
done.fail(new Error(`bringToFront failed in waitUntilWindowLoaded with error: ${err}`));
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should minimize the app and verify if the window isMinimized', (done) => {
|
it('should restore the browser window and verify window focus', async (done) => {
|
||||||
return app.browserWindow.minimize().then(() => {
|
await windowAction.blurBrowserWindow()
|
||||||
return app.browserWindow.isMinimized().then((isMinimized) => {
|
await app.browserWindow.minimize();
|
||||||
expect(isMinimized).toBeTruthy();
|
let isMinimized = await app.browserWindow.isMinimized();
|
||||||
|
await expect(isMinimized).toBe(true);
|
||||||
|
await app.browserWindow.restore();
|
||||||
|
let isFocused = await app.browserWindow.isFocused();
|
||||||
|
await expect(isFocused).toBe(true);
|
||||||
done();
|
done();
|
||||||
}).catch((err) => {
|
|
||||||
done.fail(new Error(`bringToFront failed in isMinimized with error: ${err}`));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should restore the browser window and verify window focus', (done) => {
|
|
||||||
bluebird.all([
|
|
||||||
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();
|
|
||||||
}).catch((err) => {
|
|
||||||
done.fail(new Error(`bringToFront failed to restore with error: ${err}`));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should minimize and verify if the window isMinimized again', function () {
|
|
||||||
return app.browserWindow.minimize().then(() => {
|
|
||||||
return app.browserWindow.isMinimized().then((isMinimized) => {
|
|
||||||
expect(isMinimized).toBeTruthy();
|
|
||||||
}).catch((err) => {
|
|
||||||
done.fail(new Error(`bringToFront failed to minimize with error: ${err}`));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should show the browser window and verify window focus', (done) => {
|
|
||||||
bluebird.all([
|
|
||||||
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();
|
|
||||||
}).catch((err) => {
|
|
||||||
done.fail(new Error(`bringToFront failed to focus with error: ${err}`));
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
@ -29,37 +29,6 @@ describe('Tests for Close', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should launch the app', (done) => {
|
|
||||||
return app.client.waitUntilWindowLoaded().then(() => {
|
|
||||||
return app.client.getWindowCount().then((count) => {
|
|
||||||
expect(count === 1).toBeTruthy();
|
|
||||||
done();
|
|
||||||
}).catch((err) => {
|
|
||||||
done.fail(new Error(`close failed in getWindowCount with error: ${err}`));
|
|
||||||
});
|
|
||||||
}).catch((err) => {
|
|
||||||
done.fail(new Error(`close failed in waitUntilWindowLoaded with error: ${err}`));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should check window count', (done) => {
|
|
||||||
return app.client.getWindowCount().then((count) => {
|
|
||||||
expect(count === 1).toBeTruthy();
|
|
||||||
done();
|
|
||||||
}).catch((err) => {
|
|
||||||
done.fail(new Error(`close failed in getWindowCount with error: ${err}`));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should check browser window visibility', (done) => {
|
|
||||||
return app.browserWindow.isVisible().then((isVisible) => {
|
|
||||||
expect(isVisible).toBeTruthy();
|
|
||||||
done();
|
|
||||||
}).catch((err) => {
|
|
||||||
done.fail(new Error(`close failed in isVisible with error: ${err}`));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should close the app', () => {
|
it('should close the app', () => {
|
||||||
return app.stop();
|
return app.stop();
|
||||||
});
|
});
|
||||||
|
@ -17,7 +17,17 @@ module.exports = {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
MENUMAC: {
|
||||||
|
"root": {
|
||||||
|
name: "menu", step: 0, items: [
|
||||||
|
{ name: "Electron", step: 0, items: [{ name: "About Symphony", step: 0 }, { name: "Services", step: 1 }]},
|
||||||
|
{ name: "Edit", step: 1, items: [{ name: "Undo", step: 0 }, { name: "Redo", step: 1 }, { name: "Cut", step: 2 }, { name: "Copy", step: 3 }, { name: "Paste", step: 4 }, { name: "Paste and Match Style", step: 5 }, { name: "Delete", step: 6 }, { name: "Select All", step: 7 }] },
|
||||||
|
{ name: "View", step: 2, items: [{ name: "Reload", step: 0 }, { name: "Actual Size", step: 1 }, { name: "Zoom In", step: 2 }, { name: "Zoom Out", step: 3 }, { name: "Toogle Full Screen", step: 4 },{ name: "Minimize on Close", step: 8 }] },
|
||||||
|
{ name: "Window", step: 3, items: [{ name: "Close", step: 0 }, { name: "Minimize", step: 1 }, { name: "Zoom", step: 2 }]},
|
||||||
|
{ name: "Help", step: 4, items: [{ name: "Symphony Help", step: 0 }, { name: "Learn More", step: 1 }, { name: "Troubleshooting", step: 2, items: [{ name: "Show Logs in Explorer", step: 0 }] }, { name: "About Symphony", step: 3 }] }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
LOG_FILENAME_PREFIX: "logs_symphony_",
|
LOG_FILENAME_PREFIX: "logs_symphony_",
|
||||||
USER_A: { username: process.env.USER_A, password: process.env.PASSWORD, name: process.env.USER_A_NAME },
|
USER_A: { username: process.env.USER_A, password: process.env.PASSWORD, name: process.env.USER_A_NAME },
|
||||||
USER_B: { username: process.env.USER_B, password: process.env.PASSWORD, name: process.env.USER_B_NAME },
|
USER_B: { username: process.env.USER_B, password: process.env.PASSWORD, name: process.env.USER_B_NAME },
|
||||||
|
@ -6,6 +6,7 @@ module.exports= {
|
|||||||
CLOSE_BUTTON: "button#title-bar-close-button",
|
CLOSE_BUTTON: "button#title-bar-close-button",
|
||||||
MAIN_MENU_ITEM: "#hamburger-menu-button",
|
MAIN_MENU_ITEM: "#hamburger-menu-button",
|
||||||
SYM_LOGO: "#logo",
|
SYM_LOGO: "#logo",
|
||||||
|
MINIMIZE_BTN: "#title-bar-minimize-button",
|
||||||
|
|
||||||
//Sign In
|
//Sign In
|
||||||
SIGN_IN_BUTTON: "//button[@name='signin-submit']",
|
SIGN_IN_BUTTON: "//button[@name='signin-submit']",
|
||||||
@ -56,6 +57,7 @@ module.exports= {
|
|||||||
HEADER_MODULE_NAME: "//header[contains(@class,'module-header gs-draggable')]//span[contains(@class,'aliasable') and normalize-space()='$$']",
|
HEADER_MODULE_NAME: "//header[contains(@class,'module-header gs-draggable')]//span[contains(@class,'aliasable') and normalize-space()='$$']",
|
||||||
CLOSE_MODULE: "//button[contains(@class,'close-module')]",
|
CLOSE_MODULE: "//button[contains(@class,'close-module')]",
|
||||||
CLOSE_MODULES: "(//button[contains(@class,'close-module')])[$$]",
|
CLOSE_MODULES: "(//button[contains(@class,'close-module')])[$$]",
|
||||||
|
PIN_CHAT_MODS: "(//button[contains(@class,'pin-view')])[$$]",
|
||||||
|
|
||||||
//Popin Popout
|
//Popin Popout
|
||||||
POPOUT_BUTTON: ".enhanced-pop-out",
|
POPOUT_BUTTON: ".enhanced-pop-out",
|
||||||
@ -76,7 +78,7 @@ module.exports= {
|
|||||||
INBOX_HEADER: ".inbox-header",
|
INBOX_HEADER: ".inbox-header",
|
||||||
|
|
||||||
//ACP
|
//ACP
|
||||||
ACP_LINK: "//button[@class='show-admin-link left-action button-reset']",
|
ACP_LINK: "//*[contains(@class,'show-admin-link')]",
|
||||||
IMG_ADMIN_LOGO: "//img[@src='./img/nav_admin_logo.png']",
|
IMG_ADMIN_LOGO: "//img[@src='./img/nav_admin_logo.png']",
|
||||||
|
|
||||||
//LOG OUT
|
//LOG OUT
|
||||||
@ -91,4 +93,3 @@ module.exports= {
|
|||||||
//Symphony Electron API Demo
|
//Symphony Electron API Demo
|
||||||
TAG_TEXTBOX: "#tag"
|
TAG_TEXTBOX: "#tag"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -87,10 +87,13 @@ class WindowsActions {
|
|||||||
await robot.mouseClick();
|
await robot.mouseClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
async verifyWindowsOnTop() {
|
async verifyWindowsOnTop(value) {
|
||||||
let isAlwaysOnTop = await this.app.browserWindow.isAlwaysOnTop();
|
let isAlwaysOnTop = await this.app.browserWindow.isAlwaysOnTop();
|
||||||
await expect(isAlwaysOnTop === true).toBeTruthy();
|
if (value) {
|
||||||
|
await expect(isAlwaysOnTop).toBeTruthy();
|
||||||
|
} else {
|
||||||
|
await expect(isAlwaysOnTop).toBeFalsy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async menuSearch(element, namevalue) {
|
async menuSearch(element, namevalue) {
|
||||||
@ -156,16 +159,13 @@ class WindowsActions {
|
|||||||
|
|
||||||
async actionForMenusOnMac(arrMenu) {
|
async actionForMenusOnMac(arrMenu) {
|
||||||
let webAction = await new WebActions(this.app);
|
let webAction = await new WebActions(this.app);
|
||||||
//await this.app.browserWindow.getBounds().then(async (bounds) => {
|
|
||||||
await robot.setMouseDelay(2000);
|
await robot.setMouseDelay(2000);
|
||||||
let x = 5;
|
let x = 5;
|
||||||
let y = 5;
|
let y = 5;
|
||||||
await robot.moveMouseSmooth(x, y);
|
await robot.moveMouseSmooth(x, y);
|
||||||
await robot.moveMouse(x, y);
|
await robot.moveMouse(x, y);
|
||||||
await robot.mouseClick();
|
await robot.mouseClick();
|
||||||
//await webAction.openApplicationMenuByClick();
|
|
||||||
await robot.setKeyboardDelay(100);
|
await robot.setKeyboardDelay(100);
|
||||||
|
|
||||||
for (var i = 0; i < arrMenu.length; i++) {
|
for (var i = 0; i < arrMenu.length; i++) {
|
||||||
if (i==0)
|
if (i==0)
|
||||||
{
|
{
|
||||||
@ -187,7 +187,6 @@ class WindowsActions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
await robot.keyTap('enter');
|
await robot.keyTap('enter');
|
||||||
//});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async verifyLogExported() {
|
async verifyLogExported() {
|
||||||
@ -588,6 +587,12 @@ class WindowsActions {
|
|||||||
}
|
}
|
||||||
await robot.keyTap('enter');
|
await robot.keyTap('enter');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async blurBrowserWindow() {
|
||||||
|
await robot.setMouseDelay(200);
|
||||||
|
await robot.moveMouse(0, 100);
|
||||||
|
await robot.mouseClick();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = WindowsActions;
|
module.exports = WindowsActions;
|
||||||
|
Loading…
Reference in New Issue
Block a user