2017-07-20 06:57:48 -05:00
|
|
|
const Application = require('./spectronSetup');
|
2017-07-06 06:36:16 -05:00
|
|
|
let app = new Application({});
|
|
|
|
|
2017-07-05 03:53:39 -05:00
|
|
|
describe('Tests for Bring to front', () => {
|
|
|
|
|
|
|
|
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
2017-07-06 06:36:16 -05:00
|
|
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
2017-07-05 03:53:39 -05:00
|
|
|
|
2017-07-06 04:39:50 -05:00
|
|
|
beforeAll((done) => {
|
|
|
|
return app.startApplication().then((startedApp) => {
|
|
|
|
app = startedApp;
|
|
|
|
done();
|
2017-07-06 06:36:16 -05:00
|
|
|
}).catch((err) => {
|
|
|
|
expect(err).toBeNull();
|
2017-07-06 04:39:50 -05:00
|
|
|
});
|
2017-07-05 03:53:39 -05:00
|
|
|
});
|
|
|
|
|
2017-07-06 04:39:50 -05:00
|
|
|
afterAll((done) => {
|
2017-07-05 03:53:39 -05:00
|
|
|
if (app && app.isRunning()) {
|
|
|
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
|
2017-07-06 04:39:50 -05:00
|
|
|
app.stop().then(() => {
|
|
|
|
done();
|
|
|
|
}).catch((err) => {
|
|
|
|
done();
|
|
|
|
});
|
2017-07-05 03:53:39 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-07-06 04:39:50 -05:00
|
|
|
it('should launch the app', (done) => {
|
|
|
|
return app.client.waitUntilWindowLoaded().then(() => {
|
|
|
|
return app.client.getWindowCount().then((count) => {
|
2017-07-05 03:53:39 -05:00
|
|
|
expect(count === 1).toBeTruthy();
|
2017-07-06 04:39:50 -05:00
|
|
|
done();
|
2017-07-06 06:36:16 -05:00
|
|
|
}).catch((err) => {
|
|
|
|
expect(err).toBeNull();
|
2017-07-06 04:39:50 -05:00
|
|
|
});
|
2017-07-06 06:36:16 -05:00
|
|
|
}).catch((err) => {
|
|
|
|
expect(err).toBeNull();
|
2017-07-05 03:53:39 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should minimize the app', () => {
|
2017-07-06 04:39:50 -05:00
|
|
|
return app.browserWindow.minimize().then(() => {
|
|
|
|
return app.browserWindow.isMinimized().then((isMinimized) => {
|
|
|
|
expect(isMinimized).toBeTruthy();
|
2017-07-06 06:36:16 -05:00
|
|
|
}).catch((err) => {
|
|
|
|
expect(err).toBeNull();
|
2017-07-06 04:39:50 -05:00
|
|
|
});
|
2017-07-06 06:36:16 -05:00
|
|
|
}).catch((err) => {
|
|
|
|
expect(err).toBeNull();
|
2017-07-06 04:39:50 -05:00
|
|
|
});
|
2017-07-05 03:53:39 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should not be focused', () => {
|
|
|
|
return app.browserWindow.isFocused().then((isFocused) => {
|
|
|
|
expect(isFocused).toBeFalsy();
|
2017-07-06 06:36:16 -05:00
|
|
|
}).catch((err) => {
|
|
|
|
expect(err).toBeNull();
|
2017-07-05 03:53:39 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should maximize browser window', () => {
|
2017-07-06 07:05:21 -05:00
|
|
|
return app.browserWindow.restore().then(() => {
|
2017-07-06 04:39:50 -05:00
|
|
|
return app.browserWindow.isMinimized().then((isMinimized) => {
|
|
|
|
expect(isMinimized).toBeFalsy();
|
2017-07-06 06:36:16 -05:00
|
|
|
}).catch((err) => {
|
|
|
|
expect(err).toBeNull();
|
2017-07-06 04:39:50 -05:00
|
|
|
});
|
2017-07-06 06:36:16 -05:00
|
|
|
}).catch((err) => {
|
|
|
|
expect(err).toBeNull();
|
2017-07-05 03:53:39 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should be focused', () => {
|
|
|
|
return app.browserWindow.isFocused().then((isFocused) => {
|
|
|
|
expect(isFocused).toBeTruthy();
|
2017-07-06 06:36:16 -05:00
|
|
|
}).catch((err) => {
|
|
|
|
expect(err).toBeNull();
|
2017-07-05 03:53:39 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|