2019-10-05 03:09:34 +02:00
|
|
|
import * as assert from 'assert';
|
2019-10-06 22:29:04 +02:00
|
|
|
import * as electron from 'electron';
|
2019-10-05 03:09:34 +02:00
|
|
|
import { afterEach, beforeEach, describe, it } from 'mocha';
|
|
|
|
import { Application } from 'spectron';
|
|
|
|
import packageJson from '../../package.json';
|
|
|
|
|
|
|
|
describe('Application Launch', function(): void {
|
|
|
|
this.timeout('10s');
|
|
|
|
|
|
|
|
beforeEach(function(): any {
|
|
|
|
this.app = new Application({
|
2019-10-06 22:29:04 +02:00
|
|
|
// @ts-ignore this does give the path to electron executable (hopefully platform agnostic)
|
|
|
|
path: electron.default,
|
2019-10-05 03:09:34 +02:00
|
|
|
args: [packageJson.main],
|
|
|
|
});
|
|
|
|
return this.app.start();
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(function(): any {
|
|
|
|
if (this.app && this.app.isRunning()) {
|
|
|
|
return this.app.stop();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
it('shows an initial window', function(): any {
|
|
|
|
return this.app.client.getWindowCount().then((count: number) => {
|
|
|
|
assert.strictEqual(count, 1);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|