From 0e46833b324e0dce5f83b59782d3d8f1ab3f2f2d Mon Sep 17 00:00:00 2001 From: Kiran Niranjan Date: Mon, 3 Jul 2017 16:19:31 +0530 Subject: [PATCH] Electron-93 Spectron test for always on top feature --- spectron/tests/alwaysOnTop-test.js | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 spectron/tests/alwaysOnTop-test.js diff --git a/spectron/tests/alwaysOnTop-test.js b/spectron/tests/alwaysOnTop-test.js new file mode 100644 index 00000000..4cdf1409 --- /dev/null +++ b/spectron/tests/alwaysOnTop-test.js @@ -0,0 +1,54 @@ +const Application = require('../app'); +const assert = require('assert'); +const path = require('path'); + +describe('Tests for Activity Detection', () => { + let app; + + before(() => { + app = new Application({}); + }); + + after(() => { + if (app && app.isRunning()) { + return app.stop(); + } + }); + + it('should launch the app', () => { + return app.startApplication().then((startedApp) => { + app = startedApp; + app.client.waitUntilWindowLoaded().getWindowCount() + .should.eventually.equal(1); + }); + }); + + it('should check window count', () => { + return app.client.windowHandles().then(function (response) { + assert.equal(response.value.length, 1) + }); + }); + + it('should check browser window visibility', () => { + return app.browserWindow.isVisible().then(function (visible) { + assert.equal(visible, true); + }); + }); + + it('should check is always on top', () => { + return app.browserWindow.isAlwaysOnTop().then(function (isAlwaysOnTop) { + assert.equal(isAlwaysOnTop, false); + }); + }); + + it('should change the always on top property', () => { + return app.browserWindow.setAlwaysOnTop(true); + }); + + it('should check is always on top to be true', () => { + return app.browserWindow.isAlwaysOnTop().then(function (isAlwaysOnTop) { + assert.equal(isAlwaysOnTop, true); + }); + }); + +}); \ No newline at end of file