2018-08-01 09:50:48 -05:00
|
|
|
const Application = require('./spectronSetup');
|
|
|
|
const WindowsActions = require('./spectronWindowsActions');
|
|
|
|
const WebActions = require('./spectronWebActions');
|
|
|
|
const Utils = require('./spectronUtils');
|
2018-09-05 23:51:05 -05:00
|
|
|
const { isMac } = require('../../js/utils/misc');
|
2018-08-01 09:50:48 -05:00
|
|
|
|
2018-09-19 00:36:40 -05:00
|
|
|
let app, windowActions, webActions;
|
2018-08-01 09:50:48 -05:00
|
|
|
|
2018-09-05 23:51:05 -05:00
|
|
|
describe('Tests for always on top with mult-apps are opened', () => {
|
2018-08-01 09:50:48 -05:00
|
|
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
|
|
|
|
|
|
|
beforeAll(async (done) => {
|
|
|
|
try {
|
2018-09-05 23:51:05 -05:00
|
|
|
app = await new Application({}).startApplication({ alwaysOnTop: false });
|
2018-08-01 09:50:48 -05:00
|
|
|
windowActions = await new WindowsActions(app);
|
|
|
|
webActions = await new WebActions(app);
|
|
|
|
done();
|
2018-09-05 23:51:05 -05:00
|
|
|
} catch (err) {
|
2018-08-01 09:50:48 -05:00
|
|
|
done.fail(new Error(`Unable to start application error: ${err}`));
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async (done) => {
|
|
|
|
try {
|
2018-09-05 23:51:05 -05:00
|
|
|
if (isMac) {
|
|
|
|
await Utils.killProcess("Notes");
|
|
|
|
await Utils.killProcess("Reminders");
|
|
|
|
} else {
|
|
|
|
await Utils.killProcess("notepad.exe");
|
|
|
|
await Utils.killProcess("mspaint.exe");
|
|
|
|
}
|
2018-08-01 09:50:48 -05:00
|
|
|
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 {
|
2018-09-05 23:51:05 -05:00
|
|
|
await windowActions.setAlwaysOnTop(true);
|
2018-08-01 09:50:48 -05:00
|
|
|
await webActions.minimizeWindows();
|
2018-09-05 23:51:05 -05:00
|
|
|
if (isMac) {
|
|
|
|
await Utils.openAppInMaximize("Notes");
|
|
|
|
await Utils.openAppInMaximize("Reminders");
|
2018-09-10 02:17:49 -05:00
|
|
|
await Utils.sleep(10); //Sleep 10secs for waiting app opening completely.
|
2018-09-05 23:51:05 -05:00
|
|
|
} else {
|
|
|
|
await Utils.openAppInMaximize("notepad.exe");
|
|
|
|
await Utils.openAppInMaximize("mspaint.exe");
|
|
|
|
}
|
2018-08-01 09:50:48 -05:00
|
|
|
await windowActions.showWindow();
|
|
|
|
await windowActions.clickOutsideWindow();
|
2018-09-05 23:51:05 -05:00
|
|
|
await windowActions.verifyWindowsOnTop(true);
|
2018-09-10 02:17:49 -05:00
|
|
|
|
2018-08-01 09:50:48 -05:00
|
|
|
//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();
|
2018-09-05 23:51:05 -05:00
|
|
|
await windowActions.verifyWindowsOnTop(true);
|
2018-08-01 09:50:48 -05:00
|
|
|
done();
|
2018-09-05 23:51:05 -05:00
|
|
|
} catch (err) {
|
2018-08-01 09:50:48 -05:00
|
|
|
done.fail(new Error(`Fail to keep Always on Top options when multiple applications are opened with error: ${err}`));
|
|
|
|
};
|
|
|
|
});
|
2018-09-05 23:51:05 -05:00
|
|
|
});
|