@@ -230,6 +230,58 @@ def android_mock_create_session_w3c_direct_no_path(core)
230
230
assert_equal '/wd/hub/' , uri . path
231
231
end
232
232
233
+ def test_default_timeout_for_http_client_with_direct_no_supported_client
234
+ def android_mock_create_session_w3c_direct_default_client ( core )
235
+ response = {
236
+ value : {
237
+ sessionId : '1234567890' ,
238
+ capabilities : {
239
+ platformName : :android ,
240
+ automationName : ENV [ 'AUTOMATION_NAME_DROID' ] || 'uiautomator2' ,
241
+ app : 'test/functional/app/api.apk.zip' ,
242
+ platformVersion : '7.1.1' ,
243
+ deviceName : 'Android Emulator' ,
244
+ appPackage : 'io.appium.android.apis' ,
245
+ appActivity : 'io.appium.android.apis.ApiDemos' ,
246
+ someCapability : 'some_capability' ,
247
+ unicodeKeyboard : true ,
248
+ resetKeyboard : true ,
249
+ directConnectProtocol : 'http' ,
250
+ directConnectHost : 'localhost' ,
251
+ directConnectPort : '8888' ,
252
+ directConnectPath : '/wd/hub'
253
+ }
254
+ }
255
+ } . to_json
256
+
257
+ stub_request ( :post , 'http://127.0.0.1:4723/wd/hub/session' )
258
+ . to_return ( headers : HEADER , status : 200 , body : response )
259
+
260
+ stub_request ( :post , 'http://127.0.0.1:4723/wd/hub/session/1234567890/timeouts' )
261
+ . with ( body : { implicit : 30_000 } . to_json )
262
+ . to_return ( headers : HEADER , status : 200 , body : { value : nil } . to_json )
263
+
264
+ driver = core . start_driver http_client_ops : { http_client : Selenium ::WebDriver ::Remote ::Http ::Default . new }
265
+
266
+ assert_requested ( :post , 'http://127.0.0.1:4723/wd/hub/session' , times : 1 )
267
+ assert_requested ( :post , 'http://127.0.0.1:4723/wd/hub/session/1234567890/timeouts' ,
268
+ body : { implicit : 30_000 } . to_json , times : 1 )
269
+ driver
270
+ end
271
+
272
+ core = ::Appium ::Core . for ( Caps . android_direct )
273
+ driver = android_mock_create_session_w3c_direct_default_client ( core )
274
+
275
+ assert_nil driver . send ( :bridge ) . http . open_timeout
276
+ assert_nil driver . send ( :bridge ) . http . read_timeout
277
+ uri = driver . send ( :bridge ) . http . send ( :server_url )
278
+ assert core . direct_connect
279
+ assert_equal 'http' , uri . scheme
280
+ assert_equal '127.0.0.1' , uri . host
281
+ assert_equal 4723 , uri . port
282
+ assert_equal '/wd/hub/' , uri . path
283
+ end
284
+
233
285
def test_default_timeout_for_http_client_with_enable_idempotency_header_false
234
286
def _android_mock_create_session_w3c ( core )
235
287
response = {
0 commit comments