{
    "description": {
        "author": "Salesforce",
        "text": [
            "Selector: className(\"android.widget.ListView\").",
            "Represents the Android list view of overflow actions from the toolbar.",
            "Perform actions that are held in the toolbar overflow\n."
        ]
    },
    "implements": "utam-salesforceapp/pageObjects/navigation/navBarOverflowMenu",
    "root": true,
    "platform": "native",
    "profile": [
        {
            "platform": [
                "android_phone",
                "android_tablet"
            ]
        }
    ],
    "beforeLoad": [
        {
            "apply": "waitFor",
            "args": [
                {
                    "type": "function",
                    "predicate": [
                        {
                            "element": "root",
                            "apply": "containsElement",
                            "args": [
                                {
                                    "type": "locator",
                                    "value": {
                                        "uiautomator": "resourceId(\"com.salesforce.chatter:id/title\").textContains(\"Favorites\")"
                                    }
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ],
    "selector": {
        "uiautomator": "className(\"android.widget.ListView\")"
    },
    "elements": [
        {
            "name": "share",
            "selector": {
                "uiautomator": "resourceId(\"com.salesforce.chatter:id/title\").text(\"Share\")"
            },
            "type": [
                "clickable"
            ]
        },
        {
            "name": "favorite",
            "selector": {
                "uiautomator": "resourceId(\"com.salesforce.chatter:id/title\").textContains(\"Favorites\")"
            },
            "type": [
                "clickable"
            ]
        }
    ],
    "methods": [
        {
            "name": "clickShare",
            "compose": [
                {
                    "element": "share",
                    "apply": "click"
                }
            ]
        },
        {
            "name": "clickFavorite",
            "compose": [
                {
                    "element": "favorite",
                    "apply": "click"
                }
            ]
        },
        {
            "name": "waitForIsFavorite",
            "compose": [
                {
                    "element": "root",
                    "apply": "waitFor",
                    "args": [
                        {
                            "type": "function",
                            "predicate": [
                                {
                                    "element": "root",
                                    "apply": "containsElement",
                                    "args": [
                                        {
                                            "type": "locator",
                                            "value": {
                                                "uiautomator": "resourceId(\"com.salesforce.chatter:id/title\").text(\"Remove from Favorites\")"
                                            }
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            ]
        },
        {
            "name": "waitForIsNotFavorite",
            "compose": [
                {
                    "element": "root",
                    "apply": "waitFor",
                    "args": [
                        {
                            "type": "function",
                            "predicate": [
                                {
                                    "element": "root",
                                    "apply": "containsElement",
                                    "args": [
                                        {
                                            "type": "locator",
                                            "value": {
                                                "uiautomator": "resourceId(\"com.salesforce.chatter:id/title\").text(\"Add to Favorites\")"
                                            }
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ]
}