Appium

For users with a deviceBridge license, Appium is supported as an augmented proxy that integrates existing GigaFox features and supports testing of devices, registered with GigaFox, directly from a user’s system.

WARNING: Support for Chrome 64 has been disabled due to bug #805014- Android: Infinite loop of FrameLayouts in accessibility tree. To prevent a session from failing, update devices to Chrome 65 or later.
As a precaution, if attempting to start an Appium session with Chrome 64, GigaFox will detect the affected version and display an error warning message.

Appium Set-up Support

To setup Appium, please contact Mobile Labs Support.

Upload Appium app

Upload the app to GigaFox and use the bundleId (iOS) or appPackage and appActivity capabilities, per Appium documentation, to direct launch the app. GigaFox will install the app using its own content storage system and install code, enforcing ACLs as relevant.

Appium Usage

Custom DesiredCapabilities

Key Required Description
deviceConnectUsername Required The GigaFox username for authentication.
Example:
"deviceConnectUsername": "John.Smith@company.com"
deviceConnectApiKey Required The user’s API token for authentication.
Example:
"deviceConnectApiKey": "bca2e6ae-d0c2-4833-9fcd-9446076442a5"
deviceConnectDevice Optional The GigaFox device ID for the device.
Example:
"deviceConnectDevice": "69498336-2a30-4a42-b837-6d453f3a153b"
Default: An available device compatible with the application is automatically chosen when following the automatic device selection logic.
deviceConnectApplication Optional Can specify the application by its GigaFox application ID.
Example:
"deviceConnectApplication": "c05f6041-4880-4c62-ad61-9088388d2d5f"
deviceConnectApplicationVersion Optional Specifies the application by version or build version.
Example:
"deviceConnectApplicationVersion": "1.0.1"
deviceConnectSkipInstall Optional By default, Appium reinstalls an application each time a session is created. deviceConnectSkipInstall will skip the installation process, allowing a device to test with previously saved application data and avoiding the need to grant application permissions for every session. deviceConnectSkipInstall will launch applications that are already installed on a device, but not in the GigaFox Application List.
Example: "deviceConnectSkipInstall": true
deviceConnectSkipResigning Enabled by default Set to true by default, deviceConnectSkipResigning prevents Trust instrumentation libraries from loading on the application.
Example: "deviceConnectSkipResigning": true
deviceConnectIgnoreSession Enabled by default If an existing Appium session has disconnected but is trying to re-estabish the connection, deviceConnectIgnoreSession will kill that session allowing a new session to start. If set to false, Appium will go through the process of trying to reconnect multiple times and will not allow a new session to start until the existing connection fails.
Example: "deviceConnectIgnoreSession": true
deviceConnectChromeDriverVerbose Optional Enable verbose ChromeDriver logging on Appium logs.
Example: "deviceConnectChromeDriverVerbose": true
deviceConnectSessionName Optional Assigns a name to the Appium session which can be used for future reference. When set, the assigned deviceConnectSessionName is displayed inside of the historical Appium session logs.
Example:
"deviceConnectSessionName": "Appium Test 1"

DesiredCapabilities augmented by GigaFox

Key Required Description
bundleId Required (iOS) The iOS application’s bundle identifier. The latest version managed by GigaFox is used.
Example: "bundleID": "com.mobilelabsinc.Trust-Browser"
appPackage Required (Android) The Android application’s package name.
Example: "appPackage": "com.mobilelabsinc.trustbrowser"
appActivity Required (Android) The Android application’s activity name to launch. appPackage and appActivity are used together to locate the latest version of the application managed by GigaFox.
Example: "appActivity": "com.mobilelabsinc.trustbrowser"
Default: Exclude to perform native browser testing. browserName must be specified when excluded.
browserName Optional The name of the native web browser to use. Must be "Safari" on iOS or "Chrome", "Chromium", or "Browser" on Android.
Example: "browserName": "Safari"
Default: Exclude to perform application test. bundleId (iOS) or appPackage/ appActivity (Android) must be specified when excluded.
automationName Optional Set to XCUITest for testing iOS 9.3 and later devices using XCTest, otherwise no value should be set. XCTest is required for iOS 10 and later.
Example: "automationName": "XCUITest"

NOTE: The following capabilities are automatically managed by GigaFox and cannot be used: xcodeConfigFile, realDeviceLogger, app, and keychainPath.

For more information on DesiredCapabilities, go to Appium’s DesiredCapabilities documentation.

GigaFox Device ID

The GigaFox ID for a device is located in the URL of the device’s details page.

GigaFox Application ID

The GigaFox application ID is located in the URL of the application’s details page.

Automatic device selection

If deviceConnectDevice is not specified, then GigaFox automatically selects a device.

For a device to be selected, the following conditions must be true:

  1. Is not retained/in-use.
  2. Regarding the application:
    1. The device’s operating system matches the application’s (iOS or Android).
    2. The device’s operating system version is at least the application’s minimum supported version.
    3. If the application is for an iOS device and not universal, the device must be an iPad or iPhone as specified.
  3. If "XCUITest" is specified for the automationName, the device must be iOS 9.3 or newer.
  4. If platformVersion is specified, the device’s OS version must match exactly.

Integration test examples

A Java sample of how to use GigaFox with Appium integration:


   import io.appium.java_client.ios.IOSDriver;

   import org.openqa.selenium.WebElement;
   import org.openqa.selenium.remote.DesiredCapabilities;
   import java.net.URL;

   public class AppiumTest {
     // The hostname or IP address used to connect to deviceConnect.
     public static final String deviceConnectHost = "deviceconnect.yourcompany.com";

     // The user’s deviceConnect login email address.
     public static final String deviceConnectUserName = "user@yourcompany.com";

     // The user’s API token. The API token can be found by clicking the user
     // name menu in the upper right of deviceConnect, selecting
     // "Manage your account", then selecting View Token.
     public static final String deviceConnectApiKey =
     "bca2e6ae-d0c2-4833-9fcd-9446076442a5";

     private static final String serviceUrl =
     "http://" + deviceConnectHost + "/Appium";

     public static void IOSSafariExample() {
       DesiredCapabilities capabilities = new DesiredCapabilities();

     // The name of a web browser to test on. Possible values are Safari or
     // Chrome. If no device is specified, an
     // appropriate iOS or Android device will be chosen automatically.
     capabilities.setCapability("browserName", "Safari");
     capabilities.setCapability("automationName", "XCUITest");
     capabilities.setCapability("deviceConnectUsername", deviceConnectUserName);
     capabilities.setCapability("deviceConnectApiKey", deviceConnectApiKey);

     IOSDriver driver = null;

     try {
       URL url = new URL(serviceUrl);
       driver = new IOSDriver(url, capabilities);

         driver.navigate().to("http://www.google.com");
       WebElement searchBox =
       driver.findElementByCssSelector("input[type=text]");
       WebElement googleSearchButton =
       driver.findElementByCssSelector("input[type=submit]");

       searchBox.sendKeys("Hello World!");
       googleSearchButton.click();
     } catch (Exception e) {
         System.out.println("Error performing Appium test: " + e.getMessage());
         e.printStackTrace();
     } finally {
         if (driver != null) {
           driver.close();
        }
     }
   }
   public static void IOSHybridApplicationExample() {
     DesiredCapabilities capabilities = new DesiredCapabilities();
     // deviceConnect will select the latest version of this application from
     // the applications list. Because it is an iOS application and no device
     // is specified, an appropriate iOS device will be selected automatically.
     capabilities.setCapability("bundleId", "com.mobilelabsinc.Trust-Browser");
     capabilities.setCapability("automationName", "XCUITest");
     capabilities.setCapability("deviceConnectUsername", deviceConnectUserName);
     capabilities.setCapability("deviceConnectApiKey", deviceConnectApiKey);

     IOSDriver driver = null;

     try {
        URL url = new URL(serviceUrl);
        driver = new IOSDriver(url, capabilities);
        // Find and click on a native element.
        WebElement nativeElement = driver.findElementByName("nativeElementName");
        nativeElement.click();
        // Switch contexts to the WebView, then find and click on an element.
        driver.context("WEBVIEW_1");
        WebElement webElement = driver.findElementByName("webElementName");
        webElement.click();
    } catch (Exception e) {
        System.out.println("Error performing Appium test: " + e.getMessage());
        e.printStackTrace();
    } finally {
        if (driver != null) {
            driver.close();
      }
     }
    }
   }
    

Appium Logs

To view Appium logs on the web:

  1. Navigate to the device's detail page..
  2. Click the ... button and View Appium Logs.

Appium Log Export

To download Appium logs, go to the System Logs and enable Report Appium Issue

Appium Documentation

For Appium concepts, explanations, and test samples go to Appium’s documentation.