コード例 #1
0
 def am_i_here(self):
     if not match_location():
         return False
     summary = summary_title()
     return summary.startswith("Automate Method [{} - Updated".format(self.obj.display_name)) or summary.startswith(
         "Automate Method [{} - Updated".format(self.obj.name)
     )
コード例 #2
0
ファイル: datastore.py プロジェクト: FilipB/cfme_tests
 def _on_detail_page(self):
     """ Returns ``True`` if on the datastore detail page, ``False`` if not."""
     title = version.pick({
         version.LOWEST: '{} ({})'.format(self.name, "Datastore"),
         "5.6": '{} "{}"'.format("Datastore", self.name)})
     try:
         return summary_title() == title
     except AttributeError:
         return False
コード例 #3
0
ファイル: provider.py プロジェクト: rananda/cfme_tests
 def _on_detail_page(self):
     """ Returns ``True`` if on the providers detail page, ``False`` if not."""
     if not self.string_name:
         # No point in doing that since it is probably being called from badly configured class
         # And since it is badly configured, let's notify the user.
         logger.warning(
             'Hey, _on_details_page called from {} class which does not have string_name set'
             .format(type(self).__name__))
         return False
     ensure_browser_open()
     collection = '{} Providers'.format(self.string_name)
     title = '{} (Summary)'.format(self.name)
     return breadcrumbs_names() == [collection, title] and summary_title() == title
コード例 #4
0
 def _on_detail_page(self):
     """ Returns ``True`` if on the providers detail page, ``False`` if not."""
     if not self.string_name:
         # No point in doing that since it is probably being called from badly configured class
         # And since it is badly configured, let's notify the user.
         logger.warning(
             'Hey, _on_details_page called from {} class which does not have string_name set'
             .format(type(self).__name__))
         return False
     ensure_browser_open()
     collection = '{} Providers'.format(self.string_name)
     title = '{} (Summary)'.format(self.name)
     return breadcrumbs_names() == [collection, title
                                    ] and summary_title() == title
コード例 #5
0
def test_host_role_association(provider, soft_assert):
    navigate_to(provider, 'ProviderNodes')
    names = [q.name for q in list(Quadicon.all())]
    for node in names:
        host = Host(node, provider=provider)
        host.run_smartstate_analysis()
        wait_for(is_host_analysis_finished, [host.name], delay=15,
                 timeout="10m", fail_func=toolbar.refresh)
        navigate_to(host, 'Details')
        role_name = summary_title().split()[1].translate(None, '()')
        role_name = 'Compute' if role_name == 'NovaCompute' else role_name
        try:
            role_assoc = host.get_detail('Relationships', 'Deployment Role')
        except NoSuchElementException:
            role_assoc = host.get_detail('Relationships', 'Cluster / Deployment Role')
        soft_assert(role_name in role_assoc, 'Deployment roles misconfigured')
コード例 #6
0
def test_breadcrumbs(provider, soft_assert):

    for dataset in DATA_SETS:

        if current_version() < '5.7' and dataset.obj == Template:
            continue

        rows = navigate_and_get_rows(provider, dataset.obj, 1)
        if not rows:
            pytest.skip(
                'Could not test breadcrums: No records found in {}\'s table'.
                format(dataset.obj.__name__))
        row = rows[-1]
        instance_name = row[2].text
        sel.click(row)

        breadcrumb_elements = breadcrumbs()
        soft_assert(
            breadcrumb_elements,
            'Breadcrumbs not found in {} {} summary page'.format(
                dataset.obj.__name__, instance_name))
        bread_names_2_element = {
            sel.text_sane(b): b
            for b in breadcrumb_elements
        }

        try:
            breadcrumb_element = soft_get(bread_names_2_element,
                                          dataset.obj_base_name,
                                          dict_=True)
        except:
            soft_assert(
                False,
                'Could not find breadcrumb "{}" in {} {} summary page. breadcrumbs: {}'
                .format(dataset.obj_base_name, bread_names_2_element.keys(),
                        dataset.obj.__name__, instance_name))

        breadcrumb_name = sel.text_sane(breadcrumb_element)
        sel.click(breadcrumb_element)

        # We verify the location as following since we want to prevent from name convention errors
        soft_assert(
            dataset.obj_base_name in summary_title().lower(),
            'Breadcrumb link "{}" in {} {} page should navigate to '
            '{}s main page. navigated instead to: {}'.format(
                breadcrumb_name, dataset.obj.__name__, instance_name,
                dataset.obj.__name__, sel.current_url()))
コード例 #7
0
def check_relationships(instance):
    """Check the relationships linking & data integrity"""
    sum_values = instance.summary.relationships.items().values()
    shuffle(sum_values)
    for attr in sum_values:
        if attr.clickable:
            break
    else:
        return  # No clickable object but we still want to pass
    link_value = attr.value
    attr.click()
    if type(link_value) is int:
        rec_total = paginator.rec_total()
        if rec_total != link_value:
            raise Exception('Difference between the value({}) in the relationships table in {}'
                            'to number of records ({}) in the target'
                            'page'.format(link_value, instance.name, rec_total))
    else:
        assert '(Summary)' in summary_title()
コード例 #8
0
def test_breadcrumbs(provider, soft_assert):

    for dataset in DATA_SETS:

        if current_version() < '5.7' and dataset.obj == Template:
            continue

        rows = navigate_and_get_rows(provider, dataset.obj, 1)
        if not rows:
            pytest.skip('Could not test breadcrums: No records found in {}\'s table'
                        .format(dataset.obj.__name__))
        row = rows[-1]
        instance_name = row[2].text
        sel.click(row)

        breadcrumb_elements = breadcrumbs()
        soft_assert(breadcrumb_elements,
                    'Breadcrumbs not found in {} {} summary page'
                    .format(dataset.obj.__name__, instance_name))
        bread_names_2_element = {sel.text_sane(b): b for b in breadcrumb_elements}

        try:
            breadcrumb_element = soft_get(bread_names_2_element,
                                          dataset.obj_base_name, dict_=True)
        except:
            soft_assert(False,
                'Could not find breadcrumb "{}" in {} {} summary page. breadcrumbs: {}'
                .format(dataset.obj_base_name, bread_names_2_element.keys(),
                        dataset.obj.__name__, instance_name))

        breadcrumb_name = sel.text_sane(breadcrumb_element)
        sel.click(breadcrumb_element)

        # We verify the location as following since we want to prevent from name convention errors
        soft_assert(dataset.obj_base_name in summary_title().lower(),
            'Breadcrumb link "{}" in {} {} page should navigate to '
            '{}s main page. navigated instead to: {}'
            .format(breadcrumb_name, dataset.obj.__name__,
                    instance_name, dataset.obj.__name__,
                    sel.current_url()))
コード例 #9
0
def check_relationships(instance):
    """Check the relationships linking & data integrity"""
    instance.summary.reload()  # Because sometimes:
    # AttributeError: 'Summary' object has no attribute 'relationships'
    sum_values = instance.summary.relationships.items().values()
    shuffle(sum_values)
    for attr in sum_values:
        if attr.clickable:
            break
    else:
        return  # No clickable object but we still want to pass
    link_value = attr.value
    attr.click()
    if type(link_value) is int:
        rec_total = paginator.rec_total()
        if rec_total != link_value:
            raise Exception(
                'Difference between the value({}) in the relationships table in {}'
                'to number of records ({}) in the target'
                'page'.format(link_value, instance.name, rec_total))
    else:
        assert '(Summary)' in summary_title()
コード例 #10
0
    def on_details(self, force=False):
        """A function to determine if the browser is already on the proper vm details page.
        """
        title = '{} "{}"'.format(
            "VM and Instance" if self.is_vm else "VM Template and Image", self.name)
        present_title = summary_title()
        if present_title is None or title not in present_title:
            if not force:
                return False
            else:
                self.load_details()
                return True

        pattern = r'("[A-Za-z0-9_\./\\-]*")'
        m = re.search(pattern, present_title)

        if not force:
            return self.name == m.group().replace('"', '')
        else:
            if self.name != m.group().replace('"', ''):
                self._load_details()
            else:
                return False
コード例 #11
0
    def on_details(self, force=False):
        """A function to determine if the browser is already on the proper vm details page.
        """
        title = '{} "{}"'.format(
            "VM and Instance" if self.is_vm else "VM Template and Image",
            self.name)
        present_title = summary_title()
        if present_title is None or title not in present_title:
            if not force:
                return False
            else:
                self.load_details()
                return True

        pattern = r'("[A-Za-z0-9_\./\\-]*")'
        m = re.search(pattern, present_title)

        if not force:
            return self.name == m.group().replace('"', '')
        else:
            if self.name != m.group().replace('"', ''):
                self._load_details()
            else:
                return False
コード例 #12
0
 def am_i_here(self, *args, **kwargs):
     return summary_title() == "{} Widget \"{}\"".format(
         self.obj.TITLE[:-1], self.obj.title)
コード例 #13
0
ファイル: datastore.py プロジェクト: FilipB/cfme_tests
 def _on_vms_page(self):
     """ Returns ``True`` if on the datastore vms page, ``False`` if not."""
     return summary_title() == '{} ({})'.format(self.name, "All Registered VMs")
コード例 #14
0
ファイル: host.py プロジェクト: anewmanRH/cfme_tests
 def am_i_here(self):
     return summary_title() == "{} (Summary)".format(self.obj.name)
コード例 #15
0
 def _nav_to_snapshot_mgmt(self):
     snapshot_title = '"Snapshots" for Virtual Machine "{}"'.format(self.vm.name)
     if summary_title() != snapshot_title:
         self.vm.load_details()
         sel.click(InfoBlock.element("Properties", "Snapshots"))
コード例 #16
0
 def am_i_here(self, *args, **kwargs):
     return summary_title() == "{} Widget \"{}\"".format(self.obj.TITLE[:-1], self.obj.title)
コード例 #17
0
 def _nav_to_snapshot_mgmt(self):
     snapshot_title = '"Snapshots" for Virtual Machine "{}"'.format(
         self.vm.name)
     if summary_title() != snapshot_title:
         self.vm.load_details()
         sel.click(InfoBlock.element("Properties", "Snapshots"))