Skip to content

Commit e2339e9

Browse files
authored
Run android functional tests on ci (appium#396)
* Add android functional test to ci * Add missing param * Add run_test template * Fixed: test running failed * Fixed * Fixed * fixed * Add run_android_test * Changed emulator to Nexus6 * Run all android tests * fixed * Resolve python-dateutil dependency * Run on 3 workers * Add chromedriver installation * Skip failed test cases on ci * fixed * Extend adbExecTimeout * Add script source to comment * Run 5 workers for android * Use Node11 * Extend wait time * Reduced running android functional tests * Revert some changes
1 parent d679ed8 commit e2339e9

File tree

6 files changed

+90
-25
lines changed

6 files changed

+90
-25
lines changed

Pipfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,18 @@ pre-commit = "~=1.13"
88

99
[packages]
1010
selenium = "~=3.141"
11+
1112
autopep8 = "~=1.4"
12-
httpretty = "~=0.9"
13+
1314
pytest = "~=4.0"
1415
pytest-cov = "~=2.6"
16+
1517
tox = "~=3.6"
1618
tox-travis = "~=0.11"
1719

20+
httpretty = "~=0.9"
21+
python-dateutil = "~=2.8"
22+
1823
# TODO Update to the latest ver when py2 support dropped
1924
pylint = "~=1.9"
2025
astroid = "~=1.6"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
jobs:
2+
- job: ${{ parameters.name }}
3+
pool:
4+
vmImage: ${{ parameters.vmImage }}
5+
variables:
6+
ANDROID_SDK_VERSION: ${{ parameters.sdkVer }}
7+
steps:
8+
- template: ./run_appium.yml
9+
- script: bash ci-jobs/functional/start-emulator.sh
10+
displayName: Create and run Emulator
11+
- script: |
12+
cd test/functional/android
13+
py.test ${{ parameters.testFiles}} ${{ parameters.pytestOpt }}
14+
displayName: Run Android functional tests
15+
- template: ./publish_test_result.yml

ci-jobs/functional/run_appium.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
steps:
22
- task: NodeTool@0
33
inputs:
4-
versionSpec: '10.x'
5-
displayName: Install Node 10.x
6-
- script: npm install -g appium
4+
versionSpec: '11.x'
5+
displayName: Install Node 11.x
6+
- script: npm install -g appium --chromedriver_version='2.44'
77
displayName: Install appium
88
- task: UsePythonVersion@0
99
inputs:
@@ -24,5 +24,5 @@ steps:
2424
appium --version
2525
node --version
2626
displayName: Check versions
27-
- script: appium --relaxed-security &
27+
- script: nohup appium --relaxed-security &
2828
displayName: Run Appium in background
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
jobs:
2+
- job: ${{ parameters.name }}
3+
pool:
4+
vmImage: ${{ parameters.vmImage }}
5+
steps:
6+
- template: ./run_appium.yml
7+
- script: |
8+
cd test/functional/ios
9+
py.test ${{ parameters.testFiles}} ${{ parameters.pytestOpt }}
10+
displayName: Run iOS functional tests
11+
- template: ./publish_test_result.yml
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
3+
# This file comes from https://github.com/appium/ruby_lib_core
4+
5+
# This script was copy-pasted from https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/android?view=azure-devops#test-on-the-android-emulator
6+
# with some changes
7+
8+
# Install AVD files
9+
declare -r emulator="system-images;android-${ANDROID_SDK_VERSION};google_apis;x86"
10+
echo "y" | ${ANDROID_HOME}/tools/bin/sdkmanager --install "$emulator"
11+
12+
# Show a list of emulators
13+
${ANDROID_HOME}/tools/bin/avdmanager list
14+
15+
# Create emulator
16+
echo "no" | ${ANDROID_HOME}/tools/bin/avdmanager create avd -d "Nexus 6" -n testemulator -k "${emulator}" --force
17+
18+
echo ${ANDROID_HOME}/emulator/emulator -list-avds
19+
20+
echo "Starting emulator"
21+
22+
# Start emulator in background
23+
nohup ${ANDROID_HOME}/emulator/emulator -avd testemulator -no-boot-anim -no-snapshot > /dev/null 2>&1 &
24+
${ANDROID_HOME}/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82'
25+
26+
${ANDROID_HOME}/platform-tools/adb devices
27+
28+
echo "Emulator started"

ci-jobs/functional_test.yml

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
11
parameters:
2-
vmImage: 'macOS-10.14'
3-
pytestOpt: '--doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html'
2+
vmImage: 'macOS-10.14'
3+
pytestOpt: '--doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html'
44

55
jobs:
6-
- job: func_test_ios1
7-
pool:
6+
- template: ./functional/run_ios_test.yml
7+
parameters:
8+
name: 'func_test_ios1'
89
vmImage: ${{ parameters.vmImage }}
9-
steps:
10-
- template: ./functional/run_appium.yml
11-
- script: |
12-
cd test/functional/ios
13-
py.test find_*.py remote_fs_tests.py safari_tests.py ${{ parameters.pytestOpt }}
14-
displayName: Run functional tests
15-
- template: ./functional/publish_test_result.yml
16-
- job: func_test_ios2
17-
pool:
10+
pytestOpt: ${{ parameters.pytestOpt }}
11+
testFiles: 'find_*.py remote_fs_tests.py safari_tests.py'
12+
- template: ./functional/run_ios_test.yml
13+
parameters:
14+
name: 'func_test_ios2'
1815
vmImage: ${{ parameters.vmImage }}
19-
steps:
20-
- template: ./functional/run_appium.yml
21-
- script: |
22-
cd test/functional/ios
23-
py.test applications_tests.py hw_actions_tests.py keyboard_tests.py screen_record_tests.py webdriver_tests.py ${{ parameters.pytestOpt }}
24-
displayName: Run functional tests
25-
- template: ./functional/publish_test_result.yml
16+
pytestOpt: ${{ parameters.pytestOpt }}
17+
testFiles: 'applications_tests.py hw_actions_tests.py keyboard_tests.py screen_record_tests.py webdriver_tests.py'
18+
- template: ./functional/run_android_test.yml
19+
parameters:
20+
name: 'func_test_android1'
21+
vmImage: ${{ parameters.vmImage }}
22+
pytestOpt: ${{ parameters.pytestOpt }}
23+
testFiles: 'location_tests.py'
24+
sdkVer: 28
25+
- template: ./functional/run_android_test.yml
26+
parameters:
27+
name: 'func_test_android2'
28+
vmImage: ${{ parameters.vmImage }}
29+
pytestOpt: ${{ parameters.pytestOpt }}
30+
testFiles: 'remote_fs_tests.py'
31+
sdkVer: 28

0 commit comments

Comments
 (0)