SymphonyElectron/tests/spectron/bringToFront.spectron.js

82 lines
2.4 KiB
JavaScript
Raw Normal View History

const Application = require('./spectronSetup');
2017-07-06 06:36:16 -05:00
let app = new Application({});
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-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-06 04:39:50 -05:00
afterAll((done) => {
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-06 04:39:50 -05:00
it('should launch the app', (done) => {
return app.client.waitUntilWindowLoaded().then(() => {
return app.client.getWindowCount().then((count) => {
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();
});
});
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
});
});
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();
});
});
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();
});
});
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();
});
});
});