This skill provides a systematic approach to testing React Native applications on an Android emulator using ADB commands. It allows for autonomous interaction, state verification, and visual regression checking.
adb installed and in PATH.Before interacting, always verify the screen resolution to ensure tap coordinates are accurate.
adb shell wm size
Note: Layouts are often scaled. Use the physical size returned as the base for coordinate calculations.
Use the uiautomator dump to find the exact bounds of UI elements (buttons, inputs).
adb shell uiautomator dump /sdcard/view.xml && adb pull /sdcard/view.xml ./artifacts/view.xml
Search the view.xml for text, content-desc, or resource-id. The bounds attribute [x1,y1][x2,y2] defines the clickable area.
adb shell input tap <x> <y> (Use the center of the element bounds).adb shell input swipe <x1> <y1> <x2> <y2> <duration_ms> (Used for scrolling).adb shell input text "<message>" (Note: Limited support for special characters).adb shell input keyevent <code_id> (e.g., 66 for Enter).Capture a screenshot after interaction to confirm UI changes.
adb shell screencap -p /sdcard/screen.png && adb pull /sdcard/screen.png ./artifacts/test_result.png
Monitor the JS console logs in real-time to detect errors or log successes.
adb logcat -d | grep "ReactNativeJS" | tail -n 20
Always store generated files in the artifacts/ folder to satisfy project organization rules.
[x1,y1][x2,y2] for the most reliable tap target.✅ Action Successful) to make grep verification easy.uiautomator dump fails or doesn't find the expected text, stop and troubleshoot rather than blind-tapping.