SymphonyElectron/tests/spectron/bringToFront.spectron.js
Kiran Niranjan 992bc6649e Electron build issues
1. Moved spectron test to a different directory
2. Added a npm command to run spectron test separately
2017-07-20 17:27:48 +05:30

83 lines
2.4 KiB
JavaScript

const Application = require('./spectronSetup');
let app = new Application({});
describe('Tests for Bring to front', () => {
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
beforeAll((done) => {
return app.startApplication().then((startedApp) => {
app = startedApp;
done();
}).catch((err) => {
expect(err).toBeNull();
});
});
afterAll((done) => {
if (app && app.isRunning()) {
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
app.stop().then(() => {
done();
}).catch((err) => {
console.log(err);
done();
});
}
});
it('should launch the app', (done) => {
return app.client.waitUntilWindowLoaded().then(() => {
return app.client.getWindowCount().then((count) => {
expect(count === 1).toBeTruthy();
done();
}).catch((err) => {
expect(err).toBeNull();
});
}).catch((err) => {
expect(err).toBeNull();
});
});
it('should minimize the app', () => {
return app.browserWindow.minimize().then(() => {
return app.browserWindow.isMinimized().then((isMinimized) => {
expect(isMinimized).toBeTruthy();
}).catch((err) => {
expect(err).toBeNull();
});
}).catch((err) => {
expect(err).toBeNull();
});
});
it('should not be focused', () => {
return app.browserWindow.isFocused().then((isFocused) => {
expect(isFocused).toBeFalsy();
}).catch((err) => {
expect(err).toBeNull();
});
});
it('should maximize browser window', () => {
return app.browserWindow.restore().then(() => {
return app.browserWindow.isMinimized().then((isMinimized) => {
expect(isMinimized).toBeFalsy();
}).catch((err) => {
expect(err).toBeNull();
});
}).catch((err) => {
expect(err).toBeNull();
});
});
it('should be focused', () => {
return app.browserWindow.isFocused().then((isFocused) => {
expect(isFocused).toBeTruthy();
}).catch((err) => {
expect(err).toBeNull();
});
});
});