# Testing a Pre-installed app

If you'd like to test an app that's already installed, such as a system app or third-party app, this tutorial is for you.

# Android Devices

To test a pre-installed Android app we'll need to find the app's appPackage and the appActivity and add them to gondola.json

# Finding the appPackage and appActivity

You'll need the Java package name and the MainActivity name. For this example we'll use the Settings app as it's found on most Android phones.

  1. Open your AVD (Android Virtual Device) or attach your Android device to your computer.
  2. In the terminal type adb devices and hit enter
  3. You should see your device, if not make sure the device has booted properly.
  4. Type abd shell and hit enter. You should see a shell prompt like below.
generic_x86:/ $
  1. Open up the Settings app on your device or AVD.
  2. Using the shell we opened in step 4, type dumpsys window windows | grep mFocusedApp and hit enter. The output should look similar this, but it will depend on the device's Android version
  mFocusedApp=AppWindowToken{73a3116 token=Token{e623631 ActivityRecord{85f02d8 u0 com.android.settings/.Settings t114}}}

The value for appPackage is com.android.settings and the value for appActivity is com.android.settings.Settings.

# Gondola.json

You'll use these settings in gondola.json like below:

"Appium": {
    "require": "./node_modules/@logigear/gondola/built/helper/AppiumEx",
    "smartWait": 5000,
    "platform": "android", //you'll add this and remove the "app" setting
    "desiredCapabilities": {
        "appActivity": "com.android.settings.Settings",  // you app's activity
        "appPackage": "com.android.settings", // your apps Java package
        "deviceName": "emulator-5554",
        "automationName": "UiAutomator2",
        "newCommandTimeout": 600
    }
}

Now you can run a test like you would normally.

# iOS Devices

To test a pre-installed iOS app you'll need its bundleId. Follow the steps here to find the bundleId.

# Gondola.json

You can use the following settings for your gondola.json.

"Appium": {
        "require": "./node_modules/@logigear/gondola/built/helper/AppiumEx",
        "smartWait": 5000,
        "app": "com.apple.Maps", // set this to the AUT's bundleId
        "desiredCapabilities": {
            "automationName": "XCUITest",
            "platformName": "iOS",
            "platformVersion": "13.1",
            "deviceName": "iPhone  11 Pro Max"
        }
      }

Some additional configuration may be required when using a real device.

Now you can run a test like you would normally.

Last Updated: 12/28/2020, 4:12:58 AM