launchApp

Use this command to start a mobile app.

Examples

Launch the uploaded app

To launch the app you uploaded to Moropo, simply call without options:

- launchApp

Launch a different app

To launch a specific app (no one you've uploaded to Moropo), use the appId option to supply an iOS Bundle ID or Android Package Name:

- launchApp:
    appId: com.facebook.app

Stop the app before launching

The stopApp option is true by default. If you set it to false the test runner won't attempt to close the running app before launch.

- launchApp:
    stopApp: false

Clearing application state during launch

Similar to the standalone clearState command, this option will erase the application data part of the launch process. Defaults to false.

- launchApp:
    clearState: true

Note: clearState does not affect permissions configured.

Clearing the keychain during launch (iOS only)

Similar to the standalone clearKeychain command, this option will erase the entire iOS keychain as part of the launch process. Defaults to false.

- launchApp:
    clearKeychain: true

Permissions

Use the permissions option to customise which permissions are accepted, denied or unset by the virtual device being tested. By default, all permissions are allowed.

For example, to disallow every permission:

- launchApp:
    permissions: { all: deny }

To unset notifications and deny camera:

- launchApp:
    permissions:
        camera: deny
        notifications: unset

List of all standard permissions

PermissioniOS supportAndroid support

bluetooth

calendar

camera

contacts

health

homekit

location

medialibrary

microphone

motion

notifications

phone

photos

reminders

siri

sms

speech

storage

usertracking

something.custom

Launching with arguments

Launch arguments are variables that are injected into your app at start-up time. They're useful for triggering certain behaviours inside your app code. For example, telling your app to use a mock API.

Using the arguments option

You can send the following types of data: String, Integer, Double or Boolean. Data that doesn't match one of these formats will be parsed as a string.

- launchApp:
    arguments:
      myString: "This sentence is a string"
      myInteger: 123
      myDouble: 123.05
      myBoolean: true

Accessing launch arguments on React Native

Use the react-native-launch-arguments package to access arguments in your React Native app.

In JavaScript

import { LaunchArguments } from "react-native-launch-arguments";
const { myBoolean, myString } = LaunchArguments.value();

Accessing launch arguments on iOS

Using Swift:

if CommandLine.arguments.contains("myBoolean") {
    // myBoolean is true
}

let userDefaults = UserDefaults.standard
let mySentence = userDefaults.string(forKey: "myString") ?? "defaultValue"

Using Objective C:

NSArray *arguments = [[NSProcessInfo processInfo] arguments];
if ([arguments containsObject:@"myBoolean"]) {
    // myBoolean is true
}

NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
NSString *mySentence = [userDefaults stringForKey:@"myString"] ?: @"defaultValue";

Accessing launch arguments on Android

Using Kotlin:

intent.extras?.getBoolean("myBoolean")?.let { myBoolean ->
    // Do something with myBoolean (Boolean type)
}

intent.extras?.getString("myString")?.let { myString ->
    // Do something with myString (String type)
}

Using Java:

Bundle extras = intent.getExtras();
if (extras != null) {
    if (extras.containsKey("myBoolean")) {
        boolean myBoolean = extras.getBoolean("myBoolean");
        // Do something with myBoolean (boolean type)
    }

    if (extras.containsKey("myString")) {
        String myString = extras.getString("myString");
        // Do something with myString (String type)
    }
}

stopApp

Last updated