Skip to content

Commit 9c51f32

Browse files
committed
fix/ e2e test with jasmine2
1 parent 2a90191 commit 9c51f32

File tree

5 files changed

+22
-15
lines changed

5 files changed

+22
-15
lines changed

Diff for: e2e/app.e2e-spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { AngularElectronPage } from './app.po';
2+
import { browser, element, by } from 'protractor';
23

34
describe('angular-electron App', () => {
45
let page: AngularElectronPage;
@@ -8,7 +9,6 @@ describe('angular-electron App', () => {
89
});
910

1011
it('should display message saying App works !', () => {
11-
page.navigateTo();
12-
expect(page.getParagraphText()).toEqual('App works !');
12+
expect(element(by.css('app-home h1')).getText()).toMatch('App works !');
1313
});
1414
});

Diff for: e2e/app.po.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import { browser, element, by } from 'protractor';
22

3+
/* tslint:disable */
34
export class AngularElectronPage {
4-
navigateTo() {
5-
return browser.get('/');
6-
}
7-
8-
getParagraphText() {
9-
return element(by.css('app-home h1')).getText();
5+
navigateTo(route: string) {
6+
return browser.get(route);
107
}
118
}

Diff for: protractor.conf.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,28 @@
44
const { SpecReporter } = require('jasmine-spec-reporter');
55

66
exports.config = {
7-
allScriptsTimeout: 11000,
7+
allScriptsTimeout: 25000,
8+
getPageTimeout: 15000,
9+
delayBrowserTimeInSeconds: 0,
810
specs: [
911
'./e2e/**/*.e2e-spec.ts'
1012
],
1113
capabilities: {
1214
'browserName': 'chrome',
1315
chromeOptions: {
14-
binary: './node_modules/electron/dist/electron.exe',
15-
args: ['--test-type=webdriver', 'app=dist/main.js']
16+
binary: './node_modules/electron/dist/electron.exe',
17+
args: ['--test-type=webdriver', 'app=dist/main.js']
1618
}
1719
},
1820
directConnect: true,
1921
baseUrl: 'http://localhost:4200/',
20-
framework: 'jasmine',
22+
framework: 'jasmine2',
2123
jasmineNodeOpts: {
2224
showColors: true,
2325
defaultTimeoutInterval: 30000,
24-
print: function() {}
26+
print: function () { }
2527
},
26-
beforeLaunch: function() {
28+
beforeLaunch: function () {
2729
require('ts-node').register({
2830
project: 'e2e/tsconfig.e2e.json'
2931
});

Diff for: src/tsconfig.app.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
},
99
"exclude": [
1010
"test.ts",
11-
"**/*.spec.ts"
11+
"**/*.spec.ts",
12+
"dist",
13+
"app-builds",
14+
"node_modules"
1215
]
1316
}

Diff for: src/tsconfig.spec.json

+5
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,10 @@
1616
"include": [
1717
"**/*.spec.ts",
1818
"**/*.d.ts"
19+
],
20+
"exclude": [
21+
"dist",
22+
"app-builds",
23+
"node_modules"
1924
]
2025
}

0 commit comments

Comments
 (0)