Electron-87 Moved the Bring to front test to Jest from mocha

This commit is contained in:
Kiran Niranjan 2017-07-05 14:23:39 +05:30 committed by Kiran Niranjan
parent 7210f88e51
commit 4977b19d80
2 changed files with 57 additions and 45 deletions

View File

@ -1,45 +0,0 @@
const Application = require('../app');
const assert = require('assert');
describe('Tests for Bring to front', () => {
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 minimize the app', () => {
return app.browserWindow.minimize();
});
it('should not be focused', () => {
return app.browserWindow.isFocused().then((isFocused) => {
assert.equal(isFocused, false);
});
});
it('should maximize browser window', () => {
return app.browserWindow.restore();
});
it('should be focused', () => {
return app.browserWindow.isFocused().then((isFocused) => {
assert.equal(isFocused, true);
});
});
});

View File

@ -0,0 +1,57 @@
const Application = require('./spectronSetup');
describe('Tests for Bring to front', () => {
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 minimize the app', () => {
return app.browserWindow.minimize().then(async () => {
const isMinimized = await app.browserWindow.isMinimized();
expect(isMinimized).toBeTruthy();
})
});
it('should not be focused', () => {
return app.browserWindow.isFocused().then((isFocused) => {
expect(isFocused).toBeFalsy();
});
});
it('should maximize browser window', () => {
return app.browserWindow.restore().then(async () => {
const isMinimized = await app.browserWindow.isMinimized();
expect(isMinimized).toBeFalsy();
});
});
it('should be focused', () => {
return app.browserWindow.isFocused().then((isFocused) => {
expect(isFocused).toBeTruthy();
});
});
});