Document toolboxDocument toolbox

Header

(8.3.1) Prepare Mac for Mobile Test Automation

Qualitia uses third-party software components, which needs to be downloaded separately for successful mobile test automation.

In order to prepare your Mac for mobile automation testing, you need to download and install Appium and Xcode.

Download and Install Xcode

Xcode is an integrated development environment (IDE) for macOS containing a suite of software development tools developed by Apple. Xcode helps in creating a set of virtual devices for mobile application testing. 

  • Download and install the latest version of Xcode (from the app store).

Download Simulators

You need to download the required simulators if you want to execute test cases on simulators. 

To download simulators:

  1. Launch Xcode and navigate to Xcode > Preferences.
  2. Select Components from the top. 
    All the available simulators are listed here.
  3. Select one or more simulators from the list to download.
    A pop-up appears asking password.
  4. Enter Password and then click Install Software.

Install and Configure Appium Dependencies for iOS Physical Device on Mac

In order to prepare your Mac for automating test cases on iOS physical device, please install following components using terminal after you have downloaded Appium Desktop and Xcode.

For automating test cases on simulators, you do not need to download and install these components.

For more information on these dependencies, GitHub or Appium documentation.

  1. Install Homebrew, if not present.
    1. To check whether Homebrew is installed, execute following commands in terminal:
      brew --version
    2. To install Homebrew, execute the following command:
      /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    3. Once completed, confirm the installation executing brew --version command.
  2. Install Node js, if not present.
    1. To check whether Node js is installed, execute the following command in terminal: 
      npm --version
    2. To install Node js, execute following commands in terminal:
      brew update and brew install node.
    3. Once completed, confirm the installation executing following command. 
      npm --version
  3. Install appium from NPM.
    1. npm install –g appium
      This will install the latest appium version
  4. Launch terminal and install packages using the following commands:
    1. brew install usbmuxd –HEAD
      This command installs libimobiledevice.
    2. brew install libimobiledevice --HEAD 
      This command installs libimobiledevice.
    3. brew install ideviceinstaller
      This command installs ideviceinstaller required for iOS 9.
    4. npm install -g ios-deploy
      This command installs iOS-deploy required for iOS 10.
    5. gem install xcpretty
      This command installs xcpretty.
    6. brew install ios-webkit-debug-proxy
      This installs iOS Web kit debug proxy. 
    7. brew install carthage
      This command installs carthage dependency manager.
  5. Configure WebDriver Agent project using the following steps:
    1. Download a WebDriverAgent xcode project from GitHub.
      If user is using Mac OS Mojave, please download the WebDriverAgent from here.
    2. Extract the downloaded WebDriverAgent-master.zip. 
    3. Rename extracted folder to WebDriverAgent.
    4. Copy and replace the extracted folder to /Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/WebDriverAgent.
    5. /Applications is the location where you have installed Appium server.
      In case Appium is installed on different directory, replace the above path accordingly.
    6. Launch terminal and go to /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent.
    7. Execute command: 
      ./Scripts/bootstrap.sh
    8. Launch Finder and go to the same location mentioned above. 
    9. Double-click WebDriverAgent.xcodeproj.
      This launches the Xcode.
    10. Connect your physical device and select it using the drop-down list from the top menu bar.
    11. Add developer account in Xcode, if not added. 
      For more information on adding developer account, click here.
    12. Select each Target from the General section, select the Automatically Manage Signing check box from the Signing section.
    13. Select the developer account details from the Team drop-down list for each Target if not added select add Account. Add the developer account for auto signing.

    14. From the top menu items, select Product > Build For > Testing.
      Xcode then builds the WedDriver agent project for testing. If the project builds successfully, your Mac setup is ready for testing.
      If the build fails, click here for troubleshooting.
    15. Select the target as a “WebDriverAgentRunner” and Go to “Product -> Test”.
      WebDriverAgent should get installed. WebDriverAgent should be launched and minimized. Xcode status should display “Testing”.
    16. Stop the test and try launching appium object spy inspector launching the application under test.
Turning on the Automation Support on Safari (Mac) 

Enable the Develop Menu on Safari

The Develop menu can be turned on by following the steps mentioned below.

  1. Launch the Safari browser.
  2. Go to Safari > Preferences > Advanced.
  3. Ensure that Show Develop menu check box is selected.

Enable Remote Automation in the Develop Menu

  1. Launch the Safari browser.
  2. Go to Develop > Allow Remote Automation.

Common Errors while Configuring Mac

You may face some issues while configuring Mac to execute Qualitia automated test cases. This section helps you to resolve the issues coming at the time of configuring Mac.

Requested 'libusbmuxd >= 1.1.0' but version of libusbmuxd is 1.0.10

To resolve this error:

Launch terminal and execute following commands one by one:

  1. brew update
  2. brew uninstall --ignore-dependencies libimobiledevice
  3. brew uninstall --ignore-dependencies usbmuxd
  4. brew install --HEAD usbmuxd
  5. brew install --HEAD libimobiledevice

Error while brew install --HEAD usbmuxd

While executing the brew install --HEAD usbmuxd command from the list above, you may face the following error. This error appears due to compliance and IT policies of the organization.

fatal: unable to access 'https://git.sukimashita.com/libusbmuxd.git/': SSL certificate problem: self signed certificate in certificate chain

To resolve this error, ask IT team to unblock access to  https://git.sukimashita.com/libusbmuxd.git

Error while xcpretty

While executing the gem install xcpretty command from the list above, you may face the following error.

ERROR:  Could not find a valid gem 'xcpretty' (>= 0), here is why:

Unable to download data from https://rubygems.org/ - SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A (https://api.rubygems.org/specs.4.8.gz)

To resolve this error, ask IT team to unblock access to: https://rubygems.org/

Error:  You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.

To resolve this error, use sudo gem install xcpretty command. 

Command CodeSign failed with a nonzero exit code

While building a webdriver agent project in Xcode, you may face this error.

To resolve this error, 

  1. Launch XCODE and navigate to XcodePreferences > Account .
  2. Download all signing profiles manually one-by-one and reboot the system.
  3. After reboot, launch Key Chain Access using application finder.
  4. Navigate to the Certificate section and from the Trust section, mark all developer certificate as System defaults.
  5. Rebuild the Xcode project.



Troubleshooting

You may face some issues while setting up the Mac for automation testing. You may refer to this troubleshooting section to resolve these issues. 


Footer