其他分享
首页 > 其他分享> > IOS UI自动化测试环境搭建

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

  1. 安装Carthage
  2. brew install carthage
  3. 检查carthage
  4. carthage version

WebDriverAgent

有2中方式启动webdriveragent

  1. 官方下载
  2. 使用appium 自带的 /Users/admin/nodejs/node_global/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj
  3. 命令行启动
  4. 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
  5. 查看ios模拟器信息xcrun simctl list | grep "Booted"
  6. 解锁keychain,以便可以正常的签名应用,PASSWORD="replace-with-your-password"security unlock-keychain -p $PASSWORD ~/Library/Keychains/login.keychain
  7. # 获取设备的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 (元素定位)

  1. 安装macaca-cli
  2. npm install -g macaca-cli
  3. 安装macaca-doctor
  4. npm install -g macaca-doctor
  5. 检查macaca环境: macaca doctor
  6. 安装macaca-ios:
  7. npm install -g macaca-ios
  8. 安装app-inspector
  9. npm install -g app-inspector
  10. 运行 app-inspector
  11. app-inspector -u {apple_uuid}

标签:node,appium,app,IOS,UI,install,macaca,WebDriverAgent,测试环境
来源: https://blog.csdn.net/ggsz520/article/details/123605445