Merge branch 'master' into feature/travisci-macos
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -8,6 +8,7 @@
|
|||||||
/release
|
/release
|
||||||
main.js
|
main.js
|
||||||
src/**/*.js
|
src/**/*.js
|
||||||
|
!src/karma.conf.js
|
||||||
*.js.map
|
*.js.map
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
|
|||||||
@@ -3,8 +3,10 @@ os:
|
|||||||
- osx
|
- osx
|
||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- 10
|
- '12'
|
||||||
- 8
|
- '11'
|
||||||
|
- '10'
|
||||||
|
dist: xenial
|
||||||
sudo: required
|
sudo: required
|
||||||
addons:
|
addons:
|
||||||
chrome: stable
|
chrome: stable
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ Bootstrap and package your project with Angular 7 and Electron (Typescript + SAS
|
|||||||
|
|
||||||
Currently runs with:
|
Currently runs with:
|
||||||
|
|
||||||
- Angular v7.1.4
|
- Angular v7.2.0
|
||||||
- Electron v4.0.0
|
- Electron v4.0.0
|
||||||
- Electron Builder v20.28.1
|
- Electron Builder v20.28.1
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ Note that you can't use Electron or NodeJS native libraries in this case. Please
|
|||||||
- Angular 7 & Electron 3 : (master)
|
- Angular 7 & Electron 3 : (master)
|
||||||
|
|
||||||
[build-badge]: https://travis-ci.org/maximegris/angular-electron.svg?branch=master
|
[build-badge]: https://travis-ci.org/maximegris/angular-electron.svg?branch=master
|
||||||
[build]: https://travis-ci.org/maximegris/angular-electron.svg?branch=master
|
[build]: https://travis-ci.org/maximegris/angular-electron
|
||||||
[dependencyci-badge]: https://dependencyci.com/github/maximegris/angular-electron/badge
|
[dependencyci-badge]: https://dependencyci.com/github/maximegris/angular-electron/badge
|
||||||
[dependencyci]: https://dependencyci.com/github/maximegris/angular-electron
|
[dependencyci]: https://dependencyci.com/github/maximegris/angular-electron
|
||||||
[license-badge]: https://img.shields.io/badge/license-Apache2-blue.svg?style=flat
|
[license-badge]: https://img.shields.io/badge/license-Apache2-blue.svg?style=flat
|
||||||
|
|||||||
@@ -125,13 +125,6 @@
|
|||||||
"root": "e2e",
|
"root": "e2e",
|
||||||
"projectType": "application",
|
"projectType": "application",
|
||||||
"architect": {
|
"architect": {
|
||||||
"e2e": {
|
|
||||||
"builder": "@angular-devkit/build-angular:protractor",
|
|
||||||
"options": {
|
|
||||||
"protractorConfig": "e2e/protractor.conf.js",
|
|
||||||
"devServerTarget": "angular-electron:serve"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lint": {
|
"lint": {
|
||||||
"builder": "@angular-devkit/build-angular:tslint",
|
"builder": "@angular-devkit/build-angular:tslint",
|
||||||
"options": {
|
"options": {
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
import { AngularElectronPage } from './app.po';
|
|
||||||
import { browser, element, by } from 'protractor';
|
|
||||||
|
|
||||||
describe('angular-electron App', () => {
|
|
||||||
let page: AngularElectronPage;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
page = new AngularElectronPage();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should display message saying App works !', () => {
|
|
||||||
page.navigateTo('/');
|
|
||||||
expect(element(by.css('app-home h1')).getText()).toMatch('App works !');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
import { browser, element, by } from 'protractor';
|
|
||||||
|
|
||||||
/* tslint:disable */
|
|
||||||
export class AngularElectronPage {
|
|
||||||
navigateTo(route: string) {
|
|
||||||
return browser.get(route);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
41
e2e/common-setup.ts
Normal file
41
e2e/common-setup.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
const Application = require('spectron').Application;
|
||||||
|
const electronPath = require('electron'); // Require Electron from the binaries included in node_modules.
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
export default function setup() {
|
||||||
|
beforeEach(async function () {
|
||||||
|
this.app = new Application({
|
||||||
|
// Your electron path can be any binary
|
||||||
|
// i.e for OSX an example path could be '/Applications/MyApp.app/Contents/MacOS/MyApp'
|
||||||
|
// But for the sake of the example we fetch it from our node_modules.
|
||||||
|
path: electronPath,
|
||||||
|
|
||||||
|
// Assuming you have the following directory structure
|
||||||
|
|
||||||
|
// |__ my project
|
||||||
|
// |__ ...
|
||||||
|
// |__ main.js
|
||||||
|
// |__ package.json
|
||||||
|
// |__ index.html
|
||||||
|
// |__ ...
|
||||||
|
// |__ test
|
||||||
|
// |__ spec.js <- You are here! ~ Well you should be.
|
||||||
|
|
||||||
|
// The following line tells spectron to look and use the main.js file
|
||||||
|
// and the package.json located 1 level above.
|
||||||
|
args: [path.join(__dirname, '..')],
|
||||||
|
webdriverOptions: {}
|
||||||
|
});
|
||||||
|
await this.app.start();
|
||||||
|
const browser = this.app.client;
|
||||||
|
await browser.waitUntilWindowLoaded();
|
||||||
|
|
||||||
|
browser.timeouts('script', 15000);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(function () {
|
||||||
|
if (this.app && this.app.isRunning()) {
|
||||||
|
return this.app.stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
28
e2e/main.spec.ts
Normal file
28
e2e/main.spec.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import {expect, assert} from 'chai';
|
||||||
|
import {SpectronClient} from 'spectron';
|
||||||
|
|
||||||
|
import commonSetup from './common-setup';
|
||||||
|
|
||||||
|
describe('angular-electron App', function () {
|
||||||
|
commonSetup.apply(this);
|
||||||
|
|
||||||
|
let browser: any;
|
||||||
|
let client: SpectronClient;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
client = this.app.client;
|
||||||
|
browser = client as any;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should display message saying App works !', async function () {
|
||||||
|
const text = await browser.getText('app-home h1');
|
||||||
|
expect(text).to.equal('App works !');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
it('creates initial windows', async function () {
|
||||||
|
const count = await client.getWindowCount();
|
||||||
|
expect(count).to.equal(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
// Protractor configuration file, see link for more information
|
|
||||||
// https://github.com/angular/protractor/blob/master/lib/config.ts
|
|
||||||
|
|
||||||
const { SpecReporter } = require('jasmine-spec-reporter');
|
|
||||||
|
|
||||||
exports.config = {
|
|
||||||
allScriptsTimeout: 25000,
|
|
||||||
delayBrowserTimeInSeconds: 0,
|
|
||||||
specs: [
|
|
||||||
'./**/*.e2e-spec.ts'
|
|
||||||
],
|
|
||||||
capabilities: {
|
|
||||||
'browserName': 'chrome',
|
|
||||||
chromeOptions: {
|
|
||||||
args: ["--no-sandbox", "--headless", "--disable-gpu"]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
chromeOnly: true,
|
|
||||||
directConnect: true,
|
|
||||||
baseUrl: 'http://localhost:4200/',
|
|
||||||
framework: 'jasmine2',
|
|
||||||
jasmineNodeOpts: {
|
|
||||||
showColors: true,
|
|
||||||
defaultTimeoutInterval: 30000,
|
|
||||||
print: function () { },
|
|
||||||
realtimeFailure: true
|
|
||||||
},
|
|
||||||
useAllAngular2AppRoots: true,
|
|
||||||
beforeLaunch: function () {
|
|
||||||
require('ts-node').register({
|
|
||||||
project: 'e2e/tsconfig.e2e.json'
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onPrepare() {
|
|
||||||
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -2,11 +2,12 @@
|
|||||||
"extends": "../tsconfig.json",
|
"extends": "../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "../out-tsc/e2e",
|
"outDir": "../out-tsc/e2e",
|
||||||
"module": "commonjs",
|
"module": "es2015",
|
||||||
"target": "es5",
|
|
||||||
"types": [
|
"types": [
|
||||||
"jasmine",
|
"mocha"
|
||||||
"node"
|
]
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"**/*.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
7
main.ts
7
main.ts
@@ -16,7 +16,10 @@ function createWindow() {
|
|||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
width: size.width,
|
width: size.width,
|
||||||
height: size.height
|
height: size.height,
|
||||||
|
webPreferences: {
|
||||||
|
nodeIntegration: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (serve) {
|
if (serve) {
|
||||||
@@ -32,7 +35,9 @@ function createWindow() {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (serve) {
|
||||||
win.webContents.openDevTools();
|
win.webContents.openDevTools();
|
||||||
|
}
|
||||||
|
|
||||||
// Emitted when the window is closed.
|
// Emitted when the window is closed.
|
||||||
win.on('closed', () => {
|
win.on('closed', () => {
|
||||||
|
|||||||
38
package.json
38
package.json
@@ -34,28 +34,29 @@
|
|||||||
"electron:windows": "npm run build:prod && electron-builder build --windows",
|
"electron:windows": "npm run build:prod && electron-builder build --windows",
|
||||||
"electron:mac": "npm run build:prod && electron-builder build --mac",
|
"electron:mac": "npm run build:prod && electron-builder build --mac",
|
||||||
"test": "npm run postinstall:web && ng test",
|
"test": "npm run postinstall:web && ng test",
|
||||||
"e2e": "npm run postinstall:web && ng e2e",
|
"e2e": "npm run build:prod && mocha --timeout 300000 --require ts-node/register e2e/**/*.spec.ts",
|
||||||
"version": "conventional-changelog -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md"
|
"version": "conventional-changelog -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md"
|
||||||
},
|
},
|
||||||
"dependencies": {},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "0.11.4",
|
"@angular-devkit/build-angular": "0.12.1",
|
||||||
"@angular/cli": "7.1.4",
|
"@angular/cli": "7.3.3",
|
||||||
"@angular/common": "7.1.4",
|
"@angular/common": "7.2.7",
|
||||||
"@angular/compiler": "7.1.4",
|
"@angular/compiler": "7.2.7",
|
||||||
"@angular/compiler-cli": "7.1.4",
|
"@angular/compiler-cli": "7.2.7",
|
||||||
"@angular/core": "7.1.4",
|
"@angular/core": "7.2.7",
|
||||||
"@angular/forms": "7.1.4",
|
"@angular/forms": "7.2.7",
|
||||||
"@angular/http": "7.1.4",
|
"@angular/http": "7.2.7",
|
||||||
"@angular/language-service": "7.1.4",
|
"@angular/language-service": "7.2.7",
|
||||||
"@angular/platform-browser": "7.1.4",
|
"@angular/platform-browser": "7.2.7",
|
||||||
"@angular/platform-browser-dynamic": "7.1.4",
|
"@angular/platform-browser-dynamic": "7.2.7",
|
||||||
"@angular/router": "7.1.4",
|
"@angular/router": "7.2.7",
|
||||||
"@ngx-translate/core": "11.0.1",
|
"@ngx-translate/core": "11.0.1",
|
||||||
"@ngx-translate/http-loader": "4.0.0",
|
"@ngx-translate/http-loader": "4.0.0",
|
||||||
"@types/jasmine": "2.8.7",
|
"@types/jasmine": "2.8.7",
|
||||||
"@types/jasminewd2": "2.0.3",
|
"@types/jasminewd2": "2.0.3",
|
||||||
|
"@types/mocha": "^5.2.6",
|
||||||
"@types/node": "8.9.4",
|
"@types/node": "8.9.4",
|
||||||
|
"chai": "^4.2.0",
|
||||||
"codelyzer": "4.5.0",
|
"codelyzer": "4.5.0",
|
||||||
"conventional-changelog-cli": "2.0.11",
|
"conventional-changelog-cli": "2.0.11",
|
||||||
"core-js": "2.6.1",
|
"core-js": "2.6.1",
|
||||||
@@ -69,14 +70,15 @@
|
|||||||
"karma-coverage-istanbul-reporter": "2.0.4",
|
"karma-coverage-istanbul-reporter": "2.0.4",
|
||||||
"karma-jasmine": "2.0.1",
|
"karma-jasmine": "2.0.1",
|
||||||
"karma-jasmine-html-reporter": "1.4.0",
|
"karma-jasmine-html-reporter": "1.4.0",
|
||||||
|
"mocha": "6.0.2",
|
||||||
"npm-run-all": "4.1.5",
|
"npm-run-all": "4.1.5",
|
||||||
"protractor": "5.4.1",
|
"rxjs": "6.4.0",
|
||||||
"rxjs": "6.3.3",
|
"spectron": "5.0.0",
|
||||||
"ts-node": "7.0.1",
|
"ts-node": "7.0.1",
|
||||||
"tslint": "5.11.0",
|
"tslint": "5.11.0",
|
||||||
"typescript": "3.1.6",
|
"typescript": "3.2.4",
|
||||||
"wait-on": "3.2.0",
|
"wait-on": "3.2.0",
|
||||||
"webdriver-manager": "12.1.0",
|
"webdriver-manager": "12.1.0",
|
||||||
"zone.js": "0.8.26"
|
"zone.js": "0.8.29"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"typeRoots": [
|
"types": [
|
||||||
"node_modules/@types"
|
"node"
|
||||||
],
|
],
|
||||||
"lib": [
|
"lib": [
|
||||||
"es2017",
|
"es2017",
|
||||||
|
|||||||
Reference in New Issue
Block a user