File tree Expand file tree Collapse file tree
test/unit/webdriver/device Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,13 +46,3 @@ def context(self):
4646 driver.context
4747 """
4848 return self .current_context
49-
50- # pylint: disable=protected-access
51-
52- def _addCommands (self ):
53- self .command_executor ._commands [Command .CONTEXTS ] = \
54- ('GET' , '/session/$sessionId/contexts' )
55- self .command_executor ._commands [Command .GET_CURRENT_CONTEXT ] = \
56- ('GET' , '/session/$sessionId/context' )
57- self .command_executor ._commands [Command .SWITCH_TO_CONTEXT ] = \
58- ('POST' , '/session/$sessionId/context' )
Original file line number Diff line number Diff line change @@ -52,13 +52,3 @@ def location(self):
5252 - altitude
5353 """
5454 return self .execute (Command .GET_LOCATION )['value' ]
55-
56- # pylint: disable=protected-access
57-
58- def _addCommands (self ):
59- self .command_executor ._commands [Command .TOGGLE_LOCATION_SERVICES ] = \
60- ('POST' , '/session/$sessionId/appium/device/toggle_location_services' )
61- self .command_executor ._commands [Command .GET_LOCATION ] = \
62- ('GET' , '/session/$sessionId/location' )
63- self .command_executor ._commands [Command .SET_LOCATION ] = \
64- ('POST' , '/session/$sessionId/location' )
Original file line number Diff line number Diff line change @@ -1412,7 +1412,20 @@ def finger_print(self, finger_id):
14121412 # pylint: disable=protected-access
14131413
14141414 def _addCommands (self ):
1415- super (WebDriver , self )._addCommands ()
1415+ self .command_executor ._commands [Command .CONTEXTS ] = \
1416+ ('GET' , '/session/$sessionId/contexts' )
1417+ self .command_executor ._commands [Command .GET_CURRENT_CONTEXT ] = \
1418+ ('GET' , '/session/$sessionId/context' )
1419+ self .command_executor ._commands [Command .SWITCH_TO_CONTEXT ] = \
1420+ ('POST' , '/session/$sessionId/context' )
1421+
1422+ self .command_executor ._commands [Command .TOGGLE_LOCATION_SERVICES ] = \
1423+ ('POST' , '/session/$sessionId/appium/device/toggle_location_services' )
1424+ self .command_executor ._commands [Command .GET_LOCATION ] = \
1425+ ('GET' , '/session/$sessionId/location' )
1426+ self .command_executor ._commands [Command .SET_LOCATION ] = \
1427+ ('POST' , '/session/$sessionId/location' )
1428+
14161429 self .command_executor ._commands [Command .TOUCH_ACTION ] = \
14171430 ('POST' , '/session/$sessionId/touch/perform' )
14181431 self .command_executor ._commands [Command .MULTI_ACTION ] = \
Original file line number Diff line number Diff line change 3737 'appium' ,
3838 'appium.common' ,
3939 'appium.webdriver' ,
40- 'appium.webdriver.common'
40+ 'appium.webdriver.common' ,
41+ 'appium.webdriver.extensions'
4142 ],
4243 license = 'Apache 2.0' ,
4344 classifiers = [
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # http://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+
15+ from test .unit .helper .test_helper import appium_command , android_w3c_driver
16+ from appium .common .helper import appium_bytes
17+
18+ import httpretty
19+
20+
21+ class TestWebDriverDeviceContext (object ):
22+
23+ @httpretty .activate
24+ def test_get_contexts (self ):
25+ driver = android_w3c_driver ()
26+ httpretty .register_uri (
27+ httpretty .GET ,
28+ appium_command ('/session/1234567890/context' ),
29+ body = '{"value": "NATIVE"}'
30+ )
31+ assert driver .current_context == 'NATIVE'
You can’t perform that action at this time.
0 commit comments