8000 Update desired caps · YapEro/python-client@4c937ae · GitHub
[go: up one dir, main page]

Skip to content

Commit 4c937ae

Browse files
committed
Update desired caps
1 parent 82fc346 commit 4c937ae

File tree

7 files changed

+71
-63
lines changed

7 files changed

+71
-63
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,10 @@ import unittest
3333
from appium import webdriver
3434

3535
desired_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'
3939
desired_caps['app'] = PATH('../../../apps/selendroid-test-app.apk')
40-
desired_caps['app-package'] = 'io.selendroid.testapp'
41-
desired_caps['app-activity'] = '.HomeScreenActivity'
4240

4341
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
4442
```

test/functional/android/context_switching_tests.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,16 @@
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-
1815
from appium import webdriver
1916
from 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

2822
class 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):
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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

test/functional/android/find_by_accessibility_id_tests.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,15 @@
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-
1815
from 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

2721
class 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):

test/functional/android/find_by_uiautomator_tests.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,15 @@
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-
1815
from 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

2721
class 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):
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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

test/functional/ios/find_by_uiautomation_tests.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,15 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import unittest
16-
1715
from 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

2521
class 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):

0 commit comments

Comments
 (0)
0