Skip to content

Commit 556b336

Browse files
authored
Merge branch 'master' into dependabot/pip/pytest-cov-approx-eq-5.0
2 parents 5075ba8 + 7551deb commit 556b336

File tree

12 files changed

+131
-44
lines changed

12 files changed

+131
-44
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Functional Tests
2+
3+
on:
4+
# Run by manual at this time
5+
workflow_dispatch:
6+
push:
7+
branches: [ master ]
8+
pull_request:
9+
branches: [ master ]
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
ios_test:
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
test_targets:
21+
- target: test/functional/ios/search_context/find_by_*.py test/functional/ios/remote_fs_tests.py test/functional/ios/safari_tests.py test/functional/ios/execute_driver_tests.py
22+
name: func_test_ios1
23+
- target: test/functional/ios/applications_tests.py test/functional/ios/hw_actions_tests.py test/functional/ios/keyboard_tests.py
24+
name: func_test_ios2
25+
- target: test/functional/ios/screen_record_tests.py test/functional/ios/webdriver_tests.py
26+
name: func_test_ios3
27+
28+
runs-on: macos-14
29+
30+
steps:
31+
- uses: actions/checkout@v3
32+
33+
- name: Install Node.js
34+
uses: actions/setup-node@v3
35+
with:
36+
node-version: 'lts/*'
37+
38+
- name: Select Xcode
39+
uses: maxim-lobanov/setup-xcode@v1
40+
with:
41+
xcode-version: 15.3
42+
- run: defaults write com.apple.iphonesimulator PasteboardAutomaticSync -bool false
43+
44+
- uses: futureware-tech/simulator-action@v3
45+
with:
46+
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
47+
model: 'iPhone 15 Plus'
48+
os_version: '17.4'
49+
50+
# needed?
51+
- run: brew install ffmpeg
52+
53+
# Start Appium
54+
- run: npm install -g appium
55+
- run: |
56+
appium driver install xcuitest
57+
appium plugin install images
58+
appium plugin install execute-driver
59+
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors > appium.log &
60+
61+
- name: Set up Python 3.9
62+
uses: actions/setup-python@v3
63+
with:
64+
python-version: 3.9
65+
66+
- run: |
67+
# Separate 'run' creates differnet pipenv env. Does them in one run for now.
68+
pip install --upgrade pip
69+
pip install --upgrade pipenv
70+
pipenv lock --clear
71+
pipenv install -d --system
72+
pytest ${{ matrix.test_targets.target}} --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
73+
74+
- name: Save server output
75+
if: ${{ always() }}
76+
uses: actions/upload-artifact@master
77+
with:
78+
name: appium-ios-${{matrix.test_targets.name}}.log
79+
path: appium.log

.github/workflows/pr-title.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
name: https://www.conventionalcommits.org
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: beemojs/conventional-pr-action@v2
11+
- uses: beemojs/conventional-pr-action@v3
1212
with:
1313
config-preset: angular
1414
env:

Pipfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ mock = "~=5.1"
1212
pre-commit = "~=2.21"
1313
pylint = "~=3.1.0"
1414
pylint-quotes = "~=0.2.3"
15-
pytest = "~=8.1"
15+
pytest = "~=8.2"
1616
pytest-cov = "~=5.0"
1717
python-dateutil = "~=2.9"
18-
tox = "~=4.14"
18+
tox = "~=4.15"
1919
types-python-dateutil = "~=2.9"
2020

2121
[packages]
22-
selenium = "~=4.18"
22+
selenium = "~=4.20"

appium/webdriver/common/appiumby.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
class AppiumBy(By):
1919
IOS_PREDICATE = '-ios predicate string'
20-
IOS_UIAUTOMATION = '-ios uiautomation'
2120
IOS_CLASS_CHAIN = '-ios class chain'
2221
ANDROID_UIAUTOMATOR = '-android uiautomator'
2322
ANDROID_VIEWTAG = '-android viewtag'

appium/webdriver/webdriver.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def test_command(self, argument):
118118
def add_command(self):
119119
return ('post', 'session/$sessionId/path/to/your/custom/url')
120120
121-
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps,
121+
driver = webdriver.Remote('http://localhost:4723/wd/hub', options=options,
122122
extensions=[YourCustomCommand])
123123
124124
# Then, the driver sends a post request to `session/$sessionId/path/to/your/custom/url`
@@ -138,7 +138,7 @@ def custom_method_name(self, element_id):
138138
def add_command(self):
139139
return ('GET', 'session/$sessionId/path/to/your/custom/$id/url')
140140
141-
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps,
141+
driver = webdriver.Remote('http://localhost:4723/wd/hub', options=options,
142142
extensions=[YourCustomCommand])
143143
element = driver.find_elemeent(by=AppiumBy.ACCESSIBILITY_ID, value='id')
144144
@@ -240,7 +240,6 @@ def __init__(
240240
self._update_command_executor(keep_alive=keep_alive)
241241

242242
# add new method to the `find_by_*` pantheon
243-
By.IOS_UIAUTOMATION = AppiumBy.IOS_UIAUTOMATION
244243
By.IOS_PREDICATE = AppiumBy.IOS_PREDICATE
245244
By.IOS_CLASS_CHAIN = AppiumBy.IOS_CLASS_CHAIN
246245
By.ANDROID_UIAUTOMATOR = AppiumBy.ANDROID_UIAUTOMATOR

ci-jobs/functional_test.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,6 @@ parameters:
66
CI: true
77

88
jobs:
9-
- template: ./functional/run_ios_test.yml
10-
parameters:
11-
name: 'func_test_ios1'
12-
vmImage: ${{ parameters.vmImage }}
13-
pytestOpt: ${{ parameters.pytestOpt }}
14-
testFiles: 'search_context/find_by_*.py remote_fs_tests.py safari_tests.py execute_driver_tests.py'
15-
CI: ${{ parameters.ci }}
16-
xcodeForIOS: ${{ parameters.xcodeForIOS }}
17-
- template: ./functional/run_ios_test.yml
18-
parameters:
19-
name: 'func_test_ios2'
20-
vmImage: ${{ parameters.vmImage }}
21-
pytestOpt: ${{ parameters.pytestOpt }}
22-
testFiles: 'applications_tests.py hw_actions_tests.py keyboard_tests.py screen_record_tests.py webdriver_tests.py'
23-
CI: ${{ parameters.ci }}
24-
xcodeForIOS: ${{ parameters.xcodeForIOS }}
259
- template: ./functional/run_android_test.yml
2610
parameters:
2711
name: 'func_test_android1'

test/apps/UICatalog.app.zip

-16.8 MB
Binary file not shown.

test/functional/ios/helper/desired_capabilities.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def get_desired_capabilities(app: Optional[str] = None) -> Dict[str, Any]:
2828
desired_caps: Dict[str, Any] = {
2929
'deviceName': iphone_device_name(),
3030
'platformName': 'iOS',
31-
'platformVersion': '15.5',
31+
'platformVersion': '17.4',
3232
'automationName': 'XCUITest',
3333
'allowTouchIdEnroll': True,
3434
'wdaLocalPort': wda_port(),
@@ -70,7 +70,7 @@ def wda_port() -> int:
7070

7171

7272
def iphone_device_name() -> str:
73-
prefix = 'iPhone 12'
73+
prefix = 'iPhone 15 Plus'
7474
if PytestXdistWorker.NUMBER == PytestXdistWorker.gw(0):
7575
return f'{prefix} - 8100'
7676
elif PytestXdistWorker.NUMBER == PytestXdistWorker.gw(1):

test/functional/ios/helper/test_helper.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525

2626
class BaseTestCase(object):
27+
IOS_UICATALOG_APP_NAME = 'UIKitCatalog'
28+
2729
def setup_method(self) -> None:
2830
desired_caps = desired_capabilities.get_desired_capabilities('UICatalog.app.zip')
2931
self.driver = webdriver.Remote(SERVER_URL_BASE, options=XCUITestOptions().load_capabilities(desired_caps))

test/functional/ios/safari_tests.py

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,44 @@
2424
class TestSafari:
2525
def setup_method(self) -> None:
2626
caps = get_desired_capabilities()
27-
caps.update({'browserName': 'safari', 'nativeWebTap': True, 'safariIgnoreFraudWarning': True})
27+
caps.update(
28+
{
29+
'bundleId': 'com.apple.mobilesafari',
30+
'nativeWebTap': True,
31+
'safariIgnoreFraudWarning': True,
32+
'webviewConnectTimeout': 100000,
33+
}
34+
)
2835
self.driver = webdriver.Remote(SERVER_URL_BASE, options=AppiumOptions().load_capabilities(caps))
2936

37+
# Fresh iOS 17.4 simulator may not show up the webview context with "safari"
38+
# after a fresh simlator instance creation.
39+
# Re-launch the process could be a workaround in my debugging.
40+
self.driver.terminate_app('com.apple.mobilesafari')
41+
self.driver.activate_app('com.apple.mobilesafari')
42+
3043
def teardown_method(self) -> None:
3144
self.driver.quit()
3245

3346
def test_context(self) -> None:
34-
assert 'NATIVE_APP' == self.driver.contexts[0]
35-
assert self.driver.contexts[1].startswith('WEBVIEW_')
47+
contexts = self.driver.contexts
48+
assert 'NATIVE_APP' == contexts[0]
49+
assert contexts[1].startswith('WEBVIEW_')
50+
self.driver.switch_to.context(contexts[1])
3651
assert 'WEBVIEW_' in self.driver.current_context
3752

3853
def test_get(self) -> None:
54+
ok = False
55+
contexts = self.driver.contexts
56+
for context in contexts:
57+
if context.startswith('WEBVIEW_'):
58+
self.driver.switch_to.context(context)
59+
ok = True
60+
break
61+
62+
if ok is False:
63+
assert False, 'Could not set WEBVIEW context'
64+
3965
self.driver.get('http://google.com')
4066
for _ in range(5):
4167
time.sleep(0.5)

0 commit comments

Comments
 (0)