docker-android/src/appium.sh

54 lines
1.3 KiB
Bash
Raw Normal View History

#!/bin/bash
2018-05-29 01:04:30 +01:00
if [ -z "$GENY_TEMPLATE" ]; then
2018-05-29 23:54:06 +01:00
GENY_TEMPLATE="/root/tmp/devices.json"
2018-05-29 01:04:30 +01:00
fi
contents=$(cat $GENY_TEMPLATE)
function prepare_geny_cloud() {
# Register
gmtool config username="${USER}" password="${PASS}"
gmtool license register "${LICENSE}"
# Start device(s)
echo "Creating device(s) based on given json file..."
for row in $(echo "${contents}" | jq -r '.[] | @base64'); do
get_value() {
echo ${row} | base64 --decode | jq -r ${1}
}
template=$(get_value '.template')
device=$(get_value '.device')
if [[ $template ]] && [[ $template != null ]]; then
echo "Starting \"$device\" with template name \"$template\"..."
gmtool --cloud admin startdisposable "${template}" "${device}"
else
echo "Starting \"$device\"..."
gmtool --cloud admin start "${device}"
fi
done
}
function run_appium() {
echo "Preparing appium-server..."
CMD="appium --log $APPIUM_LOG"
if [ ! -z "$CONNECT_TO_GRID" ]; then
NODE_CONFIG_JSON="/root/src/nodeconfig.json"
/root/generate_config.sh $NODE_CONFIG_JSON
CMD+=" --nodeconfig $NODE_CONFIG_JSON"
fi
echo "Preparation is done"
$CMD
}
if [[ $REAL_DEVICE = true ]]; then
run_appium
elif [[ $GENYMOTION = true ]]; then
prepare_geny_cloud
run_appium
else
2018-05-29 01:04:30 +01:00
python3 -m src.app
fi