sib是以gidevice为底层实现的iOS调试工具,因为go语言特性,编译好的二进制文件可以直接运行,所以不需要额外配置python环境或者go环境,直接下载3M左右的包解压就可以使用啦!sonic组织也在持续参与建设gidevice。当前迭代了数月,到达了1.1.2版本,基础功能如下:
设备基础信息获取、设备监听
App安装卸载、启动终止
查看进程信息
启动xctest相关,如:启动Wda、Fastbot_iOS
获取电池相关信息
重启关机
代理转发
崩溃信息收集
模拟定位与取消(部分App不生效)
屏幕旋转监听
系统日志获取
性能采集(Doing)
截图
文件管理
以上功能皆跨平台,即Windows、Mac、Linux都可以使用。
UI自动化的应用(Appium)
以Java为例:
先用sib启动wda(需要指定端口可以参考官网文档的参数)
sib run wda
然后在脚本里配置Driver
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, Platform.IOS);
desiredCapabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.IOS_XCUI_TEST);
desiredCapabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 3600);
desiredCapabilities.setCapability(IOSMobileCapabilityType.COMMAND_TIMEOUTS, 3600);
desiredCapabilities.setCapability(MobileCapabilityType.NO_RESET, true);
desiredCapabilities.setCapability(MobileCapabilityType.DEVICE_NAME, 【设备名称,也可以通过sib获取】);
desiredCapabilities.setCapability(MobileCapabilityType.UDID, udId);
desiredCapabilities.setCapability("wdaConnectionTimeout", 60000);
desiredCapabilities.setCapability(IOSMobileCapabilityType.WEB_DRIVER_AGENT_URL, "http://127.0.0.1:8100");
desiredCapabilities.setCapability("useXctestrunFile", false);
desiredCapabilities.setCapability(IOSMobileCapabilityType.SHOW_IOS_LOG, false);
desiredCapabilities.setCapability(IOSMobileCapabilityType.SHOW_XCODE_LOG, false);
desiredCapabilities.setCapability("skipLogCapture", true);
desiredCapabilities.setCapability(IOSMobileCapabilityType.USE_PREBUILT_WDA, false);
new IOSDriver("http://localhost:4723/wd/hub", desiredCapabilities);
即可启动。
在 Fastbot 应用
sib run xctest -b bytedance.FastbotRunner.xxxxxxx.xctrunner -e
BUNDLEID=com.xxxxxx.internalapp -e duration=1 -e throttle=500
注意,因为wda和fastbot部分底层是相同,所以同时启动wda和fastbot会阻塞哦
获取 App 图标
加上-i参数即可获取icon,格式为base64
sib app list -i
前端渲染后效果如图
App的管理还有很多,例如安装、卸载、启动、强杀
sib app install
sib app uninstall
sib app launch
sib app kill
屏幕旋转监听
sib orientation
您会获得类似的输出
orientation: 1
获取设备信息
sib devices -d -f
你会获得类似输出
{
"deviceList": [
{
"deviceId": 1,
"connectionSpeed": 0,
"connectionType": "USB",
"locationId": 0,
"productId": 4776,
"serialNumber": "0000****-001****6F****E",
"status": "online",
"deviceDetail": {
"generationName": "iPhone 13 Pro",
"deviceName": "iPhone",
"deviceColor": "1",
"deviceClass": "iPhone",
"productVersion": "15.4.1",
"productType": "iPhone14,2",
"productName": "iPhone OS",
"passwordProtected": true,
"modelNumber": "*****",
"serialNumber": "*****",
"simStatus": "kCTSIMSupportSIMStatusReady",
"phoneNumber": "+86 *****",
"cpuArchitecture": "arm64e",
"protocolVersion": "2",
"regionInfo": "CH/A",
"telephonyCapability": true,
"timeZone": "Asia/Shanghai",
"uniqueDeviceID": "*****",
"wifiAddress": "*****",
"wirelessBoardSerialNumber": "*****",
"bluetoothAddress": "*****",
"buildVersion": "*****"
}
}
]
}
相关功能还有很多很多,这里就不全部放出来啦,推荐前往官方文档查看更多详细信息哦!
sib run wda -b your.wda.bundleId
sib run xctest -b your.wda.bundleId
sib app list
sib app launch
sib devices listen
sib app uninstall
sib screenshoot
sib ps
sib crash
sib location
sib oritation
sib battery
sib info
...
结语
sib还在持续更新中,正在挖掘无人触碰的领域,也欢迎有能力的小伙伴参与建设 ~
官网文档(下载、安装、文档):
用户社区(提bug、需求):
https://sonic-cloud.wiki/