[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-23dc66c7-1ba0-4f3e-be91-48a3607cf38d":3,"$f27_FBw7xWTqQtqkEKFaMiK8TtW_lzqALhlFkKgp4AaU":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"23dc66c7-1ba0-4f3e-be91-48a3607cf38d","android_ui_verification","使用ADB在Android模拟器上自动进行端到端UI测试和验证。","cat_coding_frontend","mod_coding","sickn33,coding","---\nname: android_ui_verification\ndescription: Automated end-to-end UI testing and verification on an Android Emulator using ADB.\nrisk: safe\nsource: community\ndate_added: \"2026-02-28\"\n---\n\n# Android UI Verification Skill\n\nThis 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.\n\n## When to Use\n- Verifying UI changes in React Native or Native Android apps.\n- Autonomous debugging of layout issues or interaction bugs.\n- Ensuring feature functionality when manual testing is too slow.\n- Capturing automated screenshots for PR documentation.\n\n## 🛠 Prerequisites\n- Android Emulator running.\n- `adb` installed and in PATH.\n- Application in debug mode for logcat access.\n\n## 🚀 Workflow\n\n### 1. Device Calibration\nBefore interacting, always verify the screen resolution to ensure tap coordinates are accurate.\n```bash\nadb shell wm size\n```\n*Note: Layouts are often scaled. Use the physical size returned as the base for coordinate calculations.*\n\n### 2. UI Inspection (State Discovery)\nUse the `uiautomator` dump to find the exact bounds of UI elements (buttons, inputs).\n```bash\nadb shell uiautomator dump \u002Fsdcard\u002Fview.xml && adb pull \u002Fsdcard\u002Fview.xml .\u002Fartifacts\u002Fview.xml\n```\nSearch the `view.xml` for `text`, `content-desc`, or `resource-id`. The `bounds` attribute `[x1,y1][x2,y2]` defines the clickable area.\n\n### 3. Interaction Commands\n- **Tap**: `adb shell input tap \u003Cx> \u003Cy>` (Use the center of the element bounds).\n- **Swipe**: `adb shell input swipe \u003Cx1> \u003Cy1> \u003Cx2> \u003Cy2> \u003Cduration_ms>` (Used for scrolling).\n- **Text Input**: `adb shell input text \"\u003Cmessage>\"` (Note: Limited support for special characters).\n- **Key Events**: `adb shell input keyevent \u003Ccode_id>` (e.g., 66 for Enter).\n\n### 4. Verification & Reporting\n#### Visual Verification\nCapture a screenshot after interaction to confirm UI changes.\n```bash\nadb shell screencap -p \u002Fsdcard\u002Fscreen.png && adb pull \u002Fsdcard\u002Fscreen.png .\u002Fartifacts\u002Ftest_result.png\n```\n\n#### Analytical Verification\nMonitor the JS console logs in real-time to detect errors or log successes.\n```bash\nadb logcat -d | grep \"ReactNativeJS\" | tail -n 20\n```\n\n#### Cleanup\nAlways store generated files in the `artifacts\u002F` folder to satisfy project organization rules.\n\n## 💡 Best Practices\n- **Wait for Animations**: Always add a short sleep (e.g., 1-2s) between interaction and verification.\n- **Center Taps**: Calculate the arithmetic mean of `[x1,y1][x2,y2]` for the most reliable tap target.\n- **Log Markers**: Use distinct log messages in the code (e.g., `✅ Action Successful`) to make `grep` verification easy.\n- **Fail Fast**: If a `uiautomator dump` fails or doesn't find the expected text, stop and troubleshoot rather than blind-tapping.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,73,1794,"2026-05-16 13:02:48",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"前端开发","frontend","mdi-language-html5","HTML\u002FCSS\u002FJavaScript\u002F框架相关",1,96,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"3facecb6-048f-4a30-8ecd-e55f648aa90f","1.0.0","android_ui_verification.zip",2293,"uploads\u002Fskills\u002F23dc66c7-1ba0-4f3e-be91-48a3607cf38d\u002Fandroid_ui_verification.zip","d7ee0cc823430df7e132eb4c18ea0ea287246c601d0897a93a8092d3f46e8614","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":3164},{\"path\":\"scripts\u002Fverify_ui.sh\",\"isDirectory\":false,\"size\":895}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]