iOS

To execute the examples over the iOS platform you'l need:

  • MacOS machine

  • Xcode installed

  • iPhone simulator

Prerequisite

Setup Environment

Install NodeJs

Install Homebrew

Homebrew is a package management software that will make it much simpler for us to install a few other software.

To install, follow the instructions on this page: https://brew.sh/ This step will also install the Xcode Command Line Tools as part of the process.

Install Xcode And Simulators

  • Launch the Mac AppStore and download/install Xcode

  • Once installed, Launch Xcode and select Xcode > Preferences > Components to install the simulators that you might want to test against.

Install Carthage

Carthage is a dependency manager. In our case, it is required by WebDriverAgent.

In terminal, enter the following:

brew install carthage

Install authorize-ios

authorize-ios is a little utility that pre-authorizes Instruments to run UIAutomation scripts against iOS devices. You need this utility to run tests on real devices

In terminal, enter the following:

npm install -g authorize-ios

Install ideviceinstaller

ideviceinstaller is a tool to interact with the installation_proxy of an iOS device allowing to install, upgrade, uninstall, archive, restore and enumerate installed or archived apps. You also need this utility to run tests on real devices.

brew install ideviceinstaller

**If you are macOS High Sierra or Mojave you may encounter an error involving “invalid active developer path” in which case run the following command in terminal:

xcode-select --install
sudo xcode-select -r

Then try install ideviceinstaller one more time.

Install Appium

  • Run command: npm install -g appium

  • If permission issues: sudo npm install -g appium --unsafe-perm=true --allow-root

  • Check version in command line:

  • appium --version
    1.15.1

Install Appium Doctor

  • Appium doctor checks preconditions for appium

  • In terminal, enter the following:

npm install -g appium-doctor

To run appium doctor, set the following into terminal:

appium-doctor
  • appium-doctor’s output should look something like this:

  • Android Home, adb, android and emulator errors can be ignored as they relate to automation testing on Android devices.

  • Follow instructions on missing components

Install Appium Desktop

Setup Inspector

  • Launch Appium and Start Server

  • Select "Start Inspector Session" (magnifying glass, top right icon)

  • Setup Desired Capabilities:

    • platforName: iOS

    • platformVersion: version of iOS simulator

    • deviceName: Simulator name

      • Real Android device:

        • Connect a real Android device to your computer

        • Command prompt: adb devices

        • Device name: ENUL6303030010

        • In Appium Set: UDID: ENUL6303030010

  • app: location of app file

  • {
    "platformName": "iOS",
    "platformVersion": "12.1",
    "deviceName": "iPhone XR",
    "app": "/Users/Shared/Jenkins/Documents/Selenium/automation-client/selenium/resources/eurika.app"
    }
  • Start Session

  • The app and the page source will be displayed side by side

UiAutomator Viewer

iOS Test Setup