Automate iOS devices using Appium from a Raspberry Pi.

Automate iOS devices using Appium from a Raspberry Pi.

This tutorial describes how you can install and use Appium on a Raspberry Pi to automate iOS devices.

This tutorial uses Ansible to deploy and configure all necessary components.

Prerequisites

  • Raspberry Pi 4 model b. Make sure the Raspberry Pi has sufficient power.
  • Ubuntu 19.10
  • SSH access to the Raspberry Pi from an other linux machine (control machine). You can also an Ubuntu subsystem for windows. see Windows subsystem installation
  • One of more iOS device attached to the Raspberry Pi. If more than one iOS device is used we advise to use a powered USB hub.

Install Ansible on the control machine.

sudo apt-add-repository ppa:ansible/ansible
sudo apt update
sudo apt-get install ansible -y

Clone the appium-ios Ansible role.

git clone https://github.com/quamotion/ansible-role-appium-ios.git appium-ios

Install the nodejs Ansible module

ansible-galaxy install geerlingguy.nodejs

Install and configure Appium on the rapberry pi

Create the playbook.yml file

Create the playbook.yml file (at the same level of the appium-ios git folder). This is an sample playbook file. Please alter the vars (license_file_path, developer_profile_path, devimg_dir)


---
- hosts: rpi
  become: true
  vars:
    license_file_path: /home/bsg/.license
    developer_profile_path: /home/bsg/quamotion.developerprofile
    devimg_dir: /home/bsg/devimg/
  roles:
  - appium-ios

More info about:

Once you know your machineId you can request a trial license using the trial license portal. You can find your machineId by executing any of the installed quamotion tools e.g. xcuitrunner:

/usr/share/xcuitrunner/xcuitrunner

Create the playbook.yml file

Create the inventory.yml file (at the same level of the appium-ios git folder). This is an sample inventory file. Please alter the vars (yourpassword, theraspberrypihost)

[all:vars]
ansible_connection=ssh
ansible_user=ubuntu
ansible_ssh_pass=yourpassword
ansible_become_pass=yourpassword
ansible_python_interpreter=/usr/bin/python3

[rpi]
bsg-rpi ansible_host=theraspberrypihost

Execute the playbook.

export ANSIBLE_HOST_KEY_CHECKING=False
ansible-playbook -i inventory.yml playbook.yml

Run an Appium session

To run a session on the iOS device connected to the Raspberry Pi you need to set the remote host to the host name or ip of the Raspberry Pi.

A session requires at least the following capabilities:

  • platformName: “iOS”
  • deviceName: any name
  • udid: the udid of the device
  • app: can be a bundle or path (on the Raspberry Pi) or the signed ipa file
  • automationName: “XCUITest”

What’s next

For more information about this tutorial, contact us at info@quamotion.mobi.

Last modified December 13, 2019: Fix some writing errors (070a061)