fix and review

This commit is contained in:
Tran Duc Anh
2018-09-12 10:09:57 +07:00
parent 29a0780d65
commit 220797dbbd
14 changed files with 214 additions and 349 deletions

View File

@@ -1,20 +1,25 @@
const Application = require('./spectronSetup'); const Application = require('./spectronSetup');
const path = require('path'); const path = require('path');
const WebActions = require('./spectronWebActions');
let app = new Application({}); const ifc = require('./spectronInterfaces.js');
let mainApp = new Application({});
let app,webActions;
describe('Tests for clipboard', () => { describe('Tests for clipboard', () => {
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL; let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut(); jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
beforeAll((done) => { beforeAll(async (done) => {
return app.startApplication().then((startedApp) => { try {
app = startedApp; let testHost = await 'file:///' + path.join(__dirname, '..', '..', 'demo/index.html');
done(); app = await mainApp.startApplication({testedHost:testHost, alwaysOnTop: false });
}).catch((err) => { webActions = await new WebActions(app);
webActions.fillTagText("Test")
await done();
} catch (err) {
done.fail(new Error(`Unable to start application error: ${err}`)); done.fail(new Error(`Unable to start application error: ${err}`));
}); };
}); });
afterAll((done) => { afterAll((done) => {
@@ -28,48 +33,17 @@ describe('Tests for clipboard', () => {
} }
}); });
it('should launch the app', (done) => { it('should verify electron clipboard', async () => {
return app.client.waitUntilWindowLoaded().then(() => { let valueTag = await app.client.getValue(ifc.TAG_TEXTBOX);
return app.client.getWindowCount().then((count) => { await app.electron.clipboard.writeText(valueTag);
expect(count === 1).toBeTruthy(); let clipboardText = await app.electron.clipboard.readText();
done(); expect(clipboardText === valueTag).toBeTruthy();
}).catch((err) => { let tempText = "Testing copy";
done.fail(new Error(`clipboard failed in getWindowCount with error: ${err}`)); await app.electron.clipboard.writeText(tempText);
}); clipboardText = await app.electron.clipboard.readText();
}).catch((err) => { await app.client.setValue(ifc.TAG_TEXTBOX, clipboardText);
done.fail(new Error(`clipboard failed in waitUntilWindowLoaded with error: ${err}`)); valueTag = await app.client.getValue(ifc.TAG_TEXTBOX);
}); expect(clipboardText === valueTag).toBeTruthy();
});
it('should check window count', () => {
return app.client.url('file:///' + path.join(__dirname, '..', '..', 'demo/index.html'));
});
it('should set the username field', () => {
return app.client
.windowByIndex(0)
.setValue('#tag', 'Test')
.getValue('#tag').then((value) => {
expect(value === 'Test').toBeTruthy();
});
});
it('should verify electron clipboard', () => {
return app.client
.getValue('#tag').then((value) => {
return app.electron.clipboard.writeText(value)
.electron.clipboard.readText().then((clipboardText) => {
expect(clipboardText === 'Test').toBeTruthy();
});
});
});
it('should verify electron clipboard copy', () => {
return app.electron.clipboard.writeText('Testing copy')
.electron.clipboard.readText().then((clipboardText) => {
return app.client.setValue('#tag', clipboardText).getValue('#tag').then((value) => {
expect(value === 'Testing copy').toBeTruthy();
});
});
}); });
}); });

View File

@@ -29,12 +29,11 @@ describe('Tests for Close', () => {
} }
}); });
it('should close the app', () => { it('should check whether the app is running', async (done) => {
return app.stop(); await app.stop();
}); let isRun = await app.isRunning();
await expect(isRun).toBe(false);
it('should check whether the app is running', () => { await done();
expect(app.isRunning()).toBe(false);
}); });
}); });

View File

@@ -6,8 +6,6 @@ const Utils = require('./spectronUtils');
let mainApp = new Application({}); let mainApp = new Application({});
let app, wActions, config, userConfig; let app, wActions, config, userConfig;
describe('Add Test To Verify Minimize on Close', () => { describe('Add Test To Verify Minimize on Close', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 120000; jasmine.DEFAULT_TIMEOUT_INTERVAL = 120000;
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL; let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
@@ -46,7 +44,6 @@ describe('Add Test To Verify Minimize on Close', () => {
try { try {
if (app && app.isRunning()) { if (app && app.isRunning()) {
if (isMac) { if (isMac) {
//await wActions.closeChromeDriverOnMac();
await app.stop(); await app.stop();
} }
else { else {
@@ -70,33 +67,12 @@ describe('Add Test To Verify Minimize on Close', () => {
try { try {
userConfig = await Application.readConfig(config); userConfig = await Application.readConfig(config);
if (userConfig.minimizeOnClose == false) { if (userConfig.minimizeOnClose == false) {
if (!isMac) { await wActions.openMinimizeAndClose(1, 1);
await wActions.openMenu(["Window", "Minimize on Close"]); await wActions.verifyMinimizeWindows();
await wActions.openMenu(["Window", "Close"]);
}
else {
await wActions.openMenuOnMac(["View", "Minimize on Close"]);
await wActions.openMenuOnMac(["Window", "Close"]);
}
await wActions.verifyMinimizeWindows()
await done(); await done();
} }
else { else {
if (!isMac) { wActions.openMinimizeAndClose(2, 1);
await wActions.openMenu(["Window", "Minimize on Close"]);
await wActions.openMenu(["Window", "Minimize on Close"])
await wActions.openMenu(["Window", "Close"]);
}
else {
await wActions.openMenuOnMac(["View", "Minimize on Close"]);
await wActions.openMenuOnMac(["View", "Minimize on Close"]);
await wActions.openMenuOnMac(["Window", "Close"]);
}
await wActions.verifyMinimizeWindows(); await wActions.verifyMinimizeWindows();
await done(); await done();
} }
@@ -117,73 +93,54 @@ describe('Add Test To Verify Minimize on Close', () => {
try { try {
await wActions.bringToFront("Symphony"); await wActions.bringToFront("Symphony");
await wActions.openMinimizeAndClose(2, 1);
if (!isMac) { await wActions.verifyMinimizeWindows();
await wActions.openMenu(["Window", "Minimize on Close"]);
await wActions.openMenu(["Window", "Minimize on Close"])
await wActions.openMenu(["Window", "Close"]);
}
else {
await wActions.openMenuOnMac(["View", "Minimize on Close"]);
await wActions.openMenuOnMac(["View", "Minimize on Close"]);
await wActions.openMenuOnMac(["Window", "Close"]);
}
await wActions.verifyMinimizeWindows()
await wActions.bringToFront("Symphony"); await wActions.bringToFront("Symphony");
await Utils.sleep(2); await Utils.sleep(2);
if (!isMac) if (!isMac)
{
await wActions.pressCtrlW(); await wActions.pressCtrlW();
}
else else
await wActions.pressCtrlWOnMac() {
await wActions.pressCtrlWOnMac();
}
await wActions.verifyMinimizeWindows(); await wActions.verifyMinimizeWindows();
await done() await done();
} catch (err) { } catch (err) {
done.fail(new Error(`Close window when "Minimize on Close" is ON: ${err}`)); done.fail(new Error(`Close window when "Minimize on Close" is ON: ${err}`));
}; };
}); });
// /** /**
// * Verify by deselecting Minimize on Close option once the application is launched * Verify by deselecting Minimize on Close option once the application is launched
// * TC-ID: 3084612 * TC-ID: 3084612
// * Cover scenarios in AVT-938 * Cover scenarios in AVT-938
// */ */
it('Verify by deselecting Minimize on Close option once the application is launched', async (done) => { it('Verify by deselecting Minimize on Close option once the application is launched', async (done) => {
try { try {
//userConfig = await Application.readConfig(config);
await wActions.bringToFront("Symphony"); await wActions.bringToFront("Symphony");
let count = await app.client.getWindowCount(); let count = await app.client.getWindowCount();
if (!isMac) { await wActions.openMinimizeAndClose(1, 1);
await wActions.openMenu(["Window", "Minimize on Close"]);
}
else {
await wActions.openMenuOnMac(["View", "Minimize on Close"]);
}
if (!isMac) {
await wActions.openMenu(["Window", "Close"]);
}
else {
await wActions.openMenuOnMac(["Window", "Close"]);
}
try { try {
count = await app.client.getWindowCount() count = await app.client.getWindowCount();
} }
catch (err1) { catch (err1) {
count = 0; count = 0;
} }
if (!isMac) { finally {
await expect(count === 0).toBeTruthy(); if (!isMac) {
await expect(count === 0).toBeTruthy();
}
else {
await expect(count === 1).toBeTruthy();
}
await done();
} }
else {
await expect(count === 1).toBeTruthy();
}
await done();
} catch (err) { } catch (err) {
done.fail(new Error(`should check whether the app is minimized: ${err}`)); done.fail(new Error(`should check whether the app is minimized: ${err}`));
}; };
}) })
}); })

View File

@@ -1,114 +0,0 @@
const Application = require('./spectronSetup');
const { isMac } = require('../../js/utils/misc');
const robot = require('robotjs');
const WindowsActions = require('./spectronWindowsActions');
const Utils = require('./spectronUtils');
let configPath,wActions,app;
let mainApp = new Application({});
!isMac? describe('Tests for Minimize on Close', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
beforeAll(async (done) => {
try {
app = await mainApp.startApplication({ alwaysOnTop: false });
await Utils.sleep(2);
wActions = await new WindowsActions(app);
configPath = await getConfigPath();
await wActions.focusWindow();
await done();
} catch (err) {
done.fail(new Error(`Unable to start application error: ${err}`));
};
});
function getConfigPath() {
return new Promise(function (resolve, reject) {
app.client.addCommand('getUserDataPath', function () {
return this.execute(function () {
return require('electron').remote.app.getPath('userData');
})
});
app.client.getUserDataPath().then((userConfigPath) => {
resolve(userConfigPath.value)
}).catch((err) => {
reject(err);
});
});
}
afterAll(async (done) => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
try {
if (app && app.isRunning()) {
done();
wActions.closeChrome();
}
} catch (error) {
done.fail(new Error(`After all: ${error}`));
}
});
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(`minimize-on-close failed in getWindowCount with error: ${err}`));
});
}).catch((err) => {
done.fail(new Error(`minimize-on-close 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(`minimize-on-close failed in getWindowCount 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(`minimize-on-close 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 check whether the app is minimized', async(done) => {
try {
let userConfig = await Application.readConfig(configPath);
await wActions.focusWindow();
await wActions.openMenu(["Window", "Minimize on Close"]);
if (userConfig.minimizeOnClose == false) {
await wActions.openMenu(["Window", "Minimize on Close"]);
}
await wActions.openMenu(["Window", "Close"])
await Utils.sleep(5);
let status = await wActions.isElectronProcessRunning() ;
await console.log(status);
await expect(status === false).toBeTruthy();
await done();
} catch (err) {
done.fail(new Error(`should check whether the app is minimized: ${err}`));
};
});
}) : describe.skip();

View File

@@ -12,8 +12,8 @@ describe('Tests for Notification position', () => {
beforeAll(async (done) => { beforeAll(async (done) => {
try { try {
let testHost = await 'file:///' + path.join(__dirname, '..', '..', 'demo/index.html') let testHost = await 'file:///' + path.join(__dirname, '..', '..', 'demo/index.html');
app = await mainApp.startApplication({testedHost:testHost, alwaysOnTop: false }) app = await mainApp.startApplication({testedHost:testHost, alwaysOnTop: false });
await done(); await done();
} catch (err) { } catch (err) {
done.fail(new Error(`Unable to start application error: ${err}`)); done.fail(new Error(`Unable to start application error: ${err}`));

View File

@@ -1,11 +1,7 @@
const Application = require('./spectronSetup'); const Application = require('./spectronSetup');
const WebDriver = require('./spectronWebDriver');
const { isMac } = require('../../js/utils/misc.js'); const { isMac } = require('../../js/utils/misc.js');
const Utils = require('./spectronUtils'); const Utils = require('./spectronUtils');
var app = new Application({ var app = new Application({});
startTimeout: 1200000,
waitTimeout: 1200000
});
const WindowsAction = require('./spectronWindowsActions'); const WindowsAction = require('./spectronWindowsActions');
const WebActions = require('./spectronWebActions'); const WebActions = require('./spectronWebActions');
const ifc = require('./spectronInterfaces.js'); const ifc = require('./spectronInterfaces.js');
@@ -13,7 +9,8 @@ const specconst = require('./spectronConstants.js');
let webActions, windowAction; let webActions, windowAction;
!isMac ? describe(' Open ACP inside Electron when clicking on the "Go to AC portal"', () => { !isMac ? describe(' Open ACP inside Electron when clicking on the "Go to AC portal"', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1200000; jasmine.DEFAULT_TIMEOUT_INTERVAL = 600000;
let originalTimeout = Application.getTimeOut();
beforeAll(async (done) => { beforeAll(async (done) => {
try { try {
app = await new Application({}).startApplication({ testedHost: specconst.TESTED_HOST, alwaysOnTop: true }); app = await new Application({}).startApplication({ testedHost: specconst.TESTED_HOST, alwaysOnTop: true });
@@ -25,12 +22,16 @@ let webActions, windowAction;
}; };
}); });
afterAll(async (done) => { afterAll(async (done) => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
try { try {
if (app && app.isRunning()) { if (app && app.isRunning()) {
await app.stop(); await app.stop();
await windowAction.closeChromeDriver();
done(); done();
} }
} catch (err) { } catch (err) {
await app.stop();
await windowAction.closeChromeDriver();
done.fail(new Error(`Failed at post-condition: ${err}`)); done.fail(new Error(`Failed at post-condition: ${err}`));
}; };
}); });
@@ -40,15 +41,18 @@ let webActions, windowAction;
* TC-ID: 3308790 * TC-ID: 3308790
* Cover scenarios in AVT-1107 * Cover scenarios in AVT-1107
*/ */
it('The user is directed to the ACP inside Electron and does not login again', async () => { it('The user is directed to the ACP inside Electron and does not login again', async (done) => {
try {
await webActions.login(specconst.USER_A); await webActions.login(specconst.USER_A);
await app.client.waitForVisible(ifc.SETTTING_BUTTON, Utils.toMs(50)); await app.client.waitForVisible(ifc.SETTTING_BUTTON, Utils.toMs(50));
await windowAction.pressF11(); await windowAction.pressF11();
await webActions.openACP(); await webActions.openACP();
await webActions.verifyElementExist(ifc.IMG_ADMIN_LOGO); await app.client.waitForVisible(ifc.IMG_ADMIN_LOGO, Utils.toMs(20));
await webActions.verifyElementExist(ifc.IMG_ADMIN_LOGO);
await done();
} catch (err) {
done.fail(new Error(`Fail to verify open ACP: ${err}`));
};
}); });
}) : describe.skip(); }) : describe.skip();

View File

@@ -11,7 +11,7 @@ module.exports = {
"root": { "root": {
name: "menu", step: 0, items: [ name: "menu", step: 0, items: [
{ name: "Edit", step: 0, items: [{ name: "Undo", step: 0 }, { name: "Redo", step: 1 }, { name: "Cut", step: 2 }, { name: "Copy", step: 3 }, { name: "Paste", step: 4 }, { name: "Paste and Match Style", step: 5 }, { name: "Delete", step: 6 }, { name: "Select All", step: 7 }] }, { name: "Edit", step: 0, items: [{ name: "Undo", step: 0 }, { name: "Redo", step: 1 }, { name: "Cut", step: 2 }, { name: "Copy", step: 3 }, { name: "Paste", step: 4 }, { name: "Paste and Match Style", step: 5 }, { name: "Delete", step: 6 }, { name: "Select All", step: 7 }] },
{ name: "View", step: 1, items: [{ name: "Reload", step: 0 }, { name: "Actual Size", step: 1 }, { name: "Zoom In", step: 2 }, { name: "Zoom Out", step: 3 }, { name: "Toogle Full Screen", step: 4 }] }, { name: "View", step: 1, items: [{ name: "Reload", step: 0 }, { name: "Actual Size", step: 1 }, { name: "Zoom In", step: 2 }, { name: "Zoom Out", step: 3 }, { name: "Toggle Full Screen", step: 4 }] },
{ name: "Window", step: 2, items: [{ name: "Minimize", step: 0 }, { name: "Close", step: 1 }, { name: "Auto Launch On Startup", step: 2 }, { name: "Always on Top", step: 3 }, { name: "Minimize on Close", step: 4 }] }, { name: "Window", step: 2, items: [{ name: "Minimize", step: 0 }, { name: "Close", step: 1 }, { name: "Auto Launch On Startup", step: 2 }, { name: "Always on Top", step: 3 }, { name: "Minimize on Close", step: 4 }] },
{ name: "Help", step: 3, items: [{ name: "Symphony Help", step: 0 }, { name: "Learn More", step: 1 }, { name: "Troubleshooting", step: 2, items: [{ name: "Show Logs in Explorer", step: 0 }] }, { name: "About Symphony", step: 3 }] } { name: "Help", step: 3, items: [{ name: "Symphony Help", step: 0 }, { name: "Learn More", step: 1 }, { name: "Troubleshooting", step: 2, items: [{ name: "Show Logs in Explorer", step: 0 }] }, { name: "About Symphony", step: 3 }] }
] ]

View File

@@ -1,4 +1,4 @@
module.exports= { module.exports = {
// Title bar // Title bar
TITLE_BAR: "#title-bar", TITLE_BAR: "#title-bar",
MAXIMIZE_BTN: "#title-bar-maximize-button", MAXIMIZE_BTN: "#title-bar-maximize-button",
@@ -57,7 +57,7 @@ module.exports= {
HEADER_MODULE_NAME: "//header[contains(@class,'module-header gs-draggable')]//span[contains(@class,'aliasable') and normalize-space()='$$']", 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_MODULE: "//button[contains(@class,'close-module')]",
CLOSE_MODULES: "(//button[contains(@class,'close-module')])[$$]", CLOSE_MODULES: "(//button[contains(@class,'close-module')])[$$]",
PIN_CHAT_MODS: "(//button[contains(@class,'pin-view')])[$$]", PIN_CHAT_MODS: "(//button[contains(@class,'pin-view')])[$$]",
//Popin Popout //Popin Popout
POPOUT_BUTTON: ".enhanced-pop-out", POPOUT_BUTTON: ".enhanced-pop-out",
@@ -91,8 +91,9 @@ module.exports= {
INPUT_SEARCH_ENTITIES: "//input[@id='search-entities']", INPUT_SEARCH_ENTITIES: "//input[@id='search-entities']",
//Symphony Electron API Demo //Symphony Electron API Demo
GET_VERSION_BUTTON: "#get-version", GET_VERSION_BUTTON: "#get-version",
OPEN_WINDOW_BUTTON: "#open-win", OPEN_WINDOW_BUTTON: "#open-win",
//Symphony Electron API Demo TAG_TEXTBOX: "#tag" //Symphony Electron API Demo
TAG_TEXTBOX: "#tag"
}; };

View File

@@ -419,21 +419,26 @@ class WebActions {
const bluebird = require('bluebird'); const bluebird = require('bluebird');
const API_VERSION = '2.0.0'; const API_VERSION = '2.0.0';
const SEARCH_API_VERSION = '3.0.0'; const SEARCH_API_VERSION = '3.0.0';
const ELECTRON_VERSION = '3.0.0';
let values = await bluebird.all([ let values = await bluebird.all([
'#api-version', '#api-version',
'#container-identifier', '#container-identifier',
'#container-ver', '#container-ver',
'#build-number', '#build-number',
'#search-api-ver' '#search-api-ver'
]).mapSeries((string) => {return this.app.client.getText(string)}) ]).mapSeries((string) => {return this.app.client.getText(string)});
await console.log(values);
await expect(values[ 0 ]).toBe(API_VERSION); await expect(values[ 0 ]).toBe(API_VERSION);
await expect(values[ 1 ]).toBe('Electron'); await expect(values[ 1 ]).toBe('Electron');
await expect(values[ 2 ]).toBe(electronVersion); await expect(values[ 2 ]).toBe(ELECTRON_VERSION);
await expect(values[ 3 ]).toBe(buildNumber); await expect(values[ 3 ]).toBe(buildNumber);
await expect(values[ 4 ]).toBe(SEARCH_API_VERSION); await expect(values[ 4 ]).toBe(SEARCH_API_VERSION);
} }
async fillTagText(value)
{
await this.inputText(ui.TAG_TEXTBOX,value)
}
} }
module.exports = WebActions; module.exports = WebActions;

View File

@@ -628,6 +628,28 @@ class WindowsActions {
} }
await expect(expected).toBeTruthy(); await expect(expected).toBeTruthy();
} }
async openMinimizeAndClose(minimizeTimes,closeTimes)
{
for (let i = 0; i < minimizeTimes; i++) {
if (!isMac) {
await this.openMenu(["Window", "Minimize on Close"]);
}
else
{
await this.openMenuOnMac(["View", "Minimize on Close"]);
}
}
for (let j = 0; j < closeTimes; j++) {
if (!isMac) {
await this.openMenu(["Window", "Close"]);
}
else
{
await this.openMenuOnMac(["Window", "Close"]);
}
}
}
} }
module.exports = WindowsActions; module.exports = WindowsActions;

View File

@@ -5,23 +5,25 @@ var app = new Application({
startTimeout: Application.getTimeOut(), startTimeout: Application.getTimeOut(),
waitTimeout: Application.getTimeOut() waitTimeout: Application.getTimeOut()
}); });
var webdriver = new WebDriver({ browser: 'chrome' }); let webdriver,webActions, windowAction;
const WindowsAction = require('./spectronWindowsActions'); const WindowsAction = require('./spectronWindowsActions');
const WebActions = require('./spectronWebActions'); const WebActions = require('./spectronWebActions');
const specconst = require('./spectronConstants.js'); const specconst = require('./spectronConstants.js');
const Utils = require('./spectronUtils'); const Utils = require('./spectronUtils');
const ifc = require('./spectronInterfaces.js'); const ifc = require('./spectronInterfaces.js');
let webActions, windowAction;
!isMac ? describe('Verify Flash notification in taskbar option when multiple applications are opened', () => { !isMac ? describe('Verify Flash notification in taskbar option when multiple applications are opened', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut(); jasmine.DEFAULT_TIMEOUT_INTERVAL = specconst.TIMEOUT_TEST_SUITE;
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL; let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
beforeAll(async (done) => { beforeAll(async (done) => {
try { try {
webdriver = await new WebDriver({ browser: 'chrome' })
app = await new Application({}).startApplication({ testedHost: specconst.TESTED_HOST, alwaysOnTop: true }); app = await new Application({}).startApplication({ testedHost: specconst.TESTED_HOST, alwaysOnTop: true });
windowAction = await new WindowsAction(app); windowAction = await new WindowsAction(app);
webActions = await new WebActions(app); webActions = await new WebActions(app);
webdriver.webAction = webActions; webdriver.windowAction = windowAction;
webdriver.webActions = webActions;
await webdriver.startDriver();
done(); done();
} catch (err) { } catch (err) {
done.fail(new Error(`Unable to start application error: ${err}`)); done.fail(new Error(`Unable to start application error: ${err}`));
@@ -46,13 +48,12 @@ let webActions, windowAction;
*/ */
it('Verify Flash notification in taskbar option when multiple applications are opened', async () => { it('Verify Flash notification in taskbar option when multiple applications are opened', async () => {
await webdriver.startDriver();
await webdriver.login(specconst.USER_A); await webdriver.login(specconst.USER_A);
await webdriver.createIM(specconst.USER_B.username); 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 webActions.login(specconst.USER_B);
await windowAction.reload(); await windowAction.reload();
await app.client.waitForVisible(ifc.SETTTING_BUTTON, Utils.toMs(50)); await app.client.waitForVisible(ifc.SETTTING_BUTTON, Utils.toMs(50));
await webActions.clickIfElementVisible(ifc.SETTTING_BUTTON);
await windowAction.pressCtrlM(); await windowAction.pressCtrlM();
await webdriver.clickLeftNavItem(specconst.USER_B.name); await webdriver.clickLeftNavItem(specconst.USER_B.name);
let messages = []; let messages = [];

View File

@@ -1,17 +1,13 @@
const Application = require('./spectronSetup'); const Application = require('./spectronSetup');
const WebDriver = require('./spectronWebDriver'); const WebDriver = require('./spectronWebDriver');
const { isMac } = require('../../js/utils/misc.js'); const { isMac } = require('../../js/utils/misc.js');
var app = new Application({ var app = new Application({});
startTimeout: Application.getTimeOut(), let webdriver, webActions, windowAction, message;
waitTimeout: Application.getTimeOut()
});
var webdriver = new WebDriver({ browser: 'chrome' });
const WindowsAction = require('./spectronWindowsActions'); const WindowsAction = require('./spectronWindowsActions');
const WebActions = require('./spectronWebActions'); const WebActions = require('./spectronWebActions');
const specconst = require('./spectronConstants.js'); const specconst = require('./spectronConstants.js');
const Utils = require('./spectronUtils'); const Utils = require('./spectronUtils');
const ifc = require('./spectronInterfaces.js'); const ifc = require('./spectronInterfaces.js');
let webActions, windowAction;
!isMac ? describe('Verify toast notification for IMs', () => { !isMac ? describe('Verify toast notification for IMs', () => {
let originalTimeout = specconst.DEFAULT_TIMEOUT_INTERVAL; let originalTimeout = specconst.DEFAULT_TIMEOUT_INTERVAL;
@@ -19,45 +15,53 @@ let webActions, windowAction;
beforeAll(async (done) => { beforeAll(async (done) => {
try { try {
webdriver = await new WebDriver({ browser: 'chrome' });
app = await new Application({}).startApplication({ testedHost: specconst.TESTED_HOST, alwaysOnTop: true }); app = await new Application({}).startApplication({ testedHost: specconst.TESTED_HOST, alwaysOnTop: true });
windowAction = await new WindowsAction(app); windowAction = await new WindowsAction(app);
webActions = await new WebActions(app); webActions = await new WebActions(app);
await webdriver.startDriver();
done(); done();
} catch (err) { } catch (err) {
done.fail(new Error(`Unable to start application error: ${err}`)); done.fail(new Error(`Unable to start application error: ${err}`));
}; };
}); });
afterAll((done) => { afterAll(async (done) => {
if (app && app.isRunning()) { try {
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout; if (app && app.isRunning()) {
app.stop().then(() => { jasmine.DEFAULT_TIMEOUT_INTERVAL = await originalTimeout;
webdriver.close(); await app.stop();
webdriver.quit(); await webdriver.quit();
done(); done();
}).catch((err) => { }
done(); } catch (err) {
}); done.fail(new Error(`Failed at post-condition: ${err}`));
} };
}); });
/** /**
* Verify toast notification for IMs * Verify toast notification for IMs
* TC-ID: 3395297 * TC-ID: 3395297
* Cover scenarios in AVT-1031 * Cover scenarios in AVT-1031
*/ */
it('Toast notification should not be closed', async () => { it('Toast notification should not be closed', async (done) => {
try {
await webdriver.startDriver(); await webdriver.startDriver();
await webdriver.login(specconst.USER_A); await webdriver.login(specconst.USER_A);
await webdriver.createIM(specconst.USER_B.username); await webdriver.closeAllGridModules();
await webActions.login(specconst.USER_B); await webdriver.createIM(specconst.USER_B.username);
await windowAction.reload(); await webActions.login(specconst.USER_B);
await app.client.waitForVisible(ifc.SETTTING_BUTTON, Utils.toMs(50)); await windowAction.reload();
await webActions.clickIfElementVisible(ifc.SETTTING_BUTTON); await app.client.waitForVisible(ifc.SETTTING_BUTTON, Utils.toMs(30));
await windowAction.pressCtrlM(); await webActions.persistToastIM(false);
await webdriver.clickLeftNavItem(specconst.USER_B.name); await windowAction.pressCtrlM();
var message = await Utils.randomString(); await webdriver.clickLeftNavItem(specconst.USER_B.name);
await webdriver.sendMessages([message]); message = await Utils.randomString();
await windowAction.verifyNotCloseToastWhenMouseOver(message); await webdriver.sendMessages([message]);
await windowAction.verifyNotCloseToastWhenMouseOver(message);
await done();
}
catch (err) {
done.fail(new Error(`Failed at toast notification should not be closed: ${err}`));
};
}); });
/** /**
@@ -65,20 +69,26 @@ let webActions, windowAction;
* TC-ID: 3395306 * TC-ID: 3395306
* Cover scenarios in AVT-1032 * Cover scenarios in AVT-1032
*/ */
it('Verify toast notification for signals, mentions and keywords', async () => { it('Verify toast notification for signals, mentions and keywords', async (done) => {
var nameSignal = await Utils.randomString(); try {
var nameHashTag = await Utils.randomString(); let nameSignal = await Utils.randomString();
var roomName = await Utils.randomString(); let nameHashTag = await Utils.randomString();
var description = await Utils.randomString(); let roomName = await Utils.randomString();
let description = await Utils.randomString();
await webdriver.createSignal(nameSignal, nameHashTag); await webdriver.createSignal(nameSignal, nameHashTag);
await webdriver.createRoom([specconst.USER_B.username], roomName, description, specconst.TYPE_ROOM.public) await webdriver.createRoom([specconst.USER_B.username], roomName, description, specconst.TYPE_ROOM.public)
await webdriver.clickLeftNavItem(roomName); await webdriver.clickLeftNavItem(roomName);
await webdriver.sendMessages(["#" + nameHashTag]); await webdriver.sendMessages(["#" + nameHashTag]);
await windowAction.verifyNotCloseToastWhenMouseOver(specconst.USER_A.name + ": #" + nameHashTag); await windowAction.verifyNotCloseToastWhenMouseOver(specconst.USER_A.name + ": #" + nameHashTag);
await webdriver.mentionUserOnChat(specconst.USER_B); 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);
await done();
}
catch (err) {
done.fail(new Error(`Failed at Verify toast notification for signals, mentions and keywords: ${err}`));
};
}); });
}) : describe.skip(); }) : describe.skip();

View File

@@ -11,6 +11,7 @@ let app, webDriver, webActions, windowsActions;
!isMac ? describe('Tests for Toast Notification ', () => { !isMac ? describe('Tests for Toast Notification ', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = constants.TIMEOUT_TEST_SUITE; jasmine.DEFAULT_TIMEOUT_INTERVAL = constants.TIMEOUT_TEST_SUITE;
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
beforeAll(async (done) => { beforeAll(async (done) => {
try { try {
@@ -33,6 +34,7 @@ let app, webDriver, webActions, windowsActions;
afterAll(async (done) => { afterAll(async (done) => {
try { try {
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
await windowsActions.stopApp(); await windowsActions.stopApp();
await webDriver.quit(); await webDriver.quit();
done(); done();

View File

@@ -3,30 +3,34 @@ const WebDriver = require('./spectronWebDriver');
const { isMac } = require('../../js/utils/misc.js'); const { isMac } = require('../../js/utils/misc.js');
const Utils = require('./spectronUtils'); const Utils = require('./spectronUtils');
var app = new Application({}); var app = new Application({});
var webdriver = new WebDriver({ browser: 'chrome' }); let webdriver,webActions, windowAction;
const WindowsAction = require('./spectronWindowsActions'); const WindowsAction = require('./spectronWindowsActions');
const WebActions = require('./spectronWebActions'); const WebActions = require('./spectronWebActions');
const ifc = require('./spectronInterfaces.js'); const ifc = require('./spectronInterfaces.js');
const specconst = require('./spectronConstants.js'); const specconst = require('./spectronConstants.js');
let webActions, windowAction;
!isMac ? describe('Verify toast notification when Persist Notification is ON', () => { !isMac ? describe('Verify toast notification when Persist Notification is ON', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 300000; jasmine.DEFAULT_TIMEOUT_INTERVAL = specconst.TIMEOUT_TEST_SUITE;
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
beforeAll(async(done) => { beforeAll(async(done) => {
try try
{ {
webdriver = await new WebDriver({ browser: 'chrome' });
app = await new Application({}).startApplication({testedHost:specconst.TESTED_HOST, alwaysOnTop: true}); app = await new Application({}).startApplication({testedHost:specconst.TESTED_HOST, alwaysOnTop: true});
windowAction = await new WindowsAction(app); windowAction = await new WindowsAction(app);
webActions = await new WebActions(app); webActions = await new WebActions(app);
await webdriver.startDriver();
windowAction.webAction = await webActions;
done(); done();
} catch(err) { } catch(err) {
done.fail(new Error(`Unable to start application error: ${err}`)); done.fail(new Error(`Unable to start application error: ${err}`));
}; };
}); })
afterAll(async (done) => { afterAll(async (done) => {
try { try {
if (app && app.isRunning()) { if (app && app.isRunning()) {
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout; jasmine.DEFAULT_TIMEOUT_INTERVAL = await originalTimeout;
await app.stop(); await app.stop();
await webdriver.quit(); await webdriver.quit();
done(); done();
@@ -42,23 +46,23 @@ let webActions, windowAction;
*/ */
it('Toast notification appears on screen and should stay on the screen IM', async () => { 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.login(specconst.USER_A);
await webdriver.closeAllGridModules();
await webdriver.createIM(specconst.USER_B.username); await webdriver.createIM(specconst.USER_B.username);
await webActions.login(specconst.USER_B); await webActions.login(specconst.USER_B);
await windowAction.reload(); await windowAction.reload();
await app.client.waitForVisible(ifc.SETTTING_BUTTON, Utils.toMs(50)); await app.client.waitForVisible(ifc.SETTTING_BUTTON, Utils.toMs(30));
await webActions.persistToastIM(); await webActions.persistToastIM(true);
await windowAction.pressCtrlM(); await windowAction.pressCtrlM();
var message = await Utils.randomString(); message = await Utils.randomString();
await webdriver.sendMessages([message]); await webdriver.sendMessages([message]);
await windowAction.veriryPersistToastNotification(message); await windowAction.verifyPersistToastNotification(message);
await webdriver.startDriver(); await windowAction.pressCtrlM();
await webdriver.createMIM([specconst.USER_B.username, specconst.USER_C.username]); await webdriver.createMIM([specconst.USER_B.username, specconst.USER_C.username]);
await webdriver.sendMessages([message]); await webdriver.sendMessages([message]);
await windowAction.veriryPersistToastNotification(message); await windowAction.verifyPersistToastNotification(message);
}) })
/** /**
@@ -67,17 +71,17 @@ let webActions, windowAction;
* Cover scenarios in AVT-1027 * Cover scenarios in AVT-1027
*/ */
it('Toast notification appears on screen and should disappear in few seconds IM', async () => { it('Toast notification appears on screen and should disappear in few seconds IM', async () => {
await windowAction.bringToFront("Symphony");
await windowAction.showWindow(); await Utils.sleep(5);
await app.client.waitForVisible(ifc.SETTTING_BUTTON, Utils.toMs(50)); await webActions.persistToastIM(false);
await webActions.persistToastIM(); await windowAction.pressCtrlM();
await webdriver.clickLeftNavItem(specconst.USER_B.name); await webdriver.clickLeftNavItem(specconst.USER_B.name);
var message = await Utils.randomString(); message = await Utils.randomString();
await webdriver.sendMessages([message]); await webdriver.sendMessages([message]);
await windowAction.verifyNotPersistToastNotification("Electron"); await windowAction.verifyNotPersistToastNotification();
await webdriver.createMIM([specconst.USER_B.username, specconst.USER_C.username]); await webdriver.createMIM([specconst.USER_B.username, specconst.USER_C.username]);
await webdriver.sendMessages([message]); await webdriver.sendMessages([message]);
await windowAction.verifyNotPersistToastNotification("Electron"); await windowAction.verifyNotPersistToastNotification();
}) })