forked from selendroid/selendroid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunEnd2EndTests.sh
executable file
·75 lines (61 loc) · 2.45 KB
/
runEnd2EndTests.sh
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
#!/bin/bash
# Copyright 2014 eBay Software Foundation and selendroid committers.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
function wait_for_boot_complete {
local boot_property=$1
local boot_property_test=$2
echo "[emulator-$emulator_port] waiting to boot..."
result=`adb -s emulator-$emulator_port shell getprop $boot_property 2>/dev/null | grep $boot_property_test`
while [ -z $result ]; do
sleep 1
result=`adb -s emulator-$emulator_port shell getprop $boot_property 2>/dev/null | grep $boot_property_test`
done
echo "[emulator-$emulator_port] booted"
}
platform_version=$1
base_package="io.selendroid.testapp"
if [ -z "$platform_version" ]; then
platform_version=18
fi
echo "Using platform version: ${platform_version}"
avd_name="debug_selendroid_"${platform_version}
selendroid_version=`grep '<version' pom.xml | cut -f2 -d">"|cut -f1 -d"<"|head -1`
echo "deleting existing emulator"
android delete avd -n ${avd_name}
echo "create a new one"
echo no | android create avd -n ${avd_name} -t android-${platform_version} --force --abi x86
START=$(date +%s)
emulator_port=5560
echo "Using: ${locale} to start an emulator for API version: ${platform_version}"
emulator -avd $avd_name -no-audio -no-boot-anim -port $emulator_port&
wait_for_boot_complete "init.svc.bootanim" "stopped"
adb -s emulator-${emulator_port} shell input keyevent 4
adb -s emulator-${emulator_port} shell input keyevent 82
END=$(date +%s)
DIFF=$(( $END - $START ))
echo "It took $DIFF seconds"
echo "Make the sdcard writable"
adb shell <<DONE
su
mount -o rw,remount rootfs /
chmod 777 /mnt/sdcard
exit
exit
DONE
echo "Install test-app apk"
adb install -r selendroid-test-app/target/selendroid-test-app-${selendroid_version}.apk
echo "Running End-to-End Tests"
mvn install -pl selendroid-test-app -DskipTests=false
# for running aspecific test
# mvn install -pl selendroid-test-app -DskipTests=false -Dtest=WaitForProgressBarGoneAwayTest
echo "Stopping Emulator"
adb -s emulator-$emulator_port emu kill