{
    "description": {
        "author": "Salesforce",
        "text": [
            "Selector: finderListView.",
            "Represents the iOS view for the Einstein analytics 'Browse' page.",
            "Find a tab and navigate to it, or find a record and navigate to it."
        ]
    },
    "implements": "utam-salesforceapp/pageObjects/record/analyticsBrowse",
    "platform": "native",
    "profile": [
        {
            "platform": [
                "ios_phone",
                "ios_tablet"
            ]
        }
    ],
    "root": true,
    "type": [
        "actionable",
        "touchable"
    ],
    "selector": {
        "accessid": "ChatterWindow"
    },
    "beforeLoad": [
        {
            "apply": "waitFor",
            "args": [
                {
                    "type": "function",
                    "predicate": [
                        {
                            "element": "root",
                            "apply": "containsElement",
                            "args": [
                                {
                                    "type": "locator",
                                    "value": {
                                        "accessid": "homeListView"
                                    }
                                }
                            ],
                            "matcher": {
                                "type": "isFalse"
                            }
                        },
                        {
                            "element": "root",
                            "apply": "containsElement",
                            "args": [
                                {
                                    "type": "locator",
                                    "value": {
                                        "accessid": "crmaLoadingIndicator"
                                    }
                                }
                            ],
                            "matcher": {
                                "type": "isFalse"
                            }
                        }
                    ]
                }
            ]
        }
    ],
    "elements": [
        {
            "name": "analyticsTab",
            "type": [
                "clickable"
            ],
            "selector": {
                "accessid": "\"%s\"",
                "args": [
                    {
                        "name": "title",
                        "type": "string"
                    }
                ]
            }
        },
        {
            "name": "analyticsRecord",
            "type": [
                "clickable"
            ],
            "selector": {
                "classchain": "**/XCUIElementTypeCell[`label == '%s'`]",
                "args": [
                    {
                        "name": "label",
                        "type": "string"
                    }
                ]
            }
        },
        {
            "name": "searchInput",
            "type": [
                "editable",
                "clickable"
            ],
            "selector": {
                "classchain": "**/XCUIElementTypeSearchField"
            }
        },
        {
            "name": "clearSearchBtn",
            "type": [
                "clickable"
            ],
            "selector": {
                "classchain": "**/XCUIElementTypeSearchField/XCUIElementTypeButton"
            }
        }
    ],
    "methods": [
        {
            "name": "hasLensesTab",
            "compose": [
                {
                    "element": "root",
                    "apply": "containsElement",
                    "args": [
                        {
                            "type": "locator",
                            "value": {
                                "accessid": "Lenses"
                            }
                        }
                    ]
                }
            ]
        },
        {
            "name": "hasDashboardsTab",
            "compose": [
                {
                    "element": "root",
                    "apply": "containsElement",
                    "args": [
                        {
                            "type": "locator",
                            "value": {
                                "accessid": "Dashboards"
                            }
                        }
                    ]
                }
            ]
        },
        {
            "name": "switchTabWithTitle",
            "compose": [
                {
                    "element": "analyticsTab",
                    "apply": "click"
                }
            ]
        },
        {
            "name": "hasAnalyticsRecordWithTitle",
            "compose": [
                {
                    "element": "root",
                    "apply": "waitFor",
                    "args": [
                        {
                            "type": "function",
                            "predicate": [
                                {
                                    "element": "root",
                                    "apply": "containsElement",
                                    "args": [
                                        {
                                            "type": "locator",
                                            "value": {
                                                "classchain": "**/XCUIElementTypeCell[`label == '%s'`]",
                                                "args": [
                                                    {
                                                        "name": "label",
                                                        "type": "string"
                                                    }
                                                ]
                                            }
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            ]
        },
        {
            "name": "clickAnalyticsRecordWithTitle",
            "compose": [
                {
                    "element": "analyticsRecord",
                    "apply": "click"
                }
            ]
        },
        {
            "name": "typeToSearch",
            "compose": [
                {
                    "element": "searchInput",
                    "apply": "clearAndType",
                    "args": [
                        {
                            "name": "itemToSearch",
                            "type": "string"
                        }
                    ]
                }
            ]
        },
        {
            "name": "clearSearch",
            "compose": [
                {
                    "element": "clearSearchBtn",
                    "apply": "click"
                }
            ]
        },
        {
            "name": "pullToRefresh",
            "compose": [
                {
                    "element": "root",
                    "apply": "flick",
                    "args": [
                        {
                            "value": 0
                        },
                        {
                            "value": 400
                        }
                    ]
                }
            ]
        }
    ]
}