Skip to content

Commit cc80f7f

Browse files
committed
Merge branch 'master' into feature/travisci-macos
2 parents 2538965 + bef886b commit cc80f7f

13 files changed

+113
-100
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
/release
99
main.js
1010
src/**/*.js
11+
!src/karma.conf.js
1112
*.js.map
1213

1314
# dependencies

.travis.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ os:
33
- osx
44
language: node_js
55
node_js:
6-
- 10
7-
- 8
6+
- '12'
7+
- '11'
8+
- '10'
9+
dist: xenial
810
sudo: required
911
addons:
10-
chrome: stable
12+
chrome: stable
1113
before_script:
1214
- if [ "${TRAVIS_OS_NAME}" = "linux" ]; then export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start; fi
1315
install:

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Bootstrap and package your project with Angular 7 and Electron (Typescript + SAS
1515

1616
Currently runs with:
1717

18-
- Angular v7.1.4
18+
- Angular v7.2.0
1919
- Electron v4.0.0
2020
- Electron Builder v20.28.1
2121

@@ -90,7 +90,7 @@ Note that you can't use Electron or NodeJS native libraries in this case. Please
9090
- Angular 7 & Electron 3 : (master)
9191

9292
[build-badge]: https://travis-ci.org/maximegris/angular-electron.svg?branch=master
93-
[build]: https://travis-ci.org/maximegris/angular-electron.svg?branch=master
93+
[build]: https://travis-ci.org/maximegris/angular-electron
9494
[dependencyci-badge]: https://dependencyci.com/github/maximegris/angular-electron/badge
9595
[dependencyci]: https://dependencyci.com/github/maximegris/angular-electron
9696
[license-badge]: https://img.shields.io/badge/license-Apache2-blue.svg?style=flat

angular.json

-7
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,6 @@
125125
"root": "e2e",
126126
"projectType": "application",
127127
"architect": {
128-
"e2e": {
129-
"builder": "@angular-devkit/build-angular:protractor",
130-
"options": {
131-
"protractorConfig": "e2e/protractor.conf.js",
132-
"devServerTarget": "angular-electron:serve"
133-
}
134-
},
135128
"lint": {
136129
"builder": "@angular-devkit/build-angular:tslint",
137130
"options": {

e2e/app.e2e-spec.ts

-15
This file was deleted.

e2e/app.po.ts

-8
This file was deleted.

e2e/common-setup.ts

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
const Application = require('spectron').Application;
2+
const electronPath = require('electron'); // Require Electron from the binaries included in node_modules.
3+
const path = require('path');
4+
5+
export default function setup() {
6+
beforeEach(async function () {
7+
this.app = new Application({
8+
// Your electron path can be any binary
9+
// i.e for OSX an example path could be '/Applications/MyApp.app/Contents/MacOS/MyApp'
10+
// But for the sake of the example we fetch it from our node_modules.
11+
path: electronPath,
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+
24+
// 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, '..')],
27+
webdriverOptions: {}
28+
});
29+
await this.app.start();
30+
const browser = this.app.client;
31+
await browser.waitUntilWindowLoaded();
32+
33+
browser.timeouts('script', 15000);
34+
});
35+
36+
afterEach(function () {
37+
if (this.app && this.app.isRunning()) {
38+
return this.app.stop();
39+
}
40+
});
41+
}

e2e/main.spec.ts

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import {expect, assert} from 'chai';
2+
import {SpectronClient} from 'spectron';
3+
4+
import commonSetup from './common-setup';
5+
6+
describe('angular-electron App', function () {
7+
commonSetup.apply(this);
8+
9+
let browser: any;
10+
let client: SpectronClient;
11+
12+
beforeEach(function () {
13+
client = this.app.client;
14+
browser = client as any;
15+
});
16+
17+
it('should display message saying App works !', async function () {
18+
const text = await browser.getText('app-home h1');
19+
expect(text).to.equal('App works !');
20+
});
21+
22+
23+
it('creates initial windows', async function () {
24+
const count = await client.getWindowCount();
25+
expect(count).to.equal(1);
26+
});
27+
28+
});

e2e/protractor.conf.js

-37
This file was deleted.

e2e/tsconfig.e2e.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
"extends": "../tsconfig.json",
33
"compilerOptions": {
44
"outDir": "../out-tsc/e2e",
5-
"module": "commonjs",
6-
"target": "es5",
7-
"types":[
8-
"jasmine",
9-
"node"
5+
"module": "es2015",
6+
"types": [
7+
"mocha"
108
]
11-
}
9+
},
10+
"include": [
11+
"**/*.ts"
12+
]
1213
}

main.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ function createWindow() {
1616
x: 0,
1717
y: 0,
1818
width: size.width,
19-
height: size.height
19+
height: size.height,
20+
webPreferences: {
21+
nodeIntegration: true,
22+
},
2023
});
2124

2225
if (serve) {
@@ -32,7 +35,9 @@ function createWindow() {
3235
}));
3336
}
3437

35-
win.webContents.openDevTools();
38+
if (serve) {
39+
win.webContents.openDevTools();
40+
}
3641

3742
// Emitted when the window is closed.
3843
win.on('closed', () => {

package.json

+20-18
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,29 @@
3434
"electron:windows": "npm run build:prod && electron-builder build --windows",
3535
"electron:mac": "npm run build:prod && electron-builder build --mac",
3636
"test": "npm run postinstall:web && ng test",
37-
"e2e": "npm run postinstall:web && ng e2e",
37+
"e2e": "npm run build:prod && mocha --timeout 300000 --require ts-node/register e2e/**/*.spec.ts",
3838
"version": "conventional-changelog -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md"
3939
},
40-
"dependencies": {},
4140
"devDependencies": {
42-
"@angular-devkit/build-angular": "0.11.4",
43-
"@angular/cli": "7.1.4",
44-
"@angular/common": "7.1.4",
45-
"@angular/compiler": "7.1.4",
46-
"@angular/compiler-cli": "7.1.4",
47-
"@angular/core": "7.1.4",
48-
"@angular/forms": "7.1.4",
49-
"@angular/http": "7.1.4",
50-
"@angular/language-service": "7.1.4",
51-
"@angular/platform-browser": "7.1.4",
52-
"@angular/platform-browser-dynamic": "7.1.4",
53-
"@angular/router": "7.1.4",
41+
"@angular-devkit/build-angular": "0.12.1",
42+
"@angular/cli": "7.3.3",
43+
"@angular/common": "7.2.7",
44+
"@angular/compiler": "7.2.7",
45+
"@angular/compiler-cli": "7.2.7",
46+
"@angular/core": "7.2.7",
47+
"@angular/forms": "7.2.7",
48+
"@angular/http": "7.2.7",
49+
"@angular/language-service": "7.2.7",
50+
"@angular/platform-browser": "7.2.7",
51+
"@angular/platform-browser-dynamic": "7.2.7",
52+
"@angular/router": "7.2.7",
5453
"@ngx-translate/core": "11.0.1",
5554
"@ngx-translate/http-loader": "4.0.0",
5655
"@types/jasmine": "2.8.7",
5756
"@types/jasminewd2": "2.0.3",
57+
"@types/mocha": "^5.2.6",
5858
"@types/node": "8.9.4",
59+
"chai": "^4.2.0",
5960
"codelyzer": "4.5.0",
6061
"conventional-changelog-cli": "2.0.11",
6162
"core-js": "2.6.1",
@@ -69,14 +70,15 @@
6970
"karma-coverage-istanbul-reporter": "2.0.4",
7071
"karma-jasmine": "2.0.1",
7172
"karma-jasmine-html-reporter": "1.4.0",
73+
"mocha": "6.0.2",
7274
"npm-run-all": "4.1.5",
73-
"protractor": "5.4.1",
74-
"rxjs": "6.3.3",
75+
"rxjs": "6.4.0",
76+
"spectron": "5.0.0",
7577
"ts-node": "7.0.1",
7678
"tslint": "5.11.0",
77-
"typescript": "3.1.6",
79+
"typescript": "3.2.4",
7880
"wait-on": "3.2.0",
7981
"webdriver-manager": "12.1.0",
80-
"zone.js": "0.8.26"
82+
"zone.js": "0.8.29"
8183
}
8284
}

tsconfig-serve.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"emitDecoratorMetadata": true,
77
"experimentalDecorators": true,
88
"target": "es5",
9-
"typeRoots": [
10-
"node_modules/@types"
9+
"types": [
10+
"node"
1111
],
1212
"lib": [
1313
"es2017",

0 commit comments

Comments
 (0)