@@ -71,3 +71,78 @@ describe("E2E OPEN Browsers options (multiple)", function () {
7171 assert . equal ( args [ 1 ] , "safari" ) ;
7272 } ) ;
7373} ) ;
74+
75+ describe ( "E2E browser option with app args" , function ( ) {
76+
77+ it ( "opens with object literal" , function ( done ) {
78+ browserSync . reset ( ) ;
79+ var appArg = {
80+ app : [
81+ "chromium-browser" ,
82+ "--app=http://localhost:8080" ,
83+ "--proxy-server=localhost:8080" ,
84+ "--user-data-dir=.tmp/chomium"
85+ ]
86+ } ;
87+ var config = {
88+ logLevel : "silent" ,
89+ server : "test/fixtures" ,
90+ online : false ,
91+ browser : appArg
92+ } ;
93+
94+ var stub = sinon . spy ( utils , "open" ) ;
95+ var opnPath = require . resolve ( "opn" ) ;
96+ require ( opnPath ) ;
97+ var opnStub = require ( "sinon" ) . stub ( require . cache [ opnPath ] , "exports" ) ;
98+
99+ browserSync ( config , function ( err , bs ) {
100+ bs . cleanup ( ) ;
101+ stub . restore ( ) ;
102+ var args = opnStub . getCall ( 0 ) . args ;
103+ assert . equal ( args [ 0 ] , bs . options . getIn ( [ "urls" , "local" ] ) ) ;
104+ assert . deepEqual ( args [ 1 ] , appArg ) ;
105+ require . cache [ opnPath ] . exports . restore ( ) ;
106+ done ( )
107+ } )
108+ } ) ;
109+ it ( "opens with mix of string + objects" , function ( done ) {
110+ browserSync . reset ( ) ;
111+ var appArg = {
112+ app : [
113+ "chromium-browser" ,
114+ "--app=http://localhost:8080" ,
115+ "--proxy-server=localhost:8080" ,
116+ "--user-data-dir=.tmp/chomium"
117+ ]
118+ } ;
119+ var config = {
120+ logLevel : "silent" ,
121+ server : "test/fixtures" ,
122+ online : false ,
123+ browser : [ appArg , "safari" , "firefox" ]
124+ } ;
125+
126+ var stub = sinon . spy ( utils , "open" ) ;
127+ var opnPath = require . resolve ( "opn" ) ;
128+ require ( opnPath ) ;
129+ var opnStub = require ( "sinon" ) . stub ( require . cache [ opnPath ] , "exports" ) ;
130+
131+ browserSync ( config , function ( err , bs ) {
132+ bs . cleanup ( ) ;
133+ stub . restore ( ) ;
134+ var args1 = opnStub . getCall ( 0 ) . args ;
135+ assert . equal ( args1 [ 0 ] , bs . options . getIn ( [ "urls" , "local" ] ) ) ;
136+ assert . deepEqual ( args1 [ 1 ] , appArg ) ;
137+
138+ var args2 = opnStub . getCall ( 1 ) . args ;
139+ assert . deepEqual ( args2 [ 1 ] , { app : "safari" } ) ;
140+
141+ var args3 = opnStub . getCall ( 2 ) . args ;
142+ assert . deepEqual ( args3 [ 1 ] , { app : "firefox" } ) ;
143+
144+ require . cache [ opnPath ] . exports . restore ( ) ;
145+ done ( )
146+ } )
147+ } ) ;
148+ } ) ;
0 commit comments