Created
January 14, 2021 05:23
-
-
Save bbchriscesar/13912118d8f781c6e809139e72f799c9 to your computer and use it in GitHub Desktop.
ShellScripting.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## declare an array variable | |
## declare -a arr=("element1" "element2" "element3") | |
local=(ja) | |
#local=(pt-BR pt-PT ru th tr vi zh-TW) | |
function switchLocal(){ | |
adb shell am broadcast -a com.google.android.testing.i18n.localeswitcher.CHANGE_LOCALE -e LANGUAGE_TAG "$1" | |
} | |
function startApp(){ | |
adb shell monkey -p com.google.android.apps.fitness -c android.intent.category.LAUNCHER 1 | |
} | |
function stopApp(){ | |
adb shell am force-stop com.google.android.apps.fitness | |
} | |
function clearAppCaches(){ | |
adb shell pm clear com.google.android.apps.fitness | |
} | |
function takeSS(){ | |
local ui_name="$2" | |
sleep .8 | |
adb shell screencap -p /sdcard/"$1"/"$ui_name".png | |
} | |
function oneTap(){ | |
adb shell input tap $1 $2 | |
sleep .8 | |
} | |
function oneTap_and_takeSS(){ | |
adb shell input tap $1 $2 | |
sleep .8 | |
local ui_name="$4" | |
adb shell screencap -p /sdcard/"$3"/"$ui_name".png | |
} | |
function swipe_and_takeSS(){ | |
adb shell input swipe $1 $2 $3 $4 | |
sleep 1 | |
local ui_name="$6" | |
adb shell screencap -p /sdcard/"$5"/"$ui_name".png | |
} | |
function oneSwipe(){ | |
adb shell input swipe $1 $2 $3 $4 | |
sleep 1 | |
} | |
###################################### | |
# Main | |
###################################### | |
for i in "${local[@]}" | |
#read -p "Press [Enter] key to start ..." | |
do echo locID:"$i" | |
adb shell mkdir /sdcard/"$i" | |
############ switch local & start app ############ | |
stopApp | |
clearAppCaches | |
switchLocal $i | |
startApp | |
sleep 2 | |
takeSS $i Coaching | |
#ContinueAs | |
oneTap 485 1584 | |
sleep 7 | |
takeSS $i About_you_2 | |
sleep 1 | |
############ Copy the files and clean up ########### | |
adb pull /sdcard/$i ./Fitness/ | |
#read -p "SS copied into local desk. Press [Enter] key to continue" | |
############ Device clean up ########### | |
adb shell rm /sdcard/"$i"/* | |
adb shell rmdir /sdcard/"$i" | |
stopApp | |
clearAppCaches | |
done | |
## switch local to English | |
switchLocal "en" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment