def test_quick_search_without_filter(request):
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(fauxfactory.gen_alphanumeric())
    assert_no_cfme_exception()
Пример #2
0
    def find_quadicon(self, from_any_provider=False, use_search=True):
        """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: entity of appropriate type
        Raises: VmOrInstanceNotFound
        """
        # todo :refactor this method replace it with vm methods like get_state
        if from_any_provider:
            view = navigate_to(self, 'All')
        else:
            view = navigate_to(self, 'AllForProvider', use_resetter=False)

        view.toolbar.view_selector.select('Grid View')

        if use_search:
            search.normal_search(self.name)

        try:
            return view.entities.get_entity(by_name=self.name, surf_pages=True)
        except ItemNotFound:
            raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(
                self.name))
def test_quick_search_without_filter(request, single_provider):
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(fauxfactory.gen_alphanumeric())
    assert_no_cfme_exception()
def test_quick_search_with_filter(request):
    search.fill_and_apply_filter("fill_count(Infrastructure Provider.VMs, >=, 0)")
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(fauxfactory.gen_alphanumeric())
    assert_no_cfme_exception()
def test_quick_search_with_filter(request, single_provider):
    search.fill_and_apply_filter("fill_count(Infrastructure Provider.VMs, >=, 0)")
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(fauxfactory.gen_alphanumeric())
    assert_no_cfme_exception()
Пример #6
0
    def find_quadicon(self,
                      do_not_navigate=False,
                      mark=False,
                      refresh=True,
                      from_any_provider=False,
                      use_search=True):
        """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: VmOrInstanceNotFound
        """
        quadicon = Quadicon(self.name, self.quadicon_type)
        if not do_not_navigate:
            if from_any_provider:
                # TODO implement as navigate_to when cfme.infra.virtual_machines has destination
                navigate_to(self, 'All')
            elif self.is_vm:
                navigate_to(self, 'AllForProvider', use_resetter=False)
            else:
                navigate_to(self, 'AllForProvider', use_resetter=False)
            toolbar.select('Grid View')
        else:
            # Search requires navigation, we shouldn't use it then
            use_search = False
            if refresh:
                sel.refresh()
        if not paginator.page_controls_exist():
            if self.is_vm:
                raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(
                    self.name))
            else:
                raise TemplateNotFound("Template '{}' not found in UI!".format(
                    self.name))

        paginator.results_per_page(1000)
        if use_search:
            try:
                if not search.has_quick_search_box():
                    # TODO rework search for archived/orphaned VMs
                    if self.is_vm:
                        navigate_to(self, 'AllForProvider', use_resetter=False)
                    else:
                        navigate_to(self, 'AllForProvider', use_resetter=False)
                search.normal_search(self.name)
            except Exception as e:
                logger.warning("Failed to use search: %s", str(e))
        for page in paginator.pages():
            if sel.is_displayed(quadicon, move_to=True):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(
                self.name))
def test_quick_search_without_filter(request, providers):
    pytest.sel.force_navigate("infrastructure_providers")
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(fauxfactory.gen_alphanumeric())
    assert_no_cfme_exception()
Пример #8
0
def test_quick_search_without_filter(request, providers):
    sel.force_navigate("infrastructure_providers")
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(fauxfactory.gen_alphanumeric())
    assert_no_cfme_exception()
def test_quick_search_with_filter(request, providers):
    sel.force_navigate("infrastructure_providers")
    search.fill_and_apply_filter("fill_count(Infrastructure Provider.VMs, >=, 0)")
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(generate_random_string())
    assert_no_cfme_exception()
Пример #10
0
    def find_quadicon(
            self, do_not_navigate=False, mark=False, refresh=True, from_any_provider=False,
            use_search=True):
        """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: VmOrInstanceNotFound
        """
        quadicon = Quadicon(self.name, self.quadicon_type)
        if not do_not_navigate:
            if from_any_provider:
                # TODO implement as navigate_to when cfme.infra.virtual_machines has destination
                sel.force_navigate(self.ALL_LIST_LOCATION)
            elif self.is_vm:
                self.provider.load_all_provider_vms()
            else:
                self.provider.load_all_provider_templates()
            toolbar.select('Grid View')
        else:
            # Search requires navigation, we shouldn't use it then
            use_search = False
            if refresh:
                sel.refresh()
        if not paginator.page_controls_exist():
            if self.is_vm:
                raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(self.name))
            else:
                raise TemplateNotFound("Template '{}' not found in UI!".format(self.name))

        # this is causing some issues in 5.5.0.9, commenting out for a bit
        # paginator.results_per_page(1000)
        if use_search:
            try:
                if not search.has_quick_search_box():
                    # We don't use provider-specific page (vm_templates_provider_branch) here
                    # as those don't list archived/orphaned VMs
                    if self.is_vm:
                        navigate_to(self.provider, 'Instances')
                    else:
                        navigate_to(self.provider, self.provider.templates_destination_name)
                search.normal_search(self.name)
            except Exception as e:
                logger.warning("Failed to use search: %s", str(e))

        for page in paginator.pages():
            if sel.is_displayed(quadicon, move_to=True):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(self.name))
Пример #11
0
def test_quick_search_without_filter(vms, subset_of_vms):
    sel.force_navigate("infra_vms")
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    vm = pick(subset_of_vms, 1)[0]
    # Filter this host only
    search.normal_search(vm)
    assert_no_cfme_exception()
    # Check it is there
    all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True)
    assert len(all_vms_visible) == 1 and vm in all_vms_visible
Пример #12
0
def test_quick_search_with_filter(vms, subset_of_vms, expression_for_vms_subset):
    sel.force_navigate("infra_vms")
    search.fill_and_apply_filter(expression_for_vms_subset)
    assert_no_cfme_exception()
    # Filter this host only
    chosen_vm = pick(subset_of_vms, 1)[0]
    search.normal_search(chosen_vm)
    assert_no_cfme_exception()
    # Check it is there
    all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True)
    assert len(all_vms_visible) == 1 and chosen_vm in all_vms_visible
Пример #13
0
def test_quick_search_without_filter(vms, subset_of_vms):
    sel.force_navigate("infra_vms")
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    vm = pick(subset_of_vms, 1)[0]
    # Filter this host only
    search.normal_search(vm)
    assert_no_cfme_exception()
    # Check it is there
    all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True)
    assert len(all_vms_visible) == 1 and vm in all_vms_visible
def test_quick_search_without_filter(hosts, hosts_with_vm_count, host_with_median_vm):
    sel.force_navigate("infrastructure_hosts")
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    median_host, median_vm_count = host_with_median_vm
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
Пример #15
0
    def find_quadicon(
            self, do_not_navigate=False, mark=False, refresh=True, from_any_provider=False,
            use_search=True):
        """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: VmOrInstanceNotFound
        """
        quadicon = Quadicon(self.name, self.quadicon_type)
        if not do_not_navigate:
            if from_any_provider:
                sel.force_navigate(self.ALL_LIST_LOCATION)
            elif self.is_vm:
                self.provider.load_all_provider_vms()
            else:
                self.provider.load_all_provider_templates()
            toolbar.select('Grid View')
        else:
            # Search requires navigation, we shouldn't use it then
            use_search = False
            if refresh:
                sel.refresh()
        if not paginator.page_controls_exist():
            if self.is_vm:
                raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(self.name))
            else:
                raise TemplateNotFound("Template '{}' not found in UI!".format(self.name))

        # this is causing some issues in 5.5.0.9, commenting out for a bit
        # paginator.results_per_page(1000)
        if use_search:
            try:
                if not search.has_quick_search_box():
                    # We don't use provider-specific page (vm_templates_provider_branch) here
                    # as those don't list archived/orphaned VMs
                    if self.is_vm:
                        sel.force_navigate(self.provider.instances_page_name)
                    else:
                        sel.force_navigate(self.provider.templates_page_name)
                search.normal_search(self.name)
            except Exception as e:
                logger.warning("Failed to use search: %s", str(e))

        for page in paginator.pages():
            if sel.is_displayed(quadicon, move_to=True):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(self.name))
Пример #16
0
def test_quick_search_without_filter(hosts, hosts_with_vm_count,
                                     host_with_median_vm):
    sel.force_navigate("infrastructure_hosts")
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    median_host, median_vm_count = host_with_median_vm
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
Пример #17
0
def test_quick_search_with_filter(vms, subset_of_vms,
                                  expression_for_vms_subset):
    sel.force_navigate("infra_vms")
    search.fill_and_apply_filter(expression_for_vms_subset)
    assert_no_cfme_exception()
    # Filter this host only
    chosen_vm = pick(subset_of_vms, 1)[0]
    search.normal_search(chosen_vm)
    assert_no_cfme_exception()
    # Check it is there
    all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True)
    assert len(all_vms_visible) == 1 and chosen_vm in all_vms_visible
Пример #18
0
    def find_quadicon(
            self, do_not_navigate=False, mark=False, refresh=True, from_any_provider=False,
            use_search=True):
        """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: VmOrInstanceNotFound
        """
        quadicon = Quadicon(self.name, self.quadicon_type)
        if not do_not_navigate:
            if from_any_provider:
                # TODO implement as navigate_to when cfme.infra.virtual_machines has destination
                navigate_to(self, 'All')
            elif self.is_vm:
                navigate_to(self, 'AllForProvider', use_resetter=False)
            else:
                navigate_to(self, 'AllForProvider', use_resetter=False)
            toolbar.select('Grid View')
        else:
            # Search requires navigation, we shouldn't use it then
            use_search = False
            if refresh:
                sel.refresh()
        if not paginator.page_controls_exist():
            if self.is_vm:
                raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(self.name))
            else:
                raise TemplateNotFound("Template '{}' not found in UI!".format(self.name))

        paginator.results_per_page(1000)
        if use_search:
            try:
                if not search.has_quick_search_box():
                    # TODO rework search for archived/orphaned VMs
                    if self.is_vm:
                        navigate_to(self, 'AllForProvider', use_resetter=False)
                    else:
                        navigate_to(self, 'AllForProvider', use_resetter=False)
                search.normal_search(self.name)
            except Exception as e:
                logger.warning("Failed to use search: %s", str(e))
        for page in paginator.pages():
            if sel.is_displayed(quadicon, move_to=True):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(self.name))
Пример #19
0
def test_quick_search_with_filter(request, hosts, hosts_with_vm_count, host_with_median_vm):
    pytest.sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm
    search.fill_and_apply_filter(get_expression(False, ">=").format(median_vm_count))
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
def test_quick_search_without_filter(request, hosts, hosts_with_vm_count, host_with_median_vm):
    navigate_to(Host, 'All')
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    median_host, median_vm_count = host_with_median_vm
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
def test_quick_search_without_filter(request, vms, subset_of_vms):
    navigate_to(Vm, 'VMsOnly')
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    vm = sample(subset_of_vms, 1)[0]
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(vm)
    assert_no_cfme_exception()
    # Check it is there
    all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True)
    assert len(all_vms_visible) == 1 and vm in all_vms_visible
Пример #22
0
def test_quick_search_with_filter(request, hosts, hosts_with_vm_count, host_with_median_vm):
    navigate_to(Host, 'All')
    median_host, median_vm_count = host_with_median_vm
    search.fill_and_apply_filter(get_expression(False, ">=").format(median_vm_count))
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
def test_quick_search_with_filter(request, vms, subset_of_vms, expression_for_vms_subset):
    sel.force_navigate("infra_vms")
    search.fill_and_apply_filter(expression_for_vms_subset)
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    chosen_vm = sample(subset_of_vms, 1)[0]
    search.normal_search(chosen_vm)
    assert_no_cfme_exception()
    # Check it is there
    all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True)
    assert len(all_vms_visible) == 1 and chosen_vm in all_vms_visible
def test_quick_search_without_filter(request, hosts, hosts_with_vm_count, host_with_median_vm):
    navigate_to(Host, 'All')
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    median_host, median_vm_count = host_with_median_vm
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts()
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
def test_quick_search_with_filter(hosts, hosts_with_vm_count, host_with_median_vm):
    sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm
    search.fill_and_apply_filter(
        "fill_count(Host.VMs, >=, %d)" % median_vm_count
    )
    assert_no_cfme_exception()
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
Пример #26
0
def test_quick_search_with_filter(hosts, hosts_with_vm_count,
                                  host_with_median_vm):
    sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm
    search.fill_and_apply_filter("fill_count(Host.VMs, >=, %d)" %
                                 median_vm_count)
    assert_no_cfme_exception()
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
Пример #27
0
def test_quick_search_without_filter(request, vms, subset_of_vms):
    pytest.sel.force_navigate("infra_vms")
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    vm = sample(subset_of_vms, 1)[0]
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(vm)
    assert_no_cfme_exception()
    # Check it is there
    all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True)
    assert len(all_vms_visible) == 1 and vm in all_vms_visible
def test_quick_search_with_filter(request, vms, subset_of_vms,
                                  expression_for_vms_subset):
    navigate_to(Vm, 'VMsOnly')
    search.fill_and_apply_filter(expression_for_vms_subset)
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    chosen_vm = sample(subset_of_vms, 1)[0]
    search.normal_search(chosen_vm)
    assert_no_cfme_exception()
    # Check it is there
    all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True)
    assert len(all_vms_visible) == 1 and chosen_vm in all_vms_visible
Пример #29
0
def test_search_bar(provider, soft_assert):
    """ <object> summary page - Search bar
    This test checks Search bar functionality on every object summary page
    Steps:
        * Goes to <object> page
        * Inserts: Irregular symbol, '*' character, full search string, partial search string
        * Verify proper results
    """
    for obj in TEST_OBJECTS:
        rows = navigate_and_get_rows(provider, obj, 1)
        if not rows:
            pytest.skip(
                'No Records Found in {} table. Could not test search. skipping...'
                .format(obj))
        exist_member_str = choice(rows).name.text
        # Mapping the search string and the expected found result:
        search_strings_and_result = {
            '***': None,
            exist_member_str: exist_member_str,
            '$$$': None,
            exist_member_str[:len(exist_member_str) / 2]: exist_member_str
        }

        try:
            for search_string, result in search_strings_and_result.items():
                search.normal_search(search_string)
                # NOTE: We must re-instantiate here table
                # in order to prevent StaleElementException or UsingSharedTables
                list_tbl = CheckboxTable(
                    table_locator="//div[@id='list_grid']//table")
                results_row_names = ([
                    r.name.text for r in list_tbl.rows_as_list()
                ] if not sel.is_displayed_text("No Records Found.") else [])
                if result:
                    soft_assert(
                        result in results_row_names,
                        'Expected to get result "{}" '
                        'for search string "{}". search results: {}'.format(
                            result, search_string, results_row_names))
                else:
                    soft_assert(
                        not results_row_names,
                        'Unexpected result for search string "{}", '
                        'Should not find records, search results: "{}"'.format(
                            search_string, results_row_names))
        finally:
            # search.ensure_no_filter_applied() -> TimedOutError
            # https://github.com/ManageIQ/integration_tests/issues/4401
            search.normal_search("")
Пример #30
0
def test_search_bar(provider, soft_assert):
    """ <object> summary page - Search bar
    This test checks Search bar functionality on every object summary page
    Steps:
        * Goes to <object> page
        * Inserts: Irregular symbol, '*' character, full search string, partial search string
        * Verify proper results
    """
    for obj in TEST_OBJECTS:
        rows = navigate_and_get_rows(provider, obj, 1)
        if not rows:
            pytest.skip('No Records Found in {} table. Could not test search. skipping...'
                        .format(obj))
        exist_member_str = choice(rows).name.text
        # Mapping the search string and the expected found result:
        search_strings_and_result = {
            '***': None,
            exist_member_str: exist_member_str,
            '$$$': None,
            exist_member_str[:len(exist_member_str) / 2]: exist_member_str
        }

        try:
            for search_string, result in search_strings_and_result.items():
                search.normal_search(search_string)
                # NOTE: We must re-instantiate here table
                # in order to prevent StaleElementException or UsingSharedTables
                list_tbl = CheckboxTable(table_locator="//div[@id='list_grid']//table")
                results_row_names = ([r.name.text for r in list_tbl.rows_as_list()]
                             if not sel.is_displayed_text("No Records Found.") else [])
                if result:
                    soft_assert(result in results_row_names,
                        'Expected to get result "{}" '
                        'for search string "{}". search results: {}'
                        .format(result, search_string, results_row_names))
                else:
                    soft_assert(not results_row_names,
                        'Unexpected result for search string "{}", '
                        'Should not find records, search results: "{}"'
                        .format(search_string, results_row_names))
        finally:
            # search.ensure_no_filter_applied() -> TimedOutError
            # https://github.com/ManageIQ/integration_tests/issues/4401
            search.normal_search("")
Пример #31
0
def test_search_bar(test_obj):
    """ <object> summary page - Search bar
    This test checks Search bar functionality on every object summary page
    Steps:
        * Goes to <object> page
        * Inserts: Irregular symbol, '*' character, full search string, partial search string
        * Verify proper results
    """
    navigate_to(test_obj.obj, 'All')
    tb.select('List View')
    if sel.is_displayed_text("No Records Found."):
        pytest.skip('No Records Found in {} table. Could not test search. skipping...'
                    .format(test_obj.obj))
    rows = test_obj.list_tbl.rows_as_list()
    exist_member_str = choice(rows).name.text
    # Mapping the search string and the expected found result:
    search_strings_and_result = {
        '***': None,
        exist_member_str: exist_member_str,
        '$$$': None,
        exist_member_str[:len(exist_member_str) / 2]: exist_member_str
    }

    for search_string, result in search_strings_and_result.items():
        search.normal_search(search_string)
        results_row_names = ([r.name.text for r in test_obj.list_tbl.rows_as_list()]
                     if not sel.is_displayed_text("No Records Found.") else [])
        if result:
            if result not in results_row_names:
                raise Exception('Expected to get result "{}" '
                                'for search string "{}". search results: {}'
                                .format(result, search_string, results_row_names))
        else:
            if results_row_names:
                raise Exception('Unexpected result for search string "{}", '
                                'Should not find records, search results: "{}"'
                                .format(search_string, results_row_names))
def test_routes_search(routes_search_strings):
    """ Routes summary page - Search bar

           This test checks Search bar functionality on the Routes summary page

           Steps:
               * Goes to Containers Routes page
               * Inserts: Irregular symbol, '*' character, full search string, partial search string
               * Verify proper results
           """
    navigate_to(Route, 'All')
    if ''.join(routes_search_strings) == '*':
        full_name_to_search = '*'
        names_list = []
        located_names = []
        projects_table = Table(table_el)
        for row in projects_table.rows():
            names_list.append(row.name.text)
        search.normal_search(full_name_to_search)
        for row in projects_table.rows():
            located_names.append(row.name.text)
        for name in located_names:
            assert name in names_list
    elif ''.join(routes_search_strings) == 'front':
        full_name_to_search = 'front'
        search.normal_search(full_name_to_search)
        projects_table = Table(table_el)
        for row in projects_table.rows():
            name = row.name.text
            assert full_name_to_search in name
    elif ''.join(routes_search_strings) == '$':
        full_name_to_search = '$'
        search.normal_search(full_name_to_search)
        assert sel.is_displayed_text("No Records Found.")
    else:
        full_name_to_search = ''.join(routes_search_strings)
        search.normal_search(full_name_to_search)
        projects_table = Table(table_el)
        for row in projects_table.rows():
            name = row.name.text
            assert name == full_name_to_search
def test_routes_search(routes_search_strings):
    """ Routes summary page - Search bar

           This test checks Search bar functionality on the Routes summary page

           Steps:
               * Goes to Containers Routes page
               * Inserts: Irregular symbol, '*' character, full search string, partial search string
               * Verify proper results
           """
    sel.force_navigate('containers_routes')
    if ''.join(routes_search_strings) == '*':
        full_name_to_search = '*'
        names_list = []
        located_names = []
        projects_table = Table(table_el)
        for row in projects_table.rows():
            names_list.append(row.name.text)
        search.normal_search(full_name_to_search)
        for row in projects_table.rows():
            located_names.append(row.name.text)
        for name in located_names:
            assert name in names_list
    elif ''.join(routes_search_strings) == 'front':
        full_name_to_search = 'front'
        search.normal_search(full_name_to_search)
        projects_table = Table(table_el)
        for row in projects_table.rows():
            name = row.name.text
            assert full_name_to_search in name
    elif ''.join(routes_search_strings) == '$':
        full_name_to_search = '$'
        search.normal_search(full_name_to_search)
        assert sel.is_displayed_text("No Records Found.")
    else:
        full_name_to_search = ''.join(routes_search_strings)
        search.normal_search(full_name_to_search)
        projects_table = Table(table_el)
        for row in projects_table.rows():
            name = row.name.text
            assert name == full_name_to_search