Sitelet https://github.com/appium/python-client/pull/1007/files
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c237299
add android as initial commit
KazuCocoa May 8, 2024
31c5a4f
add espresso
KazuCocoa May 10, 2024
d1620fc
fix test
KazuCocoa May 10, 2024
ee79462
skip images
KazuCocoa May 10, 2024
619a723
remoe partial tests from azure
KazuCocoa May 10, 2024
9562006
Merge branch 'master' into ci-android
KazuCocoa May 24, 2024
d9cbf9f
Merge branch 'master' into ci-android
KazuCocoa Jul 23, 2024
36b9cc7
comment out ios and azure
KazuCocoa Jul 23, 2024
e8c029f
Update functional-test.yml
KazuCocoa Jul 27, 2024
b6e8e04
fix lint
KazuCocoa Jul 27, 2024
3b9702a
Merge branch 'ci-android' of github.com:appium/python-client into ci-…
KazuCocoa Jul 27, 2024
67c969c
add skip
KazuCocoa Jul 27, 2024
2ee88c1
revert comment out
KazuCocoa Jul 27, 2024
ca38307
Merge branch 'master' into ci-android
KazuCocoa Jul 27, 2024
557c343
fix gha
KazuCocoa Jul 27, 2024
40db455
Merge branch 'ci-android' of github.com:appium/python-client into ci-…
KazuCocoa Jul 27, 2024
ee9659b
fix test
KazuCocoa Jul 28, 2024
40a7e2b
tweak
KazuCocoa Jul 28, 2024
102b9fd
update skipped test
KazuCocoa Jul 28, 2024
a4f0c89
remove unused lines
KazuCocoa Jul 28, 2024
f546827
tweak more
KazuCocoa Jul 28, 2024
8e2a59e
fix lint
KazuCocoa Jul 28, 2024
7da6b1a
tweak
KazuCocoa Jul 28, 2024
482deae
tune
KazuCocoa Jul 28, 2024
68db2b1
use plxel 8
KazuCocoa Jul 28, 2024
721e408
use plxel 6
KazuCocoa Jul 28, 2024
5fb985f
use profile nexus 5x
KazuCocoa Jul 28, 2024
a45ba43
use wait for condition
KazuCocoa Jul 29, 2024
f62953c
revert unnecessary changes
KazuCocoa Jul 29, 2024
89d0a38
fix lint
KazuCocoa Jul 29, 2024
abdbb14
remove wait for
KazuCocoa Jul 29, 2024
737f306
remove unused import
KazuCocoa Jul 29, 2024
c0433ff
refirect stderr, add note about available xcode/ios versions on a run…
KazuCocoa Jul 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 108 additions & 3 deletions .github/workflows/functional-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ jobs:

runs-on: macos-14

# Please make sure the available Xcode versions and iOS versions
# on the runner images. https://github.com/actions/runner-images
env:
XCODE_VERSION: 15.3

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a note that in order to change xcode version one must also check for compatible macOS version in the compat matrix

IOS_VERSION: 17.4
IPHONE_MODEL: iPhone 15 Plus

steps:
- uses: actions/checkout@v3

Expand All @@ -38,14 +45,14 @@ jobs:
- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 15.3
xcode-version: ${{ env.XCODE_VERSION }}
- run: defaults write com.apple.iphonesimulator PasteboardAutomaticSync -bool false

- uses: futureware-tech/simulator-action@v3
with:
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
model: 'iPhone 15 Plus'
os_version: '17.4'
model: ${{ env.IPHONE_MODEL }}
Comment thread
mykola-mokhnach marked this conversation as resolved.
os_version: ${{ env.IOS_VERSION }}

# needed?
- run: brew install ffmpeg
Expand Down Expand Up @@ -77,3 +84,101 @@ jobs:
with:
name: appium-ios-${{matrix.test_targets.name}}.log
path: appium.log


android_test:
strategy:
fail-fast: false
matrix:
test_targets:
- target: test/functional/android/device_time_tests.py test/functional/android/search_context/find_by_*.py
name: func_test_android1

runs-on: ubuntu-latest

env:
API_LEVEL: 29
ARCH: x86

steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 'lts/*'

# Start Appium
- run: npm install -g appium
- run: |
appium driver install uiautomator2
appium driver install espresso
appium plugin install images
appium plugin install execute-driver
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors 2>&1 > appium.log &

- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ env.API_LEVEL }}
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.API_LEVEL }}
arch: ${{ env.ARCH }}
target: google_apis
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."

- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it rather be latest python?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually, I'm thinking of making it the latest. For now, this is my local (mac's) default major version to test this out on my local and the GHA env.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np, just leave a TODO there for later so we don't forget about it.


- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.API_LEVEL }}
arch: ${{ env.ARCH }}
script: |
# Separate 'run' creates differnet pipenv env. Does them in one run for now.
pip install --upgrade pip
pip install --upgrade pipenv
pipenv lock --clear
pipenv install -d --system
pytest ${{ matrix.test_targets.target}} --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
target: google_apis
profile: Nexus 5X
disable-spellchecker: true
disable-animations: true

env:
ANDROID_SDK_VERSION: ${{ env.API_LEVEL }}
APPIUM_DRIVER: ${{matrix.test_targets.automation_name}}
IGNORE_VERSION_SKIP: true
CI: true

- name: Save server output
if: ${{ always() }}
uses: actions/upload-artifact@master
with:
name: appium-android-${{matrix.test_targets.name}}.log
path: appium.log
1 change: 0 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
# https://docs.microsoft.com/azure/devops/pipelines/languages/xcode
jobs:
- template: ./ci-jobs/functional_test.yml

8 changes: 0 additions & 8 deletions ci-jobs/functional_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ parameters:
CI: true

jobs:
- template: ./functional/run_android_test.yml
parameters:
name: 'func_test_android1'
vmImage: ${{ parameters.vmImage }}
pytestOpt: ${{ parameters.pytestOpt }}
testFiles: 'device_time_tests.py search_context/find_by_*.py'
sdkVer: ${{ parameters.androidSdkVer }}
CI: ${{ parameters.ci }}
- template: ./functional/run_android_test.yml
parameters:
name: 'func_test_android2'
Expand Down
Binary file modified test/functional/android/file/find_by_image_success.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ def setup_method(self) -> None:

# relax template matching
self.driver.update_settings(
{'fixImageFindScreenshotDims': False, 'fixImageTemplateSize': True, 'autoUpdateImageElementPosition': True}
{
'fixImageFindScreenshotDims': False,
'fixImageTemplateSize': True,
'autoUpdateImageElementPosition': True,
'fixImageTemplateScale': True,
'imageMatchThreshold': 0.8,
}
)

def teardown_method(self) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def test_find_single_element_using_hamcrest_matcher(self) -> None:
# androidx.test.espresso.AmbiguousViewMatcherException:
# 'with text: a string containing "Access"' matches multiple views in the hierarchy.
def test_find_multiple_elements(self) -> None:
with pytest.raises(WebDriverException):
self.driver.find_elements(
by=AppiumBy.ANDROID_VIEW_MATCHER,
value=json.dumps({'name': 'withSubstring', 'args': ['Access'], 'class': 'ViewMatchers'}),
)
el = self.driver.find_element(
by=AppiumBy.ANDROID_VIEW_MATCHER,
value=json.dumps({'name': 'withSubstring', 'args': ['Access'], 'class': 'ViewMatchers'}),
)
assert el.text == "Access'ibility"