Appium Setup for POS UI Automation Testing

Set up Appium and automate an app on a physical iPad using its bundle ID.

Configuration & Setup

This section provides a comprehensive setup guide for configuring Appium to work with your iPad for POS UI automation testing. The setup process involves installing necessary tools, configuring Xcode, setting up WebDriverAgent, and configuring Appium Inspector. Follow each step carefully to make sure the setup is successful.

Install Required Tools

Before setting up Xcode and WebDriverAgent, install required command-line tools and dependencies. These tools provide the foundation for iOS automation testing and ensure compatibility between your development environment and iOS devices.

Install Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install Node.js and npm

brew install node

Install Appium

npm install -g appium

Install Appium Doctor

npm install -g appium-doctor

Install Carthage

brew install carthage

Install iOS Deploy

brew install ios-deploy

Verify iOS Deploy Installation

ios-deploy -c

Setup Xcode

Xcode is essential for iOS development and automation. It provides the necessary tools, simulators, and device management capabilities required to work with iOS devices and WebDriverAgent.

Install Xcode

  1. Open the Mac App Store.
  2. Search for "Xcode" and install it if not already installed.

Verify Xcode Installation

  1. Open Xcode from the Applications folder.
  2. Go to Window > Devices and Simulators.
  3. Make sure your iPad appears under the Devices tab.

Enable Developer Mode on iPad

  1. On your iPad, go to Settings > Privacy & Security.
  2. Scroll down and select Developer Mode.
  3. Turn on Developer Mode and allow your iPad to restart.

Obtain iPad's UDID

  1. Open Xcode on your Mac.
  2. Go to Window > Devices and Simulators.
  3. Select your iPad from the list of connected devices.
  4. Copy the UDID displayed for your iPad.

WebDriverAgent

Clone the WebDriverAgent Repository

git clone https://github.com/appium/WebDriverAgent.git

Navigate to WebDriverAgent Directory

cd WebDriverAgent

Bootstrap Carthage

carthage bootstrap

Open WebDriverAgent in Xcode

open WebDriverAgent.xcodeproj

Configure Signing for Targets

  1. In Xcode, select the WebDriverAgentLib target.
  2. Go to Signing & Capabilities.
  3. Select your development team from the drop-down list.
  4. Repeat steps 1-3 for the WebDriverAgentRunner and IntegrationApp targets.

Build and Run WebDriverAgent on the iPad

  1. Select your connected iPad as the target device in Xcode.
  2. Choose the WebDriverAgentRunner scheme.
  3. Press Cmd + R to build and run WebDriverAgent on your iPad.

Troubleshooting

If the build-and-run process is not successful, try the following:

  1. Install the IntegrationApp by selecting it as the scheme and pressing Cmd + R.
  2. Execute a test of the WebDriverAgentRunner by selecting it as the scheme and pressing Cmd + U.

Access WebDriverAgent

After the test is triggered, access the WebDriverAgent at the following URL:

http://<your device IP>:8100/

mceclip1.png

mceclip2.png

mceclip3.png

Start Appium Server

  1. Open a terminal window.
  2. Run the following command:
appium

Configure Appium Inspector

Download and Install Appium Inspector

  1. Go to the official Appium releases page.
  2. Download and install the latest version of Appium Inspector for your operating system.

Launch Appium Inspector and Configure Desired Capabilities

  1. Open Appium Inspector.

  2. Configure the following settings:

    • Remote Host: localhost (use your device IP if necessary)
    • Remote Port: 4723
    • Remote Path: /
  3. Add the following desired capabilities:

    • platformName: iOS
    • platformVersion: (Your iPad's iOS version, for example, 14.0)
    • deviceName: (Your iPad's name, for example, iPad)
    • automationName: XCUITest
    • udid: (Your iPad's UDID)
    • app: (The bundle ID of the app you want to automate)

Verify Setup

Start a New Session in Appium Inspector

  1. Open Appium Inspector.
  2. Click on the Start Session button.
  3. The app specified by the bundleId should launch on the iPad.
  4. You should be able to inspect and interact with the app elements.

Example Configuration for Appium Inspector

Here is an example of how the desired capabilities configuration should look in Appium Inspector:

{
  "appium:deviceName": "PS API iPad",
  "platformName": "iOS",
  "appium:platformVersion": "17.5.1",
  "appium:automationName": "XCUITest",
  "appium:app": "com.psstore.beta.ios",
  "appium:udid": "00008030-000A69C92EA3C02E",
  "appium:xcodeSigningId": "iPhone Developer"
}

mceclip4.png

important: Replace the placeholders with the actual values specific to your setup.