@@ -7,7 +7,9 @@ var assert = require('assert'),
7
7
path = require ( 'path' ) ,
8
8
http = require ( 'http' ) ,
9
9
browserstackRunner = require ( '../../bin/cli.js' ) ,
10
- Tunnel = require ( '../../lib/local.js' ) . Tunnel ;
10
+ Tunnel = require ( '../../lib/local.js' ) . Tunnel ,
11
+ exec = require ( 'child_process' ) . exec ,
12
+ execSync = require ( 'child_process' ) . execSync ;
11
13
12
14
var getBaseConfig = function ( ) {
13
15
return {
@@ -219,3 +221,39 @@ describe('Pass/Fail reporting', function() {
219
221
} ) ;
220
222
} ) ;
221
223
} ) ;
224
+
225
+ describe ( 'Command Line Interface Tests' , function ( ) {
226
+ this . timeout ( 0 ) ;
227
+ it ( 'Should run with valid CLI arguments' , function ( done ) {
228
+ execSync ( 'bin/runner.js init' ) ;
229
+ exec ( 'bin/runner.js --browsers 1 --path tests/behaviour/resources/qunit_sample.html' , null , function ( error , stdout , stderr ) {
230
+ assert . equal ( error , null ) ;
231
+ done ( ) ;
232
+ } ) ;
233
+ } ) ;
234
+ it ( 'Should raise errors if all invalid browser keys.' , function ( done ) {
235
+ exec ( 'bin/runner.js --browsers 10 --path tests/behaviour/resources/qunit_sample.html' , null , function ( error , stdout , stderr ) {
236
+ assert . notEqual ( error . message . match ( 'Invalid' ) , null ) ;
237
+ done ( ) ;
238
+ } ) ;
239
+ } ) ;
240
+ it ( 'Should raise error if invalid test path' , function ( done ) {
241
+ exec ( 'bin/runner.js --browsers 1 --path invalid/path' , function ( error , stdout , stderr ) {
242
+ assert . notEqual ( error , null ) ;
243
+ assert . notEqual ( error . message . match ( 'Invalid' ) , null ) ;
244
+ done ( ) ;
245
+ } ) ;
246
+ } ) ;
247
+ it ( 'Should run tests on browsers present if some keys not present' , function ( done ) {
248
+ exec ( 'bin/runner.js --browsers 1 10 --path tests/behaviour/resources/qunit_sample.html' , null , function ( error , stdout , stderr ) {
249
+ assert . equal ( error , null ) ;
250
+ done ( ) ;
251
+ } ) ;
252
+ } ) ;
253
+ it ( 'Should raise error if empty pid path with pid parameter' , function ( done ) {
254
+ exec ( 'bin/runner.js --browsers 1 --path tests/behaviour/resources/qunit_sample.html --pid' , null , function ( error , stdout , stderr ) {
255
+ assert . notEqual ( error , null ) ;
256
+ done ( ) ;
257
+ } ) ;
258
+ } ) ;
259
+ } ) ;
0 commit comments