@@ -53,6 +53,10 @@ module Chrome
53
53
minidump_path : 'linux/only' ,
54
54
perf_logging_prefs : { enable_network : true } ,
55
55
window_types : %w[ normal devtools ] ,
56
+ android_package : 'package' ,
57
+ android_activity : 'activity' ,
58
+ android_device_serial : '123' ,
59
+ android_use_running_app : true ,
56
60
'custom:options' : { foo : 'bar' } )
57
61
58
62
expect ( opts . args ) . to eq ( %w[ foo bar ] )
@@ -77,6 +81,10 @@ module Chrome
77
81
expect ( opts . strict_file_interactability ) . to eq ( true )
78
82
expect ( opts . timeouts ) . to eq ( script : 40000 , page_load : 400000 , implicit : 1 )
79
83
expect ( opts . set_window_rect ) . to eq ( false )
84
+ expect ( opts . android_package ) . to eq ( 'package' )
85
+ expect ( opts . android_activity ) . to eq ( 'activity' )
86
+ expect ( opts . android_device_serial ) . to eq ( '123' )
87
+ expect ( opts . android_use_running_app ) . to eq ( true )
80
88
expect ( opts . options [ :'custom:options' ] ) . to eq ( foo : 'bar' )
81
89
end
82
90
end
@@ -212,6 +220,28 @@ module Chrome
212
220
end
213
221
end
214
222
223
+ describe '#enable_android' do
224
+ it 'adds default android settings' do
225
+ options . enable_android
226
+
227
+ expect ( options . android_package ) . to eq ( 'com.android.chrome' )
228
+ expect ( options . android_activity ) . to be_nil
229
+ expect ( options . android_device_serial ) . to be_nil
230
+ expect ( options . android_use_running_app ) . to be_nil
231
+ end
232
+
233
+ it 'accepts parameters' do
234
+ options . enable_android ( package : 'foo' ,
235
+ serial_number : '123' ,
236
+ activity : 'qualified' ,
237
+ use_running_app : true )
238
+ expect ( options . android_package ) . to eq ( 'foo' )
239
+ expect ( options . android_activity ) . to eq ( 'qualified' )
240
+ expect ( options . android_device_serial ) . to eq ( '123' )
241
+ expect ( options . android_use_running_app ) . to eq ( true )
242
+ end
243
+ end
244
+
215
245
describe '#as_json' do
216
246
it 'returns empty options by default' do
217
247
expect ( options . as_json ) . to eq ( "browserName" => "chrome" , "goog:chromeOptions" => { } )
@@ -269,6 +299,10 @@ module Chrome
269
299
minidump_path : 'linux/only' ,
270
300
perf_logging_prefs : { 'enable_network' : true } ,
271
301
window_types : %w[ normal devtools ] ,
302
+ android_package : 'package' ,
303
+ android_activity : 'activity' ,
304
+ android_device_serial : '123' ,
305
+ android_use_running_app : true ,
272
306
'custom:options' : { foo : 'bar' } )
273
307
274
308
key = 'goog:chromeOptions'
@@ -301,7 +335,11 @@ module Chrome
301
335
'excludeSwitches' => %w[ foobar barfoo ] ,
302
336
'minidumpPath' => 'linux/only' ,
303
337
'perfLoggingPrefs' => { 'enableNetwork' => true } ,
304
- 'windowTypes' => %w[ normal devtools ] } )
338
+ 'windowTypes' => %w[ normal devtools ] ,
339
+ 'androidPackage' => 'package' ,
340
+ 'androidActivity' => 'activity' ,
341
+ 'androidDeviceSerial' => '123' ,
342
+ 'androidUseRunningApp' => true } )
305
343
end
306
344
end
307
345
end
0 commit comments