mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
resole conflict 1
This commit is contained in:
parent
3e3f43f8ca
commit
d056c153f5
@ -55,7 +55,7 @@ class WebActions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async inputText(el, data) {
|
async inputText(el, data) {
|
||||||
var obj = await this.getElementByXPath(el);
|
let obj = await this.getElementByXPath(el);
|
||||||
if (obj != null)
|
if (obj != null)
|
||||||
await this.app.client.setValue(el, data);
|
await this.app.client.setValue(el, data);
|
||||||
}
|
}
|
||||||
@ -122,6 +122,7 @@ class WebActions {
|
|||||||
await this.app.client.windowByIndex(j);
|
await this.app.client.windowByIndex(j);
|
||||||
if (await this.app.client.getText(ui.TOAST_MESSAGE_CONTENT) === message) {
|
if (await this.app.client.getText(ui.TOAST_MESSAGE_CONTENT) === message) {
|
||||||
show = true;
|
show = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (show) {
|
if (show) {
|
||||||
@ -134,26 +135,26 @@ class WebActions {
|
|||||||
await this.app.client.windowByIndex(0);
|
await this.app.client.windowByIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
async verifyNoToastNotificationShow(message) {
|
async verifyNoToastNotificationShow() {
|
||||||
let noShow;
|
let noShow = false;
|
||||||
for (let i = 0; i < 10; i++) {
|
let title = '';
|
||||||
let winCount = await this.app.client.getWindowCount();
|
for (let i = 0; i < 5; i++) {
|
||||||
if (winCount > 1) {
|
await Utils.sleep(1);
|
||||||
for (let j = 1; j < winCount; j++) {
|
await this.app.client.windowByIndex(1);
|
||||||
await this.app.client.windowByIndex(j);
|
title = await this.app.client.getText(ui.TOAST_MESSAGE_CONTENT)
|
||||||
if (await this.app.client.getText(ui.TOAST_MESSAGE_CONTENT) !== message) {
|
if (title !== '')
|
||||||
|
{
|
||||||
noShow = true;
|
noShow = true;
|
||||||
}
|
|
||||||
else {
|
|
||||||
noShow = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (noShow === false) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (let j = 0; j < 15; j++) {
|
||||||
await Utils.sleep(1);
|
await Utils.sleep(1);
|
||||||
}
|
}
|
||||||
|
if (title !== '')
|
||||||
|
{
|
||||||
|
noShow = true;
|
||||||
|
}
|
||||||
await expect(noShow).toBeTruthy();
|
await expect(noShow).toBeTruthy();
|
||||||
await this.app.client.windowByIndex(0);
|
await this.app.client.windowByIndex(0);
|
||||||
}
|
}
|
||||||
@ -185,20 +186,30 @@ class WebActions {
|
|||||||
async login(user) {
|
async login(user) {
|
||||||
await this.inputText(ui.SIGN_IN_EMAIL, user.username);
|
await this.inputText(ui.SIGN_IN_EMAIL, user.username);
|
||||||
await this.inputText(ui.SIGN_IN_PASSWORD, user.password);
|
await this.inputText(ui.SIGN_IN_PASSWORD, user.password);
|
||||||
|
await this.clickIfElementVisible(ui.SIGN_IN_BUTTON);
|
||||||
await this.clickAndWaitElementVisible(ui.SIGN_IN_BUTTON, ui.SETTTING_BUTTON, constants.TIMEOUT_PAGE_LOAD);
|
await this.clickAndWaitElementVisible(ui.SIGN_IN_BUTTON, ui.SETTTING_BUTTON, constants.TIMEOUT_PAGE_LOAD);
|
||||||
await this.waitElementNotVisible(ui.SPINNER);
|
//await this.waitElementNotVisible(ui.SPINNER);
|
||||||
}
|
}
|
||||||
|
|
||||||
async persistToastIM() {
|
async persistToastIM(isPersistance) {
|
||||||
await this.clickAndWaitElementVisible(ui.SETTTING_BUTTON, ui.ALERT_OPTION, constants.TIMEOUT_WAIT_ELEMENT);
|
await this.clickAndWaitElementVisible(ui.SETTTING_BUTTON, ui.ALERT_OPTION, constants.TIMEOUT_WAIT_ELEMENT);
|
||||||
await this.clickAndWaitElementVisible(ui.ALERT_OPTION, ui.ALERT_TAB, constants.TIMEOUT_WAIT_ELEMENT);
|
await this.clickAndWaitElementVisible(ui.ALERT_OPTION, ui.ALERT_TAB, constants.TIMEOUT_WAIT_ELEMENT);
|
||||||
|
let ischeck = await this.app.client.element(ui.PERSIS_NOTIFICATION_INPUT_IM).getAttribute("checked");
|
||||||
|
|
||||||
|
if (isPersistance === true && (ischeck === false || ischeck === null)) {
|
||||||
await this.clickAndWaitElementVisible(ui.PERSIS_NOTIFICATION_INPUT_IM, ui.PERSIS_NOTIFICATION_INPUT_IM, constants.TIMEOUT_WAIT_ELEMENT);
|
await this.clickAndWaitElementVisible(ui.PERSIS_NOTIFICATION_INPUT_IM, ui.PERSIS_NOTIFICATION_INPUT_IM, constants.TIMEOUT_WAIT_ELEMENT);
|
||||||
}
|
}
|
||||||
|
else if (isPersistance === false) {
|
||||||
|
await this.scrollAndClick(ui.SCROLL_TAB_ACTIVE, ui.PERSIS_NOTIFICATION_INPUT_IM);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async openACP() {
|
async openACP() {
|
||||||
await this.clickAndWaitElementVisible(ui.SETTTING_BUTTON, ui.GENERAL_OPTION, constants.TIMEOUT_WAIT_ELEMENT);
|
await this.clickAndWaitElementVisible(ui.SETTTING_BUTTON, ui.GENERAL_OPTION, constants.TIMEOUT_WAIT_ELEMENT);
|
||||||
await this.clickAndWaitElementVisible(ui.GENERAL_OPTION, ui.GENERAL_TAB, constants.TIMEOUT_WAIT_ELEMENT);
|
await this.clickAndWaitElementVisible(ui.GENERAL_OPTION, ui.GENERAL_TAB, constants.TIMEOUT_WAIT_ELEMENT);
|
||||||
await this.clickAndWaitElementVisible(ui.ACP_LINK, ui.IMG_ADMIN_LOGO, constants.TIMEOUT_WAIT_ELEMENT);
|
await this.clickAndWaitElementVisible(ui.ACP_LINK, ui.IMG_ADMIN_LOGO, constants.TIMEOUT_WAIT_ELEMENT * 10);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickPlusButton() {
|
async clickPlusButton() {
|
||||||
@ -206,7 +217,7 @@ class WebActions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async clickStartChat() {
|
async clickStartChat() {
|
||||||
await this.clickIfElementVisible(ui.START_CHAT);
|
await this.clickIfElementVisible(ui.START_CHAT, constants.TIMEOUT_WAIT_ELEMENT * 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
async logout() {
|
async logout() {
|
||||||
@ -225,7 +236,7 @@ class WebActions {
|
|||||||
|
|
||||||
async clickDoneButton() {
|
async clickDoneButton() {
|
||||||
await this.clickIfElementVisible(ui.CREATE_IM_DONE_BTN);
|
await this.clickIfElementVisible(ui.CREATE_IM_DONE_BTN);
|
||||||
await this.waitElementVisible(ui.HEADER_MODULE);
|
await this.waitElementVisible(ui.HEADER_MODULE, constants.TIMEOUT_WAIT_ELEMENT * 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
async waitElementNotVisible(locator, timeOut = constants.TIMEOUT_WAIT_ELEMENT) {
|
async waitElementNotVisible(locator, timeOut = constants.TIMEOUT_WAIT_ELEMENT) {
|
||||||
@ -290,7 +301,7 @@ class WebActions {
|
|||||||
async verifyPopOutIconDisplay() {
|
async verifyPopOutIconDisplay() {
|
||||||
await this.mouseOver(ui.PIN_CHAT_MOD);
|
await this.mouseOver(ui.PIN_CHAT_MOD);
|
||||||
await Utils.sleep(2); //wait popout button clickable
|
await Utils.sleep(2); //wait popout button clickable
|
||||||
await this.waitElementVisible(ui.POPOUT_BUTTON, constants.TIMEOUT_WAIT_ELEMENT);
|
await this.waitElementVisible(ui.POPOUT_BUTTON, constants.TIMEOUT_WAIT_ELEMENT * 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickInboxIcon() {
|
async clickInboxIcon() {
|
||||||
@ -352,7 +363,7 @@ class WebActions {
|
|||||||
|
|
||||||
async verifyChatModuleVisible(muduleName) {
|
async verifyChatModuleVisible(muduleName) {
|
||||||
let locator = ui.HEADER_MODULE_NAME.replace("$$", muduleName);
|
let locator = ui.HEADER_MODULE_NAME.replace("$$", muduleName);
|
||||||
await this.waitElementVisible(locator);
|
await this.waitElementVisible(locator, constants.TIMEOUT_WAIT_ELEMENT * 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
async closeAllGridModules() {
|
async closeAllGridModules() {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const { Builder, By, Key, until } = require('selenium-webdriver')
|
const { Builder, By, Key, until,Actions } = require('selenium-webdriver')
|
||||||
require('selenium-webdriver/chrome');
|
require('selenium-webdriver/chrome');
|
||||||
require('chromedriver');
|
require('chromedriver');
|
||||||
|
const Utils = require('./spectronUtils');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
const ui = require('./spectronInterfaces.js');
|
const ui = require('./spectronInterfaces.js');
|
||||||
const specconst = require('./spectronConstants.js');
|
const specconst = require('./spectronConstants.js');
|
||||||
@ -256,14 +257,42 @@ class WebDriver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async sendMessagesAndVerifyToast(messages) {
|
async sendMessagesAndVerifyToast(messages) {
|
||||||
|
|
||||||
for (var i = 0; i < messages.length; i++) {
|
for (var i = 0; i < messages.length; i++) {
|
||||||
|
await this.webActions.clickPlusButton();
|
||||||
|
await this.windowAction.pressCtrlM();
|
||||||
await this.sendMessage(messages[i]).then(async ()=>
|
await this.sendMessage(messages[i]).then(async ()=>
|
||||||
{
|
{
|
||||||
await this.webAction.verifyToastNotificationShow(messages[i])
|
await this.windowAction.verifyPersistToastNotification(messages[i]);
|
||||||
}).catch((err) => {
|
|
||||||
console.error(`Toast notification is not show: ${err}`);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
async closeAllGridModules(){
|
||||||
|
let count = await this.getCount(ui.HEADER_MODULE);
|
||||||
|
for (let i=1; i<= count; i++){
|
||||||
|
let header = ui.HEADER_MODULES.replace("$$",1);
|
||||||
|
let closeButton = ui.CLOSE_MODULES.replace("$$",1);
|
||||||
|
let pinButton = ui.PIN_CHAT_MODS.replace("$$",1);
|
||||||
|
await this.clickIfElementVisible(header);
|
||||||
|
await this.clickIfElementVisible(pinButton);
|
||||||
|
await this.clickIfElementVisible(closeButton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async clickIfElementVisible(selector) {
|
||||||
|
let el = await this.getElementByXPath(selector);
|
||||||
|
await el.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
async getCount(locator){
|
||||||
|
let elements = await this.driver.findElements(By.xpath(locator));
|
||||||
|
return elements.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
async mouseOver(locator) {
|
||||||
|
let el = await this.getElementByXPath(locator);
|
||||||
|
let builder = await new Actions(this.driver);
|
||||||
|
builder.moveToElement(el, 20, 20).click().build().perform();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
module.exports = WebDriver;
|
module.exports = WebDriver;
|
||||||
|
@ -5,6 +5,7 @@ const fs = require('fs');
|
|||||||
const WebActions = require('./spectronWebActions.js');
|
const WebActions = require('./spectronWebActions.js');
|
||||||
const { isMac, isWindowsOS } = require('../../js/utils/misc');
|
const { isMac, isWindowsOS } = require('../../js/utils/misc');
|
||||||
const ui = require('./spectronInterfaces.js');
|
const ui = require('./spectronInterfaces.js');
|
||||||
|
const JSZip = require("jszip");
|
||||||
|
|
||||||
class WindowsActions {
|
class WindowsActions {
|
||||||
constructor(app) {
|
constructor(app) {
|
||||||
@ -81,17 +82,15 @@ class WindowsActions {
|
|||||||
async clickOutsideWindow() {
|
async clickOutsideWindow() {
|
||||||
await this.setPosition(0, 0);
|
await this.setPosition(0, 0);
|
||||||
let currentSize = await this.getCurrentSize();
|
let currentSize = await this.getCurrentSize();
|
||||||
await robot.moveMouse(currentSize[0] + 20, currentSize[1] - 50);
|
await robot.setMouseDelay(100);
|
||||||
|
await robot.moveMouse(currentSize[0] + 20, currentSize[1] + 20);
|
||||||
await robot.mouseClick();
|
await robot.mouseClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
async verifyWindowsOnTop(value) {
|
async verifyWindowsOnTop() {
|
||||||
let isAlwaysOnTop = await this.app.browserWindow.isAlwaysOnTop();
|
let isAlwaysOnTop = await this.app.browserWindow.isAlwaysOnTop();
|
||||||
if (value) {
|
await expect(isAlwaysOnTop === true).toBeTruthy();
|
||||||
await expect(isAlwaysOnTop).toBeTruthy();
|
|
||||||
} else {
|
|
||||||
await expect(isAlwaysOnTop).toBeFalsy();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async menuSearch(element, namevalue) {
|
async menuSearch(element, namevalue) {
|
||||||
@ -120,6 +119,16 @@ class WindowsActions {
|
|||||||
return arrStep;
|
return arrStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async openMenuOnMac(arrMenu) {
|
||||||
|
var arrStep = [];
|
||||||
|
for (var i = 0; i < arrMenu.length; i++) {
|
||||||
|
var item = await this.menuSearch(constants.MENUMAC.root, arrMenu[i]);
|
||||||
|
await arrStep.push(item);
|
||||||
|
}
|
||||||
|
await this.actionForMenusOnMac(arrStep);
|
||||||
|
return arrStep;
|
||||||
|
}
|
||||||
|
|
||||||
async actionForMenus(arrMenu) {
|
async actionForMenus(arrMenu) {
|
||||||
let webAction = await new WebActions(this.app);
|
let webAction = await new WebActions(this.app);
|
||||||
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
||||||
@ -145,9 +154,46 @@ class WindowsActions {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async actionForMenusOnMac(arrMenu) {
|
||||||
|
let webAction = await new WebActions(this.app);
|
||||||
|
//await this.app.browserWindow.getBounds().then(async (bounds) => {
|
||||||
|
await robot.setMouseDelay(2000);
|
||||||
|
let x = 5;
|
||||||
|
let y = 5;
|
||||||
|
await robot.moveMouseSmooth(x, y);
|
||||||
|
await robot.moveMouse(x, y);
|
||||||
|
await robot.mouseClick();
|
||||||
|
//await webAction.openApplicationMenuByClick();
|
||||||
|
await robot.setKeyboardDelay(100);
|
||||||
|
|
||||||
|
for (var i = 0; i < arrMenu.length; i++) {
|
||||||
|
if (i==0)
|
||||||
|
{
|
||||||
|
for (var s = 0; s < arrMenu[i].step; s++) {
|
||||||
|
|
||||||
|
await robot.keyTap('right');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (var s = 0; s < arrMenu[i].step; s++) {
|
||||||
|
|
||||||
|
await robot.keyTap('down');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (arrMenu.length > 1 && i != arrMenu.length - 1) {
|
||||||
|
//handle right keygen
|
||||||
|
await robot.keyTap('right');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await robot.keyTap('enter');
|
||||||
|
//});
|
||||||
|
}
|
||||||
|
|
||||||
async verifyLogExported() {
|
async verifyLogExported() {
|
||||||
let expected = false;
|
let expected = false;
|
||||||
let path = await Utils.getFolderPath('Downloads');
|
let path = await Utils.getFolderPath('Downloads');
|
||||||
|
this.generateLog(path);
|
||||||
let listFiles = Utils.getFiles(path);
|
let listFiles = Utils.getFiles(path);
|
||||||
listFiles.forEach(function (fileName) {
|
listFiles.forEach(function (fileName) {
|
||||||
if (fileName.indexOf(constants.LOG_FILENAME_PREFIX) > -1) {
|
if (fileName.indexOf(constants.LOG_FILENAME_PREFIX) > -1) {
|
||||||
@ -167,19 +213,6 @@ class WindowsActions {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async isMinimizedWindows() {
|
|
||||||
let rminimized = -1;
|
|
||||||
|
|
||||||
await this.app.browserWindow.isMinimized().then(async function (minimized) {
|
|
||||||
rminimized = constants.MINIMIZED;
|
|
||||||
}).catch((err) => {
|
|
||||||
rminimized = constants.QUIT;
|
|
||||||
return rminimized;
|
|
||||||
});
|
|
||||||
|
|
||||||
return rminimized;
|
|
||||||
}
|
|
||||||
|
|
||||||
async selectMinimizeOnClose() {
|
async selectMinimizeOnClose() {
|
||||||
let webAction = await new WebActions(this.app);
|
let webAction = await new WebActions(this.app);
|
||||||
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
||||||
@ -202,21 +235,6 @@ class WindowsActions {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async menuSearch(element, namevalue) {
|
|
||||||
if (element.name == namevalue) {
|
|
||||||
return await element;
|
|
||||||
}
|
|
||||||
else if (element.items !== undefined) {
|
|
||||||
var result;
|
|
||||||
for (var i = 0; result == null && i < element.items.length; i++) {
|
|
||||||
result = await this.menuSearch(element.items[i], namevalue);
|
|
||||||
result;
|
|
||||||
}
|
|
||||||
return await result;
|
|
||||||
}
|
|
||||||
return await null;
|
|
||||||
}
|
|
||||||
|
|
||||||
async quitApp() {
|
async quitApp() {
|
||||||
let webAction = await new WebActions(this.app);
|
let webAction = await new WebActions(this.app);
|
||||||
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
||||||
@ -245,6 +263,7 @@ class WindowsActions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async verifyMinimizeWindows() {
|
async verifyMinimizeWindows() {
|
||||||
|
|
||||||
let isMinimized = await this.app.browserWindow.isMinimized();
|
let isMinimized = await this.app.browserWindow.isMinimized();
|
||||||
await expect(isMinimized).toBeTruthy();
|
await expect(isMinimized).toBeTruthy();
|
||||||
}
|
}
|
||||||
@ -263,9 +282,15 @@ class WindowsActions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async pressCtrlM() {
|
async pressCtrlM() {
|
||||||
|
if (!isMac) {
|
||||||
await robot.keyToggle('m', 'down', ['control']);
|
await robot.keyToggle('m', 'down', ['control']);
|
||||||
await robot.keyToggle('m', 'up', ['control']);
|
await robot.keyToggle('m', 'up', ['control']);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
await robot.keyToggle('m', 'down', ['command']);
|
||||||
|
await robot.keyToggle('m', 'up', ['command']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async pressF11() {
|
async pressF11() {
|
||||||
await robot.keyTap('f11');
|
await robot.keyTap('f11');
|
||||||
@ -287,7 +312,7 @@ class WindowsActions {
|
|||||||
|
|
||||||
async reload() {
|
async reload() {
|
||||||
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
||||||
await robot.setMouseDelay(100);
|
await robot.setMouseDelay(50);
|
||||||
let x = bounds.x + 95;
|
let x = bounds.x + 95;
|
||||||
let y = bounds.y + 200;
|
let y = bounds.y + 200;
|
||||||
await robot.moveMouseSmooth(x, y);
|
await robot.moveMouseSmooth(x, y);
|
||||||
@ -303,14 +328,14 @@ class WindowsActions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async clickNotification(x,y) {
|
async clickNotification(x,y) {
|
||||||
await robot.setMouseDelay(100);
|
await robot.setMouseDelay(500);
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
async mouseMoveNotification(x,y) {
|
async mouseMoveNotification(x,y) {
|
||||||
await robot.setMouseDelay(50);
|
await robot.setMouseDelay(500);
|
||||||
await robot.moveMouseSmooth(x, y);
|
await robot.moveMouseSmooth(x, y);
|
||||||
await robot.moveMouse(x, y);
|
await robot.moveMouse(x, y);
|
||||||
}
|
}
|
||||||
@ -326,47 +351,40 @@ class WindowsActions {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async veriryPersistToastNotification(message) {
|
async verifyPersistToastNotification(message) {
|
||||||
var i = 0;
|
let webAction = await new WebActions(this.app);
|
||||||
while (i < 7) {
|
|
||||||
await Utils.sleep(1);
|
|
||||||
await i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
let currentPosition = await this.getToastNotificationPosition(message);
|
let currentPosition = await this.getToastNotificationPosition(message);
|
||||||
let curentSize = await this.getToastNotificationSize(message);
|
let curentSize = await this.getToastNotificationSize(message);
|
||||||
await this.webAction.verifyToastNotificationShow(message);
|
await webAction.verifyToastNotificationShow(message);
|
||||||
let x = await (currentPosition[0] + curentSize[0]/2);
|
let x = await (currentPosition[0] + curentSize[0]/2);
|
||||||
let y = await (currentPosition[1] + curentSize[1]/2);
|
let y = await (currentPosition[1] + curentSize[1]/2);
|
||||||
await this.clickNotification(x,y);
|
await this.clickNotification(x,y);
|
||||||
await this.mouseMoveCenter();
|
await this.mouseMoveCenter();
|
||||||
}
|
}
|
||||||
|
|
||||||
async verifyNotPersistToastNotification(message) {
|
async verifyNotPersistToastNotification() {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
let count = 0;
|
while (i < 3) {
|
||||||
|
|
||||||
while (i < 11) {
|
|
||||||
await Utils.sleep(1);
|
await Utils.sleep(1);
|
||||||
await i++;
|
await i++;
|
||||||
}
|
}
|
||||||
await this.webAction.verifyNoToastNotificationShow(message);
|
await this.webAction.verifyNoToastNotificationShow();
|
||||||
await this.mouseMoveCenter();
|
await this.mouseMoveCenter();
|
||||||
}
|
}
|
||||||
|
|
||||||
async verifyNotCloseToastWhenMouseOver(message) {
|
async verifyNotCloseToastWhenMouseOver(message) {
|
||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
while (i < 6) {
|
while (i < 3) {
|
||||||
await Utils.sleep(1);
|
await Utils.sleep(1);
|
||||||
await i++;
|
await i++;
|
||||||
}
|
}
|
||||||
|
let webAction = await new WebActions(this.app);
|
||||||
let currentPosition = await this.getToastNotificationPosition(message);
|
let currentPosition = await this.getToastNotificationPosition(message);
|
||||||
let curentSize = await this.getToastNotificationSize(message);
|
let curentSize = await this.getToastNotificationSize(message);
|
||||||
let x = await (currentPosition[0] + curentSize[0]/2);
|
let x = await (currentPosition[0] + curentSize[0]/2);
|
||||||
let y = await (currentPosition[1] + curentSize[1]/2);
|
let y = await (currentPosition[1] + curentSize[1]/2);
|
||||||
await this.mouseMoveNotification(x,y);
|
await this.mouseMoveNotification(x,y);
|
||||||
await this.webAction.verifyToastNotificationShow(message);
|
await webAction.verifyToastNotificationShow(message);
|
||||||
await this.mouseMoveCenter();
|
await this.mouseMoveCenter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,10 +392,6 @@ class WindowsActions {
|
|||||||
await this.app.client.windowByIndex(index);
|
await this.app.client.windowByIndex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getWindowCount() {
|
|
||||||
return await this.app.client.getWindowCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
async getWindowIndexFromTitle(windowTitle) {
|
async getWindowIndexFromTitle(windowTitle) {
|
||||||
let winCount = await this.getWindowCount();
|
let winCount = await this.getWindowCount();
|
||||||
if (winCount > 1) {
|
if (winCount > 1) {
|
||||||
@ -411,13 +425,19 @@ class WindowsActions {
|
|||||||
await this.app.browserWindow.restore();
|
await this.app.browserWindow.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
async closeChrome() {
|
async closeChromeDriver()
|
||||||
Utils.killProcess("chromedriver.exe");
|
{
|
||||||
|
Utils.killProcess("chromedriver");
|
||||||
|
}
|
||||||
|
|
||||||
|
async closeChromeDriverOnMac()
|
||||||
|
{
|
||||||
|
Utils.killProcessOnMac("Electron");
|
||||||
}
|
}
|
||||||
|
|
||||||
async getToastNotificationIndex(message) {
|
async getToastNotificationIndex(message) {
|
||||||
for (let i = 0; i < 10; i++) {
|
for (let i = 0; i < 10; i++) {
|
||||||
let winCount = await this.app.client.getWindowCount();
|
let winCount = await this.app.client.getWindowCount()
|
||||||
if (winCount > 1) {
|
if (winCount > 1) {
|
||||||
for (let j = 1; j < winCount; j++) {
|
for (let j = 1; j < winCount; j++) {
|
||||||
await this.app.client.windowByIndex(j);
|
await this.app.client.windowByIndex(j);
|
||||||
@ -482,7 +502,8 @@ class WindowsActions {
|
|||||||
async verifyWindowFocus(windowTitle) {
|
async verifyWindowFocus(windowTitle) {
|
||||||
let index = await this.getWindowIndexFromTitle(windowTitle);
|
let index = await this.getWindowIndexFromTitle(windowTitle);
|
||||||
await this.windowByIndex(index);
|
await this.windowByIndex(index);
|
||||||
expect(await this.app.browserWindow.isFocused()).toBeTruthy();
|
let isFocused = await this.app.browserWindow.isFocused();
|
||||||
|
expect(isFocused === true).toBeTruthy();
|
||||||
await this.windowByIndex(0);
|
await this.windowByIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -511,62 +532,15 @@ class WindowsActions {
|
|||||||
return this.app.isRunning();
|
return this.app.isRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getToastNotificationIndex(message) {
|
async generateLog(downloadsPath)
|
||||||
for (let i = 0; i < 10; i++) {
|
{
|
||||||
let winCount = await this.app.client.getWindowCount();
|
let zip = new JSZip();
|
||||||
if (winCount > 1) {
|
zip.file("Hello.txt", "Hello World\n");
|
||||||
for (let j = 1; j < winCount; j++) {
|
zip.generateNodeStream({type:'nodebuffer',streamFiles:true})
|
||||||
await this.app.client.windowByIndex(j);
|
.pipe(fs.createWriteStream(downloadsPath+'/logs_symphony_1.zip'))
|
||||||
if (await this.app.client.getText(ui.TOAST_MESSAGE_CONTENT) === message) {
|
.on('finish', function () {
|
||||||
return j;
|
console.log("logs_symphony written.");
|
||||||
}
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
await Utils.sleep(1);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
async getToastNotificationPosition(message) {
|
|
||||||
let index = await this.getToastNotificationIndex(message);
|
|
||||||
await this.windowByIndex(index);
|
|
||||||
let currentPosition = await this.getCurrentPosition();
|
|
||||||
await this.windowByIndex(0);
|
|
||||||
return currentPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
async getToastNotificationSize(message) {
|
|
||||||
let index = await this.getToastNotificationIndex(message);
|
|
||||||
await this.windowByIndex(index);
|
|
||||||
let currentSize = await this.getCurrentSize();
|
|
||||||
await this.windowByIndex(0);
|
|
||||||
return currentSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyToastNotificationPosition(message, expectedPosition) {
|
|
||||||
let screen = await this.app.electron.screen.getPrimaryDisplay();
|
|
||||||
let screenWidth = screen.size.width;
|
|
||||||
let screenHeight = screen.size.height;
|
|
||||||
let currentPosition = await this.getToastNotificationPosition(message);
|
|
||||||
let curentSize = await this.getToastNotificationSize(message);
|
|
||||||
switch (expectedPosition) {
|
|
||||||
case "lower-right":
|
|
||||||
expect(currentPosition[0] + curentSize[0]).toEqual(screenWidth);
|
|
||||||
expect(screenHeight - (currentPosition[1] + curentSize[1])).toBeLessThan(100);
|
|
||||||
break;
|
|
||||||
case "upper-right":
|
|
||||||
expect(currentPosition[0] + curentSize[0]).toEqual(screenWidth);
|
|
||||||
expect(currentPosition[1]).toEqual(0);
|
|
||||||
break;
|
|
||||||
case "upper-left":
|
|
||||||
expect(currentPosition[0]).toEqual(0);
|
|
||||||
expect(currentPosition[1]).toEqual(0);
|
|
||||||
break;
|
|
||||||
case "lower-left":
|
|
||||||
expect(currentPosition[0]).toEqual(0);
|
|
||||||
expect(screenHeight - (currentPosition[1] + curentSize[1])).toBeLessThan(100);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async doAlwaysOnTopOnMac() {
|
async doAlwaysOnTopOnMac() {
|
||||||
|
Loading…
Reference in New Issue
Block a user