Example #1
0
class TabModel(DynamicWebstrModel):
    """
    Item/tab of a Tabs
    """
    _root = NameRootPageElement(by=By.XPATH,
                                locator=TabsModel.TABS_XPATH +
                                '/li/a[contains(text(),%s)]')
Example #2
0
class TableViewRowModel(DynamicWebstrModel):
    """
    Item/row of a Table View
    """
    _root = NameRootPageElement(by=By.XPATH,
                                locator=TableViewModel.TABLE_XPATH +
                                '/tbody//tr[@role="row"][%d]')
Example #3
0
class ListViewRowModel(DynamicWebstrModel):
    """
    Item/row of a List View
    """
    _root = NameRootPageElement(
      by=By.XPATH,
      locator='(' + ListViewModel.LIST_XPATH + '//*[contains(concat(" ", @class, " "), " list-group-item ")])[%d]')
Example #4
0
class GenericStatPanelModel(WebstrModel):
    """
    Generic model for displaying some data

    NOTE:
        _title (string): title of the panel
                         it has to be properly set before use
                         e.g. "Volume Utilization"
    """
    _title = None
    _root = NameRootPageElement(
        By.XPATH,
        '//grafana-panel[.//span[contains(@class, "panel-title-text") and '
        'text()="%s"]]')
    header = PageElement(By.XPATH,
                         './/span[contains(class, "panel-title-text")]')

    def __init__(self, driver):
        """
        Save the webdriver instance to attribute.

        Parameters:
            driver: webdriver instance
        """
        self._name = self._title
        super().__init__(driver)
Example #5
0
class TaskEventModel(DynamicWebstrModel):
    """
    An item (row) in a Tasks list.
    """
    _root = NameRootPageElement(by=By.ID, locator='log-list-group-item-%d')

    # Design: https://redhat.invisionapp.com/share/8N93NO7Q4
    # missing status icon
    # status_icon = StatusIcon(
    #     by=By.XPATH,
    #     locator="./div/i")
    status_text = PageElement(by=By.XPATH, locator="./div[2]")
    message = PageElement(by=By.XPATH, locator="./div[3]")
    time = PageElement(by=By.XPATH, locator="./div[4]")
Example #6
0
class HostsItemModel(contentviews.ListViewRowModel):
    """
    An item (row) in a Hosts list.
    """
    name_label = PageElement(
        by=By.XPATH,
        locator=".//div[contains(@class, 'host-name')]")
    release = PageElement(
        by=By.XPATH,
        locator=".//div[contains(@class, 'host-release')]")
    name = name_label
    role = PageElement(
        By.XPATH,
        ".//div[contains(@class, 'list-view-pf-additional-info')]/div[2]")
    _root = NameRootPageElement(
        by=By.XPATH,
        locator='({}//*[contains(concat(" ", @class, " "),'
        ' " list-group-item ")][@ng-repeat])[%d]'.format(
            contentviews.ListViewModel.LIST_XPATH))
Example #7
0
class GenericDropDownListModel(WebstrModel):
    """
    Grafana DropDown list
    """
    _title = None
    _root = NameRootPageElement(
        By.XPATH, '//label[text()="%s"]/following::value-select-dropdown')
    rows = PageElement(By.XPATH,
                       './/a[contains(@class, "variable-option")]',
                       as_list=True)

    def __init__(self, driver):
        """
        Save the webdriver instance to attribute.

        Parameters:
            driver: webdriver instance
        """
        self._name = self._title
        super().__init__(driver)