[AutoQC] Set up AutoQC iOS server

Guideline for setting up autoQC iOS server

Preface

This Guideline provide information about how to set up autoQC iOS server, include of:

  • Appium Setup
  • Environment Variables Setup
  • Appium XCUITest Driver Real Device Setup

Appium Setup

1. Install NodeJS

  • Go to the Node.js Downloads page
  • Download Node.js for macOS by clicking the “macOS Installer” option
  • Run the downloaded Node.js .pkg Installer
  • Run the installer, including accepting the license, selecting the destination, and authenticating for the install.
  • You’re finished! To ensure Node.js has been installed, run node -v in your terminal - you should get something like v6.9.4

References: https://nodejs.org/en/download/

2. Install Appium

Installation via NPM

npm install -g appium

To verify that all of Appium’s dependencies are met you can use appium-doctor .
Install it with npm install -g appium-doctor , then run the appium-doctor command, supplying the --ios or --android flags to verify that all of the dependencies are set up correctly.

Appium’s dependencies

brew install carthage
brew install libimobiledevice --HEAD
brew install ios-deploy

References: http://appium.io/docs/en/about-appium/getting-started/

Environment Variables Setup

1. Install Java and set JAVA_HOME variable
Install Java

  • Go to the Java SE Development Kit 8 Downloads
  • Download Java SDK for macOS by clicking the corresponding file
    jdk
  • Run the installer to install as normal application.
  • After finishing installation, run below command to check

java --version

Set up JAVA_HOME variable

  • Run below command to export JAVA_HOME variable
echo "export JAVA_HOME=$(/usr/libexec/java_home)" >> ~/.bash_profile
echo "export PATH=$PATH:$JAVA_HOME/bin" >> ~/.bash_profile
source ~/.bash_profile

Note: If .bash_profile file is not exist, run the touch ~/.bash_profile command to create it.

2. Install Android SDK and set ANDROID_HOME variable

  • Download SDK Tools

  • Unzip downloaded file to /Users/rta/Library/Android/sdk folder. (If this folder is not exist, create it)

  • Install platform-tools, run command:

cd /Users/rta/Library/Android/sdk/tools/bin/
./sdkmanager "platform-tools" "platforms;android-28"
  • Run below command to export JAVA_HOME variable
echo "export ANDROID_HOME=/Users/rta/Library/Android/sdk" >> ~/.bash_profile
echo "export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools

" >> ~/.bash_profile

source ~/.bash_profile

Note: run the appium-doctor command to check Appium dependencies installed successful.

Appium XCUITest Driver Real Device Setup

1. Create Bundle Identifier

cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
mkdir -p Resources/WebDriverAgent.bundle
./Scripts/bootstrap.sh -d
Open -a Xcode WebDriverAgent.xcodeproj
  • Open WebDriverAgent.xcodeproj in Xcode. For both the WebDriverAgentLib and WebDriverAgentRunner targets, select “Automatically manage signing” in the “General” tab, and then select your Development Team . This should also auto select Signing Ceritificate . The outcome should look as shown below:

  • Go to the “Build Settings” tab, and changing the “Product Bundle Identifier” from com.facebook.WebDriverAgentRunner to rta.appium.runner.automation.WebDriverAgentRunner as created above.

  • Run below command to test build

xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=[uuid]' test
  • That’s on.

References: http://appium.io/docs/en/drivers/ios-xcuitest-real-devices/