File tree Expand file tree Collapse file tree 8 files changed +79
-77
lines changed
Expand file tree Collapse file tree 8 files changed +79
-77
lines changed Original file line number Diff line number Diff line change 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" : {
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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 ( 2 ) ;
26+ } ) ;
27+
28+ } ) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 22 "extends" : " ../tsconfig.json" ,
33 "compilerOptions" : {
44 "outDir" : " ../out-tsc/e2e" ,
5- "module" : " commonjs" ,
6- "target" : " es5" ,
7- "types" :[
8- " jasmine" ,
9- " node"
10- ]
11- }
5+ "module" : " es2015" ,
6+ "types" :[]
7+ },
8+ "include" : [
9+ " **/*.ts"
10+ ]
1211}
Original file line number Diff line number Diff line change 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" : {
4241 "@angular-devkit/build-angular" : " 0.12.1" ,
4342 "@angular/cli" : " 7.2.1" ,
5655 "@types/jasmine" : " 2.8.7" ,
5756 "@types/jasminewd2" : " 2.0.3" ,
5857 "@types/node" : " 8.9.4" ,
58+ "chai" : " ^4.2.0" ,
5959 "codelyzer" : " 4.5.0" ,
6060 "conventional-changelog-cli" : " 2.0.11" ,
6161 "core-js" : " 2.6.1" ,
6969 "karma-coverage-istanbul-reporter" : " 2.0.4" ,
7070 "karma-jasmine" : " 2.0.1" ,
7171 "karma-jasmine-html-reporter" : " 1.4.0" ,
72+ "mocha" : " ^6.0.2" ,
7273 "npm-run-all" : " 4.1.5" ,
73- "protractor" : " 5.4.1" ,
7474 "rxjs" : " 6.3.3" ,
75+ "spectron" : " ^5.0.0" ,
7576 "ts-node" : " 7.0.1" ,
7677 "tslint" : " 5.11.0" ,
7778 "typescript" : " 3.2.2" ,
You can’t perform that action at this time.
0 commit comments