Merge pull request #503 from tranducanh/AVT-1152

AVT-1152: fix and review AVT-1152,AVT-1149,AVT-1151,AVT-1156
This commit is contained in:
Keerthi Niranjan 2018-09-12 10:59:18 +05:30 committed by GitHub
commit 6eefc624a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 367 additions and 488 deletions

View File

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

View File

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

View File

@ -4,14 +4,12 @@ const WindowsActions = require('./spectronWindowsActions');
const WebActions = require('./spectronWebActions');
const Utils = require('./spectronUtils');
let mainApp = new Application({});
let app, wActions, config;
let app, wActions, config, userConfig;
!isMac? describe('Add Test To Verify Minimize on Close', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
describe('Add Test To Verify Minimize on Close', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 120000;
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
beforeAll(async (done) => {
try {
app = await mainApp.startApplication({ alwaysOnTop: false });
@ -43,13 +41,19 @@ let app, wActions, config;
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}`));
try {
if (app && app.isRunning()) {
if (isMac) {
await app.stop();
}
else {
await wActions.closeChromeDriver();
}
await done();
}
} catch (error) {
done.fail(new Error(`After all: ${error}`));
}
});
@ -59,23 +63,25 @@ let app, wActions, config;
* Cover scenarios in AVT-939
*/
it('Verify Minimize on Close option once the application is installed', async (done) => {
if (isWindowsOS) {
try {
let userConfig = await Application.readConfig(config);
await wActions.openMenu(["Window", "Minimize on Close"]);
if (userConfig.minimizeOnClose != false) {
await wActions.openMenu(["Window", "Minimize on Close"]);
}
await wActions.openMenu(["Window", "Close"]);
try {
userConfig = await Application.readConfig(config);
if (userConfig.minimizeOnClose == false) {
await wActions.openMinimizeAndClose(1, 1);
await wActions.verifyMinimizeWindows();
await done();
} catch (err) {
done.fail(new Error(`Verify Minimize on Close option once the application is installed: ${err}`));
};
}
else {
await done();
}
}
else {
wActions.openMinimizeAndClose(2, 1);
await wActions.verifyMinimizeWindows();
await done();
}
} catch (err) {
done.fail(new Error(`Verify Minimize on Close option once the application is installed: ${err}`));
};
});
/**
@ -84,60 +90,57 @@ let app, wActions, config;
* Cover scenarios in AVT-937
*/
it('Close window when "Minimize on Close" is ON', async (done) => {
if (isWindowsOS) {
try {
let userConfig = await Application.readConfig(config);
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 wActions.verifyMinimizeWindows();
await wActions.focusWindow();
await wActions.bringToFront("");
await Utils.sleep(2);
try {
await wActions.bringToFront("Symphony");
await wActions.openMinimizeAndClose(2, 1);
await wActions.verifyMinimizeWindows();
await wActions.bringToFront("Symphony");
await Utils.sleep(2);
if (!isMac)
{
await wActions.pressCtrlW();
await wActions.verifyMinimizeWindows();
await done()
} catch (err) {
done.fail(new Error(`Close window when "Minimize on Close" is ON: ${err}`));
};
}
else {
}
else
{
await wActions.pressCtrlWOnMac();
}
await wActions.verifyMinimizeWindows();
await done();
}
} catch (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
* 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) => {
if (isWindowsOS) {
try {
await wActions.bringToFront("Symphony");
let count = await app.client.getWindowCount();
await wActions.openMinimizeAndClose(1, 1);
try {
let userConfig = await Application.readConfig(config);
await wActions.focusWindow();
await wActions.openMenu(["Window", "Minimize on Close"]);
if (userConfig.minimizeOnClose == false) {
await wActions.openMenu(["Window", "Minimize on Close"]);
count = await app.client.getWindowCount();
}
catch (err1) {
count = 0;
}
finally {
if (!isMac) {
await expect(count === 0).toBeTruthy();
}
await wActions.openMenu(["Window", "Close"])
await Utils.sleep(5);
let status = await wActions.isElectronProcessRunning() ;
await console.log(status);
await expect(status === false).toBeTruthy();
else {
await expect(count === 1).toBeTruthy();
}
await done();
} catch (err) {
done.fail(new Error(`Verify by deselecting Minimize on Close option once the application is launched: ${err}`));
};
}
else {
await done();
}
});
}) : describe.skip();
}
} catch (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

@ -2,20 +2,22 @@ const Application = require('./spectronSetup');
const path = require('path');
const { isMac } = require('../../js/utils/misc');
let app = new Application({});
let mainApp = new Application({});
let app;
describe('Tests for Notification position', () => {
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
beforeAll((done) => {
return app.startApplication().then((startedApp) => {
app = startedApp;
done();
}).catch((err) => {
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) => {
@ -28,37 +30,7 @@ describe('Tests for Notification position', () => {
});
}
});
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(`notificationPosition failed in getWindowCount with error: ${err}`));
});
}).catch((err) => {
done.fail(new Error(`notificationPosition failed in waitUntilWindowLoaded with error: ${err}`));
});
});
it('should load demo html page', () => {
return app.client.url('file:///' + path.join(__dirname, '..', '..', 'demo/index.html'));
});
it('should load demo html', (done) => {
return app.client.waitUntilWindowLoaded().then(() => {
return app.client.getTitle().then((title) => {
expect(title === '').toBeTruthy();
done();
}).catch((err) => {
done.fail(new Error(`notificationPosition failed in getTitle with error: ${err}`));
});
}).catch((err) => {
done.fail(new Error(`notificationPosition failed in waitUntilWindowLoaded with error: ${err}`));
});
});
it('should open notification configure window', () => {
return app.client
.click('#open-config-win')

View File

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

View File

@ -3,12 +3,13 @@ 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({});
!isMac? describe('Tests for Generating & Sharing Logs', () => {
describe('Tests for Generating & Sharing Logs', () => {
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
@ -26,7 +27,7 @@ let app = new Application({});
}).catch((err) => {
done.fail(new Error(`Unable to start application error: ${err}`));
});
});
});
function getDownloadsPath() {
return new Promise(function (resolve, reject) {
@ -105,6 +106,16 @@ let app = new Application({});
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) {
@ -133,4 +144,4 @@ let app = new Application({});
});
});
}) : describe.skip();
})

View File

@ -11,7 +11,7 @@ module.exports = {
"root": {
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: "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: "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 }] }
]
@ -22,7 +22,7 @@ module.exports = {
name: "menu", step: 0, items: [
{ name: "Electron", step: 0, items: [{ name: "About Symphony", step: 0 }, { name: "Services", step: 1 }]},
{ name: "Edit", step: 1, 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: 2, 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: "Minimize on Close", step: 8 }] },
{ name: "View", step: 2, 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: "Minimize on Close", step: 7 }] },
{ name: "Window", step: 3, items: [{ name: "Close", step: 0 }, { name: "Minimize", step: 1 }, { name: "Zoom", step: 2 }]},
{ name: "Help", step: 4, 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,7 +1,7 @@
module.exports= {
module.exports = {
// Title bar
TITLE_BAR: "#title-bar",
MAXIMIZE_BTN: "#title-bar-maximize-button",
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",
@ -26,7 +26,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']",
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']",
@ -57,7 +57,7 @@ module.exports= {
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')])[$$]",
PIN_CHAT_MODS: "(//button[contains(@class,'pin-view')])[$$]",
PIN_CHAT_MODS: "(//button[contains(@class,'pin-view')])[$$]",
//Popin Popout
POPOUT_BUTTON: ".enhanced-pop-out",
@ -69,7 +69,7 @@ module.exports= {
//Alert Settings
MUTE_POPUP_ALERTS_CKB: ".field.field-notifications-on input",
ALERT_POSITION: ".field-configure-desktop-alerts button",
//Toast Message
TOAST_MESSAGE_CONTENT: "#message",
@ -94,6 +94,6 @@ module.exports= {
GET_VERSION_BUTTON: "#get-version",
OPEN_WINDOW_BUTTON: "#open-win",
//Symphony Electron API Demo
//Symphony Electron API Demo
TAG_TEXTBOX: "#tag"
};

View File

@ -419,21 +419,26 @@ class WebActions {
const bluebird = require('bluebird');
const API_VERSION = '2.0.0';
const SEARCH_API_VERSION = '3.0.0';
const ELECTRON_VERSION = '3.0.0';
let values = await bluebird.all([
'#api-version',
'#container-identifier',
'#container-ver',
'#build-number',
'#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[ 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[ 4 ]).toBe(SEARCH_API_VERSION);
}
async fillTagText(value)
{
await this.inputText(ui.TAG_TEXTBOX,value)
}
}
module.exports = WebActions;

View File

@ -174,7 +174,7 @@ class WindowsActions {
}
}
else {
for (var s = 0; s < arrMenu[i].step; s++) {
for (var s = 0; s <= arrMenu[i].step; s++) {
await robot.keyTap('down');
}
@ -259,6 +259,11 @@ class WindowsActions {
await robot.keyToggle('w', 'up', ['control']);
}
async pressCtrlWOnMac() {
await robot.keyToggle('w', 'down', ['command']);
await robot.keyToggle('w', 'up', ['command']);
}
async verifyMinimizeWindows() {
let isMinimized = await this.app.browserWindow.isMinimized();
@ -623,6 +628,28 @@ class WindowsActions {
}
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(),
waitTimeout: Application.getTimeOut()
});
var webdriver = new WebDriver({ browser: 'chrome' });
let webdriver,webActions, windowAction;
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();
jasmine.DEFAULT_TIMEOUT_INTERVAL = specconst.TIMEOUT_TEST_SUITE;
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
beforeAll(async (done) => {
try {
webdriver = await new WebDriver({ browser: 'chrome' })
app = await new Application({}).startApplication({ testedHost: specconst.TESTED_HOST, alwaysOnTop: true });
windowAction = await new WindowsAction(app);
webActions = await new WebActions(app);
webdriver.webAction = webActions;
webActions = await new WebActions(app);
webdriver.windowAction = windowAction;
webdriver.webActions = webActions;
await webdriver.startDriver();
done();
} catch (err) {
done.fail(new Error(`Unable to start application error: ${err}`));
@ -45,14 +47,13 @@ let webActions, windowAction;
* 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 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 webActions.clickIfElementVisible(ifc.SETTTING_BUTTON);
await app.client.waitForVisible(ifc.SETTTING_BUTTON, Utils.toMs(50));
await windowAction.pressCtrlM();
await webdriver.clickLeftNavItem(specconst.USER_B.name);
let messages = [];

View File

@ -1,17 +1,13 @@
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' });
var app = new Application({});
let webdriver, webActions, windowAction, message;
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 toast notification for IMs', () => {
let originalTimeout = specconst.DEFAULT_TIMEOUT_INTERVAL;
@ -19,45 +15,53 @@ let webActions, windowAction;
beforeAll(async (done) => {
try {
webdriver = await new WebDriver({ browser: 'chrome' });
app = await new Application({}).startApplication({ testedHost: specconst.TESTED_HOST, alwaysOnTop: true });
windowAction = await new WindowsAction(app);
webActions = await new WebActions(app);
webActions = await new WebActions(app);
await webdriver.startDriver();
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();
afterAll(async (done) => {
try {
if (app && app.isRunning()) {
jasmine.DEFAULT_TIMEOUT_INTERVAL = await originalTimeout;
await app.stop();
await webdriver.quit();
done();
}).catch((err) => {
done();
});
}
}
} catch (err) {
done.fail(new Error(`Failed at post-condition: ${err}`));
};
});
/**
* 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);
it('Toast notification should not be closed', async (done) => {
try {
await webdriver.startDriver();
await webdriver.login(specconst.USER_A);
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();
await webdriver.clickLeftNavItem(specconst.USER_B.name);
message = await Utils.randomString();
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
* 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();
it('Verify toast notification for signals, mentions and keywords', async (done) => {
try {
let nameSignal = await Utils.randomString();
let nameHashTag = await Utils.randomString();
let roomName = await Utils.randomString();
let 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.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.mentionUserOnChat(specconst.USER_B);
await windowAction.verifyNotCloseToastWhenMouseOver(specconst.USER_A.name + ": @" + specconst.USER_B.name);
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 done();
}
catch (err) {
done.fail(new Error(`Failed at Verify toast notification for signals, mentions and keywords: ${err}`));
};
});
}) : describe.skip();

View File

@ -11,6 +11,7 @@ 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;
beforeAll(async (done) => {
try {
@ -33,6 +34,7 @@ let app, webDriver, webActions, windowsActions;
afterAll(async (done) => {
try {
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
await windowsActions.stopApp();
await webDriver.quit();
done();

View File

@ -3,35 +3,39 @@ const WebDriver = require('./spectronWebDriver');
const { isMac } = require('../../js/utils/misc.js');
const Utils = require('./spectronUtils');
var app = new Application({});
var webdriver = new WebDriver({ browser: 'chrome' });
let webdriver,webActions, windowAction;
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 = 300000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = specconst.TIMEOUT_TEST_SUITE;
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
beforeAll(async(done) => {
try
{
{
webdriver = await new WebDriver({ browser: 'chrome' });
app = await new Application({}).startApplication({testedHost:specconst.TESTED_HOST, alwaysOnTop: true});
windowAction = await new WindowsAction(app);
webActions = await new WebActions(app);
webActions = await new WebActions(app);
await webdriver.startDriver();
windowAction.webAction = await webActions;
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;
jasmine.DEFAULT_TIMEOUT_INTERVAL = await originalTimeout;
await app.stop();
await webdriver.quit();
await webdriver.quit();
done();
}
} catch (err) {
} catch (err) {
done.fail(new Error(`Failed at post-condition: ${err}`));
};
});
@ -42,23 +46,23 @@ let webActions, windowAction;
*/
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.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(50));
await webActions.persistToastIM();
await app.client.waitForVisible(ifc.SETTTING_BUTTON, Utils.toMs(30));
await webActions.persistToastIM(true);
await windowAction.pressCtrlM();
var message = await Utils.randomString();
message = await Utils.randomString();
await webdriver.sendMessages([message]);
await windowAction.veriryPersistToastNotification(message);
await webdriver.startDriver();
await windowAction.verifyPersistToastNotification(message);
await windowAction.pressCtrlM();
await webdriver.createMIM([specconst.USER_B.username, specconst.USER_C.username]);
await webdriver.sendMessages([message]);
await windowAction.veriryPersistToastNotification(message);
await windowAction.verifyPersistToastNotification(message);
})
/**
@ -67,17 +71,17 @@ let webActions, windowAction;
* 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, Utils.toMs(50));
await webActions.persistToastIM();
await windowAction.bringToFront("Symphony");
await Utils.sleep(5);
await webActions.persistToastIM(false);
await windowAction.pressCtrlM();
await webdriver.clickLeftNavItem(specconst.USER_B.name);
var message = await Utils.randomString();
await webdriver.sendMessages([message]);
await windowAction.verifyNotPersistToastNotification("Electron");
message = await Utils.randomString();
await webdriver.sendMessages([message]);
await windowAction.verifyNotPersistToastNotification();
await webdriver.createMIM([specconst.USER_B.username, specconst.USER_C.username]);
await webdriver.sendMessages([message]);
await windowAction.verifyNotPersistToastNotification("Electron");
await windowAction.verifyNotPersistToastNotification();
})

View File

@ -1,31 +1,29 @@
const Application = require('./spectronSetup');
const { isMac } = require('../../js/utils/misc');
const robot = require('robotjs');
let configPath;
let app = new Application({});
const WindowsActions = require('./spectronWindowsActions');
let app, config,wActions;
let mainApp = new Application({});
const Utils = require('./spectronUtils');
describe('Tests for Zoom in and Zoom out', () => {
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
beforeAll((done) => {
return app.startApplication().then((startedApp) => {
app = startedApp;
getConfigPath().then((config) => {
configPath = config;
done();
}).catch((err) => {
done.fail(new Error(`Unable to start application error: ${err}`));
});
}).catch((err) => {
beforeAll(async (done) => {
try {
app = await mainApp.startApplication({ alwaysOnTop: false });
await Utils.sleep(2);
wActions = await new WindowsActions(app);
config = await getConfigPath(app);
await done();
} catch (err) {
done.fail(new Error(`Unable to start application error: ${err}`));
});
};
});
function getConfigPath() {
function getConfigPath(app) {
return new Promise(function (resolve, reject) {
app.client.addCommand('getUserDataPath', function () {
return this.execute(function () {
@ -41,7 +39,7 @@ describe('Tests for Zoom in and Zoom out', () => {
}
afterAll((done) => {
// Get it back normal size
// Get it back normal size
if (!isMac) {
for (let i = 0; i < 4; i++) {
robot.keyToggle('+', 'down', ['control', 'shift']);
@ -109,100 +107,83 @@ describe('Tests for Zoom in and Zoom out', () => {
});
});
it('should zoom in the app and check whether it is zoomed in', (done) => {
robot.setKeyboardDelay(500);
if (isMac) {
it('should zoom in the app and check whether it is zoomed in', async (done) => {
if (!isMac) {
await robot.setKeyboardDelay(500);
let bounds = await app.browserWindow.getBounds();
await robot.setMouseDelay(100);
let x = await bounds.x + 200;
let y = await bounds.y + 200;
await robot.moveMouse(x, y);
await robot.mouseClick();
robot.keyToggle('0', 'down', ['command']);
robot.keyToggle('0', 'up');
robot.keyToggle('command', 'up');
await robot.keyToggle('0', 'down', ['control']);
await robot.keyToggle('0', 'up',['control']);
for (let i = 0; i < 4; i++) {
robot.keyToggle('+', 'down', ['command']);
await robot.keyToggle('+', 'down', ['control', 'shift']);
await robot.keyToggle('+', 'up', ['control', 'shift']);
}
let zoomFactor = await app.electron.webFrame.getZoomFactor()
await expect(zoomFactor > 1).toBeTruthy();
await done();
}
else {
let x = 200;
let y = 200;
await robot.moveMouse(x, y);
await robot.mouseClick();
await robot.keyToggle('0', 'down', ['command']);
await robot.keyToggle('0', 'up', ['command']);
for (let i = 0; i < 4; i++) {
await robot.keyToggle('+', 'down', ['command']);
await robot.keyToggle('+', 'up', ['command']);
}
robot.keyToggle('+', 'up');
robot.keyToggle('command', 'up');
return app.electron.webFrame.getZoomFactor().then((zoomFactor) => {
expect(zoomFactor > 1).toBeTruthy();
done();
}).catch((err) => {
done.fail(new Error(`zoom-in-zoom-out failed in getZoomFactor with error: ${err}`));
})
} else {
return app.browserWindow.getBounds().then((bounds) => {
robot.setMouseDelay(100);
let x = bounds.x + 200;
let y = bounds.y + 200;
robot.moveMouse(x, y);
robot.mouseClick();
robot.keyToggle('0', 'down', ['control']);
robot.keyToggle('0', 'up');
robot.keyToggle('control', 'up');
for (let i = 0; i < 4; i++) {
robot.keyToggle('+', 'down', ['control', 'shift']);
}
robot.keyToggle('+', 'up');
robot.keyToggle('control', 'up');
robot.keyToggle('shift', 'up');
return app.electron.webFrame.getZoomFactor().then((zoomFactor) => {
expect(zoomFactor > 1).toBeTruthy();
done();
}).catch((err) => {
done.fail(new Error(`zoom-in-zoom-out failed in getBounds with error: ${err}`));
})
});
let zoomFactor = await app.electron.webFrame.getZoomFactor()
await expect(zoomFactor > 1).toBeTruthy();
await done();
}
});
it('should zoom out the app and check whether it is zoomed out', () => {
robot.setKeyboardDelay(500);
if (isMac) {
it('should zoom out the app and check whether it is zoomed out', async (done) => {
if (!isMac) {
await robot.setKeyboardDelay(500);
let bounds = await app.browserWindow.getBounds();
await robot.setMouseDelay(100);
let x = await bounds.x + 200;
let y = await bounds.y + 200;
await robot.moveMouse(x, y);
await robot.mouseClick();
robot.keyToggle('0', 'down', ['command']);
robot.keyToggle('0', 'up');
robot.keyToggle('command', 'up');
await robot.keyToggle('0', 'down', ['control']);
await robot.keyToggle('0', 'up');
await robot.keyToggle('control', 'up');
for (let i = 0; i < 4; i++) {
robot.keyToggle('-', 'down', ['command']);
await robot.keyToggle('-', 'down', ['control']);
}
robot.keyToggle('-', 'up');
robot.keyToggle('command', 'up');
await robot.keyToggle('-', 'up');
await robot.keyToggle('control', 'up');
return app.electron.webFrame.getZoomFactor().then((zoomFactor) => {
expect(zoomFactor < 1).toBeTruthy();
}).catch((err) => {
expect(err).toBeNull();
})
} else {
return app.browserWindow.getBounds().then((bounds) => {
robot.setMouseDelay(100);
let x = bounds.x + 200;
let y = bounds.y + 200;
robot.moveMouse(x, y);
robot.mouseClick();
robot.keyToggle('0', 'down', ['control']);
robot.keyToggle('0', 'up');
robot.keyToggle('control', 'up');
for (let i = 0; i < 4; i++) {
robot.keyToggle('-', 'down', ['control']);
}
robot.keyToggle('-', 'up');
robot.keyToggle('control', 'up');
return app.electron.webFrame.getZoomFactor().then((zoomFactor) => {
expect(zoomFactor < 1).toBeTruthy();
}).catch((err) => {
expect(err).toBeNull();
})
});
let zoomFactor = await app.electron.webFrame.getZoomFactor()
await expect(zoomFactor < 1).toBeTruthy();
await done();
}
else {
let x = 200;
let y = 200;
await robot.moveMouse(x, y);
await robot.mouseClick();
await robot.keyToggle('0', 'down', ['command']);
await robot.keyToggle('0', 'up', ['command']);
for (let i = 0; i < 4; i++) {
await robot.keyToggle('-', 'down', ['command']);
await robot.keyToggle('-', 'up', ['command']);
}
let zoomFactor = await app.electron.webFrame.getZoomFactor()
await expect(zoomFactor < 1).toBeTruthy();
await done();
}
});
});