App Service

Learn how to use BELLATRIX iOS app service.

Example

public class AppServiceTests extends IOSTest {
    @Test
    public void testBackgroundApp() {
        app().appService().backgroundApp(1);
    }

    @Test
    public void testResetApp() {
        app().appService().resetApp();
    }

    @Test
    public void installAppInstalledTrue_When_AppIsInstalled() {
        Assert.assertTrue(app().appService().isAppInstalled("com.apple.mobilecal"));
    }

    @Test
    public void installAppInstalledFalse_When_AppIsUninstalled() throws URISyntaxException {
        URL appUrl = getClass().getClassLoader().getResource("Demos/TestApp.app.zip");
        File appFile = Paths.get(appUrl.toURI()).toFile();
        String appPath = appFile.getAbsolutePath();

        app().appService().installApp(appPath);

        app().appService().removeApp("com.apple.mobilecal");

        Assert.assertFalse(app().appService().isAppInstalled("com.apple.mobilecal"));

        app().appService().installApp(appPath);
        Assert.assertTrue(app().appService().isAppInstalled("com.apple.mobilecal"));
    }
}

Explanations

BELLATRIX gives you an interface to most common operations for controlling the iOS app through the appService method.

app().appService().backgroundApp(1);

Backgrounds the app for the specified number of seconds.

app().appService().resetApp();

Resets the app.

Assert.assertTrue(app().appService().isAppInstalled("com.apple.mobilecal"));

Checks whether the app with the specified bundleId is installed.

app().appService().installApp(appPath);

Installs the app file on the device.

app().appService().removeApp("com.apple.mobilecal");

Uninstalls the app with the specified bundleId. You can get your app’s bundleId from XCode.