Class AndroidCapability

java.lang.Object
core.uiCore.driverProperties.capabilities.AndroidCapability

public class AndroidCapability extends Object
Author:
ehsan.matean
  • Field Details

    • capabilities

      public org.openqa.selenium.remote.DesiredCapabilities capabilities
    • APP_DIR_PATH

      public static String APP_DIR_PATH
    • APP_NAME

      public static String APP_NAME
    • ANDROID_ENGINE

      public static String ANDROID_ENGINE
    • UIAUTOMATOR2

      public static String UIAUTOMATOR2
    • ANDROID_INIT

      public static boolean ANDROID_INIT
    • ANDROID_HOME

      public static String ANDROID_HOME
    • ANDROID_UDID

      public static String ANDROID_UDID
    • IS_HYBRID_APP

      public static String IS_HYBRID_APP
    • CHROME_VERSION

      public static String CHROME_VERSION
    • simulatorList

      public List<String> simulatorList
    • SYSTEM_PORT

      public static int SYSTEM_PORT
  • Constructor Details

    • AndroidCapability

      public AndroidCapability()
  • Method Details

    • withCapability

      public AndroidCapability withCapability(org.openqa.selenium.remote.DesiredCapabilities Capabilities)
    • withDevice

      public AndroidCapability withDevice(String device)
      device: property name from property file. eg. device1, device2
      Parameters:
      device -
      Returns:
    • getCapability

      public org.openqa.selenium.remote.DesiredCapabilities getCapability()
    • getAppPath

      public String getAppPath()
    • withAndroidCapability

      public AndroidCapability withAndroidCapability()
      sets android capabilities values are from maven or properties file maven has higher priority than properties
      Returns:
    • setAndroidCapabilties

      public org.openqa.selenium.remote.DesiredCapabilities setAndroidCapabilties()
      set capabilties with prefix android.capabilties. eg. android.capabilties.fullReset="false iterates through all property values with such prefix And adds them to android desired capabilities
      Returns:
    • setChromeDriver

      public void setChromeDriver()
      download chrome driver if hybrid app is enabled if Version is LATEST, download latest driver unless set in config
    • setSingleSignIn

      public void setSingleSignIn()
      runs subsequent tests without restarting the app removes the need to sign in on every test if tests fail, it will restart the app
    • isRealDeviceConnected

      public boolean isRealDeviceConnected()
      if adb device contains emulator, Then its an emulator otherwise, its a connected real device
      Parameters:
      devices -
      Returns:
    • getRealDevices

      public static List<String> getRealDevices(List<String> devices)
      gets the name of the first real device connected
      Parameters:
      devices -
      Returns:
    • getAndroidDeviceList

      public static List<String> getAndroidDeviceList()
      gets the list of android devices including real devices + emulators skips the first item, as it is not a device
      Returns:
      device list
    • getAndroidRealDeviceList

      public List<String> getAndroidRealDeviceList()
    • setSimulator

      public void setSimulator()
      sets ios device number of devices must be equal or greater than number of threads for parallel run
    • setPort

      public void setPort(String deviceName)
      if device has port assigned, use assigned port else generate new port number
      Parameters:
      deviceName -
    • restartAdb

      public static void restartAdb()
    • uninstallUiAutomator2

      public static void uninstallUiAutomator2()
      uninstalls the uiautomator2 server only runs the first time android test is run a device or emulator must be connected
    • setRealDevices

      public void setRealDevices()
      sets real device
    • setAndroidDevice

      public void setAndroidDevice()
      sets device by following strategy: if device is connected, selects device if emulator is not specified with "withDevice1() or with Device2() function, select device 1 by default from properties else select emulator from properties specified in panel config page
    • printAndroidHelp

      public static void printAndroidHelp(Exception e)
    • setAndroidHome

      public static void setAndroidHome()
      sets the value for android home based on its default location sets android home based on user.home location on mac checks if the generated android home location exists, if true, adds to android.home config value