-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #213 from IntergalacticPenguin/feature/random-tweaks
atestmonkey + random tweaks = v 1.2.0
- Loading branch information
Showing
20 changed files
with
181 additions
and
104 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
🚨 **Check all before merging!** | ||
- [ ] 🏗 Everything implemented thoroughly | ||
- [ ] 🔨 All changes tested | ||
- [ ] Change #1 | ||
- [ ] Change #2... | ||
- [ ] 👀 Go through the diff | ||
- [ ] 📝 API changes included in README.md | ||
- [ ] 📣 Major changes listed in changelog.txt | ||
|
||
✅ All good? -> **Merge!** 🎉🎉🎉 | ||
## ⚠️ Progress checklist | ||
- [ ] 🏗 **Features fully completed** | ||
- [ ] 🔬 **Shellcheck issues resolved** | ||
- [ ] 🔨 **All changes tested** | ||
- [ ] 💬 **Terminal output satisfactory** | ||
- [ ] 👀 **Diff examined thoroughly** | ||
- [ ] 📝 **API changes included in `README.md`** | ||
- [ ] 📣 **Major changes listed in `changelog.txt`** |
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/bash | ||
LOCATION=$(dirname "$0") | ||
source "$LOCATION"/../common_tools | ||
trap 'ctrlc' 1 2 3 6 15 | ||
|
||
ctrlc(){ | ||
if $RUNNING_TESTS; then | ||
MONKEY_TASK_ID=$(adb -s "$SELECTED_DEVICE" shell pidof "com.android.commands.monkey") | ||
adb -s "$SELECTED_DEVICE" shell kill "$MONKEY_TASK_ID" >/dev/null 2>&1 | ||
echo "🔪 Test monkey terminated, the device is safe to use now!" | ||
fi | ||
|
||
unlock_app_fullscreen | ||
exit 2 | ||
} | ||
|
||
unlock_app_fullscreen(){ | ||
adb -s "$1" shell am task lock stop >/dev/null 2>&1 | ||
echo "🔓 App fullscreen pinning disabled" | ||
} | ||
|
||
update_package_name(){ | ||
APP_PACKAGE_NAME="$(android_get_foreground_package "$1")" | ||
} | ||
|
||
check_screen_pinning(){ | ||
PINNING_ENABLED=$(adb -s "$1" shell settings get system lock_to_app_enabled) | ||
PINNING_ENABLED=${PINNING_ENABLED%$'\r'} # remove trailing carriage return | ||
if [ "$PINNING_ENABLED" != "1" ]; then | ||
adb -s "$1" shell am start -a android.settings.SECURITY_SETTINGS >/dev/null 2>&1 | ||
read -r -p "🔑 Enable \"Screen pinning\" option in security settings, then press enter..." | ||
fi | ||
} | ||
|
||
lock_task_fullscreen(){ | ||
check_screen_pinning "$1" | ||
adb -s "$1" shell monkey -p "$APP_PACKAGE_NAME" -c android.intent.category.LAUNCHER 1 &> /dev/null | ||
adb -s "$1" shell input keyevent "KEYCODE_APP_SWITCH" | ||
read -r -p "📌 Press the \"Pin\" button in \"$APP_PACKAGE_NAME\" window, then press enter... " #TODO add check if already on | ||
tput setaf 3 && should_proceed "🔥 DANGER ZONE ⊗ Perform monkey test on \"$APP_PACKAGE_NAME\"? (it will take a while)" && tput sgr0 #set red and white text color | ||
} | ||
|
||
run_test(){ | ||
SEED="$2" | ||
echo "🐒 Running monkey stress test... (press ctrl^c to end now)" | ||
RUNNING_TESTS=true | ||
LOG_FILE=~/Desktop/"monkey-test-log-seed-$SEED-$APP_PACKAGE_NAME-$MANUFACTURER-$MODEL-API$SDK-$(date +%Y-%m-%d-%H-%M-%S).txt" | ||
adb -s "$1" shell monkey -p "$APP_PACKAGE_NAME" -s "$SEED" --pct-appswitch 0 --pct-syskeys 0 --pct-anyevent 0 "$EVENT_COUNT" &> "$LOG_FILE" | ||
unlock_app_fullscreen "$@" | ||
grep -q "CRASH" "$LOG_FILE" && tput setaf 1 && echo "❌ Test failed, see crash log for details, seed: $SEED" && tput sgr0 && open "$LOG_FILE" && exit 1 | ||
tput setaf 2 && echo "✅ Test passed, successfully executed all input events, seed: $SEED" && tput sgr0 | ||
} | ||
|
||
RUNNING_TESTS=false | ||
EVENT_COUNT=15000 #Should convert to argument later, this is bad | ||
SEED="$RANDOM" | ||
|
||
android_choose_device | ||
android_device_info "$SELECTED_DEVICE" | ||
update_package_name "$SELECTED_DEVICE" | ||
lock_task_fullscreen "$SELECTED_DEVICE" | ||
|
||
case "$1" in #if $1 not number, LOL | ||
''|*[!0-9]*) ;; #nothing left to do | ||
*) SEED="$1" ;; | ||
esac | ||
|
||
run_test "$SELECTED_DEVICE" "$SEED" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
LOCATION=$(dirname "$0") | ||
source "$LOCATION"/../common_tools | ||
trap "kill 0" SIGINT # Kill all spawned subprocesses on ctrl^c | ||
|
||
android_choose_device | ||
|
||
MONKEY_TASK_ID=$(adb -s "$SELECTED_DEVICE" shell pidof "com.android.commands.monkey") | ||
|
||
if [ -z "$MONKEY_TASK_ID" ]; then | ||
echo "🙈 No test monkey running, device is safe to use" | ||
|
||
else | ||
adb -s "$SELECTED_DEVICE" shell kill "$MONKEY_TASK_ID" >/dev/null 2>&1 | ||
echo "🔪 Test monkey terminated, the device is safe to use now!" | ||
fi |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,12 @@ | ||
🩹 Fix brew cask usage in dependency check | ||
🎉 Celebrate new release 1.2.0 together as a community! | ||
⭐️ Leave a star on GitHub, that makes me real happy | ||
📬 Share Mobile Toolkit to your friends and colleagues | ||
📨 Any feedback is highly appreciated | ||
🌍 https://github.com/IntergalacticPenguin/mobile-toolkit | ||
|
||
🆕 Notable changes: | ||
🐒 New "atestmonkey" tool for app stress testing | ||
📦 Automatic "irecord" video compression (saves a lot space) | ||
🚀 Launch "aoptions" single activity result automatically | ||
👋 Remove "igif" (irecord made it obsolete) | ||
😌 Remove emulator prompt on "no device detected" |
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
Oops, something went wrong.