Skip to content

Instantly share code, notes, and snippets.

@rbsilva
Created October 18, 2016 17:35
Show Gist options
  • Save rbsilva/377fbb71a90ef31e2f633a0a1c91dc6e to your computer and use it in GitHub Desktop.
Save rbsilva/377fbb71a90ef31e2f633a0a1c91dc6e to your computer and use it in GitHub Desktop.
Android Monkeyrunner
#!/bin/bash
# Start the emulator with no-window
emulator64-arm -avd instagram -no-window -wipe-data -no-audio -gpu off -no-skin &
# Don't exit until emulator is loaded
output=''
while [[ ${output:0:7} != 'stopped' ]]; do
output=`adb shell getprop init.svc.bootanim`
sleep 1
done
adb install com.instagram.android.apk
adb shell mkdir -p /mnt/sdcard/DCIM/Camera
adb push $1 /mnt/sdcard/DCIM/Camera/
adb shell am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///sdcard
adb shell monkey -p com.instagram.android -c android.intent.category.LAUNCHER 1
monkeyrunner test.py
# Kill emulator
adb -s emulator-5554 emu kill
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment