1
0
mirror of https://github.com/finos/SymphonyElectron.git synced 2025-02-13 08:56:04 -06:00

Electron-93 Moved the Always on top test to Jest from mocha

This commit is contained in:
Kiran Niranjan 2017-07-05 14:42:21 +05:30 committed by Kiran Niranjan
parent 0e46833b32
commit 6db3cc2c3d
2 changed files with 56 additions and 54 deletions

View File

@ -1,54 +0,0 @@
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);
});
});
});

56
tests/alwaysOnTop.test.js Normal file
View File

@ -0,0 +1,56 @@
const Application = require('./spectronSetup');
const path = require('path');
describe('Tests for Always on top', () => {
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
let app;
beforeAll(() => {
app = new Application({});
});
afterAll(() => {
if (app && app.isRunning()) {
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
return app.stop();
}
});
it('should launch the app', () => {
return app.startApplication().then((startedApp) => {
app = startedApp;
return app.client.waitUntilWindowLoaded().then(async () => {
const count = await app.client.getWindowCount();
expect(count === 1).toBeTruthy();
})
});
});
it('should check window count', async () => {
const count = await app.client.getWindowCount();
expect(count === 1).toBeTruthy();
});
it('should check browser window visibility', async () => {
const isVisible = await app.browserWindow.isVisible();
expect(isVisible).toBeTruthy();
});
it('should check is always on top', async () => {
const isAlwaysOnTop = await app.browserWindow.isAlwaysOnTop();
expect(isAlwaysOnTop).toBeFalsy();
});
it('should change the always on top property', () => {
return app.browserWindow.setAlwaysOnTop(true);
});
it('should check is always on top to be true', async () => {
const isAlwaysOnTop = await app.browserWindow.isAlwaysOnTop();
expect(isAlwaysOnTop).toBeTruthy();
});
});