2019-10-06 22:30:24 +02:00
|
|
|
import { expect } from 'chai';
|
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';
|
2019-10-11 23:10:30 +02:00
|
|
|
import packageJson from '../package.json';
|
2019-10-05 03:09:34 +02:00
|
|
|
|
2019-10-12 00:57:02 +02:00
|
|
|
describe('Application', function() {
|
2019-10-11 22:14:30 +02:00
|
|
|
this.timeout(10000);
|
2019-10-05 03:09:34 +02:00
|
|
|
|
2019-10-12 00:57:02 +02:00
|
|
|
beforeEach(function() {
|
2019-10-05 03:09:34 +02:00
|
|
|
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();
|
|
|
|
});
|
|
|
|
|
2019-10-12 00:57:02 +02:00
|
|
|
afterEach(function() {
|
2019-10-05 03:09:34 +02:00
|
|
|
if (this.app && this.app.isRunning()) {
|
|
|
|
return this.app.stop();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-10-12 00:57:02 +02:00
|
|
|
it('shows an initial window @slow', function() {
|
2019-10-05 03:09:34 +02:00
|
|
|
return this.app.client.getWindowCount().then((count: number) => {
|
2019-10-10 19:44:39 +02:00
|
|
|
expect(count).to.be.gte(1);
|
2019-10-05 03:09:34 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|