Sha256: ba285f5d784ba5561c0397549a6c96451ad129de08ba4acc710a3ae183e23e56

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

package com.amplify.honeydew_server.actions;

import com.android.uiautomator.core.*;
import com.amplify.honeydew_server.Action;
import com.amplify.honeydew_server.Result;

import java.util.Map;

public class LaunchApp extends Action {
    public LaunchApp(UiDevice uiDevice) {
        super(uiDevice);
    }

    @Override
    public Result execute(Map<String, Object> arguments) throws UiObjectNotFoundException {
        String appName = (String) arguments.get("appName");
        getUiDevice().pressHome();
        final UiObject uiObject = new UiObject(new UiSelector().description("Apps"));

        if(isUiObjectAvailable(uiObject,arguments)){
            uiObject.click();
        }else{
            return Result.FAILURE;
        }

        UiScrollable appViews = new UiScrollable(new UiSelector().scrollable(true));

        if(isUiObjectAvailable(appViews, arguments)){
            appViews.setAsHorizontalList();
            appViews.getChildByText(new UiSelector().className(android.widget.TextView.class.getName()), appName).clickAndWaitForNewWindow();
            return Result.OK;
        }

        return Result.FAILURE;
    }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
honeydew-0.17.0 server/src/main/java/com/amplify/honeydew_server/actions/LaunchApp.java
honeydew-0.16.0 server/src/main/java/com/amplify/honeydew_server/actions/LaunchApp.java
honeydew-0.15.0 server/src/main/java/com/amplify/honeydew_server/actions/LaunchApp.java