mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
AVT-1083: Verify Flash notification in taskbar option when multiple applications are opened (#459)
* AVT-1083 add new test * update code * remove check isMac
This commit is contained in:
parent
7fb6c4c407
commit
6629d5c67c
@ -82,24 +82,6 @@ class WebActions {
|
||||
return;
|
||||
}
|
||||
|
||||
async promiseTimeout(ms, promiseFunc) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
// create a timeout to reject promise if not resolved
|
||||
var timer = setTimeout(function () {
|
||||
reject(new Error("promise timeout"));
|
||||
}, ms);
|
||||
promiseFunc
|
||||
.then(function (res) {
|
||||
clearTimeout(timer);
|
||||
resolve(res);
|
||||
})
|
||||
.catch(function (err) {
|
||||
clearTimeout(timer);
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
async clickIfElementVisible(selector, timeOut = constants.TIMEOUT_WAIT_ELEMENT) {
|
||||
await this.app.client.waitForVisible(selector, timeOut)
|
||||
.click(selector)
|
||||
|
@ -31,20 +31,7 @@ class WebDriver {
|
||||
catch (err) {
|
||||
await assert.equal(result, false);
|
||||
}
|
||||
}
|
||||
|
||||
async waitElelmentIsVisible(xpath,timeout) {
|
||||
try {
|
||||
const el = await this.driver.wait(
|
||||
until.elementLocated(By.xpath(xpath)),
|
||||
specconst.TIMEOUT_WAIT_ELEMENT
|
||||
)
|
||||
await this.driver.wait(until.elementIsVisible(el), timeout);
|
||||
}
|
||||
catch (err) {
|
||||
console.log("Error:"+err.messages);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async waitElementVisibleAndGet(xpath) {
|
||||
const el = await this.driver.wait(
|
||||
@ -265,7 +252,7 @@ class WebDriver {
|
||||
await this.driver.wait(until.elementIsVisible(el), timeout);
|
||||
}
|
||||
catch (err) {
|
||||
console.log("Error:"+err.messages);
|
||||
console.error(`Error wait element is visible: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,5 +262,16 @@ class WebDriver {
|
||||
async close() {
|
||||
await this.driver.close();
|
||||
}
|
||||
|
||||
async sendMessagesAndVerifyToast(messages) {
|
||||
for (var i = 0; i < messages.length; i++) {
|
||||
await this.sendMessage(messages[i]).then(async() =>
|
||||
{
|
||||
await this.webAction.verifyToastNotificationShow(messages[i])
|
||||
}).catch((err) => {
|
||||
console.error(`Toast notification is not show: ${err}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = WebDriver;
|
@ -0,0 +1,67 @@
|
||||
const Application = require('./spectronSetup');
|
||||
const WebDriver = require('./spectronWebDriver');
|
||||
const { isMac } = require('../../js/utils/misc.js');
|
||||
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 specconst = require('./spectronConstants.js');
|
||||
const Utils = require('./spectronUtils');
|
||||
const ifc = require('./spectronInterfaces.js');
|
||||
let webActions, windowAction;
|
||||
|
||||
!isMac ? describe('Verify Flash notification in taskbar option when multiple applications are opened', () => {
|
||||
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);
|
||||
webdriver.webAction = webActions;
|
||||
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 Flash notification in taskbar option when multiple applications are opened
|
||||
* TC-ID: 47308146
|
||||
* Cover scenarios in AVT-1083
|
||||
*/
|
||||
it('Verify Flash notification in taskbar option when multiple applications are opened', 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);
|
||||
let messages = [];
|
||||
await messages.push(await Utils.randomString());
|
||||
await messages.push(await Utils.randomString());
|
||||
await messages.push(await Utils.randomString());
|
||||
await webdriver.sendMessagesAndVerifyToast(messages);
|
||||
|
||||
});
|
||||
|
||||
}) : describe.skip();
|
||||
|
Loading…
Reference in New Issue
Block a user