Stabilize automation tests. (#504)

* Combine commits

* share-logs.spectron (replaced by electronProductionLogging)

* notificationPosition.spectron (replaced by toastNotification)

* Remove reload
This commit is contained in:
thaisym1912 2018-09-19 12:36:40 +07:00 committed by Vishwas Shashidhar
parent 6752ec2042
commit 08d9c34735
19 changed files with 74 additions and 449 deletions

View File

@ -4,9 +4,7 @@ const WebActions = require('./spectronWebActions');
const Utils = require('./spectronUtils');
const { isMac } = require('../../js/utils/misc');
let app;
let windowActions;
let webActions;
let app, windowActions, webActions;
describe('Tests for always on top with mult-apps are opened', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();

View File

@ -5,10 +5,11 @@ const constants = require('./spectronConstants.js');
const path = require('path');
const ui = require('./spectronInterfaces.js');
const Utils = require('./spectronUtils.js');
let TIMEOUT_TEST_SUITE = parseInt(constants.TIMEOUT_TEST_SUITE, 10);
let app, windowsActions;
describe('Tests for pop outs reload scenario', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = constants.TIMEOUT_TEST_SUITE;
jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT_TEST_SUITE;
beforeAll(async (done) => {
try {

View File

@ -2,10 +2,11 @@ const Application = require('./spectronSetup');
const WindowsActions = require('./spectronWindowsActions');
const constants = require('./spectronConstants.js');
const {isMac} = require('../../js/utils/misc');
let TIMEOUT_TEST_SUITE = parseInt(constants.TIMEOUT_TEST_SUITE, 10);
let app, windowsActions;
describe('Tests for fullscreen', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = constants.TIMEOUT_TEST_SUITE;
jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT_TEST_SUITE;
beforeAll(async (done) => {
try {

View File

@ -4,11 +4,11 @@ const WindowsActions = require('./spectronWindowsActions');
const constants = require('./spectronConstants.js');
const path = require('path');
const ui = require('./spectronInterfaces.js');
let TIMEOUT_TEST_SUITE = parseInt(constants.TIMEOUT_TEST_SUITE, 10);
let app, windowsActions;
describe('Tests for getVersionInfo API', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = constants.TIMEOUT_TEST_SUITE;
jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT_TEST_SUITE;
beforeAll(async (done) => {
try {

View File

@ -42,18 +42,11 @@ describe('Add Test To Verify Minimize on Close', () => {
afterAll(async (done) => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
try {
if (app && app.isRunning()) {
if (isMac) {
await app.stop();
}
else {
await wActions.closeChromeDriver();
}
await done();
}
await Utils.killProcess("chromedriver.exe");
await Utils.killProcess("electron.exe");
done();
} catch (error) {
done.fail(new Error(`After all: ${error}`));
done.fail(new Error(`After all: ${error}`));
}
});

View File

@ -1,186 +0,0 @@
const Application = require('./spectronSetup');
const path = require('path');
const { isMac } = require('../../js/utils/misc');
let mainApp = new Application({});
let app;
describe('Tests for Notification position', () => {
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
beforeAll(async (done) => {
try {
let testHost = await 'file:///' + path.join(__dirname, '..', '..', 'demo/index.html');
app = await mainApp.startApplication({testedHost:testHost, alwaysOnTop: false });
await 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(() => {
done();
}).catch((err) => {
done();
});
}
});
it('should open notification configure window', () => {
return app.client
.click('#open-config-win')
.windowByIndex(1)
.click('#upper-left')
.click('#ok-button')
.windowByIndex(0)
.click('#notf')
.windowByIndex(1)
});
it('should check notification position', (done) => {
return app.browserWindow.getBounds().then((bounds) => {
expect(bounds.x === 0).toBeTruthy();
if (isMac) {
expect(bounds.y > 0).toBeTruthy();
done();
} else {
expect(bounds.y === 0).toBeTruthy();
done();
}
}).catch((err) => {
done.fail(new Error(`notificationPosition failed in getBounds with error: ${err}`));
});
});
it('should change the window', (done) => {
return app.client.windowByIndex(0).then(() => {
return app.browserWindow.getTitle().then((title) => {
expect(title === 'Symphony | Secure Seamless Communication').toBeTruthy();
done();
}).catch((err) => {
done.fail(new Error(`notificationPosition failed in getTitle with error: ${err}`));
});
}).catch((err) => {
done.fail(new Error(`notificationPosition failed in windowByIndex with error: ${err}`));
});
});
it('should change notification position to lower-right', (done) => {
return app.client
.click('#open-config-win')
.windowByIndex(2)
.click('#lower-right')
.click('#ok-button')
.windowByIndex(0)
.click('#notf')
.windowByIndex(1).then(() => {
return app.browserWindow.getTitle().then((title) => {
expect(title === 'Electron').toBeTruthy();
done();
}).catch((err) => {
done.fail(new Error(`notificationPosition failed in getTitle with error: ${err}`));
});
}).catch((err) => {
done.fail(new Error(`notificationPosition failed in windowByIndex with error: ${err}`));
});
});
it('should check notification position and equal to lower-right', (done) => {
return app.browserWindow.getBounds().then((bounds) => {
expect(bounds.x > 0).toBeTruthy();
expect(bounds.y > 0).toBeTruthy();
done();
}).catch((err) => {
done.fail(new Error(`notificationPosition failed in getBounds with error: ${err}`));
});
});
it('should change the window', (done) => {
return app.client.windowByIndex(0).then(() => {
return app.browserWindow.getTitle().then((title) => {
expect(title === 'Symphony | Secure Seamless Communication').toBeTruthy();
done();
}).catch((err) => {
done.fail(new Error(`notificationPosition failed in getTitle with error: ${err}`));
});
}).catch((err) => {
done.fail(new Error(`notificationPosition failed in windowByIndex with error: ${err}`));
});
});
it('should change notification position to upper-right', (done) => {
return app.client
.click('#open-config-win')
.windowByIndex(3)
.click('#upper-right')
.click('#ok-button')
.windowByIndex(0)
.click('#notf')
.windowByIndex(1).then(() => {
return app.browserWindow.getTitle().then((title) => {
expect(title === 'Electron').toBeTruthy();
done();
}).catch((err) => {
done.fail(new Error(`notificationPosition failed in getTitle with error: ${err}`));
});
}).catch((err) => {
done.fail(new Error(`notificationPosition failed in windowByIndex with error: ${err}`));
});
});
it('should check notification position and equal to upper-right', (done) => {
return app.browserWindow.getBounds().then((bounds) => {
expect(bounds.x > 0).toBeTruthy();
if (isMac) {
expect(bounds.y > 0).toBeTruthy();
done();
} else {
expect(bounds.y === 0).toBeTruthy();
done();
}
}).catch((err) => {
done.fail(new Error(`notificationPosition failed in getBounds with error: ${err}`));
});
});
it('should change the window to main', (done) => {
return app.client.windowByIndex(0).then(() => {
return app.browserWindow.getTitle().then((title) => {
expect(title === 'Symphony | Secure Seamless Communication').toBeTruthy();
done();
}).catch((err) => {
done.fail(new Error(`notificationPosition failed in getTitle with error: ${err}`));
});
}).catch((err) => {
done.fail(new Error(`notificationPosition failed in windowByIndex with error: ${err}`));
});
});
it('should open notification and close', (done) => {
return app.client
.windowByIndex(0)
.click('#notf')
.getWindowCount().then((count) => {
expect(count === 4).toBeTruthy();
done();
}).catch((err) => {
done.fail(new Error(`notificationPosition failed in getWindowCount with error: ${err}`));
})
.windowByIndex(1).then(() => {
return app.browserWindow.getTitle().then((title) => {
expect(title === 'Electron').toBeTruthy();
done();
}).catch((err) => {
done.fail(new Error(`notificationPosition failed in getTitle with error: ${err}`));
});
}).catch((err) => {
done.fail(new Error(`notificationPosition failed in windowByIndex with error: ${err}`));
});
});
});

View File

@ -38,7 +38,7 @@ let webActions, windowAction;
/**
* The user is directed to the ACP inside Electron and does not login again
* TC-ID: 3308790
* TC-ID: 131251
* Cover scenarios in AVT-1107
*/
it('The user is directed to the ACP inside Electron and does not login again', async (done) => {

View File

@ -4,11 +4,11 @@ const WindowsActions = require('./spectronWindowsActions');
const { isMac } = require('../../js/utils/misc.js');
const constants = require('./spectronConstants.js');
const Utils = require('./spectronUtils');
let TIMEOUT_TEST_SUITE = parseInt(constants.TIMEOUT_TEST_SUITE, 10);
let app, webActions, windowsActions;
describe('Tests for Pop-Outs', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = constants.TIMEOUT_TEST_SUITE;
jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT_TEST_SUITE;
beforeAll(async (done) => {
try {

View File

@ -1,147 +0,0 @@
const Application = require('./spectronSetup');
const { isMac } = require('../../js/utils/misc');
const robot = require('robotjs');
const fs = require('fs');
const glob = require('glob');
const JSZip = require("jszip");
const WindowsActions = require('./spectronWindowsActions');
let downloadsPath, wActions;
let app = new Application({});
describe('Tests for Generating & Sharing Logs', () => {
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
beforeAll((done) => {
return app.startApplication().then((startedApp) => {
app = startedApp;
wActions = new WindowsActions(app);
getDownloadsPath().then((path) => {
downloadsPath = path;
done();
}).catch((err) => {
done.fail(new Error(`Unable to start application error: ${err}`));
});
}).catch((err) => {
done.fail(new Error(`Unable to start application error: ${err}`));
});
});
function getDownloadsPath() {
return new Promise(function (resolve, reject) {
app.client.addCommand('getDownloadsPath', function () {
return this.execute(function () {
return require('electron').remote.app.getPath('downloads');
})
});
app.client.getDownloadsPath().then((downloadsPath) => {
resolve(downloadsPath.value)
}).catch((err) => {
reject(err);
});
});
}
afterAll((done) => {
if (app && app.isRunning()) {
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
app.client.getWindowCount().then((count) => {
if (count > 0) {
app.stop().then(() => {
done();
}).catch((err) => {
done();
});
} else {
done();
}
})
} else {
done();
}
});
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(`share-logs failed in getWindowCount with error: ${err}`));
});
}).catch((err) => {
done.fail(new Error(`share-logs 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(`share-logs failed in waitUntilWindowLoaded 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(`share-logs failed in isVisible with error: ${err}`));
});
});
it('should bring the app to top', () => {
app.browserWindow.focus();
return app.browserWindow.setAlwaysOnTop(true).then(() => {
return app.browserWindow.isAlwaysOnTop().then((isOnTop) => {
expect(isOnTop).toBeTruthy();
});
});
});
it('should generate logs', (done) => {
wActions.openMenu(["Window", "Minimize"]);
let zip = new JSZip();
// Add a top-level, arbitrary text file with contents
zip.file("Hello.txt", "Hello World\n");
zip.generateNodeStream({type:'nodebuffer',streamFiles:true})
.pipe(fs.createWriteStream(downloadsPath+'/logs_symphony1.zip'))
.on('finish', function () {
// JSZip generates a readable stream with a "end" event,
// but is piped here in a writable stream which emits a "finish" event.
console.log("logs_symphony written.");
});
glob(downloadsPath + '/logs_symphony*.zip', function (err, files) {
if (err || files.length < 1) {
return done.fail(new Error(`log was not generated / file doesn't exist`));
}
let i = files.length;
files.forEach(function (file) {
fs.unlink(file, function (err) {
i--;
if (err) {
console.log('unable to delete file -> ' + file);
}
if (i <= 0) {
return done();
}
});
});
});
});
})

View File

@ -5,6 +5,7 @@ const { isMac, isWindowsOS } = require('../../js/utils/misc');
const ncp = require('ncp').ncp;
const constants = require('./spectronConstants.js');
const ui = require('./spectronInterfaces.js');
const Utils = require('./spectronUtils');
class App {
@ -27,6 +28,8 @@ class App {
async startApplication(configurations) {
try {
await Utils.killProcess("electron.exe");
await Utils.killProcess("chromedriver.exe");
this.app = await this.app.start();
await this.app.client.waitForVisible(ui.SYM_LOGO, constants.TIMEOUT_PAGE_LOAD);
if (configurations) {

View File

@ -4,6 +4,8 @@ const Utils = require('./spectronUtils');
const WindowsActions = require('./spectronWindowsActions');
const robot = require('robotjs');
const { isMac, isWindowsOS } = require('../../js/utils/misc');
let TIMEOUT_WAIT_ELEMENT = parseInt(constants.TIMEOUT_WAIT_ELEMENT, 10);
let TIMEOUT_PAGE_LOAD = parseInt(constants.TIMEOUT_PAGE_LOAD, 10);
class WebActions {
constructor(app) {
@ -11,7 +13,7 @@ class WebActions {
}
async maximizeButtonByClick() {
await this.app.client.waitForVisible(ui.MAXIMIZE_BTN, constants.TIMEOUT_WAIT_ELEMENT).click(ui.MAXIMIZE_BTN);
await this.app.client.waitForVisible(ui.MAXIMIZE_BTN, TIMEOUT_WAIT_ELEMENT).click(ui.MAXIMIZE_BTN);
}
async maximizeWindows() {
@ -22,7 +24,7 @@ class WebActions {
}
async clickMinimizeButton() {
await this.app.client.waitForVisible(ui.MINIMIZE_BTN, constants.TIMEOUT_WAIT_ELEMENT).click(ui.MINIMIZE_BTN);
await this.app.client.waitForVisible(ui.MINIMIZE_BTN, TIMEOUT_WAIT_ELEMENT).click(ui.MINIMIZE_BTN);
}
async minimizeWindows() {
@ -46,7 +48,7 @@ class WebActions {
}
async getElementByXPath(xpath) {
await this.app.client.waitForVisible(xpath, constants.TIMEOUT_WAIT_ELEMENT);
await this.app.client.waitForVisible(xpath, TIMEOUT_WAIT_ELEMENT);
var elem = this.app.client.element(xpath);
if (elem.isVisible()) {
return elem;
@ -72,7 +74,7 @@ class WebActions {
return await this.app.client.getLocation(element);
}
async clickAndWaitElementVisible(xpath, elementToVisible, timeOut = constants.TIMEOUT_WAIT_ELEMENT) {
async clickAndWaitElementVisible(xpath, elementToVisible, timeOut = TIMEOUT_WAIT_ELEMENT) {
await this.app.client.click(xpath).then(async () => {
await this.app.client.waitForVisible(elementToVisible, timeOut);
});
@ -98,12 +100,12 @@ class WebActions {
return;
}
async clickIfElementVisible(selector, timeOut = constants.TIMEOUT_WAIT_ELEMENT) {
async clickIfElementVisible(selector, timeOut = TIMEOUT_WAIT_ELEMENT) {
await this.app.client.waitForVisible(selector, timeOut)
.click(selector)
}
async rightClickIfElementVisible(selector, timeOut = constants.TIMEOUT_WAIT_ELEMENT) {
async rightClickIfElementVisible(selector, timeOut = TIMEOUT_WAIT_ELEMENT) {
await this.app.client.waitForVisible(selector, timeOut)
.rightClick(selector, 10, 10)
}
@ -173,12 +175,12 @@ class WebActions {
await this.app.client.setValue(el, data);
}
async clickAndWaitElementVisible(xpath, elementToVisible, timeOut = constants.TIMEOUT_WAIT_ELEMENT) {
async clickAndWaitElementVisible(xpath, elementToVisible, timeOut = TIMEOUT_WAIT_ELEMENT) {
await this.app.client.click(xpath);
await this.app.client.waitForVisible(elementToVisible, timeOut);
}
async clickIfElementVisible(xpath, timeOut = constants.TIMEOUT_WAIT_ELEMENT) {
async clickIfElementVisible(xpath, timeOut = TIMEOUT_WAIT_ELEMENT) {
await this.app.client.waitForVisible(xpath, timeOut)
.click(xpath)
}
@ -187,17 +189,17 @@ class WebActions {
await this.inputText(ui.SIGN_IN_EMAIL, user.username);
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, TIMEOUT_PAGE_LOAD);
//await this.waitElementNotVisible(ui.SPINNER);
}
async persistToastIM(isPersistance) {
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.SETTTING_BUTTON, ui.ALERT_OPTION, TIMEOUT_WAIT_ELEMENT);
await this.clickAndWaitElementVisible(ui.ALERT_OPTION, ui.ALERT_TAB, 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, TIMEOUT_WAIT_ELEMENT);
}
else if (isPersistance === false) {
await this.scrollAndClick(ui.SCROLL_TAB_ACTIVE, ui.PERSIS_NOTIFICATION_INPUT_IM);
@ -206,9 +208,9 @@ class WebActions {
}
async openACP() {
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.ACP_LINK, ui.IMG_ADMIN_LOGO, constants.TIMEOUT_WAIT_ELEMENT * 10);
await this.clickAndWaitElementVisible(ui.SETTTING_BUTTON, ui.GENERAL_OPTION, TIMEOUT_WAIT_ELEMENT);
await this.clickAndWaitElementVisible(ui.GENERAL_OPTION, ui.GENERAL_TAB, TIMEOUT_WAIT_ELEMENT);
await this.clickAndWaitElementVisible(ui.ACP_LINK, ui.IMG_ADMIN_LOGO, TIMEOUT_WAIT_ELEMENT * 10);
}
@ -217,12 +219,12 @@ class WebActions {
}
async clickStartChat() {
await this.clickIfElementVisible(ui.START_CHAT, constants.TIMEOUT_WAIT_ELEMENT * 5);
await this.clickIfElementVisible(ui.START_CHAT, TIMEOUT_WAIT_ELEMENT * 5);
}
async logout() {
await this.clickAndWaitElementVisible(ui.ADMIN_NAME, ui.ADMIN_LOG_OUT, constants.TIMEOUT_WAIT_ELEMENT);
await this.clickAndWaitElementVisible(ui.ADMIN_LOG_OUT, ui.SIGN_IN_BUTTON, constants.TIMEOUT_WAIT_ELEMENT);
await this.clickAndWaitElementVisible(ui.ADMIN_NAME, ui.ADMIN_LOG_OUT, TIMEOUT_WAIT_ELEMENT);
await this.clickAndWaitElementVisible(ui.ADMIN_LOG_OUT, ui.SIGN_IN_BUTTON, TIMEOUT_WAIT_ELEMENT);
}
async selectIMTab() {
@ -236,14 +238,14 @@ class WebActions {
async clickDoneButton() {
await this.clickIfElementVisible(ui.CREATE_IM_DONE_BTN);
await this.waitElementVisible(ui.HEADER_MODULE, constants.TIMEOUT_WAIT_ELEMENT * 5);
await this.waitElementVisible(ui.HEADER_MODULE, TIMEOUT_WAIT_ELEMENT * 5);
}
async waitElementNotVisible(locator, timeOut = constants.TIMEOUT_WAIT_ELEMENT) {
async waitElementNotVisible(locator, timeOut = TIMEOUT_WAIT_ELEMENT) {
return await this.app.client.waitForVisible(locator, timeOut, true);
}
async waitElementVisible(locator, timeOut = constants.TIMEOUT_WAIT_ELEMENT) {
async waitElementVisible(locator, timeOut = TIMEOUT_WAIT_ELEMENT) {
return await this.app.client.waitForVisible(locator, timeOut);
}
@ -268,14 +270,14 @@ class WebActions {
await this.clickIfElementVisible(ui.POPOUT_BUTTON);
let index = await windowsActions.getWindowCount() - 1;
await windowsActions.windowByIndex(index);
await this.waitElementNotVisible(ui.SPINNER, constants.TIMEOUT_PAGE_LOAD);
await this.waitElementNotVisible(ui.SPINNER, 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 this.mouseOver(ui.HEADER_MODULE);
await Utils.sleep(2); //wait popin button clickable
await this.clickIfElementVisible(ui.POPIN_BUTTON);
await windowsActions.windowByIndex(0);
@ -287,21 +289,21 @@ class WebActions {
await this.clickIfElementVisible(ui.POPOUT_INBOX_BUTTON);
let index = await windowsActions.getWindowCount() - 1;
await windowsActions.windowByIndex(index);
await this.waitElementNotVisible(ui.SPINNER, constants.TIMEOUT_PAGE_LOAD);
await this.waitElementNotVisible(ui.SPINNER, TIMEOUT_PAGE_LOAD);
}
async verifyPopInIconDisplay(windowTitle) {
let windowsActions = await new WindowsActions(this.app);
let index = await windowsActions.getWindowIndexFromTitle(windowTitle);
await windowsActions.windowByIndex(index);
await this.waitElementVisible(ui.POPIN_BUTTON, constants.TIMEOUT_WAIT_ELEMENT);
await this.waitElementVisible(ui.POPIN_BUTTON, TIMEOUT_WAIT_ELEMENT);
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 * 5);
await this.waitElementVisible(ui.POPOUT_BUTTON, TIMEOUT_WAIT_ELEMENT * 5);
}
async clickInboxIcon() {
@ -316,7 +318,7 @@ class WebActions {
async logout() {
await this.openAlertsSettings();
await this.clickAndWaitElementVisible(ui.SIGNOUT, ui.SIGNOUT_MODAL_BUTTON);
await this.clickAndWaitElementVisible(ui.SIGNOUT_MODAL_BUTTON, ui.SIGN_IN_BUTTON, constants.TIMEOUT_PAGE_LOAD);
await this.clickAndWaitElementVisible(ui.SIGNOUT_MODAL_BUTTON, ui.SIGN_IN_BUTTON, TIMEOUT_PAGE_LOAD);
}
async verifyElementExist(findElement) {
@ -328,7 +330,7 @@ class WebActions {
async logintoAdmin(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.IMG_ADMIN_LOGO, constants.TIMEOUT_PAGE_LOAD);
await this.clickAndWaitElementVisible(ui.SIGN_IN_BUTTON, ui.IMG_ADMIN_LOGO, TIMEOUT_PAGE_LOAD);
}
async openNotificationPosition() {
@ -362,7 +364,7 @@ class WebActions {
async verifyChatModuleVisible(muduleName) {
let locator = ui.HEADER_MODULE_NAME.replace("$$", muduleName);
await this.waitElementVisible(locator, constants.TIMEOUT_WAIT_ELEMENT * 5);
await this.waitElementVisible(locator, TIMEOUT_WAIT_ELEMENT * 5);
}
async closeAllGridModules() {
@ -415,7 +417,6 @@ class WebActions {
async verifyVersionInfo(){
const { buildNumber } = require('../../package');
const electronVersion = require('../../package').devDependencies.electron;
const bluebird = require('bluebird');
const API_VERSION = '2.0.0';
const SEARCH_API_VERSION = '3.0.0';
@ -427,7 +428,6 @@ class WebActions {
'#build-number',
'#search-api-ver'
]).mapSeries((string) => {return this.app.client.getText(string)});
await console.log(values);
await expect(values[ 0 ]).toBe(API_VERSION);
await expect(values[ 1 ]).toBe('Electron');
await expect(values[ 2 ]).toBe(ELECTRON_VERSION);

View File

@ -5,6 +5,8 @@ const Utils = require('./spectronUtils');
var assert = require('assert');
const ui = require('./spectronInterfaces.js');
const specconst = require('./spectronConstants.js');
let TIMEOUT_WAIT_ELEMENT = parseInt(specconst.TIMEOUT_WAIT_ELEMENT, 10);
let TIMEOUT_PAGE_LOAD = parseInt(specconst.TIMEOUT_PAGE_LOAD, 10);
class WebDriver {
constructor(options) {
@ -18,9 +20,9 @@ class WebDriver {
try {
const el = await this.driver.wait(
until.elementLocated(By.xpath(xpath)),
specconst.TIMEOUT_WAIT_ELEMENT
TIMEOUT_WAIT_ELEMENT
)
await this.driver.wait(until.elementIsNotVisible(el), specconst.TIMEOUT_WAIT_ELEMENT);
await this.driver.wait(until.elementIsNotVisible(el), TIMEOUT_WAIT_ELEMENT);
if (this.driver.findElements(By.xpath(xpath)).length > 0) {
result = true;
}
@ -45,22 +47,22 @@ class WebDriver {
async waitElementVisibleAndGet(xpath) {
const el = await this.driver.wait(
until.elementLocated(By.xpath(xpath)),
specconst.TIMEOUT_WAIT_ELEMENT
TIMEOUT_WAIT_ELEMENT
)
return await this.driver.wait(until.elementIsVisible(el), specconst.TIMEOUT_WAIT_ELEMENT)
return await this.driver.wait(until.elementIsVisible(el), TIMEOUT_WAIT_ELEMENT)
}
async getElementById(id) {
const el = await this.driver.wait(until.elementLocated(By.id(id)), specconst.TIMEOUT_WAIT_ELEMENT)
return await this.driver.wait(until.elementIsVisible(el), specconst.TIMEOUT_WAIT_ELEMENT)
const el = await this.driver.wait(until.elementLocated(By.id(id)), TIMEOUT_WAIT_ELEMENT)
return await this.driver.wait(until.elementIsVisible(el), TIMEOUT_WAIT_ELEMENT)
}
async getElementByXPath(xpath) {
const el = await this.driver.wait(
until.elementLocated(By.xpath(xpath)),
specconst.TIMEOUT_WAIT_ELEMENT
TIMEOUT_WAIT_ELEMENT
)
return await this.driver.wait(until.elementIsVisible(el), specconst.TIMEOUT_WAIT_ELEMENT)
return await this.driver.wait(until.elementIsVisible(el), TIMEOUT_WAIT_ELEMENT)
}
async inputText(el, data) {
@ -90,7 +92,7 @@ class WebDriver {
await this.inputText(ui.SIGN_IN_PASSWORD, user.password);
var singin = await this.getElementByXPath(ui.SIGN_IN_BUTTON);
await singin.click();
await this.waitElelmentIsVisible(ui.SETTTING_BUTTON, specconst.TIMEOUT_PAGE_LOAD);
await this.waitElelmentIsVisible(ui.SETTTING_BUTTON, TIMEOUT_PAGE_LOAD);
}
async mentionUserOnChat(user) {
@ -185,7 +187,7 @@ class WebDriver {
var el = await this.getElementByXPath(xpath);
await el.click();
var eheader = await this.getElementByXPath(ui.HEADER_MODULE);
await this.driver.wait(until.elementIsVisible(eheader), specconst.TIMEOUT_WAIT_ELEMENT)
await this.driver.wait(until.elementIsVisible(eheader), TIMEOUT_WAIT_ELEMENT)
}
async createRoom(usernames, name, description, type) {

View File

@ -365,6 +365,7 @@ class WindowsActions {
}
async verifyNotPersistToastNotification() {
let webAction = await new WebActions(this.app);
let i = 0;
while (i < 3) {
await Utils.sleep(1);

View File

@ -5,10 +5,11 @@ const constants = require('./spectronConstants.js');
const path = require('path');
const ui = require('./spectronInterfaces.js');
const { isWindowsOS } = require('../../js/utils/misc.js');
let TIMEOUT_TEST_SUITE = parseInt(constants.TIMEOUT_TEST_SUITE, 10);
let app, windowsActions, webActions;
describe('Tests for spellChecker', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = constants.TIMEOUT_TEST_SUITE;
jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT_TEST_SUITE;
beforeAll(async (done) => {
try {

View File

@ -11,9 +11,10 @@ const WebActions = require('./spectronWebActions');
const specconst = require('./spectronConstants.js');
const Utils = require('./spectronUtils');
const ifc = require('./spectronInterfaces.js');
let TIMEOUT_TEST_SUITE = parseInt(specconst.TIMEOUT_TEST_SUITE, 10);
!isMac ? describe('Verify Flash notification in taskbar option when multiple applications are opened', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = specconst.TIMEOUT_TEST_SUITE;
jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT_TEST_SUITE;
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
beforeAll(async (done) => {
try {
@ -52,7 +53,6 @@ const ifc = require('./spectronInterfaces.js');
await webdriver.createIM(specconst.USER_B.username);
await webdriver.createMIM([specconst.USER_B.username, specconst.USER_C.username]);
await webActions.login(specconst.USER_B);
await windowAction.reload();
await app.client.waitForVisible(ifc.SETTTING_BUTTON, Utils.toMs(50));
await windowAction.pressCtrlM();
await webdriver.clickLeftNavItem(specconst.USER_B.name);

View File

@ -8,10 +8,11 @@ const WebActions = require('./spectronWebActions');
const specconst = require('./spectronConstants.js');
const Utils = require('./spectronUtils');
const ifc = require('./spectronInterfaces.js');
let TIMEOUT_TEST_SUITE = parseInt(specconst.TIMEOUT_TEST_SUITE, 10);
!isMac ? describe('Verify toast notification for IMs', () => {
let originalTimeout = specconst.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = specconst.TIMEOUT_TEST_SUITE;
jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT_TEST_SUITE;
beforeAll(async (done) => {
try {
@ -49,7 +50,6 @@ const ifc = require('./spectronInterfaces.js');
await webdriver.closeAllGridModules();
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(30));
await webActions.persistToastIM(false);
await windowAction.pressCtrlM();

View File

@ -6,12 +6,11 @@ const { isMac } = require('../../js/utils/misc.js');
const constants = require('./spectronConstants.js');
const ui = require('./spectronInterfaces.js');
const Utils = require('./spectronUtils');
let TIMEOUT_TEST_SUITE = parseInt(constants.TIMEOUT_TEST_SUITE, 10);
let app, webDriver, webActions, windowsActions;
!isMac ? describe('Tests for Toast Notification ', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = constants.TIMEOUT_TEST_SUITE;
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT_TEST_SUITE;
beforeAll(async (done) => {
try {
@ -22,7 +21,6 @@ let app, webDriver, webActions, windowsActions;
await webDriver.startDriver();
await webActions.login(constants.USER_A);
await windowsActions.bringToFront("Symphony");
await windowsActions.reload(); //workaround to show topbar menu
await webDriver.login(constants.USER_B);
done();
} catch (err) {

View File

@ -8,9 +8,10 @@ const WindowsAction = require('./spectronWindowsActions');
const WebActions = require('./spectronWebActions');
const ifc = require('./spectronInterfaces.js');
const specconst = require('./spectronConstants.js');
let TIMEOUT_TEST_SUITE = parseInt(specconst.TIMEOUT_TEST_SUITE, 10);
!isMac ? describe('Verify toast notification when Persist Notification is ON', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = specconst.TIMEOUT_TEST_SUITE;
jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT_TEST_SUITE;
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
beforeAll(async(done) => {
try
@ -51,7 +52,6 @@ const specconst = require('./spectronConstants.js');
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(30));
await webActions.persistToastIM(true);

View File

@ -13,7 +13,7 @@ describe('Tests for Zoom in and Zoom out', () => {
beforeAll(async (done) => {
try {
app = await mainApp.startApplication({ alwaysOnTop: false });
app = await mainApp.startApplication({ alwaysOnTop: true });
await Utils.sleep(2);
wActions = await new WindowsActions(app);
config = await getConfigPath(app);
@ -67,46 +67,6 @@ describe('Tests for Zoom in and Zoom out', () => {
}
});
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(`zoom-in-zoom-out failed in getWindowCount with error: ${err}`));
});
}).catch((err) => {
done.fail(new Error(`zoom-in-zoom-out 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(`zoom-in-zoom-out failed in waitUntilWindowLoaded 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(`zoom-in-zoom-out failed in isVisible with error: ${err}`));
});
});
it('should bring the app to top', () => {
app.browserWindow.focus();
return app.browserWindow.setAlwaysOnTop(true).then(() => {
return app.browserWindow.isAlwaysOnTop().then((isOnTop) => {
expect(isOnTop).toBeTruthy();
});
});
});
it('should zoom in the app and check whether it is zoomed in', async (done) => {
if (!isMac) {
await robot.setKeyboardDelay(500);