File tree Expand file tree Collapse file tree 7 files changed +71
-63
lines changed
Expand file tree Collapse file tree 7 files changed +71
-63
lines changed Original file line number Diff line number Diff line change @@ -33,12 +33,10 @@ import unittest
3333from appium import webdriver
3434
3535desired_caps = {}
36- desired_caps[' device ' ] = ' Android'
37- desired_caps[' browserName ' ] = ' '
38- desired_caps[' version ' ] = ' 4.2 '
36+ desired_caps[' platformName ' ] = ' Android'
37+ desired_caps[' platformVersion ' ] = ' 4.2 '
38+ desired_caps[' deviceName ' ] = ' Android Emulator '
3939desired_caps[' app' ] = PATH(' ../../../apps/selendroid-test-app.apk' )
40- desired_caps[' app-package' ] = ' io.selendroid.testapp'
41- desired_caps[' app-activity' ] = ' .HomeScreenActivity'
4240
4341self .driver = webdriver.Remote(' http://localhost:4723/wd/hub' , desired_caps)
4442```
Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- import os
16- from time import sleep
17-
1815from appium import webdriver
1916from appium .common .exceptions import NoSuchContextException
2017
21- import unittest
18+ import desired_capabilities
2219
23- # Returns abs path relative to this file and not cwd
24- PATH = lambda p : os .path .abspath (
25- os .path .join (os .path .dirname (__file__ ), p )
26- )
20+ import unittest
2721
2822class ContextSwitchingTests (unittest .TestCase ):
2923 def setUp (self ):
30- desired_caps = {}
31- desired_caps ['device' ] = 'Android'
32- desired_caps ['browserName' ] = ''
33- desired_caps ['version' ] = '4.2'
34- desired_caps ['app' ] = PATH ('../../apps/selendroid-test-app.apk' )
35- desired_caps ['app-package' ] = 'io.selendroid.testapp'
36- desired_caps ['app-activity' ] = '.HomeScreenActivity'
37-
24+ desired_caps = desired_capabilities .get_desired_capabilities ('selendroid-test-app.apk' )
3825 self .driver = webdriver .Remote ('http://localhost:4723/wd/hub' , desired_caps )
3926
4027 def test_contexts_list (self ):
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+ import os
16+
17+ # Returns abs path relative to this file and not cwd
18+ PATH = lambda p : os .path .abspath (
19+ os .path .join (os .path .dirname (__file__ ), p )
20+ )
21+
22+ def get_desired_capabilities (app ):
23+ desired_caps = {}
24+ desired_caps ['platformName' ] = 'Android'
25+ desired_caps ['platformVersion' ] = '4.2'
26+ desired_caps ['deviceName' ] = 'Android Emulator'
27+ desired_caps ['app' ] = PATH ('../../apps/' + app )
28+
29+ return desired_caps
Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- import os
16- from time import sleep
17-
1815from appium import webdriver
1916
20- import unittest
17+ import desired_capabilities
2118
22- # Returns abs path relative to this file and not cwd
23- PATH = lambda p : os .path .abspath (
24- os .path .join (os .path .dirname (__file__ ), p )
25- )
19+ import unittest
2620
2721class FindByAccessibilityIDTests (unittest .TestCase ):
2822 def setUp (self ):
29- desired_caps = {}
30- desired_caps ['device' ] = 'Android'
31- desired_caps ['browserName' ] = ''
32- desired_caps ['version' ] = '4.2'
33- desired_caps ['app' ] = PATH ('../../apps/ApiDemos-debug.apk' )
34- desired_caps ['app-package' ] = 'com.example.android.apis'
35- desired_caps ['app-activity' ] = '.ApiDemos'
36-
23+ desired_caps = desired_capabilities .get_desired_capabilities ('ApiDemos-debug.apk' )
3724 self .driver = webdriver .Remote ('http://localhost:4723/wd/hub' , desired_caps )
3825
3926 def tearDown (self ):
Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- import os
16- from time import sleep
17-
1815from appium import webdriver
1916
20- import unittest
17+ import desired_capabilities
2118
22- # Returns abs path relative to this file and not cwd
23- PATH = lambda p : os .path .abspath (
24- os .path .join (os .path .dirname (__file__ ), p )
25- )
19+ import unittest
2620
2721class FindByUIAutomatorTests (unittest .TestCase ):
2822 def setUp (self ):
29- desired_caps = {}
30- desired_caps ['device' ] = 'Android'
31- desired_caps ['browserName' ] = ''
32- desired_caps ['version' ] = '4.2'
33- desired_caps ['app' ] = PATH ('../../apps/ApiDemos-debug.apk' )
34- desired_caps ['app-package' ] = 'com.example.android.apis'
35- desired_caps ['app-activity' ] = '.ApiDemos'
36-
23+ desired_caps = desired_capabilities .get_desired_capabilities ('ApiDemos-debug.apk' )
3724 self .driver = webdriver .Remote ('http://localhost:4723/wd/hub' , desired_caps )
3825
3926 def tearDown (self ):
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+ import os
16+
17+ # Returns abs path relative to this file and not cwd
18+ PATH = lambda p : os .path .abspath (
19+ os .path .join (os .path .dirname (__file__ ), p )
20+ )
21+
22+ def get_desired_capabilities (app ):
23+ desired_caps = {}
24+ desired_caps ['app' ] = PATH ('../../apps/' + app )
25+
26+ return desired_caps
Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- import unittest
16-
1715from appium import webdriver
1816
19- # Returns abs path relative to this file and not cwd
20- import os
21- PATH = lambda p : os .path .abspath (
22- os .path .join (os .path .dirname (__file__ ), p )
23- )
17+ import desired_capabilities
18+
19+ import unittest
2420
2521class FindByUIAutomationTests (unittest .TestCase ):
2622 def setUp (self ):
27- desired_caps = {}
28- desired_caps ['app' ] = PATH ('../../apps/UICatalog.app.zip' )
29-
23+ desired_caps = desired_capabilities .get_desired_capabilities ('UICatalog.app.zip' )
3024 self .driver = webdriver .Remote ('http://localhost:4723/wd/hub' , desired_caps )
3125
3226 def tearDown (self ):
You can’t perform that action at this time.
0 commit comments