forked from appium/appium-uiautomator2-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
99 lines (94 loc) · 3.42 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
language: android
jdk: oraclejdk8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
android:
components:
- platform-tools
- tools
- build-tools
env:
global:
- DEVICE=android
- START_EMU=1
- ANDROID_EMU_NAME=test
- ANDROID_EMU_ABI=armeabi-v7a
- ANDROID_BUILD_TOOLS=28.0.3
- ANDROID_EMU_TAG=default
- E2E_TEST_PACKAGE=io.appium.uiautomator2.unittest.test
- CC=gcc-6 CXX=g++-6
matrix:
- TEST=unit START_EMU=0
- TEST=AlertCommandsTest ANDROID_EMU_TARGET=android-24
- TEST=ActionsCommandsTest ANDROID_EMU_TARGET=android-24
- TEST=GestureCommandsTest ANDROID_EMU_TARGET=android-24
- TEST=DeviceCommandsTest ANDROID_EMU_TARGET=android-24
- TEST=ElementCommandsTest ANDROID_EMU_TARGET=android-24
- TEST=GestureCommandsTest ANDROID_EMU_TARGET=android-22
- TEST=DeviceCommandsTest ANDROID_EMU_TARGET=android-22
- TEST=ElementCommandsTest ANDROID_EMU_TARGET=android-22
before_script:
# node stuff
- curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
- nvm install 8
- node --version
- npm --version
- npm install appium-test-support # get the travis emu scripts
# npm stuff
- npm install
- |
echo y | android update sdk --no-ui -t tools
echo yes | sdkmanager tools > /dev/null
echo yes | sdkmanager --update > /dev/null
echo yes | sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" > /dev/null
echo yes | sdkmanager "extras;android;m2repository" > /dev/null
echo yes | sdkmanager "extras;google;m2repository" > /dev/null
if [ ${START_EMU} = "1" ]; then
echo yes | sdkmanager "platforms;${ANDROID_EMU_TARGET}" > /dev/null
export ANDROID_EMU_IMAGE="system-images;${ANDROID_EMU_TARGET};${ANDROID_EMU_TAG};${ANDROID_EMU_ABI}"
for retry in 1 2 3; do
echo yes | sdkmanager "${ANDROID_EMU_IMAGE}" > /dev/null && break
echo "sdkmanager was not able to download the ${ANDROID_EMU_IMAGE} image (retry ${retry})"
sleep 5
done
sdkmanager --list
export TOOLS=${ANDROID_HOME}/tools
export PATH=${ANDROID_HOME}:${ANDROID_HOME}/emulator:${TOOLS}:${TOOLS}/bin:${ANDROID_HOME}/platform-tools:${PATH}
echo no | avdmanager create avd -k "${ANDROID_EMU_IMAGE}" -n "${ANDROID_EMU_NAME}" -f --abi "${ANDROID_EMU_ABI}" --tag "${ANDROID_EMU_TAG}" || exit 1
emulator -avd "${ANDROID_EMU_NAME}" -no-window -camera-back none -camera-front none &
# make sure emulator started
$(npm bin)/android-emu-travis-post
# get root
adb root
adb devices
else
sdkmanager --list
fi
script:
- |
./gradlew compileServerDebugSources compileServerDebugAndroidTestSources
if [ "$TEST" == "unit" ]; then
./gradlew testServerDebugUnitTest
else
stdbuf -oL adb logcat -v time *:S appium:V appium-e2e-tests:V TestRunner:V *:E *:F > logcat.txt &
./gradlew connectedE2eTestDebugAndroidTest \
-Pandroid.testInstrumentationRunnerArguments.class=$E2E_TEST_PACKAGE.$TEST \
-Pandroid.testInstrumentationRunnerArguments.notAnnotation=$E2E_TEST_PACKAGE.internal.SkipHeadlessDevices
fi
after_failure:
- |
if [ "$TEST" != "unit" ]; then
echo -e "----UIAUTOMATOR DUMPS----\n"
adb pull /sdcard/hierarchy .
for f in ./hierarchy/*.xml
do
echo -e "Hierarchy dump for $f\n"
cat "$f"
done
echo -e "----LOGCAT----\n"
cat logcat.txt
fi