Sha256: 83eb72f06cd316d0df5ad8025742112b99854156e066ec11e755d708c2f3f7ea

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

package com.amplify.honeydew_server.actions;

import android.widget.TextView;
import com.android.uiautomator.core.*;
import com.amplify.honeydew_server.Result;

import java.util.List;
import java.util.Map;

public abstract class InspectOptionInSettingsMenu extends SelectMenuInSettings {
    private Boolean enabled;

    public InspectOptionInSettingsMenu(UiDevice uiDevice, boolean enabled) {
        super(uiDevice);
        this.enabled = enabled;
    }

    @Override
    public Result execute(Map<String, Object> arguments) throws UiObjectNotFoundException {
        super.execute(arguments);
        List<String> optionNames = (List<String>)arguments.get("optionNames");
        UiScrollable optionsMenu = new UiScrollable(new UiSelector().className("android.widget.ListView").packageName("com.android.settings").focused(false));

        if(!isUiObjectAvailable(optionsMenu, arguments)){
            return Result.FAILURE;
        }

        for (String optionName : optionNames) {
            UiObject option = optionsMenu.getChildByText(new UiSelector().className(TextView.class.getName()), optionName);
            if (!isUiObjectAvailable(option, arguments) && !enabled.equals(option.isEnabled())) {
                return Result.FAILURE;
            }
        }
        return Result.OK;
    }
}

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/InspectOptionInSettingsMenu.java
honeydew-0.16.0 server/src/main/java/com/amplify/honeydew_server/actions/InspectOptionInSettingsMenu.java
honeydew-0.15.0 server/src/main/java/com/amplify/honeydew_server/actions/InspectOptionInSettingsMenu.java