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 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 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();
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', () => {
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

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

@@ -12,8 +12,8 @@ describe('Tests for Notification position', () => {
beforeAll(async (done) => {
try {
let testHost = await 'file:///' + path.join(__dirname, '..', '..', 'demo/index.html')
app = await mainApp.startApplication({testedHost:testHost, alwaysOnTop: false })
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}`));

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 () => {
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

@@ -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 }] }
]

View File

@@ -1,4 +1,4 @@
module.exports= {
module.exports = {
// Title bar
TITLE_BAR: "#title-bar",
MAXIMIZE_BTN: "#title-bar-maximize-button",
@@ -91,8 +91,9 @@ module.exports= {
INPUT_SEARCH_ENTITIES: "//input[@id='search-entities']",
//Symphony Electron API Demo
GET_VERSION_BUTTON: "#get-version",
GET_VERSION_BUTTON: "#get-version",
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 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

@@ -628,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;

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;
webdriver.windowAction = windowAction;
webdriver.webActions = webActions;
await webdriver.startDriver();
done();
} catch (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 () => {
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 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);
await webdriver.startDriver();
done();
} catch (err) {
done.fail(new Error(`Unable to start application error: ${err}`));
};
});
afterAll((done) => {
afterAll(async (done) => {
try {
if (app && app.isRunning()) {
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
app.stop().then(() => {
webdriver.close();
webdriver.quit();
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 () => {
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(50));
await webActions.clickIfElementVisible(ifc.SETTTING_BUTTON);
await app.client.waitForVisible(ifc.SETTTING_BUTTON, Utils.toMs(30));
await webActions.persistToastIM(false);
await windowAction.pressCtrlM();
await webdriver.clickLeftNavItem(specconst.USER_B.name);
var message = await Utils.randomString();
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,11 +69,12 @@ 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)
@@ -79,6 +84,11 @@ let webActions, windowAction;
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,30 +3,34 @@ 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);
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();
done();
@@ -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();
message = await Utils.randomString();
await webdriver.sendMessages([message]);
await windowAction.verifyNotPersistToastNotification("Electron");
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();
})