AVT-1082 [Spectron][Windows] Pop-in popped-out chat (#463)

* Add test

* Updated
This commit is contained in:
thaisym1912 2018-08-16 14:54:58 +07:00 committed by Vishwas Shashidhar
parent 146db038f0
commit 9dba7521fc
5 changed files with 175 additions and 102 deletions

View File

@ -13,7 +13,7 @@ const specconst = require('./spectronConstants.js');
let webActions, windowAction;
describe('Test for Badge Count on MAC', () => {
!isMac ? describe('Test for Badge Count on MAC', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
beforeAll(async (done) => {
@ -45,25 +45,20 @@ describe('Test for Badge Count on MAC', () => {
*/
it('Show 1 in tray icon when unread message = 1', async (done) => {
try {
if (isMac) {
let message = await Utils.randomString();
await webdriver.startDriver();
await webdriver.login(specconst.USER_A);
await webdriver.createIM(specconst.USER_B.username);
await webActions.login(specconst.USER_B);
await webActions.clickLeftNavItem(specconst.USER_A.name);
await webActions.openAlertsSettings();
let currentBadgeCount = await windowAction.getBadgeCount();
await webdriver.sendMessage(message);
await windowAction.verifyCurrentBadgeCount(currentBadgeCount + 1);
done();
}
else {
done();
}
let message = await Utils.randomString();
await webdriver.startDriver();
await webdriver.login(specconst.USER_A);
await webdriver.createIM(specconst.USER_B.username);
await webActions.login(specconst.USER_B);
await webActions.clickLeftNavItem(specconst.USER_A.name);
await webActions.openAlertsSettings();
let currentBadgeCount = await windowAction.getBadgeCount();
await webdriver.sendMessage(message);
await windowAction.verifyCurrentBadgeCount(currentBadgeCount + 1);
done();
} catch (err) {
done.fail(new Error(`Show 1 in tray icon with error: ${err}`));
}
});
})
}) : describe.skip();

View File

@ -7,31 +7,43 @@ const Utils = require('./spectronUtils');
let app, webActions, windowsActions;
describe('Tests for Pop-Outs', () => {
!isMac ? describe('Tests for Pop-Outs', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = constants.TIMEOUT_TEST_SUITE;
beforeAll(async (done) => {
try {
app = await new Application({}).startApplication({testedHost: constants.TESTED_HOST});
app = await new Application({}).startApplication({ testedHost: constants.TESTED_HOST });
webActions = await new WebActions(app);
windowsActions = await new WindowsActions(app);
await webActions.login(constants.USER_A);
done();
} catch (err) {
done.fail(new Error(`Unable to start application error: ${err}`));
await windowsActions.stopApp();
done.fail(new Error(`Failed at beforeAll: ${err}`));
};
});
beforeEach(async (done) => {
try {
await windowsActions.bringToFront("Symphony");
await windowsActions.closeAllPopOutWindow();
await webActions.closeAllGridModules();
done();
} catch (err) {
await windowsActions.stopApp();
done.fail(new Error(`Failed at beforeEach: ${err}`));
};
});
afterAll(async (done) => {
try {
await windowsActions.closeAllPopOutWindow();
if (app && app.isRunning()) {
await app.stop();
await webDriver.quit();
done();
}
await webActions.closeAllGridModules();
await windowsActions.stopApp();
done();
} catch (err) {
done.fail(new Error(`Failed at post-condition: ${err}`));
await windowsActions.stopApp();
await done.fail(new Error(`Failed at afterAll: ${err}`));
};
});
@ -42,13 +54,7 @@ describe('Tests for Pop-Outs', () => {
*/
it('Verify pop-out chat, inbox', async (done) => {
try {
if (isMac) {
done();
} else {
await webActions.login(constants.USER_A);
await windowsActions.closeAllPopOutWindow();
await windowsActions.bringToFront("Symphony");
if (await windowsActions.isAppRunning()) {
await webActions.createIM(constants.USER_B.name);
await webActions.clickPopOutIcon();
await windowsActions.verifyPopOutWindowAppear(constants.USER_B.name);
@ -73,12 +79,36 @@ describe('Tests for Pop-Outs', () => {
await webActions.login(constants.USER_A);
await windowsActions.verifyPopOutWindowAppear(constants.USER_B.name);
await windowsActions.verifyPopOutWindowAppear("Inbox");
await windowsActions.closeAllPopOutWindow();
done();
}
done();
} catch (err) {
done.fail(new Error(`Fail to verify pop-out chat, inbox: ${err}`));
};
});
})
/**
* Verify pop-in popped-out chat
* TC-ID: 4130268
* Cover scenarios in AVT-1082
*/
it('Verify pop-in popped-out chat', async (done) => {
try {
if (await windowsActions.isAppRunning()) {
await webActions.createIM(constants.USER_B.name);
await webActions.pinChat();
await webActions.clickPopOutIcon();
await webActions.clickPopInIcon(constants.USER_B.name);
await webActions.verifyPopOutIconDisplay();
//Verify pinned module is persisted on grid
await webActions.createIM(constants.USER_C.name);
await webActions.verifyChatModuleVisible(constants.USER_B.name);
done();
}
done();
} catch (err) {
done.fail(new Error(`Fail to verify Pop-in popped-out chat: ${err}`));
};
});
}) : describe.skip();

View File

@ -44,6 +44,7 @@ module.exports= {
LAST_RULE_ROW: "//div[@class='react-signal__rules'][last()]",
ENTER_KEYWORD_IN_LAST_INPUT: "//input",
HEADER_MODULE: "//header[contains(@class,'module-header gs-draggable')]",
HEADER_MODULES: "(//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']",
@ -51,12 +52,16 @@ module.exports= {
SPINNER: ".spinner",
SIGNOUT: ".sign-out",
SIGNOUT_MODAL_BUTTON: "//div[@class='modal-content-buttons buttons']//button[contains(text(), 'Sign Out')]",
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_MODULES: "(//button[contains(@class,'close-module')])[$$]",
//Popin Popout
POPOUT_BUTTON: ".enhanced-pop-out",
POPOUT_INBOX_BUTTON: ".add-margin.popout",
POPIN_BUTTON: "//*[contains(@class, 'enhanced-pop-in') or contains(@class, 'add-margin popin')]",
PIN_CHAT_MOD: ".chat-module .pin-view",
PINNED_CHAT_MOD: ".chat-module .pinned",
//Alert Settings
MUTE_POPUP_ALERTS_CKB: ".field.field-notifications-on input",

View File

@ -188,8 +188,6 @@ class WebActions {
await this.clickIfElementVisible(ui.START_CHAT);
}
async logout()
{
await this.clickAndWaitElementVisible(ui.ADMIN_NAME, ui.ADMIN_LOG_OUT, constants.TIMEOUT_WAIT_ELEMENT);
@ -228,6 +226,7 @@ class WebActions {
await this.selectIMTab();
await this.addParticipant(username);
await this.clickDoneButton();
await this.verifyChatModuleVisible(username)
}
async clickPopOutIcon() {
@ -240,6 +239,17 @@ class WebActions {
await this.waitElementNotVisible(ui.SPINNER, constants.TIMEOUT_PAGE_LOAD);
}
async clickPopInIcon(windowTitle) {
let windowsActions = await new WindowsActions(this.app);
let index = await windowsActions.getWindowIndexFromTitle(windowTitle);
await windowsActions.windowByIndex(index);
await this.mouseOver(ui.PIN_CHAT_MOD);
await Utils.sleep(2); //wait popin button clickable
await this.clickIfElementVisible(ui.POPIN_BUTTON);
await windowsActions.windowByIndex(0);
await this.waitElementVisible(ui.HEADER_MODULE);
}
async clickInboxPopOutIcon() {
let windowsActions = await new WindowsActions(this.app);
await this.clickIfElementVisible(ui.POPOUT_INBOX_BUTTON);
@ -256,6 +266,12 @@ class WebActions {
await windowsActions.windowByIndex(0);
}
async verifyPopOutIconDisplay(){
await this.mouseOver(ui.PIN_CHAT_MOD);
await Utils.sleep(2); //wait popout button clickable
await this.waitElementVisible(ui.POPOUT_BUTTON, constants.TIMEOUT_WAIT_ELEMENT);
}
async clickInboxIcon() {
await this.clickIfElementVisible(ui.INBOX_BUTTON);
}
@ -306,6 +322,34 @@ class WebActions {
checked = await this.app.client.isSelected(selector);
}
}
async pinChat(){
await this.mouseOver(ui.PIN_CHAT_MOD);
await Utils.sleep(2); //wait popout button clickable
await this.clickIfElementVisible(ui.PIN_CHAT_MOD);
await this.waitElementVisible(ui.PINNED_CHAT_MOD);
}
async verifyChatModuleVisible(muduleName){
let locator = ui.HEADER_MODULE_NAME.replace("$$",muduleName);
await this.waitElementVisible(locator);
}
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);
await this.mouseOver(header);
await this.clickIfElementVisible(ui.PIN_CHAT_MOD);
await this.clickIfElementVisible(closeButton);
}
}
async getCount(locator){
let elements = await this.app.client.elements(locator);
return elements.value.length;
}
}
module.exports = WebActions;

View File

@ -13,73 +13,72 @@ const Utils = require('./spectronUtils');
const ifc = require('./spectronInterfaces.js');
let webActions, windowAction;
!isMac? describe('Verify toast notification for IMs', () => {
let originalTimeout = specconst.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = specconst.TIMEOUT_TEST_SUITE;
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((done) => {
if (app && app.isRunning()) {
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
app.stop().then(() => {
webdriver.close();
webdriver.quit();
done();
}).catch((err) => {
done();
});
}
});
/**
* Verify toast notification for IMs
* TC-ID: 3395297
* Cover scenarios in AVT-1031
*/
it('Toast notification should not be closed', async () => {
!isMac ? describe('Verify toast notification for IMs', () => {
let originalTimeout = specconst.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = specconst.TIMEOUT_TEST_SUITE;
await webdriver.startDriver();
await webdriver.login(specconst.USER_A);
await webdriver.createIM(specconst.USER_B.username);
await webActions.login(specconst.USER_B);
await windowAction.reload();
await app.client.waitForVisible(ifc.SETTTING_BUTTON, Utils.toMs(50));
await webActions.clickIfElementVisible(ifc.SETTTING_BUTTON);
await windowAction.pressCtrlM();
await webdriver.clickLeftNavItem(specconst.USER_B.name);
var message = await Utils.randomString();
await webdriver.sendMessages([message]);
await windowAction.verifyNotCloseToastWhenMouseOver(message);
});
/**
* Verify toast notification for signals, mentions and keywords
* TC-ID: 3395306
* Cover scenarios in AVT-1032
*/
it('Verify toast notification for signals, mentions and keywords', async () => {
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((done) => {
if (app && app.isRunning()) {
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
app.stop().then(() => {
webdriver.close();
webdriver.quit();
done();
}).catch((err) => {
done();
});
}
});
/**
* Verify toast notification for IMs
* TC-ID: 3395297
* Cover scenarios in AVT-1031
*/
it('Toast notification should not be closed', async () => {
await webdriver.startDriver();
await webdriver.login(specconst.USER_A);
await webdriver.createIM(specconst.USER_B.username);
await webActions.login(specconst.USER_B);
await windowAction.reload();
await app.client.waitForVisible(ifc.SETTTING_BUTTON, Utils.toMs(50));
await webActions.clickIfElementVisible(ifc.SETTTING_BUTTON);
await windowAction.pressCtrlM();
await webdriver.clickLeftNavItem(specconst.USER_B.name);
var message = await Utils.randomString();
await webdriver.sendMessages([message]);
await windowAction.verifyNotCloseToastWhenMouseOver(message);
});
/**
* Verify toast notification for signals, mentions and keywords
* TC-ID: 3395306
* Cover scenarios in AVT-1032
*/
it('Verify toast notification for signals, mentions and keywords', async () => {
var nameSignal = await Utils.randomString();
var nameHashTag = await Utils.randomString();
var roomName = await Utils.randomString();
var description =await Utils.randomString();
await webdriver.createSignal(nameSignal,nameHashTag);
await webdriver.createRoom([specconst.USER_B.username],roomName,description,specconst.TYPE_ROOM.public)
var description = await Utils.randomString();
await webdriver.createSignal(nameSignal, nameHashTag);
await webdriver.createRoom([specconst.USER_B.username], roomName, description, specconst.TYPE_ROOM.public)
await webdriver.clickLeftNavItem(roomName);
await webdriver.sendMessages(["#"+nameHashTag]);
await windowAction.verifyNotCloseToastWhenMouseOver(specconst.USER_A.name+": #"+nameHashTag);
await webdriver.sendMessages(["#" + nameHashTag]);
await windowAction.verifyNotCloseToastWhenMouseOver(specconst.USER_A.name + ": #" + nameHashTag);
await webdriver.mentionUserOnChat(specconst.USER_B);
await windowAction.verifyNotCloseToastWhenMouseOver(specconst.USER_A.name+": @"+specconst.USER_B.name);
await windowAction.verifyNotCloseToastWhenMouseOver(specconst.USER_A.name + ": @" + specconst.USER_B.name);
});
}):describe.skip();
}) : describe.skip();