File tree 5 files changed +26
-11
lines changed
5 files changed +26
-11
lines changed Original file line number Diff line number Diff line change @@ -5,14 +5,18 @@ describe('Github', function() {
5
5
. url ( 'https://github.com/nightwatchjs/nightwatch' )
6
6
. waitForElementVisible ( 'body' , 1000 )
7
7
. assert . title ( 'nightwatchjs/nightwatch · GitHub' )
8
- . assert . visible ( '.container .breadcrumb a span ' )
9
- . assert . containsText ( '.container .breadcrumb a span ' , 'nightwatch' , 'Checking project title is set to nightwatch' ) ;
8
+ . assert . visible ( '.container h1 strong a ' )
9
+ . assert . containsText ( '.container h1 strong a ' , 'nightwatch' , 'Checking project title is set to nightwatch' ) ;
10
10
} ) ;
11
11
12
12
after ( function ( client , done ) {
13
- client . end ( function ( ) {
13
+ if ( client . sessionId ) {
14
+ client . end ( function ( ) {
15
+ done ( ) ;
16
+ } ) ;
17
+ } else {
14
18
done ( ) ;
15
- } ) ;
19
+ }
16
20
} ) ;
17
21
18
22
} ) ;
Original file line number Diff line number Diff line change @@ -3,10 +3,10 @@ module.exports = {
3
3
'Demo test GitHub' : function ( client ) {
4
4
client
5
5
. url ( 'https://github.com/nightwatchjs/nightwatch' )
6
- . waitForElementVisible ( 'body ' , 1000 )
6
+ . waitForElementVisible ( 'xbody ' , 1000 )
7
7
. assert . title ( 'nightwatchjs/nightwatch · GitHub' )
8
- . assert . visible ( '.container .breadcrumb a span ' )
9
- . assert . containsText ( '.container .breadcrumb a span ' , 'nightwatch' , 'Checking project title is set to nightwatch' ) ;
8
+ . assert . visible ( '.container h1 strong a ' )
9
+ . assert . containsText ( '.container h1 strong a ' , 'nightwatch' , 'Checking project title is set to nightwatch' ) ;
10
10
} ,
11
11
12
12
after : function ( client ) {
Original file line number Diff line number Diff line change @@ -392,6 +392,10 @@ CliRunner.prototype = {
392
392
fn ( null , {
393
393
failed : failures
394
394
} ) ;
395
+
396
+ if ( failures ) {
397
+ process . exit ( 10 ) ;
398
+ }
395
399
} ) ;
396
400
397
401
} . bind ( this ) ) ;
Original file line number Diff line number Diff line change @@ -32,12 +32,13 @@ try {
32
32
'src/runner' ,
33
33
'src/expect' ,
34
34
'src/page-object' ,
35
- 'src/mocha' ,
36
35
'src/protocol' ,
37
36
'src/http' ,
38
37
'src/index' ,
39
38
'src/assertions' ,
40
- 'src/commands'
39
+ 'src/mocha' ,
40
+ 'src/commands' ,
41
+
41
42
] , options , function ( err ) {
42
43
setTimeout ( function ( ) {
43
44
server . close ( ) ;
Original file line number Diff line number Diff line change 1
1
var BASE_PATH = process . env . NIGHTWATCH_COV ? 'lib-cov' : 'lib' ;
2
2
var CliRunner = require ( '../../../' + BASE_PATH + '/runner/cli/clirunner.js' ) ;
3
3
4
+ var originalExit = process . exit ;
4
5
module . exports = {
5
6
setUp : function ( callback ) {
6
7
@@ -10,6 +11,7 @@ module.exports = {
10
11
tearDown : function ( callback ) {
11
12
process . removeAllListeners ( 'exit' ) ;
12
13
process . removeAllListeners ( 'uncaughtException' ) ;
14
+ process . exit = originalExit ;
13
15
callback ( ) ;
14
16
} ,
15
17
@@ -19,15 +21,19 @@ module.exports = {
19
21
env : 'default'
20
22
} ) . init ( ) ;
21
23
24
+ test . expect ( 15 ) ;
22
25
runner . test_settings . globals = {
23
26
test : test
24
27
} ;
25
28
26
- test . expect ( 14 ) ;
29
+ process . exit = function ( code ) {
30
+ test . equals ( code , 10 ) ;
31
+ test . done ( ) ;
32
+ } ;
33
+
27
34
runner . runner ( function ( err , results ) {
28
35
test . equals ( err , null ) ;
29
36
test . equals ( results . failed , 2 ) ;
30
- test . done ( ) ;
31
37
} ) ;
32
38
}
33
39
} ;
You can’t perform that action at this time.
0 commit comments