Mobile Local Run Setup (MacOS)

If you have the proper licensing (Basically you will see the mobile commands being available in the command wizard), follow the steps below to setup local execution on your machine. 

 

Android

Installation of Major Requirements

  1. Install Homebrew (Homebrew )

  2. Install NodeJS with Homebrew brew install node

  3. Install Java Development Kit (versions 17-21 - we recommend using 21 LTS). You can download from Oracle_17 or Oracle_21 or Adoptium

  4. Install Appium via NPM and update drivers, using console:

npm install -g appium appium driver install uiautomator2 appium driver install xcuitest

5. In order to update Appium, you can use:

appium driver update uiautomator2 appium driver update xcuitest

6. Click Appium Inspector to download Appium Desktop Inspector.

7. Run the attached SH file to install the all other requirements automatically or follow the next steps manually.

Note: If you would like to do the setup manually and want to use zsh instead of bash, you should create/modify ~/.zprofile file.

 

Install Android Emulator Hypervisor

Run the command below:

./sdkmanager "extras;google;Android_Emulator_Hypervisor_Driver"

 

Set environment variables
We need to set environment variables, so Appium can communicate with ADB (Android Debug Bridge).

For example, Android Sdk (installation step 2) is placed on /Users/home/shad0w/Android/Sdk
Open ~/.bash_profile with any editor and add next lines to the bottom:

export ANDROID_HOME=/home/shad0w/Android/Sdk export PATH=$PATH:/home/shad0w/Android/Sdk/tools export PATH=$PATH:/home/shad0w/Android/Sdk/platform-tools

 

Install required emulator system image and create an Emulator
Go to your Android SDK manager folder, e.g. /Users/home/shad0w/Android/Sdk
Run next command to download system emulator.

If you need to create a different emulator with a different API version, you can change the values in the commands. For example, if we want to create ‘Samsung Galaxy S20’ with API 27, we can use the following commands:

Note: If you need x64 version of emulators, you can replace x86 with x86_64 in the lines above.

 

Install Android Emulator Hypervisor

Execute the below command in order to install Android Emulator Hypervisor (Intel HAXM is now obsolete and no longer used)

 

Run created Emulator to be sure everything was created as planned. Go to Sdk/tools folder and run next command:

Kill simulator after

To verify that HAXM installation is successful, run next command:

emulator -accel-check

 

Run Appium
Open any console and run Appium there:

 

Emulator Customization

In order to change the default values for the emulator RAM, resolution and DPI, follow the steps below:

  1. Navigate to the folder where your AVDs are located. For example, on ~/.android/avd

  2. Go to the folder with your device name, for example Google_Pixel_4XL_27_Oreo.avd and find config.ini file

  3. The parameters below must be updated if they already exist in the file. If they do not exist, simply add the missing ones to the bottom of the file (Do not add spaces between values and equals symbol):

A full list of specification is found on the bottom of this article.

 

For example, if our device is Samsung Galaxy S20, we can use the following parameters:

Device Information:

Device Modifications in (config.ini.) file:

 

 

iOS

  1. Register an account on developer.apple.com. It’s free.

  2. Download and install Xcode from AppStore.

  3. Run Xcode and follow basic instructions if any. Quit Xcode.

  4. Install Command Line Tools for Xcode that fit your Xcode version from https://developer.apple.com/download/all/ (login with your developer account)

  5. Run Xcode and create single view project in Xcode from template.

  6. Navigate in Xcode to devices and simulators view. Windows → Devices and Simulators (or Shift+CMD+2).

  7. Switch to Simulators tab. Create here all the Simulators that you plan to use relatively to Mobile dropdown list in Subject 7 preferences. Names of simulators should fit dropdown names.

    Screenshot 2024-04-18 at 13.43.58.png
  8. Now application testing in Simulators should work.

     

Real devices

Apple does not allow to run on real devices unsigned applications of unknown authors. We use Appium as engine for testing, it installs Appium tools on device. When you run iOS test first time (after installation or after Appium update) Appium compiles updated version of Appium driver on the fly from sources. To do so it needs developer certificate.

  1. If you are not developer and you don’t have all the required certs and settings, you need to run Xcode and create new Single View project (or open already created project from step #5 in instructions above).

  2. Open project Target section → Signing & Capabilities tab.

  3. Set checkbox “Automatically manage signing”

    Screenshot 2024-04-18 at 13.58.54.png
  4. Select the Team. First time you will need to select “Add and account…”

  5. In the displayed popup, add the developer account you created in the beginning (sign in). As result Developer Certificate will be created. You can close accounts popup.

  6. Now in Target → Signing & Capabilities tab you will see 2 things from certificate that you will need:

    • Code sign identity that is Apple Development in the screenshot above

    • Team ID in round brackets that is 5KA9C2KB6C in the screenshot above.

  7. Navigate to your home folder and create file sign.xcconfig. E.g. /Users/shad0w/sign.xcconfig

  8. Put next content inside:

    Replace values with values you have

  9. Also in home folder create file driverOverrideBundleId. E.g. /Users/shad0w/driverOverrideBundleId

  10. Put the only line with application Bundle ID inside like:

    Warning!

    • Application name should be strongly WebDriverAgentRunner.

    • Domains of Bundle ID altogether should be absolutely unique and don’t correspond to real software Bundle IDs, e.g.

  11. Now first test case execution on this machine will take some time to compile driver on the fly, but next real device tests will go faster.