test: use before and after instead of beforeEach and afterEach in main.spec.ts (also move @slow tag to suite)

This commit is contained in:
Xymorot 2019-10-16 21:37:36 +02:00
parent a6c9890c70
commit 1b2157f031
1 changed files with 5 additions and 5 deletions

View File

@ -1,13 +1,13 @@
import { expect } from 'chai'; import { expect } from 'chai';
import * as electron from 'electron'; import * as electron from 'electron';
import { afterEach, beforeEach, describe, it } from 'mocha'; import { after, before, describe, it } from 'mocha';
import { Application } from 'spectron'; import { Application } from 'spectron';
import packageJson from '../package.json'; import packageJson from '../package.json';
describe('Application', function() { describe('Application @slow', function() {
this.timeout(20000); this.timeout(20000);
beforeEach(function() { before(function() {
this.app = new Application({ this.app = new Application({
// @ts-ignore this does give the path to electron executable (hopefully platform agnostic) // @ts-ignore this does give the path to electron executable (hopefully platform agnostic)
path: electron.default, path: electron.default,
@ -16,13 +16,13 @@ describe('Application', function() {
return this.app.start(); return this.app.start();
}); });
afterEach(function() { after(function() {
if (this.app && this.app.isRunning()) { if (this.app && this.app.isRunning()) {
return this.app.stop(); return this.app.stop();
} }
}); });
it('shows an initial window @slow', function() { it('shows an initial window', function() {
return this.app.client.getWindowCount().then((count: number) => { return this.app.client.getWindowCount().then((count: number) => {
expect(count).to.be.gte(1); expect(count).to.be.gte(1);
}); });