@@ -175,6 +175,45 @@ def test_create_session_register_uridirect_no_direct_connect_path(self):
175175 assert ['NATIVE_APP' , 'CHROMIUM' ] == driver .contexts
176176 assert isinstance (driver .command_executor , AppiumConnection )
177177
178+ @httpretty .activate
179+ def test_create_session_remote_server_addr_treatment_with_appiumclientconfig (self ):
180+ # remote server add in AppiumRemoteCong will be prior than the string of 'command_executor'
181+ # as same as Selenium behavior.
182+ httpretty .register_uri (
183+ httpretty .POST ,
184+ f'{ SERVER_URL_BASE } /session' ,
185+ body = json .dumps (
186+ {
187+ 'sessionId' : 'session-id' ,
188+ 'capabilities' : {
189+ 'deviceName' : 'Android Emulator' ,
190+ },
191+ }
192+ ),
193+ )
194+
195+ httpretty .register_uri (
196+ httpretty .GET ,
197+ f'{ SERVER_URL_BASE } /session/session-id/contexts' ,
198+ body = json .dumps ({'value' : ['NATIVE_APP' , 'CHROMIUM' ]}),
199+ )
200+
201+ desired_caps = {
202+ 'platformName' : 'Android' ,
203+ 'deviceName' : 'Android Emulator' ,
204+ 'app' : 'path/to/app' ,
205+ 'automationName' : 'UIAutomator2' ,
206+ }
207+ client_config = AppiumClientConfig (remote_server_addr = SERVER_URL_BASE , direct_connection = True )
208+ driver = webdriver .Remote (
209+ 'http://localhost:8080/something/path' ,
210+ options = UiAutomator2Options ().load_capabilities (desired_caps ),
211+ client_config = client_config ,
212+ )
213+
214+ assert SERVER_URL_BASE == driver .command_executor ._client_config .remote_server_addr
215+ assert isinstance (driver .command_executor , AppiumConnection )
216+
178217 @httpretty .activate
179218 def test_get_events (self ):
180219 driver = ios_w3c_driver ()
0 commit comments