Example #1
0
    def _find_quadicon(self, is_vm=True, do_not_navigate=False, mark=False, refresh=True):
        """Find and return a quadicon belonging to a specific vm

        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        Raises: VmNotFound
        """
        quadicon = Quadicon(self.name, "vm")
        if not do_not_navigate:
            if is_vm:
                self.provider_crud.load_all_provider_vms()
            else:
                self.provider_crud.load_all_provider_templates()
            toolbar.set_vms_grid_view()
        elif refresh:
            sel.refresh()
        if not paginator.page_controls_exist():
            if is_vm:
                raise VmNotFound("VM '{}' not found in UI!".format(self.name))
            else:
                raise TemplateNotFound("Template '{}' not found in UI!".format(self.name))

        paginator.results_per_page(1000)
        for page in paginator.pages():
            if sel.is_displayed(quadicon):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise VmNotFound("VM '{}' not found in UI!".format(self.name))
Example #2
0
def test_no_template_power_control(provider, setup_provider_funcscope):
    """ Ensures that no power button is displayed for templates."""
    provider.load_all_provider_templates()
    toolbar.set_vms_grid_view()
    try:
        with error.expected(NoSuchElementException):
            toolbar.select("Power")
    except Exception:
        # try again
        with error.expected(NoSuchElementException):
            toolbar.select("Power")

    # Ensure selecting a template doesn't cause power menu to appear
    templates = list(get_all_vms(True))
    template_name = random.choice(templates)
    selected_template = Vm(template_name, provider)
    quadicon = selected_template.find_quadicon(do_not_navigate=True,
                                               mark=False,
                                               refresh=False)
    with error.expected(NoSuchElementException):
        toolbar.select("Power")
    # Ensure there isn't a power button on the details page
    pytest.sel.click(quadicon)
    with error.expected(NoSuchElementException):
        toolbar.select("Power")
Example #3
0
def test_tag_item_through_selecting(request, location, tag):
    """Add a tag to an item with going through the details page.

    Prerequisities:
        * Have a tag category and tag created.
        * Be on the page you want to test.

    Steps:
        * Select any quadicon.
        * Select ``Policy/Edit Tags`` and assign the tag to it.
        * Click on the quadicon and verify the tag is assigned. (TODO)
        * Go back to the quadicon view and select ``Policy/Edit Tags`` and remove the tag.
        * Click on the quadicon and verify the tag is not present. (TODO)
    """
    pytest.sel.force_navigate(location)
    tb.set_vms_grid_view()
    if not Quadicon.any_present:
        pytest.skip("No Quadicon present, cannot test.")
    Quadicon.select_first_quad()

    def _delete():
        pytest.sel.force_navigate(location)
        tb.set_vms_grid_view()
        Quadicon.select_first_quad()
        mixins.remove_tag(tag)
    request.addfinalizer(lambda: diaper(_delete))
    mixins.add_tag(tag)
    _delete()
Example #4
0
    def find_quadicon(
            self, do_not_navigate=False, mark=False, refresh=True, from_any_provider=False):
        """Find and return a quadicon belonging to a specific instance

        Args:
            from_any_provider: Whether to look for it anywhere (root of the tree). Useful when
                looking up archived or orphaned VMs

        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        Raises: InstanceNotFound
        """
        if not do_not_navigate:
            if from_any_provider:
                sel.force_navigate("clouds_instances")
            elif not self.provider_crud.load_all_provider_instances():
                raise InstanceNotFound("No instances for the provider!")
            toolbar.set_vms_grid_view()
        elif refresh:
            sel.refresh()
        if not paginator.page_controls_exist():
            raise InstanceNotFound("Instance '{}' not found in UI!".format(self.name))

        paginator.results_per_page(1000)
        for page in paginator.pages():
            quadicon = Quadicon(self.name, "instance")
            if sel.is_displayed(quadicon):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise InstanceNotFound("Instance '{}' not found in UI!".format(self.name))
Example #5
0
def test_tag_item_through_details(request, location, tag):
    """Add a tag to an item."""
    pytest.sel.force_navigate(location)
    tb.set_vms_grid_view()
    if not Quadicon.any_present:
        pytest.skip("No Quadicon present, cannot test.")
    pytest.sel.click(Quadicon.first())
    request.addfinalizer(lambda: diaper(lambda: mixins.remove_tag(tag)))
    mixins.add_tag(tag)
    mixins.remove_tag(tag)
Example #6
0
def test_tag_item_through_selecting(request, location, tag):
    """Add a tag to an item."""
    pytest.sel.force_navigate(location)
    tb.set_vms_grid_view()
    if not Quadicon.any_present:
        pytest.skip("No Quadicon present, cannot test.")
    Quadicon.select_first_quad()

    def _delete():
        pytest.sel.force_navigate(location)
        tb.set_vms_grid_view()
        Quadicon.select_first_quad()
        mixins.remove_tag(tag)
    request.addfinalizer(lambda: diaper(_delete))
    mixins.add_tag(tag)
    _delete()
def test_no_template_power_control(provider_crud, provider_init):
    """ Ensures that no power button is displayed for templates. """
    provider_crud.load_all_provider_templates()
    with error.expected(NoSuchElementException):
        toolbar.select("Power")
    # Ensure selecting a template doesn't cause power menu to appear
    toolbar.set_vms_grid_view()
    templates = list(get_all_vms(True))
    template_name = random.choice(templates)
    selected_template = Vm(template_name, provider_crud)
    quadicon = selected_template.find_quadicon(do_not_navigate=True, mark=False, refresh=False)
    with error.expected(NoSuchElementException):
        toolbar.select("Power")
    # Ensure there isn't a power button on the details page
    pytest.sel.click(quadicon)
    with error.expected(NoSuchElementException):
        toolbar.select("Power")
    def find_quadicon(self, do_not_navigate=False, mark=False, refresh=True):
        """Find and return a quadicon belonging to a specific vm

        Args:
            vm: Host name as displayed at the quadicon
        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        """
        if not do_not_navigate:
            self.provider_crud.load_all_provider_vms()
            toolbar.set_vms_grid_view()
        if refresh:
            sel.refresh()
        for page in paginator.pages():
            quadicon = Quadicon(self.name, "vm")
            if sel.is_displayed(quadicon):
                if mark:
                    sel.click(quadicon.checkbox())
                return quadicon
        else:
            raise NoVmFound("VM '{}' not found in UI!".format(self.name))
Example #9
0
    def find_quadicon(self, do_not_navigate=False, mark=False, refresh=True):
        """Find and return a quadicon belonging to a specific vm

        Args:
            vm: Host name as displayed at the quadicon
        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        """
        if not do_not_navigate:
            self.provider_crud.load_all_provider_vms()
            toolbar.set_vms_grid_view()
        if refresh:
            sel.refresh()
        for page in paginator.pages():
            quadicon = Quadicon(self.name, "vm")
            if sel.is_displayed(quadicon):
                if mark:
                    sel.click(quadicon.checkbox())
                return quadicon
        else:
            raise NoVmFound("VM '{}' not found in UI!".format(self.name))
    def _find_quadicon(
            self, is_vm=True, do_not_navigate=False, mark=False, refresh=True,
            from_any_provider=False):
        """Find and return a quadicon belonging to a specific vm

        Args:
            from_any_provider: Whether to look for it anywhere (root of the tree). Useful when
                looking up archived or orphaned VMs

        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        Raises: VmNotFound
        """
        quadicon = Quadicon(self.name, "vm")
        if not do_not_navigate:
            if from_any_provider:
                if is_vm:
                    sel.force_navigate("infra_vms")
                else:
                    sel.force_navigate("infra_templates")
            elif is_vm:
                self.provider_crud.load_all_provider_vms()
            else:
                self.provider_crud.load_all_provider_templates()
            toolbar.set_vms_grid_view()
        elif refresh:
            sel.refresh()
        if not paginator.page_controls_exist():
            if is_vm:
                raise VmNotFound("VM '{}' not found in UI!".format(self.name))
            else:
                raise TemplateNotFound("Template '{}' not found in UI!".format(self.name))

        paginator.results_per_page(1000)
        for page in paginator.pages():
            if sel.is_displayed(quadicon, move_to=True):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise VmNotFound("VM '{}' not found in UI!".format(self.name))
Example #11
0
def test_tag_item_through_details(request, location, tag):
    """Add a tag to an item with going through the details page.

    Prerequisities:
        * Have a tag category and tag created.
        * Be on the page you want to test.

    Steps:
        * Click any quadicon.
        * On the details page, select ``Policy/Edit Tags`` and assign the tag to it.
        * Verify the tag is assigned. (TODO)
        * Select ``Policy/Edit Tags`` and remove the tag.
        * Verify the tag is not present. (TODO)
    """
    pytest.sel.force_navigate(location)
    tb.set_vms_grid_view()
    if not Quadicon.any_present:
        pytest.skip("No Quadicon present, cannot test.")
    pytest.sel.click(Quadicon.first())
    request.addfinalizer(lambda: diaper(lambda: mixins.remove_tag(tag)))
    mixins.add_tag(tag)
    mixins.remove_tag(tag)
Example #12
0
    def find_quadicon(self,
                      do_not_navigate=False,
                      mark=False,
                      refresh=True,
                      from_any_provider=False):
        """Find and return a quadicon belonging to a specific instance

        Args:
            from_any_provider: Whether to look for it anywhere (root of the tree). Useful when
                looking up archived or orphaned VMs

        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        Raises: InstanceNotFound
        """
        if not do_not_navigate:
            if from_any_provider:
                sel.force_navigate("clouds_instances")
            elif not self.provider_crud.load_all_provider_instances():
                raise InstanceNotFound("No instances for the provider!")
            toolbar.set_vms_grid_view()
        elif refresh:
            sel.refresh()
        if not paginator.page_controls_exist():
            raise InstanceNotFound("Instance '{}' not found in UI!".format(
                self.name))

        paginator.results_per_page(1000)
        for page in paginator.pages():
            quadicon = Quadicon(self.name, "instance")
            if sel.is_displayed(quadicon):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise InstanceNotFound("Instance '{}' not found in UI!".format(
                self.name))
def set_grid_stack():
    sel.force_navigate("clouds_stacks")
    toolbar.set_vms_grid_view()
def set_grid():
    sel.force_navigate("clouds_images")
    toolbar.set_vms_grid_view()
def set_grid_stack():
    sel.force_navigate("clouds_stacks")
    toolbar.set_vms_grid_view()
Example #16
0
 def _delete():
     pytest.sel.force_navigate(location)
     tb.set_vms_grid_view()
     Quadicon.select_first_quad()
     mixins.remove_tag(tag)
Example #17
0
 def f():
     accordion.tree(*args)
     toolbar.set_vms_grid_view()
Example #18
0
    body_data=("//div[@id='list_grid']/div[@class='objbox']/table/tbody", 1),
)

add_manager_btn = form_buttons.FormButton('Add')
edit_manager_btn = form_buttons.FormButton('Save changes')
cfg_btn = partial(tb.select, 'Configuration')

nav.add_branch(
    'infrastructure_config_management', {
        'infrastructure_config_managers': [
            lambda _: (accordion.tree(
                'Providers',
                version.pick({
                    version.LOWEST: 'All Red Hat Satellite Providers',
                    version.UPSTREAM: 'All Foreman Providers'
                })), toolbar.set_vms_grid_view()),
            {
                'infrastructure_config_manager_new':
                lambda _: cfg_btn('Add a new Provider'),
                'infrastructure_config_manager': [
                    lambda ctx: sel.check(
                        Quadicon(
                            '{} Configuration Manager'.
                            format(ctx['manager'].name), None).checkbox), {
                                'infrastructure_config_manager_edit':
                                lambda _: cfg_btn('Edit Selected item'),
                                'infrastructure_config_manager_refresh':
                                lambda _: cfg_btn(
                                    'Refresh Relationships and Power states',
                                    invokes_alert=True),
                                'infrastructure_config_manager_remove':
def set_grid():
    sel.force_navigate("clouds_images")
    toolbar.set_vms_grid_view()
Example #20
0
 def _delete():
     pytest.sel.force_navigate(location)
     tb.set_vms_grid_view()
     Quadicon.select_first_quad()
     mixins.remove_tag(tag)
Example #21
0
                "infra_vms_filter_folder":
                [
                    lambda ctx: visible_tree.click_path(ctx["folder_name"]),
                    {
                        "infra_vms_filter": lambda ctx: visible_tree.click_path(ctx["filter_name"]),
                    }
                ],

                "infra_vm_by_name": lambda ctx: sel.click(ctx['vm'].find_quadicon(
                    do_not_navigate=True))
            }
        ],

        "infra_templates":
        [
            lambda _: (accordion.tree("Templates", "All Templates"), toolbar.set_vms_grid_view()),
            {
                "infra_templates_filter_folder":
                [
                    lambda ctx: visible_tree.click_path(ctx["folder_name"]),
                    {
                        "infra_templates_filter":
                        lambda ctx: visible_tree.click_path(ctx["filter_name"]),
                    }
                ],
            }
        ],
    }
)

    body_data=("//div[@id='list_grid']/div[@class='objbox']/table/tbody", 1),
)

add_manager_btn = form_buttons.FormButton('Add')
edit_manager_btn = form_buttons.FormButton('Save changes')
cfg_btn = partial(tb.select, 'Configuration')

nav.add_branch(
    'infrastructure_config_management',
    {
        'infrastructure_config_managers':
        [
            lambda _: (accordion.tree('Providers',
                version.pick({version.LOWEST: 'All Red Hat Satellite Providers',
                              version.UPSTREAM: 'All Foreman Providers'})),
                toolbar.set_vms_grid_view()),
            {
                'infrastructure_config_manager_new':
                lambda _: cfg_btn('Add a new Provider'),
                'infrastructure_config_manager':
                [
                    lambda ctx: sel.check(
                        Quadicon(
                            '{} Configuration Manager'
                            .format(ctx['manager'].name), None).checkbox),
                    {
                        'infrastructure_config_manager_edit':
                        lambda _: cfg_btn('Edit Selected item'),
                        'infrastructure_config_manager_refresh':
                        lambda _: cfg_btn('Refresh Relationships and Power states',
                                  invokes_alert=True),
Example #23
0
 def f():
     accordion.tree(*args)
     toolbar.set_vms_grid_view()