mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-31 19:27:00 -06:00
Merge pull request #157 from VikasShashidhar/electron-85
Electron-85: Spectron Tests for close
This commit is contained in:
commit
8e2c85a2e3
70
tests/close.test.js
Normal file
70
tests/close.test.js
Normal file
@ -0,0 +1,70 @@
|
||||
describe('Tests for Close', () => {
|
||||
|
||||
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 90000;
|
||||
|
||||
let app;
|
||||
|
||||
beforeAll((done) => {
|
||||
const Application = require('./spectron/spectronSetup');
|
||||
app = new Application({});
|
||||
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();
|
||||
});
|
||||
} else {
|
||||
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 check window count', () => {
|
||||
return app.client.getWindowCount().then((count) => {
|
||||
expect(count === 1).toBeTruthy();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
it('should check browser window visibility', () => {
|
||||
return app.browserWindow.isVisible().then((isVisible) => {
|
||||
expect(isVisible).toBeTruthy();
|
||||
}).catch((err) => {
|
||||
expect(err).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
it('should close the app', () => {
|
||||
return app.stop();
|
||||
});
|
||||
|
||||
it('should check whether the app is running', () => {
|
||||
expect(app.isRunning()).toBe(false);
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in New Issue
Block a user