iOS setup
Last modified on Fri 24 Feb 2023
Automation does not do what testers used to do, unless one ignores most things a tester really does. Automated testing is useful for extending the reach of the testers work, not to replace it.
Unlike Android, the iOS ecosystem is a bit more cocooned. That means that the setup requires a few additional steps when compared to the Android setup.
You can set up the iOS configuration in two ways:
Automatically
- By running the iOS test, the application under test (or so called WebDriverAgentDriver) is signed automatically. This is possible to achieve by setting the correct signing certificate and provisioning profile to a "dummy project" and turning on the "Sign automatically" feature. More on that bellow.
Manually
- More often than not, life doesn't turn out the way we want it to. Meaning, automatic configuration could fail for different reasons. If that's how your beans fell, we got you covered with the Manual configuration.
bundle ID
Where to find the app's- Download the
.ipa
file - Change the extension of the
.ipa
file to.zip
- Unzip the file and open the Payload folder
- Right-click on the file and select the Show package contents option
- Open the
.plist
file to find the Bundle identifier
Automatic configuration
- Open Xcode
- Click Create a new Xcode project
- Choose the Application template (e.g. Single View App) and click Next
- Enter product name
- E.g. Demo application
- Click Add account and use your personal Infinum iCloud account
- Click Team dropdown and choose your personal Infinum account
- Make sure the Automatically manage signing option is checked
- Enter Organization Identifier and click Next
- E.g. com.appiumtest.demo-application
- Choose the Project location and click Done
- Close the Xcode project
- Open terminal and run
brew install libimobiledevice --HEAD
.- In case of Permission denied error, check step 6 from the Manual configuration setup.
- Connect your physical iPhone to your Mac
- Make sure it's trusted device
- Enter
idevice_id --list
in the terminal and hit enter - Copy the ID and use it as a UDID/device name
- Start Appium Server
- Open your Appium project in PyCharm
- Make sure there's an
.ipa
file in the project's builds folder - Run the tests
There's a huge chance an error pops up, most likely:
No profiles for 'com.facebook.WebDriverAgentRunner.xctrunner were found:
Xcode couldn't find any iOS app Development provisioning profiles matching com.facebook.WebDriverAgentRunner.xctrunner'.
In that case, do the following:
- Inspect the Appium server logs and find the WebDriverAgent path the XCUITest driver is using
- Most probably
/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/
- Most probably
- Open the
WebDriverAgent.xcodeproj
from the folder (using Xcode) - Click the WebDriverAgent from the Project navigator
- Open Signing & Capabilities tab
- Choose WebDriverAgentLib from the Targets section
- Manually choose your personal Infinum account under Team
- Wait for the signing process to finish
- Next, choose WebDriverAgentRunner from the Targets section
- Again, manually choose your personal Infinum account under Team
- Wait for the signing process to finish
- The signing will probably fail due to the wrong Bundle identifier. Don't worry, we'll fix that
- Click the Build Settings tab
- Find the Packaging category and double-click the Product Bundle Identifier.
- Change the value to something unique like com.your_name.WebDriverAgentRunner and try to sign it again
- Save the project and run the Appium project
Manual configuration
- Download the Appium client (by pressing the Download Appium button)
- Move the application to the Application folder
- Install Homebrew
- Install Node.js
Using terminal, run
npm install -g appium
- The error Permission denied could potentially appear. In that case:
- Run
sudo chmod 777 /usr/local/lib/node_modules
and type your password - Enter
npm install -g appium
again
- Run
- The error Permission denied could potentially appear. In that case:
Run
brew install libimobiledevice --HEAD
- If Permission denied error appears, run:
sudo chmod 777 /usr/local/share/doc
sudo chmod 777 /usr/local/share/man
sudo chmod 777 /usr/local/share/man/man1
brew install libimobiledevice --HEAD
- If Permission denied error appears, run:
Run
brew install carthage
Install the latest Xcode to continue with the setup
- The important step is to open Xcode application and accept the Agreement, download the latest updates and open it for the first time
Run
npm install -g ios-deploy --unsafe-perm=true
- You’ll probably see some xcodebuild requires Xcode error. In that case, run:
sudo xcode-select --switch /Library/Developer/CommandLineTools
- After entering the password, run the
npm install -g ios-deploy --unsafe-perm=true
command again.- If the issue persists, run:
rm -rf ~/Library/Developer/Xcode/DerivedData/*
npm -g uninstall ios-deploy
npm -g install ios-deploy@beta
- You’ll probably see some xcodebuild requires Xcode error. In that case, run: