Пример #1
0
class ImportClusterModel(ListMenuModel):
    """
    model for Import Cluster - Configure Cluster page
    """
    label = PageElement(By.XPATH, '//h1')
    profile_check = form.Checkbox(By.NAME, "volumeProfile")
    import_btn = form.Button(By.XPATH, '//button[contains(text(), "Import")]')
    cancel_btn = form.Button(By.XPATH, '//button[contains(text(), "Cancel")]')
Пример #2
0
class ExportDialogModel(OkCancelDlgModel):
    """
    model for 'Export to CSV' dialog
    """
    ok_btn = form.Button(By.XPATH,
                         '//export-data-modal//a[@ng-click="ctrl.export();"]')
    cancel_btn = form.Button(
        By.XPATH, '//export-data-modal//a[@ng-click="ctrl.dismiss();"]')
    mode = form.Select(By.XPATH, '//export-data-modal//select')
    time_format = form.TextInput(By.XPATH, '//export-data-modal//input')
Пример #3
0
class ActionPopupPanelModel(WebstrModel):
    """ Base Action Pop Up Panel model """
    _root = RootPageElement(By.CLASS_NAME, "actionPanelPopupPanel")

    status_btn = models.Button(
        By.XPATH,
        '//div[@class="actionPanelPopupPanel"]//td[contains(text(), "Status")]'
    )
    stop_btn = models.Button(
        By.XPATH,
        '//div[@class="actionPanelPopupPanel"]//td[contains(text(), "Stop")]')
Пример #4
0
class OrderListMenuModel(BaseListMenuModel):
    """
    auxiliary model for list menu (order fields)

    NOTE: Click on order_by opens a menu with some links
          such links has will be instanced from Page object
          a _link_text parameter will be used
          e.g. name = PageElement(by=By.LINK_TEXT, locator="Name")
    """
    order_by = form.Button(By.XPATH, '(//*[@id="hostSort"]//button)[1]')
    order_by_value = DynamicPageElement(by=By.LINK_TEXT, locator="%s")
    order_btn = form.Button(By.XPATH, '(//*[@id="hostSort"]//button)[2]')
Пример #5
0
class ClustersRowModel(contentviews.ListViewRowModel):
    """
    Row in Cluster table model.
    """
    #   https://github.com/Tendrl/specifications/pull/82
    #
    # TODO
    # https://redhat.invisionapp.com/share/BR8JDCGSQ#/screens/185937524
    # No status icon yet
    #    status_icon = StatusIcon(By.XPATH, '')
    #
    name_text = PageElement(by=By.XPATH,
                            locator='.//div[contains(@class, "cluster-name")]')
    name = name_text

    cluster_version = PageElement(
        by=By.XPATH,
        locator='.//div[contains(text(),"Cluster Version")]'
        '/following-sibling::*')

    managed = PageElement(
        by=By.XPATH,
        locator='.//div[contains(text(),"Managed")]/following-sibling::*')

    volume_profile = PageElement(
        by=By.XPATH,
        locator='.//div[contains(text(),"Volume Profile")]'
        '/following-sibling::*')

    import_btn = form.Button(
        By.XPATH, '//button[@ng-click="clusterCntrl.goToImportFlow(cluster)"]')
Пример #6
0
class AlertModel(WebstrModel):
    """
    model for any alert/notice message
    """
    _root = RootPageElement(By.XPATH, '//div[contains(@class, "alert")]')
    priority = StatusIcon(By.XPATH, './span')
    message = PageElement(By.XPATH, './strong')
    close_btn = form.Button(By.XPATH, './button')
Пример #7
0
class LoginPageModel(WebstrModel):
    """
    Common page model for the login page.
    """
    username = form.TextInput(by=By.ID, locator='username')
    password = form.PasswordInput(by=By.ID, locator='password')
    login_btn = form.Button(by=By.XPATH,
                            locator='//*[contains(@class,"btn-lg")]')
    error_label = PageElement(by=By.XPATH,
                              locator='//*[@ng-bind="loginCntrl.errorMsg"]/..')
Пример #8
0
class ListMenuModel(WebstrModel):
    """
    auxiliary model for list menu (filter and order fields)
    """
    filter_by = form.Select(
        By.XPATH,
        '//select[contains(translate(@ng-model, "F", "f"), "filterBy")]')
    filter_input = form.TextInput(By.ID, 'filter')
    order_by = form.TextInput(By.XPATH,
                              '//select[contains(@ng-model, "orderBy")]')
    order_btn = form.Button(By.XPATH, '//button[contains(@ng-init, "Order")]')
Пример #9
0
class HostsItemModel(contentviews.ListViewRowModel):
    """
    An item (row) in a Hosts list.
    """

    def _instance_identifier(self):
        """
        instance identifier: line number - 1
        """
        return self._name - 1

# Design: https://redhat.invisionapp.com/share/BR8JDCGSQ
    status_icon = StatusIcon(
        by=By.XPATH,
        locator=".//i[contains(@ng-class,'host.status')]")
    name_label = PageElement(
        by=By.XPATH,
        locator=".//div[contains(@class,'host-name')]")
    name = name_label

    gluster_label = PageElement(
        by=By.XPATH,
        locator=".//div[contains(text(),'Gluster Version')]")
    gluster_value = PageElement(
        by=By.XPATH,
        locator=".//div[contains(text(),'Gluster Version')]"
        "/following-sibling::*")

    roles_label = PageElement(
        by=By.XPATH,
        locator=".//div[contains(text(),'Role')]")
    roles_value = PageElement(
        by=By.XPATH,
        locator=".//div[contains(text(),'Role')]/following-sibling::*")

    bricks_label = PageElement(
        by=By.XPATH,
        locator=".//div[contains(text(),'Bricks')]")
    bricks_value = PageElement(
        by=By.XPATH,
        locator=".//div[contains(text(),'Bricks')]/following-sibling::*")

    alerts_label = PageElement(
        by=By.XPATH,
        locator=".//div[contains(text(),'Alerts')]")
    alerts_value = PageElement(
        by=By.XPATH,
        locator=".//div[contains(text(),'Alerts')]/following-sibling::*")

    dashboard_btn = form.Button(
        by=By.XPATH,
        locator=".//button[contains(@class,'dashboard-btn')]")
Пример #10
0
class FilterListMenuModel(BaseListMenuModel):
    """
    auxiliary model for list menu (filter and order fields)

    NOTE: Click on filter_by and order_by opens a menu with some links
          such links has will be instanced from Page object
          a _link_text parameter will be used
          e.g. name = PageElement(by=By.LINK_TEXT, locator="Name")
    """
    filter_by = form.Button(
        By.XPATH,
        '//button[contains(translate(@uib-tooltip, "F", "f"), "filter by")]')
    filter_by_value = DynamicPageElement(by=By.LINK_TEXT, locator="%s")
    # TODO In some cases the following is Button
    #      in other case it's real TextInput
    #      if not be aware with value property usage
    filter_input = form.TextInput(By.XPATH,
                                  '//div[contains(@ng-if, "filterType")]')
    filter_input_value = filter_by_value
    order_by = form.Button(By.XPATH, '(//*[@id="hostSort"]//button)[1]')

    # note the element is present only if some filter is active
    clear_all_filters = PageElement(by=By.LINK_TEXT,
                                    locator="Clear All Filters")
Пример #11
0
class ErrorDialogModel(CloseDlgModel):
    """ dialog with error message model """
    _root = RootPageElement(by=By.XPATH, locator='//div[@class="gwt-DialogBox dialogBoxStyle"]')
    close_btn = models.Button(By.XPATH, '//div[@role="button"][contains(., "Close")]')
    error = PageElement(By.XPATH, '//div[@class="gwt-HTML"]')
Пример #12
0
class RemoveConfirmDlgModel(OkCancelDlgModel):
    """ Page model for common removal confirmation dialog. """
    ok_btn = models.Button(By.XPATH, '//div[@id="RemoveConfirmationPopupView_OnRemove"]')
    cancel_btn = models.Button(By.XPATH, '//div[@id="RemoveConfirmationPopupView_Cancel"]')
Пример #13
0
class HostsItemModel(contentviews.ListViewRowModel):
    """
    An item (row) in a Hosts list.
    """
    def _instance_identifier(self):
        """
        instance identifier: line number - 1
        """
        return self._name - 1


# Design: https://redhat.invisionapp.com/share/BR8JDCGSQ

    status_icon = StatusIcon(by=By.XPATH,
                             locator=".//span[contains(@ng-if,'host.status')]")
    name_label = PageElement(by=By.XPATH,
                             locator=".//div[contains(@class,'host-name')]")
    name = name_label
    # TODO
    # https://github.com/Tendrl/specifications/pull/95
    # https://github.com/Tendrl/specifications/pull/77
    #    ip_label = PageElement(
    #        by=By.XPATH,
    #        locator=".//span[contains(@ng-bind,'host.management_ip4')]")
    #    ip = ip_label

    storage_locator = ".//donut-chart[@id='storage-donut-chart%d']"
    storage_label = DynamicPageElement(
        by=By.XPATH,
        locator="{}//*[contains(text(),'Storage')]".format(storage_locator))
    storage_used_chart = DynamicPageElement(
        by=By.XPATH, locator="{}/span[1]".format(storage_locator))
    storage_used_nr = DynamicPageElement(
        by=By.XPATH,
        locator="{}/span[2]/[contains(@ng-if,'vm.chartData.used')]".format(
            storage_locator))
    # TODO make helper if needed
    #      as of now there's not just number in text(), bu also 'of ' string
    #      e.g. 'of XXXX', where the important part is just XXXX
    storage_total_nr = DynamicPageElement(
        by=By.XPATH,
        locator="{}/span[2]/[contains(@ng-if,'vm.chartData.total')]".format(
            storage_locator))

    cpu_locator = ".//donut-chart[@id='cpu-donut-chart%d']"
    cpu_label = DynamicPageElement(
        by=By.XPATH,
        locator="{}//*[contains(text(),'CPU')]".format(cpu_locator))
    cpu_percent_chart = DynamicPageElement(
        by=By.XPATH, locator="{}/span[1]".format(cpu_locator))
    # TODO make helper if needed
    #      as of now there's not just number in text(), bu also ' % ' string
    #      e.g. ' XXXX %', where the important part is just XXXX
    cpu_percent = DynamicPageElement(
        by=By.XPATH,
        locator="{}/span[2]/[contains(@ng-if,'vm.chartData.used')]".format(
            cpu_locator))

    memory_locator = ".//donut-chart[@id='memory-donut-chart%d']"
    memory_label = DynamicPageElement(
        by=By.XPATH,
        locator="{}//*[contains(text(),'Memory')]".format(memory_locator))
    memory_used_chart = DynamicPageElement(
        by=By.XPATH, locator="{}/span[1]".format(memory_locator))
    memory_used_nr = DynamicPageElement(
        by=By.XPATH,
        locator="{}/span[2]/[contains(@ng-if,'vm.chartData.used')]".format(
            memory_locator))
    # TODO make helper if needed
    #      as of now there's not just number in text(), bu also 'of ' string
    #      e.g. 'of XXXX', where the important part is just XXXX
    memory_total_nr = DynamicPageElement(
        by=By.XPATH,
        locator="{}/span[2]/[contains(@ng-if,'vm.chartData.total')]".format(
            memory_locator))

    cluster_label = PageElement(by=By.XPATH,
                                locator=".//div/b[contains(text(),'Cluster')]")
    cluster_value = PageElement(
        by=By.XPATH,
        locator=".//div/b[contains(text(),'Cluster')]/following-sibling::*")

    roles_label = PageElement(by=By.XPATH,
                              locator=".//div/b[contains(text(),'Role')]")
    roles_value = PageElement(
        by=By.XPATH,
        locator=".//div/b[contains(text(),'Role')]/following-sibling::*")

    alerts_label = PageElement(by=By.XPATH,
                               locator=".//div/b[contains(text(),'Alerts')]")
    alerts_value = PageElement(
        by=By.XPATH,
        locator=".//div/b[contains(text(),'Alerts')]/following-sibling::*")

    menu_link = form.Button(by=By.ID, locator="dropdownKebabRight12")
Пример #14
0
class ViewTaskPageModel(WebstrModel):
    """
    model for page with View Task Progress button
    """
    view_task_btn = form.Button(
        By.XPATH, '//button[contains(@ng-click, "viewTaskProgress()")]')