IOS UI自动化测试环境搭建
作者:互联网
Xcode
App Stroe 下载安装Xcode
安装完成之后检查版本: xcodebuild -version
Xcode Command Line Tools
命令行输入:xcode-select --install
Brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install ideviceinstaller
brew install libimobiledevice
brew install ios-deploy
Carthage
- 安装Carthage
- brew install carthage
- 检查carthage
- carthage version
WebDriverAgent
有2中方式启动webdriveragent
- 官方下载
- 使用appium 自带的 /Users/admin/nodejs/node_global/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj
- 命令行启动
- xcodebuild -project /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'platform=iOS Simulator,name=iPhone 12 Pro Max' test
- 查看ios模拟器信息xcrun simctl list | grep "Booted"
- 解锁keychain,以便可以正常的签名应用,PASSWORD="replace-with-your-password"security unlock-keychain -p $PASSWORD ~/Library/Keychains/login.keychain
- # 获取设备的UDIDUDID=$(idevice_id -l | head -n1)# 真机运行测试xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination "id=$UDID" test# 模拟器运行测试xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination "platform=iOS Simulator,name=iPhone X" test
模拟器相关
查看模拟器:xcrun instruments -s
启动模拟器:xcrun instruments -w 93EAE4C0-70D4-4A9B-A04E-E21E1B53A911(udid)
真机相关
查看连接的真机: idevice_id -l
查看真机安装的app: ideviceinstaller -l
查看真机信息:ideviceinfo
Macaca (元素定位)
- 安装macaca-cli
- npm install -g macaca-cli
- 安装macaca-doctor
- npm install -g macaca-doctor
- 检查macaca环境: macaca doctor
- 安装macaca-ios:
- npm install -g macaca-ios
- 安装app-inspector
- npm install -g app-inspector
- 运行 app-inspector
- app-inspector -u {apple_uuid}
标签:node,appium,app,IOS,UI,install,macaca,WebDriverAgent,测试环境 来源: https://blog.csdn.net/ggsz520/article/details/123605445