Skip to content

Commit 742095f

Browse files
author
Maxime GRIS
committed
fix/ spectron e2e test
1 parent 7d531d1 commit 742095f

File tree

3 files changed

+8
-19
lines changed

3 files changed

+8
-19
lines changed

.eslintrc.json

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"plugin:@angular-eslint/template/process-inline-templates"
2626
],
2727
"rules": {
28+
"prefer-arrow/prefer-arrow-functions": 0,
2829
"@angular-eslint/directive-selector": 0,
2930
"@angular-eslint/component-selector": [
3031
"error",

e2e/common-setup.ts

+4-16
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,22 @@ const ELECTRON_PATH = require('electron'); // Require Electron from the binaries
33
const PATH = require('path');
44

55
export default function setup(): void {
6-
beforeEach(async () => {
6+
beforeEach(async function() {
77
this.app = new APPLICATION({
88
// Your electron path can be any binary
99
// i.e for OSX an example path could be '/Applications/MyApp.app/Contents/MacOS/MyApp'
1010
// But for the sake of the example we fetch it from our node_modules.
1111
path: ELECTRON_PATH,
12-
13-
// Assuming you have the following directory structure
14-
15-
// |__ my project
16-
// |__ ...
17-
// |__ main.js
18-
// |__ package.json
19-
// |__ index.html
20-
// |__ ...
21-
// |__ test
22-
// |__ spec.js <- You are here! ~ Well you should be.
23-
2412
// The following line tells spectron to look and use the main.js file
25-
// and the package.json located 1 level above.
26-
args: [PATH.join(__dirname, '..')],
13+
// and the package.json located in app folder.
14+
args: [PATH.join(__dirname, '../app/main.js'), PATH.join(__dirname, '../app/package.json')],
2715
webdriverOptions: {}
2816
});
2917

3018
await this.app.start();
3119
});
3220

33-
afterEach(async () => {
21+
afterEach(async function() {
3422
if (this.app && this.app.isRunning()) {
3523
await this.app.stop();
3624
}

e2e/main.e2e.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { SpectronClient } from 'spectron';
33

44
import commonSetup from './common-setup';
55

6-
describe('angular-electron App', () => {
6+
describe('angular-electron App', function() {
77

88
commonSetup.apply(this);
99

@@ -13,12 +13,12 @@ describe('angular-electron App', () => {
1313
client = this.app.client;
1414
});
1515

16-
it('creates initial windows', async () => {
16+
it('creates initial windows', async function() {
1717
const count = await client.getWindowCount();
1818
expect(count).to.equal(1);
1919
});
2020

21-
it('should display message saying App works !', async () => {
21+
it('should display message saying App works !', async function() {
2222
const elem = await client.$('app-home h1');
2323
const text = await elem.getText();
2424
expect(text).to.equal('App works !');

0 commit comments

Comments
 (0)