Using Appium to play a YouTube video on an iPhone 7 and using Raspberry Pi (Ubuntu 20.04)

iOS automation on Linux using Appium

Bart Saint Germain
2 min readJan 11, 2021

Automating iOS devices is considered to be more cumbersome to setup as compared to Android.

There are several reasons which make the experience harder on iOS:

  • Most tools have a dependency on a macOS computer and Xcode
  • You require an Apple developer account to manage the signing certificates, application identifiers and provisioning profiles.

Appium end-users also presume they require a macOS computer to perform UI tests on their iOS devices. This leads often to two separate environments, one for Android and one for iOS devices. Experience shows that a CI pipeline using two environments is more fragile and requires more maintenance.

This posts explains how you can use one Appium environment for both iOS and Android automation.

Screenmirror of iPhone on Ubuntu

Install and Configure Appium using Ansible

Using Ansible you can provision and configure one of more hosts which are ready to use Appium for iOS and Android automation.

Prerequisites:

  • One of more hosts with Ubuntu 19.04 or Ubuntu 20.04 installed.
  • One of more iOS devices attached to the host(s).
  • SSH access to the host(s) you want to provision
  • A developer profile
  • The developer disks

Install appium_ios Ansible role:

sudo apt-get install ansible -y
ansible-galaxy install quamotion.appium_ios

Define your inventory and playbook:

Ansible requires an inventory and a playbook file. The inventory file contains information about the different hosts you want to provision. The playbook file contains the required parameters to play the appium-ios role.

Sample playbook.yml: please alter the specific variables
( developer_profile_path, developer_profile_password, devimg_dir)

---
- hosts: rpi
become: true
vars:
developer_profile_path: ~/quamotion.developerprofile
developer_profile_password: quamotion
devimg_dir: ~/devimg/
roles:
- appium-ios

Sample inventory.yml: please alter the specific variables
(ansible_user, ansible_ssh_pass and ansible_host )

[all:vars]
ansible_connection=ssh
ansible_user=user
ansible_ssh_pass=qwerty
ansible_become_pass=qwerty
ansible_python_interpreter=/usr/bin/python3
[nodes]
rpi ansible_host=192.168.10.154

Provision the hosts

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

Create an Appium session

Once the host(s) is provisioned you can use any Appium client or tool to automate your iOS devices. Below is a sample set of capabilities to launch the settings application.

{
"platformName": "iOS",
"platformVersion": "12.4",
"deviceName": "iPhone 6",
"automationName": "XCUITest",
"bundleId": "com.apple.Preferences",
"udid": "de90998ec6387648a3bffbce983d77afb5b1cd4b",
"showXcodeLog": "true"
}

Do not hesitate to contact bart.saintgermain@quamotion.mobi for more information or questions regarding the post.

--

--