File tree 8 files changed +79
-77
lines changed
8 files changed +79
-77
lines changed Original file line number Diff line number Diff line change 125
125
"root" : " e2e" ,
126
126
"projectType" : " application" ,
127
127
"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
- },
135
128
"lint" : {
136
129
"builder" : " @angular-devkit/build-angular:tslint" ,
137
130
"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 2
2
"extends" : " ../tsconfig.json" ,
3
3
"compilerOptions" : {
4
4
"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
+ ]
12
11
}
Original file line number Diff line number Diff line change 34
34
"electron:windows" : " npm run build:prod && electron-builder build --windows" ,
35
35
"electron:mac" : " npm run build:prod && electron-builder build --mac" ,
36
36
"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 " ,
38
38
"version" : " conventional-changelog -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md"
39
39
},
40
- "dependencies" : {},
41
40
"devDependencies" : {
42
41
"@angular-devkit/build-angular" : " 0.12.1" ,
43
42
"@angular/cli" : " 7.2.1" ,
56
55
"@types/jasmine" : " 2.8.7" ,
57
56
"@types/jasminewd2" : " 2.0.3" ,
58
57
"@types/node" : " 8.9.4" ,
58
+ "chai" : " ^4.2.0" ,
59
59
"codelyzer" : " 4.5.0" ,
60
60
"conventional-changelog-cli" : " 2.0.11" ,
61
61
"core-js" : " 2.6.1" ,
69
69
"karma-coverage-istanbul-reporter" : " 2.0.4" ,
70
70
"karma-jasmine" : " 2.0.1" ,
71
71
"karma-jasmine-html-reporter" : " 1.4.0" ,
72
+ "mocha" : " ^6.0.2" ,
72
73
"npm-run-all" : " 4.1.5" ,
73
- "protractor" : " 5.4.1" ,
74
74
"rxjs" : " 6.3.3" ,
75
+ "spectron" : " ^5.0.0" ,
75
76
"ts-node" : " 7.0.1" ,
76
77
"tslint" : " 5.11.0" ,
77
78
"typescript" : " 3.2.2" ,
You can’t perform that action at this time.
0 commit comments