mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
AVT-1025: Verify toast notification when Persist Notification is ON (#447)
This commit is contained in:
committed by
Vishwas Shashidhar
parent
3ce535ae21
commit
d3f77685dd
@@ -1,3 +1,4 @@
|
||||
require('dotenv').config()
|
||||
module.exports = {
|
||||
|
||||
SYMPHONY_CONFIG_FILE_NAME: "/Symphony.config",
|
||||
@@ -7,7 +8,6 @@ module.exports = {
|
||||
|
||||
SEARCH_LIBRARY_PATH_MAC: "node_modules/electron/dist/Electron.app/Contents/library",
|
||||
SEARCH_LIBRARY_PATH_WIN: "node_modules/electron/dist/library",
|
||||
|
||||
MENU: {
|
||||
"root": {
|
||||
name: "menu", step: 0, items: [
|
||||
|
||||
@@ -2,7 +2,6 @@ module.exports= {
|
||||
// Title bar
|
||||
TITLE_BAR: "#title-bar",
|
||||
MAXIMIZE_BTN: "#title-bar-maximize-button",
|
||||
MINIMIZE_BTN: "#title-bar-minimize-button",
|
||||
CLOSE_BUTTON: "button#title-bar-close-button",
|
||||
MAIN_MENU_ITEM: "#hamburger-menu-button",
|
||||
SYM_LOGO: "#logo",
|
||||
@@ -25,6 +24,7 @@ module.exports= {
|
||||
PUBLIC_ROOM_RADIO_BTN: "//form[@class='create-chatroom']//input[@value='PUBLIC']",
|
||||
CREATE_IM_DONE_BTN: "//button[contains(@class,tempo-btn--good) and text()='Create']",
|
||||
START_CHAT: "//*[contains(@class, 'sym-menu-tooltip__option')]/*[text()='Start a Chat']",
|
||||
SIGNAL_OPTION: "//div[@class='sym-menu-tooltip__option']/*[text()='Create a Signal']",
|
||||
LEFT_NAV_SINGLE_ITEM: "//div[contains(@class, 'navigation-item-title')][.//span[@class='navigation-item-name' and normalize-space()='$$']]",
|
||||
CHAT_INPUT_TYPING: "//div[contains(@class,'public-DraftEditor-content')]",
|
||||
SETTTING_BUTTON: "//div[@class='toolbar-settings-text-container']",
|
||||
@@ -34,13 +34,20 @@ module.exports= {
|
||||
ALERT_TAB: "//*[contains(@class,'tempo-tabs__tab tabs-tab') and @data-tab='alerts']",
|
||||
ALERT_OPTION: "//span[@class='sym-menu-tooltip__option-label' and contains(.,'Alerts')]",
|
||||
NAV_ALIAS: "//div[@class='nav-profile__alias']",
|
||||
SIGNAL_HEADER : "//span[@class='navigation-category-name' and contains(.,'Signals')]",
|
||||
WARNING_CLOSE_ICON : "//div[@id='sysMsg']//span[@class='close-icon']",
|
||||
SCROLL_TAB_ACTIVE : "//div[@class='active-tab-container']",
|
||||
|
||||
SIGNAL_HEADER: "//span[@class='navigation-category-name' and contains(.,'Signals')]",
|
||||
WARNING_CLOSE_ICON: "//div[@id='sysMsg']//span[@class='close-icon']",
|
||||
SCROLL_TAB_ACTIVE: "//div[@class='active-tab-container']",
|
||||
SIGNAL_NAME: "//input[@class='react-signal__name']",
|
||||
HASHTAG_NAME: "//div[@class='react-signal__rule-name']//input",
|
||||
LAST_RULE_ROW: "//div[@class='react-signal__rules'][last()]",
|
||||
ENTER_KEYWORD_IN_LAST_INPUT: "//input",
|
||||
HEADER_MODULE: "//header[contains(@class,'module-header gs-draggable')]",
|
||||
MENTION_USER_SUGGESTION: "//span[@class='draftJs__suggestionsEntryText' and text()='$$']",
|
||||
SUGGESTED_ENTITY_DROPDOWN: "//span[@class='draftJs__suggestionsEntryText']",
|
||||
CONFIRM_CREATE_ROOM_BUTTON: "//div[@class='modal-box__footer-buttons']//button[text()='Yes']",
|
||||
//Alert Settings
|
||||
MUTE_POPUP_ALERTS_CKB: ".field.field-notifications-on input",
|
||||
|
||||
//Toast Message
|
||||
TOAST_MESSAGE_CONTENT: "#message",
|
||||
};
|
||||
|
||||
|
||||
@@ -29,8 +29,13 @@ class WebActions {
|
||||
})
|
||||
}
|
||||
|
||||
async minimizeWindowByClick() {
|
||||
await this.app.client.click(ui.MINIMIZED_BUTTON);
|
||||
}
|
||||
|
||||
async closeWindowByClick() {
|
||||
await this.app.client.click(ui.CLOSE_BUTTON);
|
||||
|
||||
}
|
||||
|
||||
async openApplicationMenuByClick() {
|
||||
@@ -112,14 +117,6 @@ class WebActions {
|
||||
await this.clickAndWaitElementVisible(ui.ALERT_OPTION, ui.ALERT_TAB);
|
||||
}
|
||||
|
||||
async checkBox(selector, value) {
|
||||
var checked = await this.app.client.isSelected(selector);
|
||||
while (checked != value) {
|
||||
await this.clickIfElementVisible(selector);
|
||||
checked = await this.app.client.isSelected(selector);
|
||||
}
|
||||
}
|
||||
|
||||
async verifyToastNotificationShow(message) {
|
||||
let show = false;
|
||||
for (let i = 0; i < 10; i++) {
|
||||
@@ -164,6 +161,47 @@ class WebActions {
|
||||
await expect(noShow).toBeTruthy();
|
||||
await this.app.client.windowByIndex(0);
|
||||
}
|
||||
|
||||
async getElementByXPath(xpath) {
|
||||
var elem = this.app.client.element(xpath);
|
||||
if (elem.isVisible()) {
|
||||
return elem;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
async inputText(el, data) {
|
||||
var obj = await this.getElementByXPath(el);
|
||||
if (obj != null)
|
||||
await this.app.client.setValue(el, data);
|
||||
}
|
||||
|
||||
async clickAndWaitElementVisible(xpath,elementToVisible,timeOut=5000)
|
||||
{
|
||||
await this.app.client.click(xpath).then(async()=>
|
||||
{
|
||||
await this.app.client.waitForVisible(elementToVisible,timeOut);
|
||||
});
|
||||
}
|
||||
|
||||
async clickIfElementVisible(xpath, timeOut = 5000) {
|
||||
await this.app.client.waitForVisible(xpath, timeOut)
|
||||
.click(xpath)
|
||||
}
|
||||
|
||||
async login(user) {
|
||||
await this.inputText(ui.SIGN_IN_EMAIL, user.username);
|
||||
await this.inputText(ui.SIGN_IN_PASSWORD, user.password);
|
||||
await this.clickAndWaitElementVisible(ui.SIGN_IN_BUTTON,ui.SETTTING_BUTTON,60000);
|
||||
}
|
||||
|
||||
async persistToastIM()
|
||||
{
|
||||
await this.clickAndWaitElementVisible(ui.SETTTING_BUTTON, ui.ALERT_OPTION, 5000);
|
||||
await this.clickAndWaitElementVisible(ui.ALERT_OPTION, ui.ALERT_TAB,10000);
|
||||
await this.clickAndWaitElementVisible(ui.PERSIS_NOTIFICATION_INPUT_IM,ui.PERSIS_NOTIFICATION_INPUT_IM, 5000);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = WebActions;
|
||||
|
||||
@@ -21,7 +21,7 @@ class WebDriver {
|
||||
until.elementLocated(By.xpath(xpath)),
|
||||
waitUntilTime
|
||||
)
|
||||
await this.driver.wait(until.elementIsNotVisible(el), 10000);
|
||||
await this.driver.wait(until.elementIsNotVisible(el), waitUntilTime);
|
||||
if (this.driver.findElements(By.xpath(xpath)).length > 0) {
|
||||
result = true;
|
||||
}
|
||||
@@ -35,7 +35,20 @@ class WebDriver {
|
||||
}
|
||||
}
|
||||
|
||||
async waitElementVisibleAndGet(xpath) {
|
||||
async waitElelmentIsVisible(xpath,timeout) {
|
||||
try {
|
||||
const el = await this.driver.wait(
|
||||
until.elementLocated(By.xpath(xpath)),
|
||||
waitUntilTime
|
||||
)
|
||||
await this.driver.wait(until.elementIsVisible(el), timeout);
|
||||
}
|
||||
catch (err) {
|
||||
console.log("Error:"+err.messages);
|
||||
}
|
||||
}
|
||||
|
||||
async waitElementVisibleAndGet(xpath) {
|
||||
const el = await this.driver.wait(
|
||||
until.elementLocated(By.xpath(xpath)),
|
||||
waitUntilTime
|
||||
@@ -68,7 +81,7 @@ class WebDriver {
|
||||
|
||||
async sendMessage(message) {
|
||||
await this.inputText(ui.CHAT_INPUT_TYPING, message);
|
||||
await this.sendEnter(ui.CHAT_INPUT_TYPING, message);
|
||||
await this.sendEnter(ui.CHAT_INPUT_TYPING);
|
||||
}
|
||||
|
||||
async sendMessages(messages) {
|
||||
@@ -86,6 +99,23 @@ class WebDriver {
|
||||
await this.waitElelmentIsVisible(ui.SETTTING_BUTTON,specconst.TIMEOUT_PAGE_LOAD);
|
||||
}
|
||||
|
||||
async mentionUserOnChat(user)
|
||||
{
|
||||
await this.inputText(ui.CHAT_INPUT_TYPING, "@"+user.name);
|
||||
var suggestion = ui.MENTION_USER_SUGGESTION.replace("$$",user.name);
|
||||
var el = await this.getElementByXPath(suggestion);
|
||||
await el.click();
|
||||
await this.sendEnter(ui.CHAT_INPUT_TYPING);
|
||||
}
|
||||
|
||||
async waitSuggestionShowOnlyOneItem(xpath)
|
||||
{
|
||||
if (this.driver.findElements(By.xpath(xpath)).length==1) {
|
||||
return result = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
async clickShowConversationCreationModal() {
|
||||
var plusButton = await this.getElementByXPath(ui.PLUS_BTN);
|
||||
await plusButton.click();
|
||||
@@ -113,6 +143,18 @@ class WebDriver {
|
||||
await el.click();
|
||||
}
|
||||
|
||||
async clickDoneButton() {
|
||||
var el = await this.getElementByXPath(ui.CREATE_IM_DONE_BTN);
|
||||
await el.click();
|
||||
await this.waitElelmentIsNotVisible(ui.CREATE_IM_DONE_BTN);
|
||||
}
|
||||
|
||||
async clickConfirmCreateRoom() {
|
||||
var el = await this.getElementByXPath(ui.CONFIRM_CREATE_ROOM_BUTTON);
|
||||
await el.click();
|
||||
await this.waitElelmentIsNotVisible(ui.CONFIRM_CREATE_ROOM_BUTTON);
|
||||
}
|
||||
|
||||
async clickStartChat() {
|
||||
var el = await this.getElementByXPath(ui.START_CHAT);
|
||||
await el.click();
|
||||
@@ -136,6 +178,11 @@ class WebDriver {
|
||||
await this.clickDoneButton();
|
||||
}
|
||||
|
||||
async clickCreateSignal() {
|
||||
var el = await this.getElementByXPath(ui.SIGNAL_OPTION);
|
||||
await el.click();
|
||||
}
|
||||
|
||||
async selectPublicRadioButton() {
|
||||
var el = await this.waitElementVisibleAndGet(ui.PUBLIC_ROOM_RADIO_BTN);
|
||||
await el.click();
|
||||
@@ -147,9 +194,11 @@ class WebDriver {
|
||||
}
|
||||
|
||||
async clickLeftNavItem(name) {
|
||||
xpath = ui.LEFT_NAV_SINGLE_ITEM.replace("$$", name);
|
||||
var el = await this.waitElementVisibleAndGet(xpath);
|
||||
var xpath = await ui.LEFT_NAV_SINGLE_ITEM.replace("$$", name);
|
||||
var el = await this.getElementByXPath(xpath);
|
||||
await el.click();
|
||||
var eheader = await this.getElementByXPath(ui.HEADER_MODULE);
|
||||
await this.driver.wait(until.elementIsVisible(eheader), waitUntilTime)
|
||||
}
|
||||
|
||||
async createRoom(usernames, name, description, type) {
|
||||
@@ -168,6 +217,16 @@ class WebDriver {
|
||||
await this.addParticipant(usernames[i]);
|
||||
}
|
||||
await this.clickDoneButton();
|
||||
// await this.clickConfirmCreateRoom();
|
||||
}
|
||||
|
||||
async createSignal(signalName, hashTag)
|
||||
{
|
||||
await this.clickShowConversationCreationModal();
|
||||
await this.clickCreateSignal();
|
||||
await this.inputText(ui.SIGNAL_NAME,signalName);
|
||||
await this.inputText(ui.LAST_RULE_ROW+ui.ENTER_KEYWORD_IN_LAST_INPUT,hashTag);
|
||||
await this.clickDoneButton();
|
||||
}
|
||||
|
||||
async initDriver() {
|
||||
@@ -191,12 +250,10 @@ class WebDriver {
|
||||
this.driver.switchTo().window(this.driver.getAllWindowHandles()[0]);
|
||||
}
|
||||
|
||||
async quit() {
|
||||
await d.quit();
|
||||
}
|
||||
async sleep(secondSleep) {
|
||||
await this.driver.sleep(secondSleep * 1000);
|
||||
}
|
||||
|
||||
async timeOut(secondSleep) {
|
||||
return secondSleep * 1000;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ const constants = require('./spectronConstants.js');
|
||||
const Utils = require('./spectronUtils.js');
|
||||
const fs = require('fs');
|
||||
const WebActions = require('./spectronWebActions.js')
|
||||
const ui = require('./spectronInterfaces.js');
|
||||
|
||||
class WindowsActions {
|
||||
constructor(app) {
|
||||
@@ -11,119 +10,6 @@ class WindowsActions {
|
||||
this.webAction = new WebActions(app);
|
||||
}
|
||||
|
||||
async verifyMinimizeWindows() {
|
||||
await this.app.browserWindow.isMinimized().then(async function (minimized) {
|
||||
await expect(minimized).toBeTruthy();
|
||||
}).catch((err) => {
|
||||
console.log("error:" + err.name);
|
||||
});;
|
||||
}
|
||||
|
||||
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 pressCtrlW() {
|
||||
await robot.keyToggle('w', 'down', ['control']);
|
||||
await robot.keyToggle('w', 'up', ['control']);
|
||||
}
|
||||
async pressCtrlM() {
|
||||
await robot.keyToggle('m', 'down', ['control']);
|
||||
await robot.keyToggle('m', 'up', ['control']);
|
||||
}
|
||||
async focusWindow() {
|
||||
await this.app.browserWindow.show();
|
||||
}
|
||||
|
||||
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 openMenu(arrMenu) {
|
||||
var arrStep = [];
|
||||
for (var i = 0; i < arrMenu.length; i++) {
|
||||
var item = await this.menuSearch(constants.MENU.root, arrMenu[i]);
|
||||
await arrStep.push(item);
|
||||
}
|
||||
await this.actionForMenus(arrStep);
|
||||
return arrStep;
|
||||
}
|
||||
|
||||
async actionForMenus(arrMenu) {
|
||||
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
||||
await robot.setMouseDelay(100);
|
||||
let x = bounds.x + 95;
|
||||
let y = bounds.y + 35;
|
||||
await robot.moveMouseSmooth(x, y);
|
||||
await robot.moveMouse(x, y);
|
||||
await robot.mouseClick();
|
||||
await this.webAction.openApplicationMenuByClick();
|
||||
await robot.setKeyboardDelay(1000);
|
||||
await robot.keyTap('enter');
|
||||
for (var i = 0; i < arrMenu.length; i++) {
|
||||
|
||||
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 reload() {
|
||||
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
||||
await robot.setMouseDelay(100);
|
||||
let x = bounds.x + 95;
|
||||
let y = bounds.y + 200;
|
||||
await robot.moveMouseSmooth(x, y);
|
||||
await robot.moveMouse(x, y);
|
||||
await robot.mouseClick('right');
|
||||
await robot.setKeyboardDelay(2000);
|
||||
await robot.keyTap('right');
|
||||
await robot.keyTap('down');
|
||||
await robot.keyTap('enter');
|
||||
});
|
||||
await this.app.client.waitForVisible(ui.PLUS_BTN, constants.TIMEOUT_PAGE_LOAD);
|
||||
}
|
||||
|
||||
async clickNotification() {
|
||||
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
||||
await robot.setMouseDelay(100);
|
||||
let x = bounds.x + 95;
|
||||
let y = bounds.y + bounds.height - 20;
|
||||
await robot.moveMouseSmooth(x, y);
|
||||
await robot.moveMouse(x, y);
|
||||
await robot.mouseClick();
|
||||
});
|
||||
}
|
||||
timeOut(second) {
|
||||
return second * 1000;
|
||||
}
|
||||
|
||||
async getCurrentSize() {
|
||||
return this.app.browserWindow.getSize();
|
||||
}
|
||||
@@ -164,7 +50,8 @@ class WindowsActions {
|
||||
}
|
||||
|
||||
async showWindow() {
|
||||
await this.app.browserWindow.show();
|
||||
await this.app.browserWindow.restore();
|
||||
await this.app.browserWindow.setAlwaysOnTop(true);
|
||||
}
|
||||
|
||||
async clickOutsideWindow() {
|
||||
@@ -251,6 +138,27 @@ class WindowsActions {
|
||||
})
|
||||
}
|
||||
|
||||
async verifyMinimizeWindows() {
|
||||
await this.app.browserWindow.isMinimized().then(async function (minimized) {
|
||||
await expect(minimized).toBeTruthy();
|
||||
}).catch((err) => {
|
||||
console.log(err.name);
|
||||
});;
|
||||
}
|
||||
|
||||
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() {
|
||||
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
||||
await robot.setMouseDelay(100);
|
||||
@@ -292,6 +200,264 @@ class WindowsActions {
|
||||
await robot.keyTap('enter');
|
||||
});
|
||||
}
|
||||
|
||||
async pressCtrlW() {
|
||||
await robot.keyToggle('w', 'down', ['control']);
|
||||
await robot.keyToggle('w', 'up', ['control']);
|
||||
}
|
||||
async focusWindow() {
|
||||
await this.app.browserWindow.show();
|
||||
}
|
||||
|
||||
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 openMenu(arrMenu) {
|
||||
var arrStep = [];
|
||||
for (var i = 0; i < arrMenu.length; i++) {
|
||||
var item = await this.menuSearch(constants.MENU.root, arrMenu[i]);
|
||||
await arrStep.push(item);
|
||||
}
|
||||
await this.actionForMenus(arrStep);
|
||||
return arrStep;
|
||||
}
|
||||
|
||||
async actionForMenus(arrMenu) {
|
||||
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
||||
await robot.setMouseDelay(100);
|
||||
let x = bounds.x + 95;
|
||||
let y = bounds.y + 35;
|
||||
await robot.moveMouseSmooth(x, y);
|
||||
await robot.moveMouse(x, y);
|
||||
await robot.mouseClick();
|
||||
await this.webAction.openApplicationMenuByClick();
|
||||
await robot.setKeyboardDelay(200);
|
||||
await robot.keyTap('enter');
|
||||
for (var i = 0; i < arrMenu.length; i++) {
|
||||
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 verifyMinimizeWindows() {
|
||||
await this.app.browserWindow.isMinimized().then(async function (minimized) {
|
||||
await expect(minimized).toBeTruthy();
|
||||
}).catch((err) => {
|
||||
console.log("error:"+err.name);
|
||||
});;
|
||||
}
|
||||
|
||||
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 pressCtrlW() {
|
||||
await robot.keyToggle('w', 'down', ['control']);
|
||||
await robot.keyToggle('w', 'up', ['control']);
|
||||
}
|
||||
|
||||
async pressCtrlM() {
|
||||
await robot.keyToggle('m', 'down', ['control']);
|
||||
await robot.keyToggle('m', 'up', ['control']);
|
||||
}
|
||||
|
||||
async pressCtrlR() {
|
||||
await robot.keyToggle('r', 'down', ['control']);
|
||||
await robot.keyToggle('r', 'up', ['control']);
|
||||
}
|
||||
|
||||
async focusWindow() {
|
||||
this.app.browserWindow.focus();
|
||||
this.app.browserWindow.setAlwaysOnTop(true);
|
||||
}
|
||||
|
||||
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 openMenu(arrMenu) {
|
||||
var arrStep = [];
|
||||
for (var i = 0; i < arrMenu.length; i++) {
|
||||
var item = await this.menuSearch(constants.MENU.root, arrMenu[i]);
|
||||
await arrStep.push(item);
|
||||
}
|
||||
await this.actionForMenus(arrStep);
|
||||
return arrStep;
|
||||
}
|
||||
|
||||
async reload()
|
||||
{
|
||||
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
||||
await robot.setMouseDelay(100);
|
||||
let x = bounds.x + 95;
|
||||
let y = bounds.y + 200;
|
||||
await robot.moveMouseSmooth(x, y);
|
||||
await robot.moveMouse(x, y);
|
||||
await robot.mouseClick('right');
|
||||
await robot.setKeyboardDelay(2000);
|
||||
await robot.keyTap('right');
|
||||
await robot.keyTap('down');
|
||||
await robot.keyTap('enter');
|
||||
}).catch((err1) => {
|
||||
console.log("Message:"+err1);
|
||||
});
|
||||
}
|
||||
|
||||
async clickNotification()
|
||||
{
|
||||
let screen = await this.app.electron.screen.getAllDisplays();
|
||||
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
||||
await robot.setMouseDelay(100);
|
||||
let x = screen[0].bounds.width-50;
|
||||
let y = screen[0].bounds.height - 100;
|
||||
await robot.moveMouseSmooth(x, y);
|
||||
await robot.moveMouse(x, y);
|
||||
await robot.mouseClick();
|
||||
});
|
||||
}
|
||||
|
||||
async mouseMoveNotification()
|
||||
{
|
||||
let screen = await this.app.electron.screen.getAllDisplays();
|
||||
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
||||
await robot.setMouseDelay(100);
|
||||
let x = screen[0].bounds.width-50;
|
||||
let y = screen[0].bounds.height - 100;
|
||||
await robot.moveMouseSmooth(x, y);
|
||||
await robot.moveMouse(x, y);
|
||||
});
|
||||
}
|
||||
|
||||
async mouseMoveCenter()
|
||||
{
|
||||
let screen = await this.app.electron.screen.getAllDisplays();
|
||||
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
||||
await robot.setMouseDelay(100);
|
||||
let x = screen[0].bounds.width-500;
|
||||
let y = screen[0].bounds.height - 100;
|
||||
await robot.moveMouseSmooth(x, y);
|
||||
await robot.moveMouse(x, y);
|
||||
});
|
||||
}
|
||||
|
||||
async verifyNotCloseToastWhenMouseOver()
|
||||
{
|
||||
await this.mouseMoveNotification();
|
||||
var i =0;
|
||||
while(i < 11)
|
||||
{
|
||||
await Utils.sleep(1);
|
||||
await i++;
|
||||
}
|
||||
await this.verifyToastNotificationShow();
|
||||
await this.mouseMoveCenter();
|
||||
}
|
||||
|
||||
async veriryPersistToastNotification()
|
||||
{
|
||||
var i =0;
|
||||
while(i < 11)
|
||||
{
|
||||
await Utils.sleep(1);
|
||||
await i++;
|
||||
}
|
||||
await this.verifyToastNotificationShow();
|
||||
await this.clickNotification();
|
||||
await this.mouseMoveCenter();
|
||||
}
|
||||
|
||||
async veriryNotPersistToastNotification()
|
||||
{
|
||||
var i = 0;
|
||||
let count =0;
|
||||
|
||||
while(i < 11)
|
||||
{
|
||||
await Utils.sleep(1);
|
||||
await i++;
|
||||
}
|
||||
await this.verifyNotShowToastNotification();
|
||||
await this.mouseMoveCenter();
|
||||
}
|
||||
|
||||
async verifyToastNotificationShow() {
|
||||
let show = false;
|
||||
for (let i = 0; i < 10; i++) {
|
||||
var winCount = await this.app.client.getWindowCount();
|
||||
if (winCount > 1) {
|
||||
await this.app.client.windowByIndex(1);
|
||||
if (await this.app.browserWindow.getTitle() === 'Electron') {
|
||||
show = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
await Utils.sleep(1);
|
||||
}
|
||||
await expect(show).toBeTruthy();
|
||||
await this.app.client.windowByIndex(0);
|
||||
}
|
||||
|
||||
async verifyNotShowToastNotification()
|
||||
{
|
||||
let notshow = true;
|
||||
for (let i = 0; i < 10; i++) {
|
||||
var winCount = await this.app.client.getWindowCount();
|
||||
if (winCount == 1) {
|
||||
notshow = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
await this.app.client.windowByIndex(1);
|
||||
if (await this.app.browserWindow.getTitle() !== 'Electron') {
|
||||
notshow = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
await Utils.sleep(1);
|
||||
}
|
||||
await expect(notshow).toBeTruthy();
|
||||
await this.app.client.windowByIndex(0);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = WindowsActions;
|
||||
87
tests/spectron/turnONPersistentToast.spectron.js
Normal file
87
tests/spectron/turnONPersistentToast.spectron.js
Normal file
@@ -0,0 +1,87 @@
|
||||
const Application = require('./spectronSetup');
|
||||
const WebDriver = require('./spectronWebDriver');
|
||||
const { isMac } = require('../../js/utils/misc.js');
|
||||
const Utils = require('./spectronUtils');
|
||||
var app = new Application({
|
||||
startTimeout: Application.getTimeOut(),
|
||||
waitTimeout: Application.getTimeOut()
|
||||
});
|
||||
var webdriver = new WebDriver({ browser: 'chrome' });
|
||||
const WindowsAction = require('./spectronWindowsActions');
|
||||
const WebActions = require('./spectronWebActions');
|
||||
const ifc = require('./spectronInterfaces.js');
|
||||
const specconst = require('./spectronConstants.js');
|
||||
let webActions, windowAction;
|
||||
|
||||
!isMac ? describe('Verify toast notification when Persist Notification is ON', () => {
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
||||
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
||||
beforeAll(async(done) => {
|
||||
try
|
||||
{
|
||||
app = await new Application({}).startApplication({testedHost:specconst.TESTED_HOST, alwaysOnTop: true});
|
||||
windowAction = await new WindowsAction(app);
|
||||
webActions = await new WebActions(app);
|
||||
done();
|
||||
} catch(err) {
|
||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
||||
};
|
||||
});
|
||||
afterAll(async (done) => {
|
||||
try {
|
||||
if (app && app.isRunning()) {
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
|
||||
await app.stop();
|
||||
await webdriver.quit();
|
||||
done();
|
||||
}
|
||||
} catch (err) {
|
||||
done.fail(new Error(`Failed at post-condition: ${err}`));
|
||||
};
|
||||
});
|
||||
/**
|
||||
* Verify toast notification when Persist Notification is ON
|
||||
* TC-ID: 3308790
|
||||
* Cover scenarios in AVT-1025
|
||||
*/
|
||||
it('Toast notification appears on screen and should stay on the screen IM', async () => {
|
||||
|
||||
await webdriver.startDriver();
|
||||
await webdriver.login(specconst.USER_A);
|
||||
await webdriver.createIM(specconst.USER_B);
|
||||
await webdriver.sendMessages([Utils.randomString()]);
|
||||
await webActions.login(specconst.USER_B);
|
||||
|
||||
await windowAction.reload();
|
||||
await app.client.waitForVisible(ifc.SETTTING_BUTTON, windowAction.timeOut(50));
|
||||
await webActions.persistToastIM();
|
||||
|
||||
await windowAction.pressCtrlM();
|
||||
await webdriver.sendMessages([Utils.randomString(),Utils.randomString()]);
|
||||
await windowAction.veriryPersistToastNotification();
|
||||
await webdriver.startDriver();
|
||||
await webdriver.createMIM([specconst.USER_B, specconst.USER_C]);
|
||||
await webdriver.sendMessages([Utils.randomString(),Utils.randomString()]);
|
||||
await windowAction.veriryPersistToastNotification();
|
||||
|
||||
})
|
||||
/**
|
||||
* Verify toast notification when Persist Notification is OFF
|
||||
* TC-ID: 46602241
|
||||
* Cover scenarios in AVT-1027
|
||||
*/
|
||||
it('Toast notification appears on screen and should disappear in few seconds IM', async () => {
|
||||
|
||||
await windowAction.showWindow();
|
||||
await app.client.waitForVisible(ifc.SETTTING_BUTTON, windowAction.timeOut(50));
|
||||
await webActions.persistToastIM();
|
||||
await webdriver.clickLeftNavItem(specconst.USER_B.name);
|
||||
await webdriver.sendMessages([Utils.randomString(),Utils.randomString()]);
|
||||
await windowAction.veriryNotPersistToastNotification();
|
||||
await webdriver.createMIM([specconst.USER_B, specconst.USER_C]);
|
||||
await webdriver.sendMessages([Utils.randomString(),Utils.randomString()]);
|
||||
await windowAction.veriryNotPersistToastNotification();
|
||||
|
||||
})
|
||||
|
||||
}) : describe.skip();
|
||||
Reference in New Issue
Block a user