class TabModel(DynamicWebstrModel): """ Item/tab of a Tabs """ _root = NameRootPageElement(by=By.XPATH, locator=TabsModel.TABS_XPATH + '/li/a[contains(text(),%s)]')
class TableViewRowModel(DynamicWebstrModel): """ Item/row of a Table View """ _root = NameRootPageElement(by=By.XPATH, locator=TableViewModel.TABLE_XPATH + '/tbody//tr[@role="row"][%d]')
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]')
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)
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]")
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))
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)