Mac OS installation

Common installation for both Android and iOS automation

This section describes common installation steps needed to test both Android or iOS devices on Mac OS.

During to common setup following softwares will be installed:

  • Homebrew

  • Node.js and NMP

  • Appium Desktop

  • Qentinel Pace console

Homebrew

  1. Open a terminal window and run below command:

$ /usr/bin/ruby -e "$(curl -fsSL \
  https://raw.githubusercontent.com/Homebrew/install/master/install)"
Homebrew installation

Node.js and NPM

New installation

  1. Open a terminal window and type: brew update

  2. Type: brew install node

  3. Wait for installation to complete

  4. Check installation by running:

$ node -v
v.10.16.3
$ npm -v
v.6.9.0

Update existing installation

If your existing installation has older version than 10.x, then you need to update it.

If you have not used Homebrew to install then you must find out how to upgrade that installation
  1. Open a terminal window and type: brew update

  2. Type: brew upgrade node

  3. Check the upgraded versions:

$ node -v
v.10.16.3
$ npm -v
v.6.9.0

Install webpack

  1. Open a terminal window and type:

npm install -g webpack

Appium Desktop

Appium Desktop — If you don’t have Appium Desktop client, download dmg-file and install it from here. It includes Appium Server as well and it has nice GUI. This is recommended in installations which are used for test development and execution.

If you are not able to launch Appium Desktop as "Appium" can’t be opened because Apple cannot check it for malicious software, please go to System Settings → Security & Privacy → General and click button Open Anyway

Qentinel Pace console

Download Qentinel Pace console installer for Mac OS from the given location. Please contact us if you do not have a download link.

  1. Check your Python version by typing python3 --version on your terminal. If python version is something else than 3.7.x please download and install Python 3.7.x from here.

  2. Double-click downloaded Qentinel Pace console installation file to start installation.

To be able to launch Qentinel Pace console from any location you need to add the Pace console command as alias to zsh console config file (or .bash_profile if bash is in use).

  • Open terminal and type:

vi ~/.zshrc
  • After the config file is opened in vi editor press "i" key (insert mode) and add followin line ([your_username] is your Mac username):

alias pace_console='source /Users/[your_username]/pace/run_pace_console.sh'
  • Exit the editor insert mode by pressing "ESC" key

  • Type ":" (colon)

  • Type "wq" to save and exit Vi editor

iOS specific installation

This section describes installation steps needed to test iOS devices on Mac OS.

Mac OS is needed in order to develop test automation for iOS.

Pre-requisites

To succeed you the need following:

  • A Mac computer running macOS (Catalina) 10.15.x or later

  • An iPhone running iOS 13.x or later

  • Homebrew

  • Node.js 10.x or newer and NPM

  • Appium Desktop

During the Mac setup for iOS following software will be installed:

  • Xcode 11 or newer

  • Carthage

  • Additional development tools:

    • libimobiledevice

    • ios-deploy

    • ideviceinstaller

  • WebDriverAgent

Xcode

  1. Go to AppStore and search for Xcode

  2. Install (or update) Xcode and wait for the installation to complete before continuing

Carthage

  1. Open a terminal window and type:

brew update
brew install carthage
If you have previously installed the binary version of Carthage, you should delete /Library/Frameworks/CarthageKit.framework)

Additional Development Tools

Install libimobiledevice

This is a library to communicate with iOS device natively.

  1. Open a terminal window and type: brew install libimobiledevice --HEAD

  2. Check installation by running:

$ brew info libimobiledevice

Install ios-deploy

This tool is used to debug and deploy apps to connected device from command line without using Xcode.

  1. Open a terminal window and type: brew install ios-deploy

  2. Check installation by running:

$ ios-deploy -V
1.9.4

Install ideviceinstaller

This tool helps to install, uninstall, upgrade, archive, restore and enumerate installed or archived apps. The tool is needed to run tests on real devices.

  1. Open a terminal window and type: sudo xcode-select -r

  2. Install by typing: brew install ideviceinstaller

  3. Check installation by running (you should see the usage listing):

$ ideviceinstaller

You can use ideviceinstaller to check right bundle ID’s from installed apps easily:

$ ideviceinstaller -u <UDID> -l
You can list all available UDIDs by executing command instruments -s devices
if you get an device lockdown error, then you might have to re-install libimobiledevice and ideviceinstaller:
$ brew uninstall ideviceinstaller
$ brew uninstall libimobiledevice
$ brew install --HEAD libimobiledevice
$ brew link --overwrite libimobiledevice
$ brew install --HEAD  ideviceinstaller
$ brew link --overwrite ideviceinstaller
$ sudo chmod -R 777 /var/db/lockdown/

Optional: install ios_webkit_debug_proxy

For accessing web views on real iOS device Appium uses ios_webkit_debug_proxy. To install it follow the instructions in iOS WebKit Debug Proxy web page.

WebDriverAgent

  1. Open a terminal window and type: cd /usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent

  2. Fetch all needed dependencies by typing:

$ ./Scripts/bootstrap.sh

Device Setup

In order to succeed, you need a Mac setup according to above instructions, an iPhone and Apple Developer account. Apple Developer account is needed for WebDriverAgent building and package signing as well as for your own applications. You need to register your Mac and iPhone to that account in order to use it in test automation. WebDriverAgent is a WebDriver server implementation for iOS that can be used to remote control iOS devices.

Register Mac and iPhone to Developer Account

  1. Connect iPhone to your Mac using the cable

  2. Go to website: https://developer.apple.com/

  3. Click Account at the top of right corner

  4. Login with your credentials

  5. Click Certificates, IDs & Profiles

  6. Click Devices

  7. Click ‘+’ to register a new device

  8. Select iOS, tvOS,watchOS as platform for iPhone and Mac for your computer

  9. Give a name for the device

  10. Copy & paste device UDID to Device ID field e.g. from iTunes’ device setting summary page (click Serial Number to switch between values)

  11. Next, press continue to register the device

  12. Now, you should see the device in the list

You will need the device ID (UDID) also when configuring the automated tests or if building WebDriverAgentRunner from command line

Signing in Developer Account with Xcode

  1. Open Xcode

  2. Select Xcode >> Preferences… >> Accounts

  3. Click the ‘+’ sign and choose Apple ID as account type and login

WebDriverAgent configuration

This configuration will have to be done each time when a new version of Appium is installed — or when WebDriverAgent is updated:

  1. Open a terminal and change working directory to:

    $ cd /usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent
  2. Open Xcode project file by typing:

    $ open WebDriverAgent.xcodeproj
  3. For both, the WebDriverAgentLib and WebDriverAgentRunner targets, select "Automatically manage signing" in the "Signing and Capabilities" tab, and then select your Development Team. This should also auto select Signing Certificate.

  4. Check, and possibly change, Bundle Identifiers to be different for WebDriverAgentLib and WebDriverAgentRunner. You can change it under “Build Settings” tab and “Packaging” section.

  5. Next, select WebDriverAgentRunner as active schema and target it to your connected iPhone

  6. Hit the “Play” button to build the project

  7. If all went fine, you should see “Build Succeeded” notification on the screen

Optionally, steps 5 and 6 can be done in terminal. You need device UDID to do this. In the WebDriverAgent directory (see step 1) run:

$ xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination ‘id=<UDID>’
...
** BUILD SUCCEEDED**

Android

Pre-requisites

To succeed you the need following:

  • Appium Desktop

During the Mac setup for Android following software will be installed:

  • Android Studio including Java JDK

Android Studio

Android Studio — Installing Android Studio is the surest and easiest way to run QMobile on a real device or an emulator.

To install Android Studio on your Mac, proceed as follows:

  1. Download Android Studio from here and launch the Android Studio DMG file.

  2. Drag and drop Android Studio into the Applications folder, then launch Android Studio.

  3. Select whether you want to import previous Android Studio settings, then click OK.

  4. The Android Studio Setup Wizard guides you through the rest of the setup, which includes downloading Android SDK components that are required for development.

  5. Add to console path the Android variables by opening a terminal window and typing: vi ~/.zshrc

    • After the config file is opened in Vi editor, press "i" key (insert mode of the editor) and add or copy/paste the following lines:

      export ANDROID_HOME=/Users/$USER/Library/Android/sdk
      export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
      export ANDROID_SDK=$HOME/Library/Android/sdk
      export PATH=$ANDROID_SDK/emulator:$ANDROID_SDK/tools:$PATH
    • Press "ESC" key to exit the editor insert mode

    • Type ":" (colon) and type "wq" to save modifications and exit Vi editor

For more details about install and configure, please check the official documentation.