mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
remove spectron related code
This commit is contained in:
parent
8d3878c00d
commit
d4dcb933d1
@ -80,11 +80,9 @@
|
|||||||
## Tests and Code Coverage
|
## Tests and Code Coverage
|
||||||
- [Jest framework](http://facebook.github.io/jest/) is used to run tests
|
- [Jest framework](http://facebook.github.io/jest/) is used to run tests
|
||||||
- Use `npm test` to run unit tests
|
- Use `npm test` to run unit tests
|
||||||
- Use `npm run spectron-test` to run UI tests
|
|
||||||
- Code coverage reports are placed in [coverage](./out/coverage) directory
|
- Code coverage reports are placed in [coverage](./out/coverage) directory
|
||||||
- To check the test run report, see the [dist](./out) directory
|
- To check the test run report, see the [dist](./out) directory
|
||||||
- See the [tests](./tests) directory to find all the unit tests
|
- See the [tests](./tests) directory to find all the unit tests
|
||||||
- See the [spectron](./tests/spectron) directory to find all the unit tests
|
|
||||||
|
|
||||||
## Logging
|
## Logging
|
||||||
- Local logging is enabled for dev environments using the module [electron-log](https://www.npmjs.com/package/electron-log)
|
- Local logging is enabled for dev environments using the module [electron-log](https://www.npmjs.com/package/electron-log)
|
||||||
|
@ -1,22 +1,14 @@
|
|||||||
## Description
|
## Description
|
||||||
A few sentences describing the overall goals of the pull request's commits.
|
A few sentences describing the overall goals of the pull request's commits.
|
||||||
Describe the problem or feature in addition to a link to the [JIRA-ticket](https://perzoinc.atlassian.net/browse/JIRA-ticket)
|
Describe the problem or feature in addition to a link to the
|
||||||
|
[JIRA-ticket](https://perzoinc.atlassian.net/browse/JIRA-ticket)
|
||||||
|
|
||||||
## Solution Approach
|
## Solution Approach
|
||||||
Describe the approach you've taken to implement this change / resolve the issue
|
Describe the approach you've taken to implement this change / resolve the issue
|
||||||
|
|
||||||
## Documentation
|
|
||||||
Add a link to the documentation for this issue / PR. Can be confluence / this repository's file link
|
|
||||||
|
|
||||||
## Related PRs
|
## Related PRs
|
||||||
List related PRs against other branches / repositories:
|
List related PRs against other branches / repositories:
|
||||||
|
|
||||||
branch | PR
|
branch | PR
|
||||||
------ | ------
|
------ | ------
|
||||||
other_pr_dev | [link]()
|
other_pr_dev | [link]()
|
||||||
|
|
||||||
## QA Checklist
|
|
||||||
- [] Unit-Tests
|
|
||||||
- [] Automation-Tests
|
|
||||||
|
|
||||||
Attach unit & spectron tests results in PDF format against the above task lists for this branch
|
|
@ -1,28 +0,0 @@
|
|||||||
{
|
|
||||||
"testMatch": [
|
|
||||||
"**/*.spectron.js"
|
|
||||||
],
|
|
||||||
"verbose": true,
|
|
||||||
"collectCoverage": true,
|
|
||||||
"coverageReporters": [
|
|
||||||
"text",
|
|
||||||
"html"
|
|
||||||
],
|
|
||||||
"coverageDirectory": "out/coverage",
|
|
||||||
"collectCoverageFrom": [
|
|
||||||
"js/**/*.js",
|
|
||||||
"!**/node_modules/**",
|
|
||||||
"!**/vendor/**"
|
|
||||||
],
|
|
||||||
"reporters": [
|
|
||||||
"default",
|
|
||||||
["./node_modules/jest-html-reporter", {
|
|
||||||
"pageTitle": "Symphony Electron Test Result",
|
|
||||||
"includeFailureMsg": true,
|
|
||||||
"includeConsoleLog": true,
|
|
||||||
"theme": "lightTheme",
|
|
||||||
"sort": "status",
|
|
||||||
"outputPath": "./out/Spectron Tests Report.html"
|
|
||||||
}]
|
|
||||||
]
|
|
||||||
}
|
|
@ -14,7 +14,6 @@
|
|||||||
"rebuild": "electron-rebuild -f",
|
"rebuild": "electron-rebuild -f",
|
||||||
"dev": "npm run prebuild && cross-env ELECTRON_DEV=true electron .",
|
"dev": "npm run prebuild && cross-env ELECTRON_DEV=true electron .",
|
||||||
"test": "npm run lint && npm rebuild --build-from-source && cross-env ELECTRON_QA=true jest --config jest.unit.config.json --runInBand && npm run rebuild",
|
"test": "npm run lint && npm rebuild --build-from-source && cross-env ELECTRON_QA=true jest --config jest.unit.config.json --runInBand && npm run rebuild",
|
||||||
"spectron-test": "npm run lint && npm rebuild --build-from-source robotjs && cross-env ELECTRON_QA=true jest --config jest.spectron.config.json --runInBand --detectOpenHandles",
|
|
||||||
"demo-win": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file:///demo/index.html",
|
"demo-win": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file:///demo/index.html",
|
||||||
"demo-mac": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file://$(pwd)/demo/index.html",
|
"demo-mac": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file://$(pwd)/demo/index.html",
|
||||||
"unpacked-mac": "npm run prebuild && npm run test && build --mac --dir",
|
"unpacked-mac": "npm run prebuild && npm run test && build --mac --dir",
|
||||||
@ -104,7 +103,6 @@
|
|||||||
"ncp": "2.0.0",
|
"ncp": "2.0.0",
|
||||||
"robotjs": "0.5.1",
|
"robotjs": "0.5.1",
|
||||||
"selenium-webdriver": "3.6.0",
|
"selenium-webdriver": "3.6.0",
|
||||||
"spectron": "5.0.0",
|
|
||||||
"wdio-selenium-standalone-service": "0.0.12"
|
"wdio-selenium-standalone-service": "0.0.12"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,74 +0,0 @@
|
|||||||
const Application = require('./spectronSetup');
|
|
||||||
const WindowsActions = require('./spectronWindowsActions');
|
|
||||||
const WebActions = require('./spectronWebActions');
|
|
||||||
const Utils = require('./spectronUtils');
|
|
||||||
const { isMac } = require('../../js/utils/misc');
|
|
||||||
|
|
||||||
let app, windowActions, webActions;
|
|
||||||
|
|
||||||
describe('Tests for always on top with mult-apps are opened', () => {
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
|
||||||
|
|
||||||
beforeAll(async (done) => {
|
|
||||||
try {
|
|
||||||
app = await new Application({}).startApplication({ alwaysOnTop: false });
|
|
||||||
windowActions = await new WindowsActions(app);
|
|
||||||
webActions = await new WebActions(app);
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async (done) => {
|
|
||||||
try {
|
|
||||||
if (isMac) {
|
|
||||||
await Utils.killProcess("Notes");
|
|
||||||
await Utils.killProcess("Reminders");
|
|
||||||
} else {
|
|
||||||
await Utils.killProcess("notepad.exe");
|
|
||||||
await Utils.killProcess("mspaint.exe");
|
|
||||||
}
|
|
||||||
if (app && app.isRunning()) {
|
|
||||||
await app.stop();
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Failed at post-condition: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify Always on Top options when multiple applications are opened
|
|
||||||
* TC-ID: 2898431
|
|
||||||
* Cover scenarios in AVT-990
|
|
||||||
*/
|
|
||||||
it('Verify Always on Top options when multiple applications are opened', async (done) => {
|
|
||||||
try {
|
|
||||||
await windowActions.setAlwaysOnTop(true);
|
|
||||||
await webActions.minimizeWindows();
|
|
||||||
if (isMac) {
|
|
||||||
await Utils.openAppInMaximize("Notes");
|
|
||||||
await Utils.openAppInMaximize("Reminders");
|
|
||||||
await Utils.sleep(10); //Sleep 10secs for waiting app opening completely.
|
|
||||||
} else {
|
|
||||||
await Utils.openAppInMaximize("notepad.exe");
|
|
||||||
await Utils.openAppInMaximize("mspaint.exe");
|
|
||||||
}
|
|
||||||
await windowActions.showWindow();
|
|
||||||
await windowActions.clickOutsideWindow();
|
|
||||||
await windowActions.verifyWindowsOnTop(true);
|
|
||||||
|
|
||||||
//Close and open app again, make sure it's always on top
|
|
||||||
await app.stop();
|
|
||||||
app = await new Application({}).startApplication();
|
|
||||||
windowActions = await new WindowsActions(app);
|
|
||||||
webActions = await new WebActions(app);
|
|
||||||
await windowActions.clickOutsideWindow();
|
|
||||||
await windowActions.verifyWindowsOnTop(true);
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Fail to keep Always on Top options when multiple applications are opened with error: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,63 +0,0 @@
|
|||||||
const Application = require('./spectronSetup');
|
|
||||||
const WebDriver = require('./spectronWebDriver');
|
|
||||||
const Utils = require('./spectronUtils');
|
|
||||||
let app = new Application({
|
|
||||||
startTimeout: Application.getTimeOut(),
|
|
||||||
waitTimeout: Application.getTimeOut()
|
|
||||||
});
|
|
||||||
let webdriver = new WebDriver({ browser: 'chrome' });
|
|
||||||
const WindowsAction = require('./spectronWindowsActions');
|
|
||||||
const WebActions = require('./spectronWebActions');
|
|
||||||
const specconst = require('./spectronConstants.js');
|
|
||||||
const {isWindowsOS } = require('../../js/utils/misc');
|
|
||||||
let webActions, windowAction;
|
|
||||||
|
|
||||||
!isWindowsOS ? describe('Test for Badge Count on MAC', () => {
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
|
||||||
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
|
||||||
beforeAll(async (done) => {
|
|
||||||
try {
|
|
||||||
app = await new Application({}).startApplication({ testedHost: specconst.TESTED_HOST, alwaysOnTop: true });
|
|
||||||
windowAction = await new WindowsAction(app);
|
|
||||||
webActions = await new WebActions(app);
|
|
||||||
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;
|
|
||||||
await app.stop();
|
|
||||||
await webdriver.quit();
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Failed at post-condition: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show 1 in tray icon when unread message = 1 (Support MAC only)
|
|
||||||
* TC-ID: 2906586
|
|
||||||
* Cover scenarios in AVT-1095
|
|
||||||
*/
|
|
||||||
it('Show 1 in tray icon when unread message = 1', async (done) => {
|
|
||||||
try {
|
|
||||||
let message = await Utils.randomString();
|
|
||||||
await webdriver.startDriver();
|
|
||||||
await webdriver.login(specconst.USER_A);
|
|
||||||
await webdriver.createIM(specconst.USER_B.username);
|
|
||||||
await webActions.login(specconst.USER_B);
|
|
||||||
await webActions.clickLeftNavItem(specconst.USER_A.name);
|
|
||||||
await webActions.openAlertsSettings();
|
|
||||||
let currentBadgeCount = await windowAction.getBadgeCount();
|
|
||||||
await webdriver.sendMessage(message);
|
|
||||||
await windowAction.verifyCurrentBadgeCount(currentBadgeCount + 1);
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Show 1 in tray icon with error: ${err}`));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}) : describe.skip();
|
|
@ -1,55 +0,0 @@
|
|||||||
const Application = require('./spectronSetup');
|
|
||||||
const specconst = require('./spectronConstants.js');
|
|
||||||
const WindowsAction = require('./spectronWindowsActions');
|
|
||||||
let windowAction;
|
|
||||||
let app = new Application({});
|
|
||||||
|
|
||||||
describe('Tests for Bring to front', () => {
|
|
||||||
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
|
||||||
beforeAll(async (done) => {
|
|
||||||
try {
|
|
||||||
app = await new Application({}).startApplication({ testedHost: specconst.TESTED_HOST, alwaysOnTop: true });
|
|
||||||
windowAction = await new WindowsAction(app);
|
|
||||||
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 = await originalTimeout;
|
|
||||||
await app.stop();
|
|
||||||
await webdriver.quit();
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Failed at post-condition: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should show the browser window and verify window focus', async (done) => {
|
|
||||||
await windowAction.blurBrowserWindow()
|
|
||||||
await app.browserWindow.minimize();
|
|
||||||
let isMinimized = await app.browserWindow.isMinimized();
|
|
||||||
await expect(isMinimized).toBe(true);
|
|
||||||
await app.browserWindow.showInactive();
|
|
||||||
let isFocused = await app.browserWindow.isFocused();
|
|
||||||
await expect(isFocused).toBe(false);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should restore the browser window and verify window focus', async (done) => {
|
|
||||||
await windowAction.blurBrowserWindow()
|
|
||||||
await app.browserWindow.minimize();
|
|
||||||
let isMinimized = await app.browserWindow.isMinimized();
|
|
||||||
await expect(isMinimized).toBe(true);
|
|
||||||
await app.browserWindow.restore();
|
|
||||||
let isFocused = await app.browserWindow.isFocused();
|
|
||||||
await expect(isFocused).toBe(true);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
@ -1,49 +0,0 @@
|
|||||||
const Application = require('./spectronSetup');
|
|
||||||
const path = require('path');
|
|
||||||
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(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) => {
|
|
||||||
if (app && app.isRunning()) {
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
|
|
||||||
app.stop().then(() => {
|
|
||||||
done();
|
|
||||||
}).catch((err) => {
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
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();
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,39 +0,0 @@
|
|||||||
const Application = require('./spectronSetup');
|
|
||||||
|
|
||||||
let app = new Application({});
|
|
||||||
|
|
||||||
describe('Tests for Close', () => {
|
|
||||||
|
|
||||||
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
|
||||||
|
|
||||||
beforeAll((done) => {
|
|
||||||
return app.startApplication().then((startedApp) => {
|
|
||||||
app = startedApp;
|
|
||||||
done();
|
|
||||||
}).catch((err) => {
|
|
||||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll((done) => {
|
|
||||||
if (app && app.isRunning()) {
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
|
|
||||||
app.stop().then(() => {
|
|
||||||
done();
|
|
||||||
}).catch((err) => {
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
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();
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
@ -1,55 +0,0 @@
|
|||||||
const Application = require('./spectronSetup');
|
|
||||||
const WebActions = require('./spectronWebActions');
|
|
||||||
const WindowsActions = require('./spectronWindowsActions');
|
|
||||||
const constants = require('./spectronConstants.js');
|
|
||||||
const path = require('path');
|
|
||||||
const ui = require('./spectronInterfaces.js');
|
|
||||||
const Utils = require('./spectronUtils.js');
|
|
||||||
let TIMEOUT_TEST_SUITE = parseInt(constants.TIMEOUT_TEST_SUITE, 10);
|
|
||||||
let app, windowsActions;
|
|
||||||
|
|
||||||
describe('Tests for pop outs reload scenario', () => {
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT_TEST_SUITE;
|
|
||||||
|
|
||||||
beforeAll(async (done) => {
|
|
||||||
try {
|
|
||||||
app = await new Application({}).startApplication({ testedHost: constants.TESTED_HOST, alwaysOnTop: true });
|
|
||||||
webActions = await new WebActions(app);
|
|
||||||
windowsActions = await new WindowsActions(app);
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
await windowsActions.stopApp();
|
|
||||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async (done) => {
|
|
||||||
try {
|
|
||||||
await windowsActions.stopApp();
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Failed at post-condition: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Pop-up should be closed when main window is reloaded', async (done) => {
|
|
||||||
try {
|
|
||||||
if (await windowsActions.isAppRunning()) {
|
|
||||||
await webActions.navigateURL('file:///' + path.join(__dirname, '..', '..', 'demo/index.html'));
|
|
||||||
await windowsActions.bringToFront("Symphony");
|
|
||||||
await webActions.clickIfElementVisible(ui.OPEN_WINDOW_BUTTON);
|
|
||||||
await windowsActions.verifyPopOutWindowAppear("Test pop-out window");
|
|
||||||
await windowsActions.windowByIndex(1);
|
|
||||||
await webActions.clickIfElementVisible(ui.OPEN_WINDOW_BUTTON);
|
|
||||||
await windowsActions.verifyPopOutWindowAppear("Child pop-out window");
|
|
||||||
await windowsActions.windowByIndex(0);
|
|
||||||
await windowsActions.windowReload();
|
|
||||||
await Utils.sleep(2);
|
|
||||||
await windowsActions.verifyWindowCount(1);
|
|
||||||
}
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Fail to verify pop-up closed when main window is reloaded: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,52 +0,0 @@
|
|||||||
const Application = require('./spectronSetup');
|
|
||||||
const WindowsActions = require('./spectronWindowsActions');
|
|
||||||
const { isMac } = require('../../js/utils/misc.js');
|
|
||||||
const Utils = require('./spectronUtils');
|
|
||||||
|
|
||||||
let app;
|
|
||||||
let windowActions;
|
|
||||||
|
|
||||||
!isMac ? describe('Tests for Electron Production Logging', () => {
|
|
||||||
|
|
||||||
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
|
||||||
|
|
||||||
beforeAll(async (done) => {
|
|
||||||
try {
|
|
||||||
app = await new Application({}).startApplication();
|
|
||||||
windowActions = await new WindowsActions(app);
|
|
||||||
await windowActions.deleteAllLogFiles();
|
|
||||||
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;
|
|
||||||
await app.stop();
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Failed at post-condition: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify the production logs exists when clicking on "Show logs in Explorer"
|
|
||||||
* TC-ID: 3935260
|
|
||||||
* Cover scenarios in AVT-1029
|
|
||||||
*/
|
|
||||||
it('Verify the production logs exists when clicking on Show logs in Explorer', async (done) => {
|
|
||||||
try {
|
|
||||||
await windowActions.openMenu(["Help", "Troubleshooting", "Show Logs in Explorer"]);
|
|
||||||
Utils.sleep(2000) //sleep for creating log
|
|
||||||
await windowActions.verifyLogExported();
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Fail to export production logs with error: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}) : describe.skip();
|
|
@ -1,46 +0,0 @@
|
|||||||
const Application = require('./spectronSetup');
|
|
||||||
const WindowsActions = require('./spectronWindowsActions');
|
|
||||||
const constants = require('./spectronConstants.js');
|
|
||||||
const {isMac} = require('../../js/utils/misc');
|
|
||||||
let TIMEOUT_TEST_SUITE = parseInt(constants.TIMEOUT_TEST_SUITE, 10);
|
|
||||||
let app, windowsActions;
|
|
||||||
|
|
||||||
describe('Tests for fullscreen', () => {
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT_TEST_SUITE;
|
|
||||||
|
|
||||||
beforeAll(async (done) => {
|
|
||||||
try {
|
|
||||||
app = await new Application({}).startApplication({ testedHost: constants.TESTED_HOST, alwaysOnTop: true });
|
|
||||||
windowsActions = await new WindowsActions(app);
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
await windowsActions.stopApp();
|
|
||||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async (done) => {
|
|
||||||
try {
|
|
||||||
await windowsActions.stopApp();
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Failed at post-condition: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Should set the app full screen and check whether it is in full screen', async (done) => {
|
|
||||||
try {
|
|
||||||
if (await windowsActions.isAppRunning()) {
|
|
||||||
if (isMac) {
|
|
||||||
await windowsActions.fullScreenOnMac();
|
|
||||||
} else {
|
|
||||||
await windowsActions.openMenu(["View", "Toggle Full Screen"]);
|
|
||||||
}
|
|
||||||
await windowsActions.verifyAppFullScreen();
|
|
||||||
}
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Fail to verify app full screen: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,47 +0,0 @@
|
|||||||
const Application = require('./spectronSetup');
|
|
||||||
const WebActions = require('./spectronWebActions');
|
|
||||||
const WindowsActions = require('./spectronWindowsActions');
|
|
||||||
const constants = require('./spectronConstants.js');
|
|
||||||
const path = require('path');
|
|
||||||
const ui = require('./spectronInterfaces.js');
|
|
||||||
let TIMEOUT_TEST_SUITE = parseInt(constants.TIMEOUT_TEST_SUITE, 10);
|
|
||||||
let app, windowsActions;
|
|
||||||
|
|
||||||
describe('Tests for getVersionInfo API', () => {
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT_TEST_SUITE;
|
|
||||||
|
|
||||||
beforeAll(async (done) => {
|
|
||||||
try {
|
|
||||||
app = await new Application({}).startApplication({ testedHost: constants.TESTED_HOST, alwaysOnTop: true });
|
|
||||||
webActions = await new WebActions(app);
|
|
||||||
windowsActions = await new WindowsActions(app);
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
await windowsActions.stopApp();
|
|
||||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async (done) => {
|
|
||||||
try {
|
|
||||||
await windowsActions.stopApp();
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Failed at post-condition: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Should verify if the version numbers are correct', async (done) => {
|
|
||||||
try {
|
|
||||||
if (await windowsActions.isAppRunning()) {
|
|
||||||
await webActions.navigateURL('file:///' + path.join(__dirname, '..', '..', 'demo/index.html'));
|
|
||||||
await windowsActions.bringToFront("Symphony");
|
|
||||||
await webActions.clickIfElementVisible(ui.GET_VERSION_BUTTON);
|
|
||||||
await webActions.verifyVersionInfo();
|
|
||||||
}
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Fail to verify the version numbers: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,139 +0,0 @@
|
|||||||
const Application = require('./spectronSetup');
|
|
||||||
const { isMac, isWindowsOS } = require('../../js/utils/misc');
|
|
||||||
const WindowsActions = require('./spectronWindowsActions');
|
|
||||||
const WebActions = require('./spectronWebActions');
|
|
||||||
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;
|
|
||||||
|
|
||||||
beforeAll(async (done) => {
|
|
||||||
try {
|
|
||||||
app = await mainApp.startApplication({ alwaysOnTop: false });
|
|
||||||
await Utils.sleep(2);
|
|
||||||
wActions = await new WindowsActions(app);
|
|
||||||
webActions = await new WebActions(app);
|
|
||||||
config = await getConfigPath(app);
|
|
||||||
await wActions.focusWindow();
|
|
||||||
await done();
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
function getConfigPath(app) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
app.client.addCommand('getUserDataPath', function () {
|
|
||||||
return app.client.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 {
|
|
||||||
await Utils.killProcess("chromedriver.exe");
|
|
||||||
await Utils.killProcess("electron.exe");
|
|
||||||
done();
|
|
||||||
} catch (error) {
|
|
||||||
done.fail(new Error(`After all: ${error}`));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify Minimize on Close option once the application is installed
|
|
||||||
* TC-ID: 3084609
|
|
||||||
* Cover scenarios in AVT-939
|
|
||||||
*/
|
|
||||||
it('Verify Minimize on Close option once the application is installed', async (done) => {
|
|
||||||
|
|
||||||
try {
|
|
||||||
userConfig = await Application.readConfig(config);
|
|
||||||
if (userConfig.minimizeOnClose == false) {
|
|
||||||
await wActions.openMinimizeAndClose(1, 1);
|
|
||||||
await wActions.verifyMinimizeWindows();
|
|
||||||
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}`));
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Close window when 'Minimize on Close' is ON
|
|
||||||
* TC-ID: 2911252
|
|
||||||
* Cover scenarios in AVT-937
|
|
||||||
*/
|
|
||||||
it('Close window when "Minimize on Close" is ON', async (done) => {
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
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
|
|
||||||
*/
|
|
||||||
it('Verify by deselecting Minimize on Close option once the application is launched', async (done) => {
|
|
||||||
|
|
||||||
try {
|
|
||||||
await wActions.bringToFront("Symphony");
|
|
||||||
let count = await app.client.getWindowCount();
|
|
||||||
await wActions.openMinimizeAndClose(1, 1);
|
|
||||||
try {
|
|
||||||
count = await app.client.getWindowCount();
|
|
||||||
}
|
|
||||||
catch (err1) {
|
|
||||||
count = 0;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
if (!isMac) {
|
|
||||||
await expect(count === 0).toBeTruthy();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
await expect(count === 1).toBeTruthy();
|
|
||||||
}
|
|
||||||
await done();
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`should check whether the app is minimized: ${err}`));
|
|
||||||
};
|
|
||||||
})
|
|
||||||
})
|
|
@ -1,58 +0,0 @@
|
|||||||
const Application = require('./spectronSetup');
|
|
||||||
const { isMac } = require('../../js/utils/misc.js');
|
|
||||||
const Utils = require('./spectronUtils');
|
|
||||||
var app = new Application({});
|
|
||||||
const WindowsAction = require('./spectronWindowsActions');
|
|
||||||
const WebActions = require('./spectronWebActions');
|
|
||||||
const ifc = require('./spectronInterfaces.js');
|
|
||||||
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 = 600000;
|
|
||||||
let originalTimeout = Application.getTimeOut();
|
|
||||||
beforeAll(async (done) => {
|
|
||||||
try {
|
|
||||||
app = await new Application({}).startApplication({ testedHost: specconst.TESTED_HOST, alwaysOnTop: true });
|
|
||||||
windowAction = await new WindowsAction(app);
|
|
||||||
webActions = await new WebActions(app);
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
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}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The user is directed to the ACP inside Electron and does not login again
|
|
||||||
* TC-ID: 131251
|
|
||||||
* Cover scenarios in AVT-1107
|
|
||||||
*/
|
|
||||||
it('The user is directed to the ACP inside Electron and does not login again', async (done) => {
|
|
||||||
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();
|
|
@ -1,113 +0,0 @@
|
|||||||
const Application = require('./spectronSetup');
|
|
||||||
const WebActions = require('./spectronWebActions');
|
|
||||||
const WindowsActions = require('./spectronWindowsActions');
|
|
||||||
const { isMac } = require('../../js/utils/misc.js');
|
|
||||||
const constants = require('./spectronConstants.js');
|
|
||||||
const Utils = require('./spectronUtils');
|
|
||||||
let TIMEOUT_TEST_SUITE = parseInt(constants.TIMEOUT_TEST_SUITE, 10);
|
|
||||||
let app, webActions, windowsActions;
|
|
||||||
|
|
||||||
describe('Tests for Pop-Outs', () => {
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT_TEST_SUITE;
|
|
||||||
|
|
||||||
beforeAll(async (done) => {
|
|
||||||
try {
|
|
||||||
app = await new Application({}).startApplication({ testedHost: constants.TESTED_HOST });
|
|
||||||
webActions = await new WebActions(app);
|
|
||||||
windowsActions = await new WindowsActions(app);
|
|
||||||
await webActions.login(constants.USER_A);
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
await windowsActions.stopApp();
|
|
||||||
done.fail(new Error(`Failed at beforeAll: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(async (done) => {
|
|
||||||
try {
|
|
||||||
await windowsActions.bringToFront("Symphony");
|
|
||||||
await windowsActions.closeAllPopOutWindow();
|
|
||||||
await webActions.closeAllGridModules();
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
await windowsActions.stopApp();
|
|
||||||
done.fail(new Error(`Failed at beforeEach: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async (done) => {
|
|
||||||
try {
|
|
||||||
await windowsActions.closeAllPopOutWindow();
|
|
||||||
await webActions.closeAllGridModules();
|
|
||||||
await windowsActions.stopApp();
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
await windowsActions.stopApp();
|
|
||||||
await done.fail(new Error(`Failed at afterAll: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify pop-out chat, inbox
|
|
||||||
* TC-ID: 2897209
|
|
||||||
* Cover scenarios in AVT-1081
|
|
||||||
*/
|
|
||||||
it('Verify pop-out chat, inbox', async (done) => {
|
|
||||||
try {
|
|
||||||
if (await windowsActions.isAppRunning()) {
|
|
||||||
await webActions.createIM(constants.USER_B.name);
|
|
||||||
await webActions.clickPopOutIcon();
|
|
||||||
await windowsActions.verifyPopOutWindowAppear(constants.USER_B.name);
|
|
||||||
await webActions.verifyPopInIconDisplay(constants.USER_B.name);
|
|
||||||
|
|
||||||
await webActions.clickInboxIcon();
|
|
||||||
await webActions.clickInboxPopOutIcon();
|
|
||||||
await windowsActions.verifyPopOutWindowAppear("Inbox");
|
|
||||||
await webActions.verifyPopInIconDisplay("Inbox");
|
|
||||||
|
|
||||||
await windowsActions.bringToFront("Symphony");
|
|
||||||
await webActions.clickInboxIcon();
|
|
||||||
await windowsActions.verifyWindowFocus("Inbox");
|
|
||||||
|
|
||||||
await windowsActions.bringToFront("Symphony");
|
|
||||||
await webActions.createIM(constants.USER_C.name); //work arround to move focus to userC
|
|
||||||
await webActions.clickLeftNavItem(constants.USER_B.name);
|
|
||||||
await Utils.sleep(1); //wait for popout overlaying completely
|
|
||||||
await windowsActions.verifyWindowFocus(constants.USER_B.name);
|
|
||||||
|
|
||||||
await windowsActions.bringToFront("Symphony");
|
|
||||||
await webActions.logout();
|
|
||||||
await webActions.login(constants.USER_A);
|
|
||||||
await windowsActions.verifyPopOutWindowAppear(constants.USER_B.name);
|
|
||||||
await windowsActions.verifyPopOutWindowAppear("Inbox");
|
|
||||||
}
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Fail to verify pop-out chat, inbox: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify pop-in popped-out chat
|
|
||||||
* TC-ID: 4130268
|
|
||||||
* Cover scenarios in AVT-1082
|
|
||||||
*/
|
|
||||||
it('Verify pop-in popped-out chat', async (done) => {
|
|
||||||
try {
|
|
||||||
if (await windowsActions.isAppRunning()) {
|
|
||||||
await webActions.createIM(constants.USER_B.name);
|
|
||||||
await webActions.pinChat();
|
|
||||||
await webActions.clickPopOutIcon();
|
|
||||||
await webActions.clickPopInIcon(constants.USER_B.name);
|
|
||||||
await webActions.verifyPopOutIconDisplay();
|
|
||||||
|
|
||||||
//Verify pinned module is persisted on grid
|
|
||||||
await webActions.createIM(constants.USER_C.name);
|
|
||||||
await webActions.verifyChatModuleVisible(constants.USER_B.name);
|
|
||||||
}
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Fail to verify Pop-in popped-out chat: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,49 +0,0 @@
|
|||||||
const Application = require('./spectronSetup');
|
|
||||||
const {isMac} = require('../../js/utils/misc');
|
|
||||||
const WindowsActions = require('./spectronWindowsActions');
|
|
||||||
|
|
||||||
let app = new Application({});
|
|
||||||
let windowActions;
|
|
||||||
|
|
||||||
describe('Tests for Resizing windows', () => {
|
|
||||||
|
|
||||||
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
|
||||||
|
|
||||||
beforeAll(async (done) => {
|
|
||||||
try {
|
|
||||||
app = await new Application({}).startApplication();
|
|
||||||
windowActions = await new WindowsActions(app);
|
|
||||||
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;
|
|
||||||
await app.stop();
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Failed at post-condition: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify whether the main window can be minimized upto 300px
|
|
||||||
* TC-ID: 3028239
|
|
||||||
* Cover scenarios in AVT-768
|
|
||||||
*/
|
|
||||||
it('Should be minimized up to 300px', async (done) => {
|
|
||||||
try {
|
|
||||||
await windowActions.resizeWindows(0, 0);
|
|
||||||
expect([ 300, 300 ]).toEqual(await windowActions.getCurrentSize());
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`failed to minimize window to 300 px with error: ${err}`));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,75 +0,0 @@
|
|||||||
const Application = require('./spectronSetup');
|
|
||||||
const WindowsActions = require('./spectronWindowsActions');
|
|
||||||
const WebActions = require('./spectronWebActions');
|
|
||||||
const { isMac } = require('../../js/utils/misc');
|
|
||||||
const Utils = require('./spectronUtils');
|
|
||||||
|
|
||||||
let app;
|
|
||||||
let windowActions;
|
|
||||||
let webActions;
|
|
||||||
|
|
||||||
!isMac ? describe('Tests for saved layout', () => {
|
|
||||||
|
|
||||||
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
|
||||||
|
|
||||||
beforeAll(async (done) => {
|
|
||||||
try {
|
|
||||||
app = await new Application({}).startApplication();
|
|
||||||
windowActions = await new WindowsActions(app);
|
|
||||||
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;
|
|
||||||
await app.stop();
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Failed at post-condition: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Keep size and position of the windows in previous session
|
|
||||||
* TC-ID: 2915948
|
|
||||||
* Cover scenarios in AVT-914
|
|
||||||
*/
|
|
||||||
it('Keep size and position of the windows in previous session', async (done) => {
|
|
||||||
try {
|
|
||||||
var defaultPosition = await windowActions.getCurrentPosition();
|
|
||||||
var defaultSize = await windowActions.getCurrentSize();
|
|
||||||
|
|
||||||
// Size and position of previos session keep after resizing and dragging
|
|
||||||
await windowActions.setPosition(defaultPosition[0], 20);
|
|
||||||
await windowActions.setSize(defaultSize[0] - 100, defaultSize[0] - 100);
|
|
||||||
await Utils.sleep(1); // Sleep 1s after resizing
|
|
||||||
var previousPosition = await windowActions.getCurrentPosition();
|
|
||||||
var previousSize = await windowActions.getCurrentSize();
|
|
||||||
await app.stop();
|
|
||||||
app = await new Application({}).startApplication({defaultSize: false, defaultPosition: false});
|
|
||||||
windowActions = await new WindowsActions(app);
|
|
||||||
webActions = await new WebActions(app);
|
|
||||||
expect(previousPosition).toEqual(await windowActions.getCurrentPosition());
|
|
||||||
expect(previousSize).toEqual(await windowActions.getCurrentSize());
|
|
||||||
|
|
||||||
// Size and position of previous session keep after maximizing
|
|
||||||
await webActions.maximizeWindows();
|
|
||||||
await Utils.sleep(1); // Sleep 1s after resizing
|
|
||||||
previousSize = await windowActions.getCurrentSize();
|
|
||||||
await app.stop();
|
|
||||||
app = await new Application({}).startApplication({defaultSize: false, defaultPosition: false});
|
|
||||||
windowActions = await new WindowsActions(app);
|
|
||||||
webActions = await new WebActions(app);
|
|
||||||
expect(previousSize).toEqual(await windowActions.getCurrentSize());
|
|
||||||
done();
|
|
||||||
} catch(err) {
|
|
||||||
done.fail(new Error(`Fail to keep size and position of the windows in previous session with error: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}) : describe.skip();
|
|
@ -1,40 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
|
|
||||||
SYMPHONY_CONFIG_FILE_NAME: "/Symphony.config",
|
|
||||||
|
|
||||||
ELECTRON_GLOBAL_CONFIG_PATH_MAC: "node_modules/electron/dist/Electron.app/Contents/config",
|
|
||||||
ELECTRON_GLOBAL_CONFIG_PATH_WIN: "node_modules/electron/dist/config",
|
|
||||||
|
|
||||||
SEARCH_LIBRARY_PATH_MAC: "node_modules/electron/dist/Electron.app/Contents/library",
|
|
||||||
SEARCH_LIBRARY_PATH_WIN: "node_modules/electron/dist/library",
|
|
||||||
MENU: {
|
|
||||||
"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: "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 }] }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
MENUMAC: {
|
|
||||||
"root": {
|
|
||||||
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: 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 }] }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
LOG_FILENAME_PREFIX: "logs_symphony_",
|
|
||||||
USER_A: { username: process.env.USER_A, password: process.env.PASSWORD, name: process.env.USER_A_NAME },
|
|
||||||
USER_B: { username: process.env.USER_B, password: process.env.PASSWORD, name: process.env.USER_B_NAME },
|
|
||||||
USER_C: { username: process.env.USER_C, password: process.env.PASSWORD, name: process.env.USER_C_NAME },
|
|
||||||
TESTED_HOST: process.env.TESTED_HOST,
|
|
||||||
TYPE_ROOM: { private: "PRIVATE", public: "PUBLIC" },
|
|
||||||
TIMEOUT_TEST_SUITE: process.env.TIMEOUT_TEST_SUITE,
|
|
||||||
TIMEOUT_PAGE_LOAD: process.env.TIMEOUT_PAGE_LOAD,
|
|
||||||
TIMEOUT_WAIT_ELEMENT: process.env.TIMEOUT_WAIT_ELEMENT
|
|
||||||
};
|
|
@ -1,99 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
// Title bar
|
|
||||||
TITLE_BAR: "#title-bar",
|
|
||||||
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",
|
|
||||||
SYM_LOGO: "#logo",
|
|
||||||
MINIMIZE_BTN: "#title-bar-minimize-button",
|
|
||||||
|
|
||||||
//Sign In
|
|
||||||
SIGN_IN_BUTTON: "//button[@name='signin-submit']",
|
|
||||||
SIGN_IN_EMAIL: "//input[@name='signin-email']",
|
|
||||||
SIGN_IN_PASSWORD: "//input[@name='signin-password']",
|
|
||||||
NAV_PROFILE: "//div[@id='nav-profile']",
|
|
||||||
PLUS_BTN: "//div[@class='nav-profile__plus-btn-icon']",
|
|
||||||
IM_TAB: "//div[contains(@class,'modal-box modal-box--nfs')]//li[contains(text(),'Direct Chat')]",
|
|
||||||
CHATROOM_TAB: "//div[contains(@class, 'modal-box modal-box--nfs')]//li[contains(text(),'Chat Room')]",
|
|
||||||
CREATE_IM: "//form[@class='create-im']",
|
|
||||||
CREATE_BUTTON: "//button[text()='Create']",
|
|
||||||
ADD_PARTICIPANT_TEXT: "//div[@id='react-modal']//input[contains(@class,'react-autosuggest__input')]",
|
|
||||||
USERS_SUGGESTION_LIST: "//li[@id='react-autowhatever-1-section-0-item-0']",
|
|
||||||
CHATROOM_NAME_TEXT: "//form[@class='create-chatroom']//input[@name='name']",
|
|
||||||
CHATROOM_DESCR_TEXT: "//form[@class='create-chatroom']//input[@name='description']",
|
|
||||||
PRIVATE_ROOM_RADIO_BTN: "//form[@class='create-chatroom']//input[@value='PRIVATE']",
|
|
||||||
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']",
|
|
||||||
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']",
|
|
||||||
PERSIS_NOTIFICATION_INPUT_ROOM: "//div[@class='alerts-settings__notification-category']//h5[text()='Rooms:']/..//input[@class='persistent-notification']",
|
|
||||||
PERSIS_NOTIFICATION_INPUT_IM: "//div[@class='alerts-settings__notification-category']//h5[text()='IMs:']/..//input[@class='persistent-notification']",
|
|
||||||
PERSIS_NOTIFICATION_INPUT_SIGNAL: "//div[@class='alerts-settings__notification-category']//h5[text()='Signals:']/..//input[@class='persistent-notification']",
|
|
||||||
ALERT_TAB: "//*[contains(@class,'tempo-tabs__tab tabs-tab') and @data-tab='alerts']",
|
|
||||||
GENERAL_TAB: "//*[contains(@class,'tempo-tabs__tab tabs-tab') and @data-tab='general']",
|
|
||||||
ALERT_OPTION: "//span[@class='sym-menu-tooltip__option-label' and contains(.,'Alerts')]",
|
|
||||||
GENERAL_OPTION: "//span[@class='sym-menu-tooltip__option-label' and contains(.,'General')]",
|
|
||||||
NAV_ALIAS: "//div[@class='nav-profile__alias']",
|
|
||||||
SIGNAL_HEADER: "//span[@class='navigation-category-name' and contains(.,'Signals')]",
|
|
||||||
WARNING_CLOSE_ICON: "//div[@id='sysMsg']//span[@class='close-icon']",
|
|
||||||
SCROLL_TAB_ACTIVE: "//div[@class='active-tab-container']",
|
|
||||||
SIGNAL_NAME: "//input[@class='react-signal__name']",
|
|
||||||
HASHTAG_NAME: "//div[@class='react-signal__rule-name']//input",
|
|
||||||
LAST_RULE_ROW: "//div[@class='react-signal__rules'][last()]",
|
|
||||||
ENTER_KEYWORD_IN_LAST_INPUT: "//input",
|
|
||||||
HEADER_MODULE: "//header[contains(@class,'module-header gs-draggable')]",
|
|
||||||
HEADER_MODULES: "(//header[contains(@class,'module-header gs-draggable')])[$$]",
|
|
||||||
MENTION_USER_SUGGESTION: "//span[@class='draftJs__suggestionsEntryText' and text()='$$']",
|
|
||||||
SUGGESTED_ENTITY_DROPDOWN: "//span[@class='draftJs__suggestionsEntryText']",
|
|
||||||
CONFIRM_CREATE_ROOM_BUTTON: "//div[@class='modal-box__footer-buttons']//button[text()='Yes']",
|
|
||||||
MODULE_ON_GRID: "#simple_grid",
|
|
||||||
SPINNER: ".spinner",
|
|
||||||
SIGNOUT: ".sign-out",
|
|
||||||
SIGNOUT_MODAL_BUTTON: "//div[@class='modal-content-buttons buttons']//button[contains(text(), 'Sign Out')]",
|
|
||||||
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')])[$$]",
|
|
||||||
|
|
||||||
//Popin Popout
|
|
||||||
POPOUT_BUTTON: ".enhanced-pop-out",
|
|
||||||
POPOUT_INBOX_BUTTON: ".add-margin.popout",
|
|
||||||
POPIN_BUTTON: "//*[contains(@class, 'enhanced-pop-in') or contains(@class, 'add-margin popin')]",
|
|
||||||
PIN_CHAT_MOD: ".chat-module .pin-view",
|
|
||||||
PINNED_CHAT_MOD: ".chat-module .pinned",
|
|
||||||
|
|
||||||
//Alert Settings
|
|
||||||
MUTE_POPUP_ALERTS_CKB: ".field.field-notifications-on input",
|
|
||||||
ALERT_POSITION: ".field-configure-desktop-alerts button",
|
|
||||||
|
|
||||||
//Toast Message
|
|
||||||
TOAST_MESSAGE_CONTENT: "#message",
|
|
||||||
|
|
||||||
//Inbox
|
|
||||||
INBOX_BUTTON: ".toolbar-btn-inbox",
|
|
||||||
INBOX_HEADER: ".inbox-header",
|
|
||||||
|
|
||||||
//ACP
|
|
||||||
ACP_LINK: "//*[contains(@class,'show-admin-link')]",
|
|
||||||
IMG_ADMIN_LOGO: "//img[@src='./img/nav_admin_logo.png']",
|
|
||||||
|
|
||||||
//LOG OUT
|
|
||||||
LOGOUT_DROPDOWN: "//div[@class='header-account']",
|
|
||||||
ADMIN_NAME: "//*[@class='account-name']",
|
|
||||||
ADMIN_LOG_OUT: "//*[text()[contains(.,'Log out')]]",
|
|
||||||
ADMIN_PAGE_TITLE: "//h2[@class='page-title']",
|
|
||||||
|
|
||||||
//INPUT SEARCH
|
|
||||||
INPUT_SEARCH_ENTITIES: "//input[@id='search-entities']",
|
|
||||||
|
|
||||||
//Symphony Electron API Demo
|
|
||||||
GET_VERSION_BUTTON: "#get-version",
|
|
||||||
OPEN_WINDOW_BUTTON: "#open-win",
|
|
||||||
|
|
||||||
//Symphony Electron API Demo
|
|
||||||
TAG_TEXTBOX: "#tag"
|
|
||||||
};
|
|
@ -1,138 +0,0 @@
|
|||||||
const Application = require('spectron').Application;
|
|
||||||
const path = require('path');
|
|
||||||
const fs = require('fs');
|
|
||||||
const { isMac, isWindowsOS } = require('../../js/utils/misc');
|
|
||||||
const ncp = require('ncp').ncp;
|
|
||||||
const constants = require('./spectronConstants.js');
|
|
||||||
const ui = require('./spectronInterfaces.js');
|
|
||||||
const Utils = require('./spectronUtils');
|
|
||||||
|
|
||||||
class App {
|
|
||||||
|
|
||||||
constructor(options) {
|
|
||||||
|
|
||||||
this.options = options;
|
|
||||||
|
|
||||||
if (!this.options.path) {
|
|
||||||
this.options.path = App.getAppPath();
|
|
||||||
this.options.args = [path.join(__dirname, '..', '..', 'js/main.js')];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isMac) {
|
|
||||||
App.copyConfigPath(constants.ELECTRON_GLOBAL_CONFIG_PATH_MAC);
|
|
||||||
App.copyLibraries(constants.SEARCH_LIBRARY_PATH_MAC);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.app = new Application(this.options);
|
|
||||||
}
|
|
||||||
|
|
||||||
async startApplication(configurations) {
|
|
||||||
try {
|
|
||||||
await Utils.killProcess("electron.exe");
|
|
||||||
await Utils.killProcess("chromedriver.exe");
|
|
||||||
this.app = await this.app.start();
|
|
||||||
await this.app.client.waitForVisible(ui.SYM_LOGO, constants.TIMEOUT_PAGE_LOAD);
|
|
||||||
if (configurations) {
|
|
||||||
if (typeof configurations.alwaysOnTop !== "undefined") {
|
|
||||||
await this.app.browserWindow.setAlwaysOnTop(configurations.alwaysOnTop);
|
|
||||||
}
|
|
||||||
if (configurations.testedHost) {
|
|
||||||
await this.app.client.waitUntilWindowLoaded().url(configurations.testedHost);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((typeof configurations === "undefined") || (typeof configurations.defaultSize === "undefined") || (configurations.defaultSize === true)) {
|
|
||||||
await this.app.browserWindow.setFullScreen(false);
|
|
||||||
await this.app.browserWindow.setSize(900, 900);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((typeof configurations === "undefined") || (typeof configurations.defaultPosition === "undefined") || (configurations.defaultPosition === true)) {
|
|
||||||
await this.app.browserWindow.center();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isWindowsOS) {
|
|
||||||
await this.app.browserWindow.minimize();
|
|
||||||
await this.app.browserWindow.restore();
|
|
||||||
}
|
|
||||||
return this.app;
|
|
||||||
} catch (err) {
|
|
||||||
throw new Error("Unable to start application " + err);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static getAppPath() {
|
|
||||||
let electronPath = path.join(__dirname, '..', '..', 'node_modules', '.bin', 'electron');
|
|
||||||
if (process.platform === 'win32') {
|
|
||||||
electronPath += '.cmd';
|
|
||||||
}
|
|
||||||
return electronPath
|
|
||||||
}
|
|
||||||
|
|
||||||
static getTimeOut() {
|
|
||||||
return 120000;
|
|
||||||
}
|
|
||||||
|
|
||||||
static readConfig(configPath) {
|
|
||||||
|
|
||||||
const configFilePath = configPath + constants.SYMPHONY_CONFIG_FILE_NAME;
|
|
||||||
|
|
||||||
if (!fs.existsSync(configFilePath)) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
App.copyConfigPath(configPath).then(() => {
|
|
||||||
fs.readFile(configFilePath, 'utf-8', function (err, data) {
|
|
||||||
if (err) {
|
|
||||||
throw new Error(`Unable to read user config file at ${configFilePath} ${err}`);
|
|
||||||
}
|
|
||||||
let parsedData;
|
|
||||||
try {
|
|
||||||
parsedData = JSON.parse(data);
|
|
||||||
} catch (err) {
|
|
||||||
return reject(err);
|
|
||||||
}
|
|
||||||
return resolve(parsedData);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
fs.readFile(configFilePath, 'utf-8', function (err, data) {
|
|
||||||
if (err) {
|
|
||||||
throw new Error(`Unable to read user config file at ${configFilePath} ${err}`);
|
|
||||||
}
|
|
||||||
let parsedData;
|
|
||||||
try {
|
|
||||||
parsedData = JSON.parse(data);
|
|
||||||
} catch (err) {
|
|
||||||
reject(err);
|
|
||||||
}
|
|
||||||
resolve(parsedData);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
static copyConfigPath(configPath) {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
ncp('config', configPath, function (err) {
|
|
||||||
if (err) {
|
|
||||||
throw new Error("Unable to copy config file to Electron dir " + err);
|
|
||||||
}
|
|
||||||
return resolve();
|
|
||||||
});
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
static copyLibraries(libraryPath) {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
return ncp('library', libraryPath, function (err) {
|
|
||||||
if (err) {
|
|
||||||
throw new Error("Unable to copy Swift search Libraries " + err);
|
|
||||||
}
|
|
||||||
return resolve();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = App;
|
|
@ -1,63 +0,0 @@
|
|||||||
const childProcess = require('child_process');
|
|
||||||
const path = require('path');
|
|
||||||
const fs = require('fs');
|
|
||||||
const { isMac } = require('../../js/utils/misc');
|
|
||||||
|
|
||||||
class Utils {
|
|
||||||
static async openAppInMaximize(appPath) {
|
|
||||||
if (isMac) {
|
|
||||||
const osascript = require('node-osascript');
|
|
||||||
await osascript.execute('if application "' + appPath + '" is running then \n do shell script ("pkill -9 ' + appPath + '*") \n end if \n delay 5 \n tell application "' + appPath + '" \n activate \n tell window 1 \n set zoomed to true \n end tell \n end tell');
|
|
||||||
} else {
|
|
||||||
await childProcess.exec('start /MAX ' + appPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static async killProcess(processName) {
|
|
||||||
if (isMac) {
|
|
||||||
const osascript = require('node-osascript');
|
|
||||||
await osascript.execute('if application "' + processName + '" is running then \n do shell script ("pkill -9 ' + processName + '*") \n end if \n delay 5');
|
|
||||||
} else {
|
|
||||||
await childProcess.exec('taskkill /f /t /im ' + processName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static async sleep(second) {
|
|
||||||
return new Promise(resolve => {
|
|
||||||
setTimeout(resolve, this.toMs(second));
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
static getFolderPath(folderName) {
|
|
||||||
return path.join(require('os').homedir(), folderName);
|
|
||||||
}
|
|
||||||
|
|
||||||
static getFiles(path) {
|
|
||||||
return fs.readdirSync(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
static toMs(second) {
|
|
||||||
return second * 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
static async randomString() {
|
|
||||||
var chars = await "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
|
|
||||||
var string_length = await 8;
|
|
||||||
var randomstring = await '';
|
|
||||||
for (var i = 0; i < string_length; i++) {
|
|
||||||
var rnum = await Math.floor(Math.random() * chars.length);
|
|
||||||
randomstring += await chars.substring(rnum, rnum + 1);
|
|
||||||
}
|
|
||||||
return randomstring;
|
|
||||||
}
|
|
||||||
|
|
||||||
static execPromise(command) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
childProcess.exec(command, (error, stdout, stderr) => {
|
|
||||||
resolve(stdout.trim());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Utils;
|
|
@ -1,444 +0,0 @@
|
|||||||
const ui = require('./spectronInterfaces.js');
|
|
||||||
const constants = require('./spectronConstants.js');
|
|
||||||
const Utils = require('./spectronUtils');
|
|
||||||
const WindowsActions = require('./spectronWindowsActions');
|
|
||||||
const robot = require('robotjs');
|
|
||||||
const { isMac, isWindowsOS } = require('../../js/utils/misc');
|
|
||||||
let TIMEOUT_WAIT_ELEMENT = parseInt(constants.TIMEOUT_WAIT_ELEMENT, 10);
|
|
||||||
let TIMEOUT_PAGE_LOAD = parseInt(constants.TIMEOUT_PAGE_LOAD, 10);
|
|
||||||
|
|
||||||
class WebActions {
|
|
||||||
constructor(app) {
|
|
||||||
this.app = app;
|
|
||||||
}
|
|
||||||
|
|
||||||
async maximizeButtonByClick() {
|
|
||||||
await this.app.client.waitForVisible(ui.MAXIMIZE_BTN, TIMEOUT_WAIT_ELEMENT).click(ui.MAXIMIZE_BTN);
|
|
||||||
}
|
|
||||||
|
|
||||||
async maximizeWindows() {
|
|
||||||
await this.maximizeButtonByClick();
|
|
||||||
await this.app.browserWindow.isMaximized().then(function (maximized) {
|
|
||||||
expect(maximized).toBeTruthy();
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickMinimizeButton() {
|
|
||||||
await this.app.client.waitForVisible(ui.MINIMIZE_BTN, TIMEOUT_WAIT_ELEMENT).click(ui.MINIMIZE_BTN);
|
|
||||||
}
|
|
||||||
|
|
||||||
async minimizeWindows() {
|
|
||||||
await this.app.browserWindow.minimize();
|
|
||||||
await this.app.browserWindow.isMinimized().then(function (isMinimized) {
|
|
||||||
expect(isMinimized).toBeTruthy();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async minimizeWindowByClick() {
|
|
||||||
await this.app.client.click(ui.MINIMIZED_BUTTON);
|
|
||||||
}
|
|
||||||
|
|
||||||
async closeWindowByClick() {
|
|
||||||
await this.app.client.click(ui.CLOSE_BUTTON);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async openApplicationMenuByClick() {
|
|
||||||
await this.app.client.click(ui.MAIN_MENU_ITEM);
|
|
||||||
}
|
|
||||||
|
|
||||||
async getElementByXPath(xpath) {
|
|
||||||
await this.app.client.waitForVisible(xpath, TIMEOUT_WAIT_ELEMENT);
|
|
||||||
var elem = this.app.client.element(xpath);
|
|
||||||
if (elem.isVisible()) {
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
async inputText(el, data) {
|
|
||||||
let obj = await this.getElementByXPath(el);
|
|
||||||
if (obj != null)
|
|
||||||
await this.app.client.setValue(el, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
async getText(element) {
|
|
||||||
return await this.app.client.getText(element);
|
|
||||||
}
|
|
||||||
|
|
||||||
async getValue(element) {
|
|
||||||
return await this.app.client.getValue(element);
|
|
||||||
}
|
|
||||||
|
|
||||||
async getLocation(element) {
|
|
||||||
return await this.app.client.getLocation(element);
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickAndWaitElementVisible(xpath, elementToVisible, timeOut = TIMEOUT_WAIT_ELEMENT) {
|
|
||||||
await this.app.client.click(xpath).then(async () => {
|
|
||||||
await this.app.client.waitForVisible(elementToVisible, timeOut);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async scrollAndClick(selector, findElement) {
|
|
||||||
var i = 0;
|
|
||||||
var y = 0;
|
|
||||||
await this.app.client.scroll(selector, 0, y);
|
|
||||||
var size = 0;
|
|
||||||
while (i < 10) {
|
|
||||||
size = this.app.client.getElementSize(findElement);
|
|
||||||
if (findElement != null && size == 0) {
|
|
||||||
y += 50;
|
|
||||||
await this.app.client.scroll(selector, 0, y);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
await this.app.client.click(findElement);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickIfElementVisible(selector, timeOut = TIMEOUT_WAIT_ELEMENT) {
|
|
||||||
await this.app.client.waitForVisible(selector, timeOut)
|
|
||||||
.click(selector)
|
|
||||||
}
|
|
||||||
|
|
||||||
async rightClickIfElementVisible(selector, timeOut = TIMEOUT_WAIT_ELEMENT) {
|
|
||||||
await this.app.client.waitForVisible(selector, timeOut)
|
|
||||||
.rightClick(selector, 10, 10)
|
|
||||||
}
|
|
||||||
|
|
||||||
async openAlertsSettings() {
|
|
||||||
await this.clickAndWaitElementVisible(ui.SETTTING_BUTTON, ui.ALERT_OPTION);
|
|
||||||
await this.clickAndWaitElementVisible(ui.ALERT_OPTION, ui.ALERT_TAB);
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyToastNotificationShow(message) {
|
|
||||||
let show = false;
|
|
||||||
for (let i = 0; i < 10; i++) {
|
|
||||||
let winCount = await this.app.client.getWindowCount();
|
|
||||||
if (winCount > 1) {
|
|
||||||
for (let j = 1; j < winCount; j++) {
|
|
||||||
await this.app.client.windowByIndex(j);
|
|
||||||
if (await this.app.client.getText(ui.TOAST_MESSAGE_CONTENT) === message) {
|
|
||||||
show = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (show) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await Utils.sleep(1);
|
|
||||||
}
|
|
||||||
await expect(show).toBeTruthy();
|
|
||||||
await this.app.client.windowByIndex(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyNoToastNotificationShow() {
|
|
||||||
let noShow = false;
|
|
||||||
let title = '';
|
|
||||||
for (let i = 0; i < 5; i++) {
|
|
||||||
await Utils.sleep(1);
|
|
||||||
await this.app.client.windowByIndex(1);
|
|
||||||
title = await this.app.client.getText(ui.TOAST_MESSAGE_CONTENT)
|
|
||||||
if (title !== '')
|
|
||||||
{
|
|
||||||
noShow = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (let j = 0; j < 15; j++) {
|
|
||||||
await Utils.sleep(1);
|
|
||||||
}
|
|
||||||
if (title !== '')
|
|
||||||
{
|
|
||||||
noShow = true;
|
|
||||||
}
|
|
||||||
await expect(noShow).toBeTruthy();
|
|
||||||
await this.app.client.windowByIndex(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
async getElementByXPath(xpath) {
|
|
||||||
let elem = this.app.client.element(xpath);
|
|
||||||
if (elem.isVisible()) {
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
async inputText(el, data) {
|
|
||||||
let obj = await this.getElementByXPath(el);
|
|
||||||
if (obj != null)
|
|
||||||
await this.app.client.setValue(el, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickAndWaitElementVisible(xpath, elementToVisible, timeOut = TIMEOUT_WAIT_ELEMENT) {
|
|
||||||
await this.app.client.click(xpath);
|
|
||||||
await this.app.client.waitForVisible(elementToVisible, timeOut);
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickIfElementVisible(xpath, timeOut = TIMEOUT_WAIT_ELEMENT) {
|
|
||||||
await this.app.client.waitForVisible(xpath, timeOut)
|
|
||||||
.click(xpath)
|
|
||||||
}
|
|
||||||
|
|
||||||
async login(user) {
|
|
||||||
await this.inputText(ui.SIGN_IN_EMAIL, user.username);
|
|
||||||
await this.inputText(ui.SIGN_IN_PASSWORD, user.password);
|
|
||||||
await this.clickIfElementVisible(ui.SIGN_IN_BUTTON);
|
|
||||||
await this.clickAndWaitElementVisible(ui.SIGN_IN_BUTTON, ui.SETTTING_BUTTON, TIMEOUT_PAGE_LOAD);
|
|
||||||
//await this.waitElementNotVisible(ui.SPINNER);
|
|
||||||
}
|
|
||||||
|
|
||||||
async persistToastIM(isPersistance) {
|
|
||||||
await this.clickAndWaitElementVisible(ui.SETTTING_BUTTON, ui.ALERT_OPTION, TIMEOUT_WAIT_ELEMENT);
|
|
||||||
await this.clickAndWaitElementVisible(ui.ALERT_OPTION, ui.ALERT_TAB, TIMEOUT_WAIT_ELEMENT);
|
|
||||||
let ischeck = await this.app.client.element(ui.PERSIS_NOTIFICATION_INPUT_IM).getAttribute("checked");
|
|
||||||
|
|
||||||
if (isPersistance === true && (ischeck === false || ischeck === null)) {
|
|
||||||
await this.clickAndWaitElementVisible(ui.PERSIS_NOTIFICATION_INPUT_IM, ui.PERSIS_NOTIFICATION_INPUT_IM, TIMEOUT_WAIT_ELEMENT);
|
|
||||||
}
|
|
||||||
else if (isPersistance === false) {
|
|
||||||
await this.scrollAndClick(ui.SCROLL_TAB_ACTIVE, ui.PERSIS_NOTIFICATION_INPUT_IM);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async openACP() {
|
|
||||||
await this.clickAndWaitElementVisible(ui.SETTTING_BUTTON, ui.GENERAL_OPTION, TIMEOUT_WAIT_ELEMENT);
|
|
||||||
await this.clickAndWaitElementVisible(ui.GENERAL_OPTION, ui.GENERAL_TAB, TIMEOUT_WAIT_ELEMENT);
|
|
||||||
await this.clickAndWaitElementVisible(ui.ACP_LINK, ui.IMG_ADMIN_LOGO, TIMEOUT_WAIT_ELEMENT * 10);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickPlusButton() {
|
|
||||||
await this.clickIfElementVisible(ui.PLUS_BTN);
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickStartChat() {
|
|
||||||
await this.clickIfElementVisible(ui.START_CHAT, TIMEOUT_WAIT_ELEMENT * 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
async logout() {
|
|
||||||
await this.clickAndWaitElementVisible(ui.ADMIN_NAME, ui.ADMIN_LOG_OUT, TIMEOUT_WAIT_ELEMENT);
|
|
||||||
await this.clickAndWaitElementVisible(ui.ADMIN_LOG_OUT, ui.SIGN_IN_BUTTON, TIMEOUT_WAIT_ELEMENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
async selectIMTab() {
|
|
||||||
await this.clickIfElementVisible(ui.IM_TAB);
|
|
||||||
}
|
|
||||||
|
|
||||||
async addParticipant(username) {
|
|
||||||
await this.inputText(ui.ADD_PARTICIPANT_TEXT, username);
|
|
||||||
await this.clickIfElementVisible(ui.USERS_SUGGESTION_LIST, 20000);
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickDoneButton() {
|
|
||||||
await this.clickIfElementVisible(ui.CREATE_IM_DONE_BTN);
|
|
||||||
await this.waitElementVisible(ui.HEADER_MODULE, TIMEOUT_WAIT_ELEMENT * 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
async waitElementNotVisible(locator, timeOut = TIMEOUT_WAIT_ELEMENT) {
|
|
||||||
return await this.app.client.waitForVisible(locator, timeOut, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
async waitElementVisible(locator, timeOut = TIMEOUT_WAIT_ELEMENT) {
|
|
||||||
return await this.app.client.waitForVisible(locator, timeOut);
|
|
||||||
}
|
|
||||||
|
|
||||||
async mouseOver(locator) {
|
|
||||||
await this.waitElementVisible(locator);
|
|
||||||
await this.app.client.moveToObject(locator);
|
|
||||||
}
|
|
||||||
|
|
||||||
async createIM(username) {
|
|
||||||
await this.clickPlusButton();
|
|
||||||
await this.clickStartChat();
|
|
||||||
await this.selectIMTab();
|
|
||||||
await this.addParticipant(username);
|
|
||||||
await this.clickDoneButton();
|
|
||||||
await this.verifyChatModuleVisible(username)
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickPopOutIcon() {
|
|
||||||
let windowsActions = await new WindowsActions(this.app);
|
|
||||||
await this.mouseOver(ui.PIN_CHAT_MOD);
|
|
||||||
await Utils.sleep(2); //wait popout button clickable
|
|
||||||
await this.clickIfElementVisible(ui.POPOUT_BUTTON);
|
|
||||||
let index = await windowsActions.getWindowCount() - 1;
|
|
||||||
await windowsActions.windowByIndex(index);
|
|
||||||
await this.waitElementNotVisible(ui.SPINNER, TIMEOUT_PAGE_LOAD);
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickPopInIcon(windowTitle) {
|
|
||||||
let windowsActions = await new WindowsActions(this.app);
|
|
||||||
let index = await windowsActions.getWindowIndexFromTitle(windowTitle);
|
|
||||||
await windowsActions.windowByIndex(index);
|
|
||||||
await this.mouseOver(ui.HEADER_MODULE);
|
|
||||||
await Utils.sleep(2); //wait popin button clickable
|
|
||||||
await this.clickIfElementVisible(ui.POPIN_BUTTON);
|
|
||||||
await windowsActions.windowByIndex(0);
|
|
||||||
await this.waitElementVisible(ui.HEADER_MODULE);
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickInboxPopOutIcon() {
|
|
||||||
let windowsActions = await new WindowsActions(this.app);
|
|
||||||
await this.clickIfElementVisible(ui.POPOUT_INBOX_BUTTON);
|
|
||||||
let index = await windowsActions.getWindowCount() - 1;
|
|
||||||
await windowsActions.windowByIndex(index);
|
|
||||||
await this.waitElementNotVisible(ui.SPINNER, TIMEOUT_PAGE_LOAD);
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyPopInIconDisplay(windowTitle) {
|
|
||||||
let windowsActions = await new WindowsActions(this.app);
|
|
||||||
let index = await windowsActions.getWindowIndexFromTitle(windowTitle);
|
|
||||||
await windowsActions.windowByIndex(index);
|
|
||||||
await this.waitElementVisible(ui.POPIN_BUTTON, TIMEOUT_WAIT_ELEMENT);
|
|
||||||
await windowsActions.windowByIndex(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyPopOutIconDisplay() {
|
|
||||||
await this.mouseOver(ui.PIN_CHAT_MOD);
|
|
||||||
await Utils.sleep(2); //wait popout button clickable
|
|
||||||
await this.waitElementVisible(ui.POPOUT_BUTTON, TIMEOUT_WAIT_ELEMENT * 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickInboxIcon() {
|
|
||||||
await this.clickIfElementVisible(ui.INBOX_BUTTON);
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickLeftNavItem(item) {
|
|
||||||
let singleItemLocator = ui.LEFT_NAV_SINGLE_ITEM.replace("$$", item);
|
|
||||||
await this.clickIfElementVisible(singleItemLocator);
|
|
||||||
}
|
|
||||||
|
|
||||||
async logout() {
|
|
||||||
await this.openAlertsSettings();
|
|
||||||
await this.clickAndWaitElementVisible(ui.SIGNOUT, ui.SIGNOUT_MODAL_BUTTON);
|
|
||||||
await this.clickAndWaitElementVisible(ui.SIGNOUT_MODAL_BUTTON, ui.SIGN_IN_BUTTON, TIMEOUT_PAGE_LOAD);
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyElementExist(findElement) {
|
|
||||||
let obs = await this.app.client.elements(findElement);
|
|
||||||
let len = await obs.value.length;
|
|
||||||
await expect(len).toBe(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
async logintoAdmin(user) {
|
|
||||||
await this.inputText(ui.SIGN_IN_EMAIL, user.username);
|
|
||||||
await this.inputText(ui.SIGN_IN_PASSWORD, user.password);
|
|
||||||
await this.clickAndWaitElementVisible(ui.SIGN_IN_BUTTON, ui.IMG_ADMIN_LOGO, TIMEOUT_PAGE_LOAD);
|
|
||||||
}
|
|
||||||
|
|
||||||
async openNotificationPosition() {
|
|
||||||
await this.clickIfElementVisible(ui.ALERT_POSITION);
|
|
||||||
}
|
|
||||||
|
|
||||||
async adjustNotificationPosition(position) {
|
|
||||||
await this.openNotificationPosition();
|
|
||||||
let windowsActions = await new WindowsActions(this.app);
|
|
||||||
let winCount = await windowsActions.getWindowCount();
|
|
||||||
await windowsActions.windowByIndex(winCount - 1);
|
|
||||||
await this.clickIfElementVisible("#" + position);
|
|
||||||
await this.clickIfElementVisible("#ok-button");
|
|
||||||
await windowsActions.windowByIndex(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
async checkBox(selector, value) {
|
|
||||||
var checked = await this.app.client.isSelected(selector);
|
|
||||||
while (checked != value) {
|
|
||||||
await this.clickIfElementVisible(selector);
|
|
||||||
checked = await this.app.client.isSelected(selector);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async pinChat() {
|
|
||||||
await this.mouseOver(ui.PIN_CHAT_MOD);
|
|
||||||
await Utils.sleep(2); //wait popout button clickable
|
|
||||||
await this.clickIfElementVisible(ui.PIN_CHAT_MOD);
|
|
||||||
await this.waitElementVisible(ui.PINNED_CHAT_MOD);
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyChatModuleVisible(muduleName) {
|
|
||||||
let locator = ui.HEADER_MODULE_NAME.replace("$$", muduleName);
|
|
||||||
await this.waitElementVisible(locator, TIMEOUT_WAIT_ELEMENT * 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
async closeAllGridModules() {
|
|
||||||
let count = await this.getCount(ui.HEADER_MODULE);
|
|
||||||
for (let i = 1; i <= count; i++) {
|
|
||||||
let header = ui.HEADER_MODULES.replace("$$", 1);
|
|
||||||
let closeButton = ui.CLOSE_MODULES.replace("$$", 1);
|
|
||||||
await this.mouseOver(header);
|
|
||||||
await this.clickIfElementVisible(ui.PIN_CHAT_MOD);
|
|
||||||
await this.clickIfElementVisible(closeButton);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async getCount(locator) {
|
|
||||||
let elements = await this.app.client.elements(locator);
|
|
||||||
return elements.value.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
async navigateURL(url) {
|
|
||||||
return this.app.client.url(url)
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifySpellCheckerWorking(locator, previous) {
|
|
||||||
let current = await this.getValue(locator);
|
|
||||||
await expect(current !== previous).toBeTruthy();
|
|
||||||
}
|
|
||||||
|
|
||||||
async openContextMenu(locator) {
|
|
||||||
if (isWindowsOS) {
|
|
||||||
let position = await this.getLocation(locator);
|
|
||||||
await robot.setMouseDelay(500);
|
|
||||||
await robot.moveMouse(position.x + 20, position.y + 5);
|
|
||||||
await robot.mouseToggle("down", "right");
|
|
||||||
await robot.mouseToggle("up", "right");
|
|
||||||
} else {
|
|
||||||
await this.mouseOver(locator);
|
|
||||||
//right click twice to make it work on MAC
|
|
||||||
await this.rightClickIfElementVisible(locator);
|
|
||||||
await this.rightClickIfElementVisible(locator);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async selectItemOnContextMenu(number) {
|
|
||||||
await robot.setKeyboardDelay(1000);
|
|
||||||
for (let i = 1; i <= number; i++) {
|
|
||||||
await robot.keyTap('down');
|
|
||||||
}
|
|
||||||
await robot.keyTap('enter');
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyVersionInfo(){
|
|
||||||
const { buildNumber } = require('../../package');
|
|
||||||
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)});
|
|
||||||
await expect(values[ 0 ]).toBe(API_VERSION);
|
|
||||||
await expect(values[ 1 ]).toBe('Electron');
|
|
||||||
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;
|
|
@ -1,293 +0,0 @@
|
|||||||
const { Builder, By, Key, until, Actions } = require('selenium-webdriver')
|
|
||||||
require('selenium-webdriver/chrome');
|
|
||||||
require('chromedriver');
|
|
||||||
const Utils = require('./spectronUtils');
|
|
||||||
var assert = require('assert');
|
|
||||||
const ui = require('./spectronInterfaces.js');
|
|
||||||
const specconst = require('./spectronConstants.js');
|
|
||||||
let TIMEOUT_WAIT_ELEMENT = parseInt(specconst.TIMEOUT_WAIT_ELEMENT, 10);
|
|
||||||
let TIMEOUT_PAGE_LOAD = parseInt(specconst.TIMEOUT_PAGE_LOAD, 10);
|
|
||||||
|
|
||||||
class WebDriver {
|
|
||||||
constructor(options) {
|
|
||||||
this.options = options;
|
|
||||||
this.d = new Builder().forBrowser(options.browser).build();
|
|
||||||
this.initDriver();
|
|
||||||
}
|
|
||||||
|
|
||||||
async waitElelmentIsNotVisible(xpath) {
|
|
||||||
let result = false;
|
|
||||||
try {
|
|
||||||
const el = await this.driver.wait(
|
|
||||||
until.elementLocated(By.xpath(xpath)),
|
|
||||||
TIMEOUT_WAIT_ELEMENT
|
|
||||||
)
|
|
||||||
await this.driver.wait(until.elementIsNotVisible(el), TIMEOUT_WAIT_ELEMENT);
|
|
||||||
if (this.driver.findElements(By.xpath(xpath)).length > 0) {
|
|
||||||
result = true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
return await assert.equal(result, false);
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
await assert.equal(result, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async waitElelmentIsVisible(xpath, timeout) {
|
|
||||||
const el = await this.driver.wait(
|
|
||||||
until.elementLocated(By.xpath(xpath)),
|
|
||||||
timeout
|
|
||||||
)
|
|
||||||
await this.driver.wait(until.elementIsVisible(el), timeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
async waitElementVisibleAndGet(xpath) {
|
|
||||||
const el = await this.driver.wait(
|
|
||||||
until.elementLocated(By.xpath(xpath)),
|
|
||||||
TIMEOUT_WAIT_ELEMENT
|
|
||||||
)
|
|
||||||
return await this.driver.wait(until.elementIsVisible(el), TIMEOUT_WAIT_ELEMENT)
|
|
||||||
}
|
|
||||||
|
|
||||||
async getElementById(id) {
|
|
||||||
const el = await this.driver.wait(until.elementLocated(By.id(id)), TIMEOUT_WAIT_ELEMENT)
|
|
||||||
return await this.driver.wait(until.elementIsVisible(el), TIMEOUT_WAIT_ELEMENT)
|
|
||||||
}
|
|
||||||
|
|
||||||
async getElementByXPath(xpath) {
|
|
||||||
const el = await this.driver.wait(
|
|
||||||
until.elementLocated(By.xpath(xpath)),
|
|
||||||
TIMEOUT_WAIT_ELEMENT
|
|
||||||
)
|
|
||||||
return await this.driver.wait(until.elementIsVisible(el), TIMEOUT_WAIT_ELEMENT)
|
|
||||||
}
|
|
||||||
|
|
||||||
async inputText(el, data) {
|
|
||||||
var obj = await this.getElementByXPath(el);
|
|
||||||
await obj.sendKeys(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
async sendEnter(el) {
|
|
||||||
var obj = await this.getElementByXPath(el);
|
|
||||||
await obj.sendKeys(Key.ENTER);
|
|
||||||
}
|
|
||||||
|
|
||||||
async sendMessage(message) {
|
|
||||||
await this.inputText(ui.CHAT_INPUT_TYPING, message);
|
|
||||||
await this.sendEnter(ui.CHAT_INPUT_TYPING);
|
|
||||||
}
|
|
||||||
|
|
||||||
async sendMessages(messages) {
|
|
||||||
for (var i = 0; i < messages.length; i++) {
|
|
||||||
await this.sendMessage(messages[i]);
|
|
||||||
await this.sleep(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async login(user) {
|
|
||||||
await this.inputText(ui.SIGN_IN_EMAIL, user.username);
|
|
||||||
await this.inputText(ui.SIGN_IN_PASSWORD, user.password);
|
|
||||||
var singin = await this.getElementByXPath(ui.SIGN_IN_BUTTON);
|
|
||||||
await singin.click();
|
|
||||||
await this.waitElelmentIsVisible(ui.SETTTING_BUTTON, TIMEOUT_PAGE_LOAD);
|
|
||||||
}
|
|
||||||
|
|
||||||
async mentionUserOnChat(user) {
|
|
||||||
await this.inputText(ui.CHAT_INPUT_TYPING, "@" + user.name);
|
|
||||||
var suggestion = ui.MENTION_USER_SUGGESTION.replace("$$", user.name);
|
|
||||||
var el = await this.getElementByXPath(suggestion);
|
|
||||||
await el.click();
|
|
||||||
await this.sendEnter(ui.CHAT_INPUT_TYPING);
|
|
||||||
}
|
|
||||||
|
|
||||||
async waitSuggestionShowOnlyOneItem(xpath) {
|
|
||||||
if (this.driver.findElements(By.xpath(xpath)).length == 1) {
|
|
||||||
return result = true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickShowConversationCreationModal() {
|
|
||||||
var plusButton = await this.getElementByXPath(ui.PLUS_BTN);
|
|
||||||
await plusButton.click();
|
|
||||||
}
|
|
||||||
|
|
||||||
async selectIMTab() {
|
|
||||||
var imTab = await this.getElementByXPath(ui.IM_TAB);
|
|
||||||
await imTab.click();
|
|
||||||
}
|
|
||||||
|
|
||||||
async selectRoomTab() {
|
|
||||||
var roomTab = await this.getElementByXPath(ui.CHATROOM_TAB);
|
|
||||||
await roomTab.click();
|
|
||||||
}
|
|
||||||
|
|
||||||
async addParticipant(username) {
|
|
||||||
await this.inputText(ui.ADD_PARTICIPANT_TEXT, username);
|
|
||||||
await this.sleep(5);
|
|
||||||
var el = await this.waitElementVisibleAndGet(ui.USERS_SUGGESTION_LIST);
|
|
||||||
await el.click();
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickDoneButton() {
|
|
||||||
var el = await this.getElementByXPath(ui.CREATE_IM_DONE_BTN);
|
|
||||||
await el.click();
|
|
||||||
await this.waitElelmentIsNotVisible(ui.CREATE_IM_DONE_BTN);
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickConfirmCreateRoom() {
|
|
||||||
var el = await this.getElementByXPath(ui.CONFIRM_CREATE_ROOM_BUTTON);
|
|
||||||
await el.click();
|
|
||||||
await this.waitElelmentIsNotVisible(ui.CONFIRM_CREATE_ROOM_BUTTON);
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickStartChat() {
|
|
||||||
var el = await this.getElementByXPath(ui.START_CHAT);
|
|
||||||
await el.click();
|
|
||||||
}
|
|
||||||
|
|
||||||
async createIM(username) {
|
|
||||||
await this.clickShowConversationCreationModal();
|
|
||||||
await this.clickStartChat();
|
|
||||||
await this.selectIMTab();
|
|
||||||
await this.addParticipant(username);
|
|
||||||
await this.clickDoneButton();
|
|
||||||
}
|
|
||||||
|
|
||||||
async createMIM(usernames) {
|
|
||||||
await this.clickShowConversationCreationModal();
|
|
||||||
await this.clickStartChat();
|
|
||||||
await this.selectIMTab();
|
|
||||||
for (var i = 0; i < usernames.length; i++) {
|
|
||||||
await this.addParticipant(usernames[i]);
|
|
||||||
}
|
|
||||||
await this.clickDoneButton();
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickCreateSignal() {
|
|
||||||
var el = await this.getElementByXPath(ui.SIGNAL_OPTION);
|
|
||||||
await el.click();
|
|
||||||
}
|
|
||||||
|
|
||||||
async selectPublicRadioButton() {
|
|
||||||
var el = await this.waitElementVisibleAndGet(ui.PUBLIC_ROOM_RADIO_BTN);
|
|
||||||
await el.click();
|
|
||||||
}
|
|
||||||
|
|
||||||
async selectPrivateRadioButton() {
|
|
||||||
var el = await this.waitElementVisibleAndGet(ui.PRIVATE_ROOM_RADIO_BTN);
|
|
||||||
await el.click();
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickLeftNavItem(name) {
|
|
||||||
var xpath = await ui.LEFT_NAV_SINGLE_ITEM.replace("$$", name);
|
|
||||||
var el = await this.getElementByXPath(xpath);
|
|
||||||
await el.click();
|
|
||||||
var eheader = await this.getElementByXPath(ui.HEADER_MODULE);
|
|
||||||
await this.driver.wait(until.elementIsVisible(eheader), TIMEOUT_WAIT_ELEMENT)
|
|
||||||
}
|
|
||||||
|
|
||||||
async createRoom(usernames, name, description, type) {
|
|
||||||
await this.clickShowConversationCreationModal();
|
|
||||||
await this.clickStartChat();
|
|
||||||
await this.selectRoomTab();
|
|
||||||
await this.inputText(ui.CHATROOM_NAME_TEXT, name);
|
|
||||||
await this.inputText(ui.CHATROOM_DESCR_TEXT, description);
|
|
||||||
if (type === specconst.TYPE_ROOM.private) {
|
|
||||||
await this.selectPrivateRadioButton();
|
|
||||||
}
|
|
||||||
if (type === specconst.TYPE_ROOM.public) {
|
|
||||||
await this.selectPublicRadioButton();
|
|
||||||
}
|
|
||||||
for (var i = 0; i < usernames.length; i++) {
|
|
||||||
await this.addParticipant(usernames[i]);
|
|
||||||
}
|
|
||||||
await this.clickDoneButton();
|
|
||||||
// await this.clickConfirmCreateRoom();
|
|
||||||
}
|
|
||||||
|
|
||||||
async createSignal(signalName, hashTag) {
|
|
||||||
await this.clickShowConversationCreationModal();
|
|
||||||
await this.clickCreateSignal();
|
|
||||||
await this.inputText(ui.SIGNAL_NAME, signalName);
|
|
||||||
await this.inputText(ui.LAST_RULE_ROW + ui.ENTER_KEYWORD_IN_LAST_INPUT, hashTag);
|
|
||||||
await this.clickDoneButton();
|
|
||||||
}
|
|
||||||
|
|
||||||
async initDriver() {
|
|
||||||
return this.d.then(_d => {
|
|
||||||
this.driver = _d
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async startDriver() {
|
|
||||||
await this.driver
|
|
||||||
.manage()
|
|
||||||
.window()
|
|
||||||
.setPosition(0, 0);
|
|
||||||
var size = await await this.driver
|
|
||||||
.manage()
|
|
||||||
.window().getSize();
|
|
||||||
await this.driver.get(specconst.TESTED_HOST);
|
|
||||||
}
|
|
||||||
|
|
||||||
async focusCurrentBrowser() {
|
|
||||||
this.driver.switchTo().window(this.driver.getAllWindowHandles()[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
async sleep(secondSleep) {
|
|
||||||
await this.driver.sleep(secondSleep * 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
async timeOut(secondSleep) {
|
|
||||||
return secondSleep * 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
async quit() {
|
|
||||||
await this.driver.quit();
|
|
||||||
}
|
|
||||||
async close() {
|
|
||||||
await this.driver.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
async sendMessagesAndVerifyToast(messages) {
|
|
||||||
for (var i = 0; i < messages.length; i++) {
|
|
||||||
await this.webActions.clickPlusButton();
|
|
||||||
await this.windowAction.pressCtrlM();
|
|
||||||
await this.sendMessage(messages[i]).then(async () => {
|
|
||||||
await this.windowAction.verifyPersistToastNotification(messages[i]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async closeAllGridModules() {
|
|
||||||
let count = await this.getCount(ui.HEADER_MODULE);
|
|
||||||
for (let i = 1; i <= count; i++) {
|
|
||||||
let header = ui.HEADER_MODULES.replace("$$", 1);
|
|
||||||
let closeButton = ui.CLOSE_MODULES.replace("$$", 1);
|
|
||||||
let pinButton = ui.PIN_CHAT_MODS.replace("$$", 1);
|
|
||||||
await this.clickIfElementVisible(header);
|
|
||||||
await this.clickIfElementVisible(pinButton);
|
|
||||||
await this.clickIfElementVisible(closeButton);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickIfElementVisible(selector) {
|
|
||||||
let el = await this.getElementByXPath(selector);
|
|
||||||
await el.click();
|
|
||||||
}
|
|
||||||
|
|
||||||
async getCount(locator) {
|
|
||||||
let elements = await this.driver.findElements(By.xpath(locator));
|
|
||||||
return elements.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
async mouseOver(locator) {
|
|
||||||
let el = await this.getElementByXPath(locator);
|
|
||||||
let builder = await new Actions(this.driver);
|
|
||||||
builder.moveToElement(el, 20, 20).click().build().perform();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
module.exports = WebDriver;
|
|
@ -1,656 +0,0 @@
|
|||||||
const robot = require('robotjs');
|
|
||||||
const constants = require('./spectronConstants.js');
|
|
||||||
const Utils = require('./spectronUtils.js');
|
|
||||||
const fs = require('fs');
|
|
||||||
const WebActions = require('./spectronWebActions.js');
|
|
||||||
const { isMac, isWindowsOS } = require('../../js/utils/misc');
|
|
||||||
const ui = require('./spectronInterfaces.js');
|
|
||||||
const JSZip = require("jszip");
|
|
||||||
|
|
||||||
class WindowsActions {
|
|
||||||
constructor(app) {
|
|
||||||
this.app = app;
|
|
||||||
}
|
|
||||||
|
|
||||||
async getCurrentSize() {
|
|
||||||
return this.app.browserWindow.getSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
async setSize(width, height) {
|
|
||||||
await this.app.browserWindow.setSize(width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
async closeWindows() {
|
|
||||||
try {
|
|
||||||
if (this.app) {
|
|
||||||
let isRunning = await this.app.isRunning();
|
|
||||||
await this.app.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async isElectronProcessRunning() {
|
|
||||||
let ret = false;
|
|
||||||
if (isWindowsOS) {
|
|
||||||
let result = await Utils.execPromise("tasklist | find /i \"electron.exe\"");
|
|
||||||
if (result && result.indexOf('electron.exe') > -1) {
|
|
||||||
ret = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
async resizeWindows(width, height) {
|
|
||||||
await this.app.browserWindow.getBounds().then((bounds) => {
|
|
||||||
let x = bounds.x + (bounds.width - width);
|
|
||||||
let y = bounds.y + (bounds.height - height);
|
|
||||||
robot.setMouseDelay(500);
|
|
||||||
// Plus 2 pixels to make sure this function works well on MAC
|
|
||||||
robot.moveMouse(bounds.x + 2, bounds.y + 2);
|
|
||||||
robot.mouseToggle("down");
|
|
||||||
robot.dragMouse(x, y);
|
|
||||||
robot.mouseToggle("up");
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async getCurrentPosition() {
|
|
||||||
return this.app.browserWindow.getPosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
async setPosition(x, y) {
|
|
||||||
await this.app.browserWindow.setPosition(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
async dragWindows(x, y) {
|
|
||||||
await this.app.browserWindow.getBounds().then((bounds) => {
|
|
||||||
robot.setMouseDelay(500);
|
|
||||||
robot.moveMouse(bounds.x + 200, bounds.y + 10);
|
|
||||||
robot.mouseToggle("down");
|
|
||||||
robot.moveMouse(bounds.x + 205, bounds.y + 10); // Workaround to make this keyword works properly, refer: https://github.com/octalmage/robotjs/issues/389
|
|
||||||
robot.dragMouse(x + 205, y + 10);
|
|
||||||
robot.mouseToggle("up");
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async showWindow() {
|
|
||||||
await this.app.browserWindow.restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickOutsideWindow() {
|
|
||||||
await this.setPosition(0, 0);
|
|
||||||
let currentSize = await this.getCurrentSize();
|
|
||||||
await robot.setMouseDelay(100);
|
|
||||||
await robot.moveMouse(currentSize[0] + 20, currentSize[1] + 20);
|
|
||||||
await robot.mouseClick();
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyWindowsOnTop(value) {
|
|
||||||
let isAlwaysOnTop = await this.app.browserWindow.isAlwaysOnTop();
|
|
||||||
if (value) {
|
|
||||||
await expect(isAlwaysOnTop).toBeTruthy();
|
|
||||||
} else {
|
|
||||||
await expect(isAlwaysOnTop).toBeFalsy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async menuSearch(element, namevalue) {
|
|
||||||
if (element.name == namevalue) {
|
|
||||||
return await element;
|
|
||||||
}
|
|
||||||
else if (element.items !== undefined) {
|
|
||||||
var result;
|
|
||||||
for (var i = 0; result == null && i < element.items.length; i++) {
|
|
||||||
result = await this.menuSearch(element.items[i], namevalue);
|
|
||||||
result;
|
|
||||||
}
|
|
||||||
return await result;
|
|
||||||
}
|
|
||||||
return await null;
|
|
||||||
}
|
|
||||||
|
|
||||||
async openMenu(arrMenu) {
|
|
||||||
await Utils.sleep(3);
|
|
||||||
var arrStep = [];
|
|
||||||
for (var i = 0; i < arrMenu.length; i++) {
|
|
||||||
var item = await this.menuSearch(constants.MENU.root, arrMenu[i]);
|
|
||||||
await arrStep.push(item);
|
|
||||||
}
|
|
||||||
await this.actionForMenus(arrStep);
|
|
||||||
return arrStep;
|
|
||||||
}
|
|
||||||
|
|
||||||
async openMenuOnMac(arrMenu) {
|
|
||||||
var arrStep = [];
|
|
||||||
for (var i = 0; i < arrMenu.length; i++) {
|
|
||||||
var item = await this.menuSearch(constants.MENUMAC.root, arrMenu[i]);
|
|
||||||
await arrStep.push(item);
|
|
||||||
}
|
|
||||||
await this.actionForMenusOnMac(arrStep);
|
|
||||||
return arrStep;
|
|
||||||
}
|
|
||||||
|
|
||||||
async actionForMenus(arrMenu) {
|
|
||||||
let webAction = await new WebActions(this.app);
|
|
||||||
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
|
||||||
await robot.setMouseDelay(500);
|
|
||||||
let x = bounds.x + 95;
|
|
||||||
let y = bounds.y + 35;
|
|
||||||
await robot.moveMouseSmooth(x, y);
|
|
||||||
await robot.moveMouse(x, y);
|
|
||||||
await robot.mouseClick();
|
|
||||||
await webAction.openApplicationMenuByClick();
|
|
||||||
await robot.setKeyboardDelay(200);
|
|
||||||
await robot.keyTap('enter');
|
|
||||||
for (var i = 0; i < arrMenu.length; i++) {
|
|
||||||
for (var s = 0; s < arrMenu[i].step; s++) {
|
|
||||||
await robot.keyTap('down');
|
|
||||||
}
|
|
||||||
if (arrMenu.length > 1 && i != arrMenu.length - 1) {
|
|
||||||
//handle right keygen
|
|
||||||
await robot.keyTap('right');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await robot.keyTap('enter');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async actionForMenusOnMac(arrMenu) {
|
|
||||||
let webAction = await new WebActions(this.app);
|
|
||||||
await robot.setMouseDelay(2000);
|
|
||||||
let x = 5;
|
|
||||||
let y = 5;
|
|
||||||
await robot.moveMouseSmooth(x, y);
|
|
||||||
await robot.moveMouse(x, y);
|
|
||||||
await robot.mouseClick();
|
|
||||||
await robot.setKeyboardDelay(100);
|
|
||||||
for (var i = 0; i < arrMenu.length; i++) {
|
|
||||||
if (i == 0) {
|
|
||||||
for (var s = 0; s < arrMenu[i].step; s++) {
|
|
||||||
|
|
||||||
await robot.keyTap('right');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for (var s = 0; s <= arrMenu[i].step; s++) {
|
|
||||||
|
|
||||||
await robot.keyTap('down');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (arrMenu.length > 1 && i != arrMenu.length - 1) {
|
|
||||||
//handle right keygen
|
|
||||||
await robot.keyTap('right');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await robot.keyTap('enter');
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyLogExported() {
|
|
||||||
let expected = false;
|
|
||||||
let path = await Utils.getFolderPath('Downloads');
|
|
||||||
this.generateLog(path);
|
|
||||||
let listFiles = Utils.getFiles(path);
|
|
||||||
listFiles.forEach(function (fileName) {
|
|
||||||
if (fileName.indexOf(constants.LOG_FILENAME_PREFIX) > -1) {
|
|
||||||
expected = true;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
await expect(expected).toBeTruthy();
|
|
||||||
}
|
|
||||||
|
|
||||||
async deleteAllLogFiles() {
|
|
||||||
let path = await Utils.getFolderPath('Downloads');
|
|
||||||
let listFiles = Utils.getFiles(path);
|
|
||||||
await listFiles.forEach(function (fileName) {
|
|
||||||
if (fileName.indexOf(constants.LOG_FILENAME_PREFIX) > -1) {
|
|
||||||
fs.unlinkSync(path.concat("\\", fileName));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async selectMinimizeOnClose() {
|
|
||||||
let webAction = await new WebActions(this.app);
|
|
||||||
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
|
||||||
await robot.setMouseDelay(100);
|
|
||||||
let x = bounds.x + 95;
|
|
||||||
let y = bounds.y + 35;
|
|
||||||
await robot.moveMouseSmooth(x, y);
|
|
||||||
await robot.moveMouse(x, y);
|
|
||||||
await robot.mouseClick();
|
|
||||||
await webAction.openApplicationMenuByClick();
|
|
||||||
await robot.setKeyboardDelay(1000);
|
|
||||||
await robot.keyTap('enter');
|
|
||||||
await robot.keyTap('down');
|
|
||||||
await robot.keyTap('down');
|
|
||||||
await robot.keyTap('right');
|
|
||||||
for (let i = 0; i < 4; i++) {
|
|
||||||
await robot.keyTap('down');
|
|
||||||
}
|
|
||||||
await robot.keyTap('enter');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async quitApp() {
|
|
||||||
let webAction = await new WebActions(this.app);
|
|
||||||
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
|
||||||
await robot.setMouseDelay(100);
|
|
||||||
let x = bounds.x + 95;
|
|
||||||
let y = bounds.y + 35;
|
|
||||||
await robot.moveMouseSmooth(x, y);
|
|
||||||
await robot.moveMouse(x, y);
|
|
||||||
await robot.mouseClick();
|
|
||||||
await webAction.openApplicationMenuByClick();
|
|
||||||
await robot.setKeyboardDelay(1000);
|
|
||||||
await robot.keyTap('enter');
|
|
||||||
await robot.keyTap('down');
|
|
||||||
await robot.keyTap('down');
|
|
||||||
await robot.keyTap('right');
|
|
||||||
for (let i = 0; i < 6; i++) {
|
|
||||||
await robot.keyTap('down');
|
|
||||||
}
|
|
||||||
await robot.keyTap('enter');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async pressCtrlW() {
|
|
||||||
await robot.keyToggle('w', 'down', ['control']);
|
|
||||||
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();
|
|
||||||
await expect(isMinimized).toBeTruthy();
|
|
||||||
}
|
|
||||||
|
|
||||||
async isMinimizedWindows() {
|
|
||||||
let rminimized = -1;
|
|
||||||
|
|
||||||
await this.app.browserWindow.isMinimized().then(async function (minimized) {
|
|
||||||
rminimized = constants.MINIMIZED;
|
|
||||||
}).catch((err) => {
|
|
||||||
rminimized = constants.QUIT;
|
|
||||||
return rminimized;
|
|
||||||
});
|
|
||||||
|
|
||||||
return rminimized;
|
|
||||||
}
|
|
||||||
|
|
||||||
async pressCtrlM() {
|
|
||||||
if (!isMac) {
|
|
||||||
await robot.keyToggle('m', 'down', ['control']);
|
|
||||||
await robot.keyToggle('m', 'up', ['control']);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
await robot.keyToggle('m', 'down', ['command']);
|
|
||||||
await robot.keyToggle('m', 'up', ['command']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async pressF11() {
|
|
||||||
await robot.keyTap('f11');
|
|
||||||
}
|
|
||||||
|
|
||||||
async pressCtrlR() {
|
|
||||||
await robot.keyToggle('r', 'down', ['control']);
|
|
||||||
await robot.keyToggle('r', 'up', ['control']);
|
|
||||||
}
|
|
||||||
|
|
||||||
async focusWindow() {
|
|
||||||
this.app.browserWindow.focus();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async setAlwaysOnTop(value) {
|
|
||||||
this.app.browserWindow.setAlwaysOnTop(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
async reload() {
|
|
||||||
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
|
||||||
await robot.setMouseDelay(50);
|
|
||||||
let x = bounds.x + 95;
|
|
||||||
let y = bounds.y + 200;
|
|
||||||
await robot.moveMouseSmooth(x, y);
|
|
||||||
await robot.moveMouse(x, y);
|
|
||||||
await robot.mouseClick('right');
|
|
||||||
await robot.setKeyboardDelay(2000);
|
|
||||||
await robot.keyTap('right');
|
|
||||||
await robot.keyTap('down');
|
|
||||||
await robot.keyTap('enter');
|
|
||||||
}).catch((err1) => {
|
|
||||||
console.log("Message:" + err1);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async clickNotification(x, y) {
|
|
||||||
await robot.setMouseDelay(500);
|
|
||||||
await robot.moveMouseSmooth(x, y);
|
|
||||||
await robot.moveMouse(x, y);
|
|
||||||
await robot.mouseClick();
|
|
||||||
}
|
|
||||||
|
|
||||||
async mouseMoveNotification(x, y) {
|
|
||||||
await robot.setMouseDelay(500);
|
|
||||||
await robot.moveMouseSmooth(x, y);
|
|
||||||
await robot.moveMouse(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
async mouseMoveCenter() {
|
|
||||||
let screen = await this.app.electron.screen.getAllDisplays();
|
|
||||||
await this.app.browserWindow.getBounds().then(async (bounds) => {
|
|
||||||
await robot.setMouseDelay(50);
|
|
||||||
let x = screen[0].bounds.width / 2;
|
|
||||||
let y = screen[0].bounds.height / 2;
|
|
||||||
await robot.moveMouseSmooth(x, y);
|
|
||||||
await robot.moveMouse(x, y);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyPersistToastNotification(message) {
|
|
||||||
let webAction = await new WebActions(this.app);
|
|
||||||
let currentPosition = await this.getToastNotificationPosition(message);
|
|
||||||
let curentSize = await this.getToastNotificationSize(message);
|
|
||||||
await webAction.verifyToastNotificationShow(message);
|
|
||||||
let x = await (currentPosition[0] + curentSize[0] / 2);
|
|
||||||
let y = await (currentPosition[1] + curentSize[1] / 2);
|
|
||||||
await this.clickNotification(x, y);
|
|
||||||
await this.mouseMoveCenter();
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyNotPersistToastNotification() {
|
|
||||||
let webAction = await new WebActions(this.app);
|
|
||||||
let i = 0;
|
|
||||||
while (i < 3) {
|
|
||||||
await Utils.sleep(1);
|
|
||||||
await i++;
|
|
||||||
}
|
|
||||||
await this.webAction.verifyNoToastNotificationShow();
|
|
||||||
await this.mouseMoveCenter();
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyNotCloseToastWhenMouseOver(message) {
|
|
||||||
var i = 0;
|
|
||||||
while (i < 3) {
|
|
||||||
await Utils.sleep(1);
|
|
||||||
await i++;
|
|
||||||
}
|
|
||||||
let webAction = await new WebActions(this.app);
|
|
||||||
let currentPosition = await this.getToastNotificationPosition(message);
|
|
||||||
let curentSize = await this.getToastNotificationSize(message);
|
|
||||||
let x = await (currentPosition[0] + curentSize[0] / 2);
|
|
||||||
let y = await (currentPosition[1] + curentSize[1] / 2);
|
|
||||||
await this.mouseMoveNotification(x, y);
|
|
||||||
await webAction.verifyToastNotificationShow(message);
|
|
||||||
await this.mouseMoveCenter();
|
|
||||||
}
|
|
||||||
|
|
||||||
async windowByIndex(index) {
|
|
||||||
await this.app.client.windowByIndex(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
async getWindowIndexFromTitle(windowTitle) {
|
|
||||||
let winCount = await this.getWindowCount();
|
|
||||||
if (winCount > 1) {
|
|
||||||
for (let j = 1; j < winCount; j++) {
|
|
||||||
await this.windowByIndex(j);
|
|
||||||
|
|
||||||
//wait 120s for title loading
|
|
||||||
let title = await this.app.browserWindow.getTitle();
|
|
||||||
for (let i = 1; i <= 120; i++) {
|
|
||||||
if (title != "Symphony") {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
await Utils.sleep(1);
|
|
||||||
title = await this.app.browserWindow.getTitle();;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (title === windowTitle) {
|
|
||||||
await this.windowByIndex(0);
|
|
||||||
return j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await this.windowByIndex(0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
async bringToFront(windowTitle) {
|
|
||||||
let index = await this.getWindowIndexFromTitle(windowTitle);
|
|
||||||
await this.windowByIndex(index);
|
|
||||||
await this.app.browserWindow.minimize();
|
|
||||||
await this.app.browserWindow.restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
async closeChromeDriver() {
|
|
||||||
Utils.killProcess("chromedriver");
|
|
||||||
}
|
|
||||||
|
|
||||||
async closeChromeDriverOnMac() {
|
|
||||||
Utils.killProcessOnMac("Electron");
|
|
||||||
}
|
|
||||||
|
|
||||||
async getToastNotificationIndex(message) {
|
|
||||||
for (let i = 0; i < 10; i++) {
|
|
||||||
let winCount = await this.app.client.getWindowCount()
|
|
||||||
if (winCount > 1) {
|
|
||||||
for (let j = 1; j < winCount; j++) {
|
|
||||||
await this.app.client.windowByIndex(j);
|
|
||||||
if (await this.app.client.getText(ui.TOAST_MESSAGE_CONTENT) === message) {
|
|
||||||
return j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await Utils.sleep(1);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
async getToastNotificationPosition(message) {
|
|
||||||
let index = await this.getToastNotificationIndex(message);
|
|
||||||
await this.windowByIndex(index);
|
|
||||||
let currentPosition = await this.getCurrentPosition();
|
|
||||||
await this.windowByIndex(0);
|
|
||||||
return currentPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
async getToastNotificationSize(message) {
|
|
||||||
let index = await this.getToastNotificationIndex(message);
|
|
||||||
await this.windowByIndex(index);
|
|
||||||
let currentSize = await this.getCurrentSize();
|
|
||||||
await this.windowByIndex(0);
|
|
||||||
return currentSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyToastNotificationPosition(message, expectedPosition) {
|
|
||||||
let screen = await this.app.electron.screen.getPrimaryDisplay();
|
|
||||||
let screenWidth = screen.size.width;
|
|
||||||
let screenHeight = screen.size.height;
|
|
||||||
let currentPosition = await this.getToastNotificationPosition(message);
|
|
||||||
let curentSize = await this.getToastNotificationSize(message);
|
|
||||||
switch (expectedPosition) {
|
|
||||||
case "lower-right":
|
|
||||||
expect(currentPosition[0] + curentSize[0]).toEqual(screenWidth);
|
|
||||||
expect(screenHeight - (currentPosition[1] + curentSize[1])).toBeLessThan(100);
|
|
||||||
break;
|
|
||||||
case "upper-right":
|
|
||||||
expect(currentPosition[0] + curentSize[0]).toEqual(screenWidth);
|
|
||||||
expect(currentPosition[1]).toEqual(0);
|
|
||||||
break;
|
|
||||||
case "upper-left":
|
|
||||||
expect(currentPosition[0]).toEqual(0);
|
|
||||||
expect(currentPosition[1]).toEqual(0);
|
|
||||||
break;
|
|
||||||
case "lower-left":
|
|
||||||
expect(currentPosition[0]).toEqual(0);
|
|
||||||
expect(screenHeight - (currentPosition[1] + curentSize[1])).toBeLessThan(100);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
await this.windowByIndex(0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
async getWindowCount() {
|
|
||||||
return await this.app.client.getWindowCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyWindowFocus(windowTitle) {
|
|
||||||
let index = await this.getWindowIndexFromTitle(windowTitle);
|
|
||||||
await this.windowByIndex(index);
|
|
||||||
let isFocused = await this.app.browserWindow.isFocused();
|
|
||||||
expect(isFocused === true).toBeTruthy();
|
|
||||||
await this.windowByIndex(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyPopOutWindowAppear(windowTitle) {
|
|
||||||
let index = await this.getWindowIndexFromTitle(windowTitle);
|
|
||||||
expect(index).toBeGreaterThan(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
async closeAllPopOutWindow() {
|
|
||||||
let winCount = await this.getWindowCount();
|
|
||||||
while (winCount > 1) {
|
|
||||||
await this.windowByIndex(winCount - 1);
|
|
||||||
await this.app.browserWindow.close();
|
|
||||||
await Utils.sleep(2);
|
|
||||||
winCount = await this.getWindowCount();
|
|
||||||
}
|
|
||||||
await this.windowByIndex(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
async stopApp() {
|
|
||||||
if (this.app && this.app.isRunning()) {
|
|
||||||
await this.app.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async isAppRunning() {
|
|
||||||
return this.app.isRunning();
|
|
||||||
}
|
|
||||||
|
|
||||||
async generateLog(downloadsPath) {
|
|
||||||
let zip = new JSZip();
|
|
||||||
zip.file("Hello.txt", "Hello World\n");
|
|
||||||
zip.generateNodeStream({ type: 'nodebuffer', streamFiles: true })
|
|
||||||
.pipe(fs.createWriteStream(downloadsPath + '/logs_symphony_1.zip'))
|
|
||||||
.on('finish', function () {
|
|
||||||
console.log("logs_symphony written.");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async windowReload() {
|
|
||||||
await this.app.browserWindow.reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyWindowCount(expected) {
|
|
||||||
let count = await this.app.client.getWindowCount()
|
|
||||||
await expect(count === expected).toBeTruthy();
|
|
||||||
}
|
|
||||||
|
|
||||||
async doAlwaysOnTopOnMac() {
|
|
||||||
await robot.setMouseDelay(500);
|
|
||||||
await robot.moveMouse(190, 0);
|
|
||||||
await robot.mouseClick();
|
|
||||||
// Key tap 7 times as "Always on Top" is in the
|
|
||||||
// 7th position under view menu item
|
|
||||||
for (let i = 0; i < 7; i++) {
|
|
||||||
await robot.keyTap('down');
|
|
||||||
}
|
|
||||||
await robot.keyTap('enter');
|
|
||||||
}
|
|
||||||
|
|
||||||
async setAlwaysOnTop(value) {
|
|
||||||
if (isMac) {
|
|
||||||
await this.doAlwaysOnTopOnMac();
|
|
||||||
} else {
|
|
||||||
await this.openMenu(["Window", "Always on Top"]);
|
|
||||||
}
|
|
||||||
let isAlwaysOnTop = await this.app.browserWindow.isAlwaysOnTop();
|
|
||||||
if (value !== isAlwaysOnTop) {
|
|
||||||
if (isMac) {
|
|
||||||
await this.doAlwaysOnTopOnMac();
|
|
||||||
} else {
|
|
||||||
await this.openMenu(["Window", "Always on Top"]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyAppFullScreen() {
|
|
||||||
let actual = await this.app.browserWindow.isFullScreen();
|
|
||||||
await expect(actual).toBeTruthy();
|
|
||||||
}
|
|
||||||
|
|
||||||
async fullScreenOnMac() {
|
|
||||||
await robot.setMouseDelay(100);
|
|
||||||
await robot.moveMouseSmooth(205, 10);
|
|
||||||
await robot.mouseClick();
|
|
||||||
await robot.setKeyboardDelay(100);
|
|
||||||
// Key tap 5 times as "Enter Full Screen" is in the
|
|
||||||
// 5th position under view menu item
|
|
||||||
for (let i = 0; i < 5; i++) {
|
|
||||||
await robot.keyTap('down');
|
|
||||||
}
|
|
||||||
await robot.keyTap('enter');
|
|
||||||
}
|
|
||||||
|
|
||||||
async blurBrowserWindow() {
|
|
||||||
await robot.setMouseDelay(200);
|
|
||||||
await robot.moveMouse(0, 100);
|
|
||||||
await robot.mouseClick();
|
|
||||||
}
|
|
||||||
|
|
||||||
async resetBadgeCount() {
|
|
||||||
await this.app.electron.remote.app.setBadgeCount(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
async getBadgeCount() {
|
|
||||||
let count = await this.app.electron.remote.app.getBadgeCount();
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
async verifyCurrentBadgeCount(number) {
|
|
||||||
let expected = false;
|
|
||||||
var i = 0;
|
|
||||||
var count = await this.getBadgeCount();
|
|
||||||
while (i < 5) {
|
|
||||||
if (count == number) {
|
|
||||||
expected = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
await Utils.sleep(1);
|
|
||||||
count = await this.getBadgeCount();
|
|
||||||
await i++;
|
|
||||||
}
|
|
||||||
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;
|
|
@ -1,54 +0,0 @@
|
|||||||
const Application = require('./spectronSetup');
|
|
||||||
const WebActions = require('./spectronWebActions');
|
|
||||||
const WindowsActions = require('./spectronWindowsActions');
|
|
||||||
const constants = require('./spectronConstants.js');
|
|
||||||
const path = require('path');
|
|
||||||
const ui = require('./spectronInterfaces.js');
|
|
||||||
const { isWindowsOS } = require('../../js/utils/misc.js');
|
|
||||||
let TIMEOUT_TEST_SUITE = parseInt(constants.TIMEOUT_TEST_SUITE, 10);
|
|
||||||
let app, windowsActions, webActions;
|
|
||||||
|
|
||||||
describe('Tests for spellChecker', () => {
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT_TEST_SUITE;
|
|
||||||
|
|
||||||
beforeAll(async (done) => {
|
|
||||||
try {
|
|
||||||
app = await new Application({}).startApplication({ testedHost: constants.TESTED_HOST, alwaysOnTop: true });
|
|
||||||
webActions = await new WebActions(app);
|
|
||||||
windowsActions = await new WindowsActions(app);
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
await windowsActions.stopApp();
|
|
||||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async (done) => {
|
|
||||||
try {
|
|
||||||
await windowsActions.stopApp();
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Failed at post-condition: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
it('SpellChecker should be working', async (done) => {
|
|
||||||
try {
|
|
||||||
if (await windowsActions.isAppRunning()) {
|
|
||||||
let misspelledWord = "comming ";
|
|
||||||
await webActions.navigateURL('file:///' + path.join(__dirname, '..', '..', 'demo/index.html'));
|
|
||||||
if (isWindowsOS) {
|
|
||||||
await windowsActions.bringToFront("Symphony");
|
|
||||||
await windowsActions.pressF11();
|
|
||||||
}
|
|
||||||
await webActions.inputText(ui.TAG_TEXTBOX, misspelledWord);
|
|
||||||
await webActions.openContextMenu(ui.TAG_TEXTBOX);
|
|
||||||
await webActions.selectItemOnContextMenu(3);
|
|
||||||
await webActions.verifySpellCheckerWorking(ui.TAG_TEXTBOX, misspelledWord)
|
|
||||||
}
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Fail to verify spellChecker: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,68 +0,0 @@
|
|||||||
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()
|
|
||||||
});
|
|
||||||
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 TIMEOUT_TEST_SUITE = parseInt(specconst.TIMEOUT_TEST_SUITE, 10);
|
|
||||||
|
|
||||||
!isMac ? describe('Verify Flash notification in taskbar option when multiple applications are opened', () => {
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 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.windowAction = windowAction;
|
|
||||||
webdriver.webActions = webActions;
|
|
||||||
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();
|
|
||||||
done();
|
|
||||||
}).catch((err) => {
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* Verify Flash notification in taskbar option when multiple applications are opened
|
|
||||||
* TC-ID: 47308146
|
|
||||||
* Cover scenarios in AVT-1083
|
|
||||||
*/
|
|
||||||
it('Verify Flash notification in taskbar option when multiple applications are opened', async () => {
|
|
||||||
|
|
||||||
await webdriver.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 app.client.waitForVisible(ifc.SETTTING_BUTTON, Utils.toMs(50));
|
|
||||||
await windowAction.pressCtrlM();
|
|
||||||
await webdriver.clickLeftNavItem(specconst.USER_B.name);
|
|
||||||
let messages = [];
|
|
||||||
await messages.push(await Utils.randomString());
|
|
||||||
await messages.push(await Utils.randomString());
|
|
||||||
await messages.push(await Utils.randomString());
|
|
||||||
await webdriver.sendMessagesAndVerifyToast(messages);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}) : describe.skip();
|
|
||||||
|
|
@ -1,94 +0,0 @@
|
|||||||
const Application = require('./spectronSetup');
|
|
||||||
const WebDriver = require('./spectronWebDriver');
|
|
||||||
const { isMac } = require('../../js/utils/misc.js');
|
|
||||||
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 TIMEOUT_TEST_SUITE = parseInt(specconst.TIMEOUT_TEST_SUITE, 10);
|
|
||||||
|
|
||||||
!isMac ? describe('Verify toast notification for IMs', () => {
|
|
||||||
let originalTimeout = specconst.DEFAULT_TIMEOUT_INTERVAL;
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT_TEST_SUITE;
|
|
||||||
|
|
||||||
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(async (done) => {
|
|
||||||
try {
|
|
||||||
if (app && app.isRunning()) {
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = await originalTimeout;
|
|
||||||
await app.stop();
|
|
||||||
await webdriver.quit();
|
|
||||||
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 (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 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}`));
|
|
||||||
};
|
|
||||||
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* Verify toast notification for signals, mentions and keywords
|
|
||||||
* TC-ID: 3395306
|
|
||||||
* Cover scenarios in AVT-1032
|
|
||||||
*/
|
|
||||||
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.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();
|
|
@ -1,113 +0,0 @@
|
|||||||
const Application = require('./spectronSetup');
|
|
||||||
const WebActions = require('./spectronWebActions');
|
|
||||||
const WindowsActions = require('./spectronWindowsActions');
|
|
||||||
const WebDriver = require('./spectronWebDriver');
|
|
||||||
const { isMac } = require('../../js/utils/misc.js');
|
|
||||||
const constants = require('./spectronConstants.js');
|
|
||||||
const ui = require('./spectronInterfaces.js');
|
|
||||||
const Utils = require('./spectronUtils');
|
|
||||||
let TIMEOUT_TEST_SUITE = parseInt(constants.TIMEOUT_TEST_SUITE, 10);
|
|
||||||
let app, webDriver, webActions, windowsActions;
|
|
||||||
|
|
||||||
!isMac ? describe('Tests for Toast Notification ', () => {
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT_TEST_SUITE;
|
|
||||||
|
|
||||||
beforeAll(async (done) => {
|
|
||||||
try {
|
|
||||||
webDriver = await new WebDriver({ browser: 'chrome' });
|
|
||||||
app = await new Application({}).startApplication({ testedHost: constants.TESTED_HOST, alwaysOnTop: true });
|
|
||||||
webActions = await new WebActions(app);
|
|
||||||
windowsActions = await new WindowsActions(app);
|
|
||||||
await webDriver.startDriver();
|
|
||||||
await webActions.login(constants.USER_A);
|
|
||||||
await windowsActions.bringToFront("Symphony");
|
|
||||||
await webDriver.login(constants.USER_B);
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
await windowsActions.stopApp();
|
|
||||||
await webDriver.quit();
|
|
||||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async (done) => {
|
|
||||||
try {
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
|
|
||||||
await windowsActions.stopApp();
|
|
||||||
await webDriver.quit();
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
await windowsActions.stopApp();
|
|
||||||
await webDriver.quit();
|
|
||||||
done.fail(new Error(`Failed at post-condition: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify Pop-up alert play depends on setting
|
|
||||||
* TC-ID: 2916217
|
|
||||||
* Cover scenarios in AVT-1024
|
|
||||||
*/
|
|
||||||
it('Pop-up alert play depends on setting', async (done) => {
|
|
||||||
try {
|
|
||||||
if (await windowsActions.isAppRunning()) {
|
|
||||||
let message1 = await Utils.randomString();
|
|
||||||
let message2 = await Utils.randomString();
|
|
||||||
|
|
||||||
//"Mute pop-up alerts on my desktop"=OFF
|
|
||||||
await webActions.openAlertsSettings();
|
|
||||||
await webActions.checkBox(ui.MUTE_POPUP_ALERTS_CKB, false);
|
|
||||||
await webDriver.createIM(constants.USER_A.name);
|
|
||||||
await webDriver.sendMessages([message1]);
|
|
||||||
await webActions.verifyToastNotificationShow(message1);
|
|
||||||
await Utils.sleep(5); //waitting for toast message disappears
|
|
||||||
|
|
||||||
//"Mute pop-up alerts on my desktop"=ON
|
|
||||||
await webActions.checkBox(ui.MUTE_POPUP_ALERTS_CKB, true);
|
|
||||||
await webDriver.sendMessages([message2]);
|
|
||||||
await webActions.verifyNoToastNotificationShow(message2);
|
|
||||||
}
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Fail to verify pop-up alert play depends on setting: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify Configure alert position at top/bottom left/right
|
|
||||||
* TC-ID: 2916213, 2916214, 2916215, 2916216
|
|
||||||
* Cover scenarios in AVT-1026
|
|
||||||
*/
|
|
||||||
it('Configure alert position at top/bottom left/right ', async (done) => {
|
|
||||||
try {
|
|
||||||
if (await windowsActions.isAppRunning()) {
|
|
||||||
let lowerRightMessage = await Utils.randomString();
|
|
||||||
let upperRightMessage = await Utils.randomString();
|
|
||||||
let upperLeftMessage = await Utils.randomString();
|
|
||||||
let lowerLeftMessage = await Utils.randomString();
|
|
||||||
|
|
||||||
await webDriver.createIM(constants.USER_A.name);
|
|
||||||
await webActions.openAlertsSettings();
|
|
||||||
await webActions.checkBox(ui.MUTE_POPUP_ALERTS_CKB, false);
|
|
||||||
await webActions.adjustNotificationPosition("lower-right");
|
|
||||||
await webDriver.sendMessages([lowerRightMessage]);
|
|
||||||
await windowsActions.verifyToastNotificationPosition(lowerRightMessage, "lower-right");
|
|
||||||
|
|
||||||
await webActions.adjustNotificationPosition("upper-right");
|
|
||||||
await webDriver.sendMessages([upperRightMessage]);
|
|
||||||
await windowsActions.verifyToastNotificationPosition(upperRightMessage, "upper-right");
|
|
||||||
|
|
||||||
await webActions.adjustNotificationPosition("upper-left");
|
|
||||||
await webDriver.sendMessages([upperLeftMessage]);
|
|
||||||
await windowsActions.verifyToastNotificationPosition(upperLeftMessage, "upper-left");
|
|
||||||
|
|
||||||
await webActions.adjustNotificationPosition("lower-left");
|
|
||||||
await webDriver.sendMessages([lowerLeftMessage]);
|
|
||||||
await windowsActions.verifyToastNotificationPosition(lowerLeftMessage, "lower-left");
|
|
||||||
}
|
|
||||||
done();
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Fail to configure alert position at top/bottom left/right : ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}) : describe.skip();
|
|
@ -1,88 +0,0 @@
|
|||||||
const Application = require('./spectronSetup');
|
|
||||||
const WebDriver = require('./spectronWebDriver');
|
|
||||||
const { isMac } = require('../../js/utils/misc.js');
|
|
||||||
const Utils = require('./spectronUtils');
|
|
||||||
var app = new Application({});
|
|
||||||
let webdriver,webActions, windowAction;
|
|
||||||
const WindowsAction = require('./spectronWindowsActions');
|
|
||||||
const WebActions = require('./spectronWebActions');
|
|
||||||
const ifc = require('./spectronInterfaces.js');
|
|
||||||
const specconst = require('./spectronConstants.js');
|
|
||||||
let TIMEOUT_TEST_SUITE = parseInt(specconst.TIMEOUT_TEST_SUITE, 10);
|
|
||||||
|
|
||||||
!isMac ? describe('Verify toast notification when Persist Notification is ON', () => {
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 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 = await originalTimeout;
|
|
||||||
await app.stop();
|
|
||||||
await webdriver.quit();
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
done.fail(new Error(`Failed at post-condition: ${err}`));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* Verify toast notification when Persist Notification is ON
|
|
||||||
* TC-ID: 3308790
|
|
||||||
* Cover scenarios in AVT-1025
|
|
||||||
*/
|
|
||||||
it('Toast notification appears on screen and should stay on the screen IM', async () => {
|
|
||||||
|
|
||||||
await webdriver.login(specconst.USER_A);
|
|
||||||
await webdriver.closeAllGridModules();
|
|
||||||
await webdriver.createIM(specconst.USER_B.username);
|
|
||||||
await webActions.login(specconst.USER_B);
|
|
||||||
|
|
||||||
await app.client.waitForVisible(ifc.SETTTING_BUTTON, Utils.toMs(30));
|
|
||||||
await webActions.persistToastIM(true);
|
|
||||||
|
|
||||||
await windowAction.pressCtrlM();
|
|
||||||
message = await Utils.randomString();
|
|
||||||
await webdriver.sendMessages([message]);
|
|
||||||
await windowAction.verifyPersistToastNotification(message);
|
|
||||||
await windowAction.pressCtrlM();
|
|
||||||
await webdriver.createMIM([specconst.USER_B.username, specconst.USER_C.username]);
|
|
||||||
await webdriver.sendMessages([message]);
|
|
||||||
await windowAction.verifyPersistToastNotification(message);
|
|
||||||
|
|
||||||
})
|
|
||||||
/**
|
|
||||||
* Verify toast notification when Persist Notification is OFF
|
|
||||||
* TC-ID: 46602241
|
|
||||||
* Cover scenarios in AVT-1027
|
|
||||||
*/
|
|
||||||
it('Toast notification appears on screen and should disappear in few seconds IM', async () => {
|
|
||||||
await windowAction.bringToFront("Symphony");
|
|
||||||
await Utils.sleep(5);
|
|
||||||
await webActions.persistToastIM(false);
|
|
||||||
await windowAction.pressCtrlM();
|
|
||||||
await webdriver.clickLeftNavItem(specconst.USER_B.name);
|
|
||||||
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();
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
}) : describe.skip();
|
|
@ -1,149 +0,0 @@
|
|||||||
const Application = require('./spectronSetup');
|
|
||||||
const { isMac } = require('../../js/utils/misc');
|
|
||||||
const robot = require('robotjs');
|
|
||||||
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(async (done) => {
|
|
||||||
try {
|
|
||||||
app = await mainApp.startApplication({ alwaysOnTop: true });
|
|
||||||
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(app) {
|
|
||||||
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((done) => {
|
|
||||||
// Get it back normal size
|
|
||||||
if (!isMac) {
|
|
||||||
for (let i = 0; i < 4; i++) {
|
|
||||||
robot.keyToggle('+', 'down', ['control', 'shift']);
|
|
||||||
}
|
|
||||||
robot.keyToggle('+', 'up');
|
|
||||||
robot.keyToggle('control', 'up');
|
|
||||||
robot.keyToggle('shift', 'up');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (app && app.isRunning()) {
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
|
|
||||||
app.client.getWindowCount().then((count) => {
|
|
||||||
if (count > 0) {
|
|
||||||
app.stop().then(() => {
|
|
||||||
done();
|
|
||||||
}).catch((err) => {
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should 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();
|
|
||||||
|
|
||||||
await robot.keyToggle('0', 'down', ['control']);
|
|
||||||
await robot.keyToggle('0', 'up',['control']);
|
|
||||||
|
|
||||||
for (let i = 0; i < 4; i++) {
|
|
||||||
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']);
|
|
||||||
}
|
|
||||||
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', 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();
|
|
||||||
|
|
||||||
await robot.keyToggle('0', 'down', ['control']);
|
|
||||||
await robot.keyToggle('0', 'up');
|
|
||||||
await robot.keyToggle('control', 'up');
|
|
||||||
|
|
||||||
for (let i = 0; i < 4; i++) {
|
|
||||||
await robot.keyToggle('-', 'down', ['control']);
|
|
||||||
}
|
|
||||||
await robot.keyToggle('-', 'up');
|
|
||||||
await robot.keyToggle('control', 'up');
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
Loading…
Reference in New Issue
Block a user