mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-11-25 10:20:16 -06:00
992bc6649e
1. Moved spectron test to a different directory 2. Added a npm command to run spectron test separately
83 lines
2.4 KiB
JavaScript
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();
|
|
});
|
|
});
|
|
|
|
}); |