Exemple #1
0
    def sync_custom_repos(self, product, repos):
        """Syncs Repositories from Custom Product.

        Selects multiple custom repos to Synchronize from UI,
        by first expanding the product.

        :param str product: The product which repositories belongs to.
        :param list repos: The list of repositories to sync.

        """
        strategy, value = locators["sync.prd_expander"]
        strategy1, value1 = locators["sync.repo_checkbox"]
        prd_exp = self.wait_until_element((strategy, value % product))
        if prd_exp:
            prd_exp.click()
        else:
            raise UINoSuchElementError(
                "Could not find the product expander: '%s'" % product)
        for repo in repos:
            repo_select = self.wait_until_element((strategy1, value1 % repo))
            if repo_select:
                repo_select.click()
            else:
                raise UINoSuchElementError("Could not find the repo: '%s'" %
                                           repo)
        self.wait_until_element(locators["sync.sync_now"]).click()
        self.wait_for_ajax()
        return self.assert_sync(repos)
Exemple #2
0
    def menu_click(self,
                   top_menu_locator,
                   sub_menu_locator,
                   tertiary_menu_locator=None,
                   entity=None):
        menu_element = self.wait_until_element(top_menu_locator)

        if menu_element is None:
            raise UINoSuchElementError(
                u'top_menu_locator not found: {0}'.format(top_menu_locator))
        ActionChains(self.browser).move_to_element(menu_element).perform()
        submenu_element = self.wait_until_element(sub_menu_locator)
        if submenu_element is None:
            raise UINoSuchElementError(
                u'sub_menu_locator not found: {0}'.format(sub_menu_locator))
        elif submenu_element and not tertiary_menu_locator:
            submenu_element.click()
        elif submenu_element and tertiary_menu_locator:
            ActionChains(
                self.browser).move_to_element(submenu_element).perform()
            if entity:
                strategy, value = tertiary_menu_locator
                tertiary_element = self.wait_until_element(
                    (strategy, value % entity))
            else:
                tertiary_element = self.wait_until_element(
                    tertiary_menu_locator)
            if tertiary_element is None:
                raise UINoSuchElementError(
                    u'Tertiary_menu_locator not found: {0}'.format(
                        tertiary_menu_locator))
            self.browser.execute_script(
                "arguments[0].click();",
                tertiary_element,
            )
Exemple #3
0
 def add_remove_cv(self, composite_cv, cv_names, is_add=True):
     """Add or Remove content-views to/from selected composite view.
     When 'is_add' Flag is set then add_contentView will be performed,
     otherwise remove_contentView
     """
     self.search_and_click(composite_cv)
     if self.wait_until_element(
             tab_locators['contentviews.tab_content_views']):
         self.click(tab_locators['contentviews.tab_content_views'])
     else:
         raise UINoSuchElementError(
             'Could not find ContentView tab, please make sure '
             'selected view is composite')
     for cv_name in cv_names:
         if is_add:
             self.click(tab_locators['contentviews.tab_cv_add'])
         else:
             self.click(tab_locators['contentviews.tab_cv_remove'])
         locator = locators['contentviews.select_cv']
         self.click(locator % cv_name)
         if is_add:
             self.click(locators['contentviews.add_cv'])
             self.click(tab_locators['contentviews.tab_cv_remove'])
             element = self.wait_until_element(locator % cv_name)
             if element is None:
                 raise UINoSuchElementError(
                     "Adding CV {0} failed".format(cv_name))
         else:
             self.click(locators['contentviews.remove_cv'])
             self.click(tab_locators['contentviews.tab_cv_add'])
             element = self.wait_until_element(locator % cv_name)
             if element is None:
                 raise UINoSuchElementError(
                     "Removing CV {0} fails".format(cv_name))
Exemple #4
0
    def add_remove_repos(self, cv_name, repo_names, add_repo=True):
        """
        Add or Remove repository to/from selected content-view.

        When 'add_repo' Flag is set then add_repository will be performed,
        otherwise remove_repository
        """

        element = self.search(cv_name)

        if element:
            element.click()
            self.wait_for_ajax()
            self.find_element(tab_locators["contentviews.tab_content"]).click()
            self.find_element(locators["contentviews.content_repo"]).click()
            self.wait_for_ajax()
            strategy, value = locators["contentviews.select_repo"]
            for repo_name in repo_names:
                if add_repo:
                    self.find_element(
                        tab_locators["contentviews.tab_repo_add"]).click()
                else:
                    self.find_element(
                        tab_locators["contentviews.tab_repo_remove"]).click()
                self.text_field_update(locators["contentviews.repo_search"],
                                       repo_name)
                element = self.wait_until_element(
                    (strategy, value % repo_name))
                if element:
                    element.click()
                    self.wait_for_ajax()
                    if add_repo:
                        self.wait_until_element(
                            locators["contentviews.add_repo"]).click()
                        self.wait_until_element(
                            tab_locators["contentviews.tab_repo_remove"]
                        ).click()
                        element = self.wait_until_element(
                            (strategy, value % repo_name))
                        if element is None:
                            raise UINoSuchElementError(
                                "Adding repo {0} failed".format(repo_name))
                    else:
                        self.wait_until_element(
                            locators["contentviews.remove_repo"]).click()
                        self.wait_for_ajax()
                        self.find_element(
                            tab_locators["contentviews.tab_repo_add"]).click()
                        self.wait_for_ajax()
                        element = self.wait_until_element(
                            (strategy, value % repo_name))
                        if element is None:
                            raise UINoSuchElementError(
                                "Removing repo {0} fails".format(repo_name))
                else:
                    raise Exception("Couldn't find repo '%s'"
                                    "to add into CV" % repo_name)
        else:
            raise Exception("Couldn't find the selected CV '%s'" % cv_name)
Exemple #5
0
    def sync_rh_repos(self, repos_tree):
        """Syncs RedHat repositories.

        Selects Red Hat Repos to Synchronize from UI.

        :param repos_tree: Repositories to choose which is a List of dictionary
        :return: Returns True if the sync was successful.
        :rtype: bool

        """
        strategy, value = locators["sync.prd_expander"]
        strategy1, value1 = locators["sync.verarch_expander"]
        strategy2, value2 = locators["sync.repo_checkbox"]
        repos = []
        # create_repos_tree returns data needed to be passed to this function.
        for prd in repos_tree:
            prd_exp = self.wait_until_element((strategy, value % PRDS[prd]))
            if prd_exp:
                prd_exp.click()
            for reposet in repos_tree[prd]:
                for repo in repos_tree[prd][reposet]:
                    repo_values = repos_tree[prd][reposet][repo]
                    repo_name = repo_values['repo_name']
                    repo_arch = repo_values['repo_arch']
                    repo_ver = repo_values['repo_ver']
                    repos.append(repo_name)
                    ver_exp = self.wait_until_element(
                        (strategy1, value1 % repo_ver))
                    if ver_exp:
                        ver_exp.click()
                        self.wait_for_ajax()
                    else:
                        raise UINoSuchElementError(
                            "Could not find the version expander: '%s'" %
                            repo_ver)
                    arch_exp = self.wait_until_element(
                        (strategy1, value1 % repo_arch))
                    if arch_exp:
                        arch_exp.click()
                        self.wait_for_ajax()
                    else:
                        raise UINoSuchElementError(
                            "Could not find the arch expander: '%s'" %
                            repo_arch)
                    repo_select = self.wait_until_element(
                        (strategy2, value2 % repo_name))
                    if repo_select:
                        repo_select.click()
                        self.wait_for_ajax()
                    else:
                        raise UINoSuchElementError(
                            "Could not find the repository name: '%s'" %
                            repo_name)
                self.wait_until_element(locators["sync.sync_now"]).click()
                self.wait_for_ajax()
        # Let's assert without navigating away from sync status page to avoid
        # complexities
        return self.assert_sync(repos)
Exemple #6
0
    def add_remove_repos(self,
                         cv_name,
                         repo_names,
                         add_repo=True,
                         repo_type='yum'):
        """Add or Remove repository to/from selected content-view.

        When 'add_repo' Flag is set then add_repository will be performed,
        otherwise remove_repository
        """
        element = self.search(cv_name)
        if not element:
            raise UIError(
                'Could not find the selected CV "{0}"'.format(cv_name))

        element.click()
        self.wait_for_ajax()
        if repo_type == 'yum':
            self.click(tab_locators['contentviews.tab_content'])
            self.click(locators['contentviews.content_repo'])
        elif repo_type == 'docker':
            self.click(tab_locators['contentviews.tab_docker_content'])
        elif repo_type == 'ostree':
            self.click(tab_locators['contentviews.tab_ostree_content'])
        strategy, value = locators['contentviews.select_repo']
        for repo_name in repo_names:
            if add_repo:
                self.click(tab_locators['contentviews.tab_repo_add'])
            else:
                self.click(tab_locators['contentviews.tab_repo_remove'])
            self.text_field_update(locators['contentviews.repo_search'],
                                   repo_name)
            element = self.wait_until_element((strategy, value % repo_name))
            if not element:
                raise UIError(
                    'Could not find repo "{0}" to add into CV'.format(
                        repo_name))
            element.click()
            self.wait_for_ajax()
            if add_repo:
                self.click(locators['contentviews.add_repo'])
                self.click(tab_locators['contentviews.tab_repo_remove'])
                element = self.wait_until_element(
                    (strategy, value % repo_name))
                if element is None:
                    raise UINoSuchElementError(
                        "Adding repo {0} failed".format(repo_name))
            else:
                self.click(locators['contentviews.remove_repo'])
                self.click(tab_locators['contentviews.tab_repo_add'])
                element = self.wait_until_element(
                    (strategy, value % repo_name))
                if element is None:
                    raise UINoSuchElementError(
                        "Removing repo {0} fails".format(repo_name))
Exemple #7
0
    def add_remove_repos(
            self, cv_name, repo_names, add_repo=True, repo_type='yum'):
        """Add or Remove repository to/from selected content-view.

        When 'add_repo' Flag is set then add_repository will be performed,
        otherwise remove_repository
        """
        self.search_and_click(cv_name)
        if repo_type == 'yum':
            self.click(tab_locators['contentviews.tab_yum_content'])
            self.click(locators['contentviews.content_repo'])
        elif repo_type == 'docker':
            self.click(tab_locators['contentviews.tab_docker_content'])
            self.click(locators['contentviews.docker_repo'])
        elif repo_type == 'ostree':
            self.click(tab_locators['contentviews.tab_ostree_content'])
        locator = locators['contentviews.select_repo']
        for repo_name in repo_names:
            if add_repo:
                self.click(tab_locators['contentviews.tab_repo_add'])
            else:
                self.click(tab_locators['contentviews.tab_repo_remove'])
            self.assign_value(
                locators['contentviews.repo_search'], repo_name)
            self.click(common_locators['kt_search_button'])
            if not self.wait_until_element(locator % repo_name):
                raise UIError(
                    'Could not find repo "{0}" to add into CV'
                    .format(repo_name)
                )
            self.click(locator % repo_name)
            if add_repo:
                self.click(locators['contentviews.add_repo'])
                if not self.wait_until_element(
                        common_locators['alert.success_sub_form']):
                    raise UIError(
                        'Failed to add repo "{0}" to CV'.format(repo_name)
                    )
                self.click(tab_locators['contentviews.tab_repo_remove'])
                element = self.wait_until_element(locator % repo_name)
                if element is None:
                    raise UINoSuchElementError(
                        "Adding repo {0} failed".format(repo_name))
            else:
                self.click(locators['contentviews.remove_repo'])
                if not self.wait_until_element(
                        common_locators['alert.success_sub_form']):
                    raise UIError(
                        'Failed to remove repo "{0}" from CV'.format(repo_name)
                    )
                self.click(tab_locators['contentviews.tab_repo_add'])
                element = self.wait_until_element(locator % repo_name)
                if element is None:
                    raise UINoSuchElementError(
                        "Removing repo {0} fails".format(repo_name))
Exemple #8
0
 def fetch_yum_content_repo_name(self, cv_name):
     """Fetch associated yum repository info from selected content view."""
     # find content_view
     cv = self.search(cv_name)
     if cv is None:
         raise UINoSuchElementError('Could not find CV %s', cv_name)
     cv.click()
     self.wait_for_ajax()
     self.click(tab_locators['contentviews.tab_content'])
     self.click(locators['contentviews.yum_repositories'])
     if self.wait_until_element(locators['contentviews.repo_name']):
         return self.find_element(locators['contentviews.repo_name']).text
     else:
         raise UINoSuchElementError(
             'Could not get text attribute of repository locator')
Exemple #9
0
 def remove(self, org_name, really):
     """Remove Organization in UI."""
     searched = self.search(org_name)
     if searched is None:
         raise UINoSuchElementError(
             'Could not search the entity {0}'.format(org_name))
     strategy, value = locators["org.dropdown"]
     self.wait_until_element((strategy, value % org_name)).click()
     strategy1, value1 = locators['org.delete']
     element = self.wait_until_element((strategy1, value1 % org_name))
     if element is None:
         raise UINoSuchElementError(
             'Could not select entity {0} for deletion.'.format(org_name))
     element.click()
     self.handle_alert(really)
Exemple #10
0
    def fetch_content_count(self, repo_name, content_type):
        """Fetch content count for specific repo and content type.

        :param repo_name: Name of repository that should be fetched.
        :param content_type: Type of repository content. Supported values are:

            * packages
            * errata
            * package_groups
            * puppet

        :returns: Content count.
        :rtype: int
        :raises: ``ValueError`` if passed ``content_type`` is not supported.
        :raises robottelo.ui.base.UINoSuchElementError: If content is not
            found.
        """
        self.search_and_click(repo_name)
        if content_type == 'packages':
            locator = locators['repo.fetch_packages']
        elif content_type == 'errata':
            locator = locators['repo.fetch_errata']
        elif content_type == 'package_groups':
            locator = locators['repo.fetch_package_groups']
        elif content_type == 'puppet':
            locator = locators['repo.fetch_puppet_modules']
        else:
            raise ValueError("Please provide supported content_type value")
        number = self.find_element(locator)
        if number:
            return int(number.text)
        else:
            raise UINoSuchElementError("Content count not found")
Exemple #11
0
    def update(self, name, new_name=None, new_description=None):
        """Updates an existing content view"""
        element = self.search(name)

        if element is None:
            raise UINoSuchElementError(
                'Could not update the content view {0}'.format(name))
        element.click()
        self.wait_for_ajax()
        self.click(tab_locators['contentviews.tab_details'])

        if new_name:
            self.edit_entity(
                locators['contentviews.edit_name'],
                locators['contentviews.edit_name_text'],
                new_name,
                locators['contentviews.save_name'],
            )
        if new_description:
            self.edit_entity(
                locators['contentviews.edit_description'],
                locators['contentviews.edit_description_text'],
                new_description,
                locators['contentviews.save_description']
            )
Exemple #12
0
    def enable_repos(self, name, repos, enable=True):
        """Enables repository via product_content tab of the activation_key."""

        element = self.search_key(name)
        strategy, value = locators["ak.prd_content.edit_repo"]
        strategy1, value1 = locators["ak.prd_content.select_repo"]
        if element is None:
            raise UINoSuchElementError(
                "Couldn't find the selected activation key {0}".format(name))
        element.click()
        self.wait_for_ajax()
        self.wait_until_element(tab_locators["ak.tab_prd_content"]).click()
        self.wait_for_ajax()
        for repo in repos:
            repo_edit = self.wait_until_element((strategy, value % repo))
            if repo_edit is None:
                raise Exception("Couldn't find the repo: {0}".format(repo))
            repo_edit.click()
            self.wait_for_ajax()
            repo_select = self.wait_until_element((strategy1, value1 % repo))
            if enable:
                Select(repo_select).select_by_visible_text("Override to Yes")
            else:
                Select(repo_select).select_by_visible_text("Override to No")
            self.wait_until_element(common_locators['save']).click()
            self.wait_for_ajax()
Exemple #13
0
 def create(self, name, parent=None, users=None, proxies=None,
            subnets=None, resources=None, medias=None, templates=None,
            domains=None, envs=None, hostgroups=None, organizations=None,
            select=True):
     """Creates new Location from UI."""
     self.wait_until_element(locators["location.new"]).click()
     if self.wait_until_element(locators["location.name"]) is None:
         raise UINoSuchElementError('Could not create new location.')
     self.field_update("location.name", name)
     if parent:
         Select(self.find_element(
             locators["location.parent"])).select_by_visible_text(parent)
     self.wait_until_element(common_locators["submit"]).click()
     edit_locator = self.wait_until_element(
         locators["location.proceed_to_edit"])
     if edit_locator:
         edit_locator.click()
         self._configure_location(
             users=users, proxies=proxies,
             subnets=subnets, resources=resources,
             medias=medias, templates=templates,
             domains=domains, envs=envs,
             hostgroups=hostgroups,
             organizations=organizations,
             select=select,
         )
         self.wait_until_element(common_locators["submit"]).click()
         self.wait_for_ajax()
Exemple #14
0
    def update(self, tab_locator, param_name, value_type, param_value):
        """Updates the value of selected parameter under settings

        @param tab_locator: Selenium locator to select appropriate tab.
        @param param_name: A valid parameter name.
        @param value_type: Valid value type either 'input' or 'dropdown'
        @param param_value: Value of selected parameter

        @raise OptionError: Raise an exception when value type is different
        than 'input' and 'dropdown'.
        @raise UINoSuchElementError: Raise an exception when UI element is
        not found

        """
        if self.wait_until_element(tab_locator) is None:
            raise UINoSuchElementError(
                "Couldn't find the tab with name: '%s'" % tab_locator)
        self.click(tab_locator)

        strategy, value = locators['settings.edit_param']
        self.click((strategy, value % param_name))

        if value_type == 'dropdown':
            self.select(locators['settings.select_value'], param_value)
        elif value_type == 'input':
            self.wait_until_element(locators['settings.input_value'])
            self.field_update('settings.input_value', param_value)
        else:
            raise OptionError('Please input appropriate value type')
        self.wait_for_ajax()
        self.click(locators['settings.save'])
Exemple #15
0
 def clone(self,
           name,
           custom_really=None,
           clone_name=None,
           template_path=None,
           template_type=None,
           os_list=None):
     """Clones a given template."""
     self.search(name)
     clone = self.wait_until_element(locators["provision.template_clone"])
     if not clone:
         raise UINoSuchElementError(
             "Could not locate the clone button for template '{0}'".format(
                 name))
     clone.click()
     self.field_update("provision.template_name", clone_name)
     if template_path:
         self.find_element(
             locators["provision.template_template"]).send_keys(
                 template_path)
         self.handle_alert(custom_really)
     if template_type:
         self.wait_until_element(tab_locators["provision.tab_type"]).click()
         element = self.find_element(locators["provision.template_type"])
         Select(element).select_by_visible_text(template_type)
     self.configure_entity(
         os_list,
         FILTER['template_os'],
         tab_locator=tab_locators["provision.tab_association"])
     self.find_element(common_locators["submit"]).click()
     self.wait_for_ajax()
Exemple #16
0
 def clone(self,
           name,
           custom_really=None,
           clone_name=None,
           template_path=None,
           template_type=None,
           os_list=None):
     """Clones a given template."""
     self.search(name)
     self.click(locators['provision.template_clone'])
     if self.wait_until_element(
             locators['provision.template_name']) is None:
         raise UINoSuchElementError(
             u'Could not clone provisioning template "{0}"'.format(name))
     self.field_update('provision.template_name', clone_name)
     if template_path:
         self.find_element(
             locators['provision.template_template']).send_keys(
                 template_path)
         self.handle_alert(custom_really)
     if template_type:
         self.click(tab_locators['provision.tab_type'])
         self.select(locators['provision.template_type'], template_type)
     self.configure_entity(
         os_list,
         FILTER['template_os'],
         tab_locator=tab_locators['provision.tab_association'])
     self.click(common_locators['submit'])
Exemple #17
0
 def logout(self):
     """Logout user from UI"""
     # Scroll to top
     self.browser.execute_script('window.scroll(0, 0)')
     if self.wait_until_element(locators['login.gravatar']) is None:
         raise UINoSuchElementError(
             'could not find login.gravatar to sign out')
     Navigator(self.browser).go_to_sign_out()
    def create(self, resource_name, name, command, parameter_list):
        """Creates a docker container. All values should be passed in absolute
        correspondence to UI. Parameters names created in self-descriptive
        manner. Of course, we can easily expand list of parameters and create
        custom flows for specific situations. Here are some examples of
        parameter_list values from each main tab::

            [
                {'main_tab_name': 'Preliminary', 'sub_tab_name': 'Location',
                'name': ['Default Location']},
                {'main_tab_name': 'Image', 'sub_tab_name': 'Content View',
                'name': 'Lifecycle Environment', 'value': self.lce.name},
                {'main_tab_name': 'Image', 'sub_tab_name': 'Docker Hub',
                'name': 'Docker Hub Tag', 'value': 'latest'},
                {'main_tab_name': 'Configuration', 'name': 'Memory',
                'value': '512m'},
                {'main_tab_name': 'Environment', 'name': 'TTY', 'value': True},
            ]
        """
        self.assign_value(locators['container.resource_name'], resource_name)
        for parameter in parameter_list:
            if parameter['main_tab_name'] == 'Preliminary':
                if parameter['sub_tab_name'] == 'Organization':
                    self._configure_orgs(parameter['name'], True)
                elif parameter['sub_tab_name'] == 'Location':
                    self._configure_locations(parameter['name'], True)
        self.click(locators['container.next_section'])
        current_tab = self._form_locator_name('Content View Tab')
        for parameter in parameter_list:
            if parameter['main_tab_name'] == 'Image':
                current_tab = self._form_locator_name(
                    parameter['sub_tab_name'] + ' Tab')
                self.click(locators[current_tab])
                self.assign_value(
                    locators[self._form_locator_name(parameter['name'])],
                    parameter['value'])
        self.click(locators[current_tab + '_next'])
        self.assign_value(locators['container.name'], name)
        self.assign_value(locators['container.command'], command)
        for parameter in parameter_list:
            if parameter['main_tab_name'] == 'Configuration':
                self.assign_value(
                    locators[self._form_locator_name(parameter['name'])],
                    parameter['value'])
        self.click(locators['container.next_section'])
        self.browser.refresh()
        for parameter in parameter_list:
            if parameter['main_tab_name'] == 'Environment':
                self.assign_value(
                    locators[self._form_locator_name(parameter['name'])],
                    parameter['value'])
        self.click(locators['container.next_section'])
        strategy, value = locators['container.created_container_name']
        element = self.wait_until_element((strategy, value % name))
        if element is None:
            raise UINoSuchElementError(
                'Container with name {0} was not created successfully'.format(
                    name))
 def create(self, name):
     """Creates the config-groups."""
     self.click(locators['config_groups.new'])
     if self.wait_until_element(locators['config_groups.name']):
         self.find_element(locators['config_groups.name']).send_keys(name)
         self.click(common_locators['submit'])
     else:
         raise UINoSuchElementError(
             'Could not text box to add config_group name')
Exemple #20
0
 def create(self, name=None, server=None, ldaps=False, port=None,
            server_type=None, login_name=None, first_name=None,
            surname=None, mail=None, photo=None, account_user=None,
            account_passwd=None, account_basedn=None,
            account_grpbasedn=None, ldap_filter=False, otf_register=True,
            orgs=None, org_select=None, locations=None, loc_select=None):
     """Create new ldap auth source from UI."""
     if not self.wait_until_element(locators['ldapsource.new']):
         return
     self.click(locators['ldapsource.new'])
     if self.wait_until_element(locators['ldapserver.name']):
         self.assign_value(locators['ldapserver.name'], name)
         self.assign_value(locators['ldapserver.server'], server)
         if ldaps:
             self.click(locators['ldapserver.ldaps'])
         if port:
             self.assign_value(locators['ldapserver.port'], port)
         self.select(locators['ldapserver.server_type'], server_type)
     self.click(tab_locators['ldapserver.tab_account'])
     if self.wait_until_element(locators['ldapserver.acc_user']) is None:
         raise UINoSuchElementError(u'Could not select the attributes Tab.')
     self.assign_value(locators['ldapserver.acc_user'], account_user)
     self.assign_value(locators['ldapserver.acc_passwd'], account_passwd)
     self.assign_value(locators['ldapserver.basedn'], account_basedn)
     self.assign_value(
         locators['ldapserver.group_basedn'], account_grpbasedn)
     if ldap_filter:
         self.click(locators['ldapserver.ldap_filter'])
     if otf_register:
         self.click(locators['ldapserver.otf_register'])
     self.click(tab_locators['ldapserver.tab_attributes'])
     if self.wait_until_element(locators['ldapserver.loginname']) is None:
         raise UINoSuchElementError(u'Could not select the account Tab.')
     self.assign_value(locators['ldapserver.loginname'], login_name)
     self.assign_value(locators['ldapserver.firstname'], first_name)
     self.assign_value(locators['ldapserver.surname'], surname)
     self.assign_value(locators['ldapserver.mail'], mail)
     if locations:
         self._configure_locations(locations, loc_select)
     if orgs:
         self._configure_orgs(orgs, org_select)
     if photo:
         self.assign_value(locators['ldapserver.photo'], photo)
     self.click(common_locators['submit'])
Exemple #21
0
 def delete(self, name):
     """Deletes an existing environment. We don't have confirmation dialog
     for current operation, so it is necessary to use custom method
     """
     element = self.search(name)
     if not element:
         raise UINoSuchElementError(
             'Could not find the %s lifecycle environment.' % name)
     element.click()
     self.click(locators['content_env.remove'])
Exemple #22
0
    def delete(self, name):
        """Deletes an existing environment."""

        strategy = locators["content_env.select_name"][0]
        value = locators["content_env.select_name"][1]
        element = self.wait_until_element((strategy, value % name))
        if element is None:
            raise UINoSuchElementError(
                'Could not find the selected environment {0}'.format(name))
        element.click()
        self.wait_until_element(locators["content_env.remove"]).click()
Exemple #23
0
 def create(self, name):
     """
     Creates the config-groups.
     """
     self.wait_until_element(locators["config_groups.new"]).click()
     if self.wait_until_element(locators["config_groups.name"]):
         self.find_element(locators["config_groups.name"]).send_keys(name)
         self.find_element(common_locators["submit"]).click()
         self.wait_for_ajax()
     else:
         raise UINoSuchElementError(
             "Could not text box to add config_group name")
Exemple #24
0
 def get_saved_value(self, tab_locator, param_name):
     """Fetch the updated value to assert"""
     self.navigate_to_entity()
     if self.wait_until_element(tab_locator):
         self.click(tab_locator)
         strategy, value = locators['settings.edit_param']
         element = self.wait_until_element((strategy, value % param_name))
         if element:
             return element.text
         else:
             raise UINoSuchElementError(
                 "Couldn't find element to fetch the param's value")
Exemple #25
0
    def assert_sync(self, repos, product=None):
        """Asserts sync status of the Repositories.

        Asserts the sync of Repositories, loops over while cancel is visible,
        during the syncing process.

        :param list repos: List of repositories names to assert sync status.
        :param str product: product is required only when syncing via
            repository page.
        :return: Returns True if sync is successful.
        :rtype: bool

        """
        repos_result = []
        strategy1, value1 = locators["sync.fetch_result"]
        strategy2, value2 = locators["sync.cancel"]
        strategy3, value3 = locators["sync.prd_expander"]
        if product:
            prd_exp = self.wait_until_element((strategy3, value3 % product))
            if not prd_exp:
                raise UINoSuchElementError(
                    "Could not find the product expander: '{0}'".format(
                        product))
            prd_exp.click()
        for repo in repos:
            timeout = time.time() + 60 * 10
            sync_cancel = self.wait_until_element(
                (strategy2, value2 % repo),
                timeout=6,
                poll_frequency=2,
            )
            # Waits until sync "cancel" is visible on the UI or times out
            # after 10 mins
            while sync_cancel:
                if time.time() > timeout:
                    break
                sync_cancel = self.wait_until_element(
                    (strategy2, value2 % repo),
                    timeout=6,
                    poll_frequency=2,
                )
            result = self.wait_until_element((strategy1, value1 % repo),
                                             5).text
            # Updates the result of every sync repo to the repos_result list.
            repos_result.append(result)
        # Checks whether every item(sync result) in the list is
        # "Syncing Complete."
        # This function returns False if it encounters any of the below:
        # "Error Syncing", "Queued", "None", "Never Synced" or "Cancel".
        if all([str(r) == "Syncing Complete." for r in repos_result]):
            return True
        else:
            return False
Exemple #26
0
    def add_remove_repos(self,
                         cv_name,
                         repo_names,
                         add_repo=True,
                         repo_type='yum'):
        """Add or Remove repository to/from selected content-view.

        When 'add_repo' Flag is set then add_repository will be performed,
        otherwise remove_repository
        """
        self.search_and_click(cv_name)
        if repo_type == 'yum':
            self.click(tab_locators['contentviews.tab_content'])
            self.click(locators['contentviews.content_repo'])
        elif repo_type == 'docker':
            self.click(tab_locators['contentviews.tab_docker_content'])
        elif repo_type == 'ostree':
            self.click(tab_locators['contentviews.tab_ostree_content'])
        locator = locators['contentviews.select_repo']
        for repo_name in repo_names:
            if add_repo:
                self.click(tab_locators['contentviews.tab_repo_add'])
            else:
                self.click(tab_locators['contentviews.tab_repo_remove'])
            self.assign_value(locators['contentviews.repo_search'], repo_name)
            self.click(locator % repo_name)
            if add_repo:
                self.click(locators['contentviews.add_repo'])
                self.click(tab_locators['contentviews.tab_repo_remove'])
                element = self.wait_until_element(locator % repo_name)
                if element is None:
                    raise UINoSuchElementError(
                        "Adding repo {0} failed".format(repo_name))
            else:
                self.click(locators['contentviews.remove_repo'])
                self.click(tab_locators['contentviews.tab_repo_add'])
                element = self.wait_until_element(locator % repo_name)
                if element is None:
                    raise UINoSuchElementError(
                        "Removing repo {0} fails".format(repo_name))
Exemple #27
0
    def update(self, tab_locator, param_name, value_type, param_value):
        """
        Updates the value of selected parameter under settings

        @param tab_locator: Selenium locator to select appropriate tab.
        @param param_name: A valid parameter name.
        @param value_type: Valid value type either 'input' or 'dropdown'
        @param param_value: Value of selected parameter

        @raise OptionError: Raise an exception when value type is different
        than 'input' and 'dropdown'.
        @raise UINoSuchElementError: Raise an exception when UI element is
        not found
        """

        if self.wait_until_element(tab_locator):
            self.find_element(tab_locator).click()
            strategy, value = locators["settings.edit_param"]
            element = self.wait_until_element((strategy,
                                               value % param_name))
            if element:
                element.click()
                if value_type == "dropdown":
                    Select(self.find_element
                           (locators["settings.select_value"])
                           ).select_by_value(param_value)
                elif value_type == "input":
                    self.field_update("settings.input_value", param_value)
                else:
                    raise OptionError(
                        "Please input appropriate value type")
                self.wait_for_ajax()
                self.wait_until_element(locators["settings.save"]).click()
                self.wait_for_ajax()
            else:
                raise UINoSuchElementError(
                    "Couldn't find edit button to update selected param")
        else:
            raise UINoSuchElementError(
                "Couldn't find the tab with name: '%s'" % tab_locator)
Exemple #28
0
    def get_cv_table_value(self, cv_name, column_name):
        """Get value for specific table cell

        :param str cv_name: Name of content view to be fetched
        :param str column_name: Name of table column that needs to be fetched
        :return str: Cell value text
        """
        element = self.search(cv_name)
        if element is None:
            raise UINoSuchElementError(
                'Unable to find necessary cv "{0}".'.format(cv_name))
        return self.wait_until_element(common_locators['kt_table_cell_value'] %
                                       (cv_name, column_name)).text
Exemple #29
0
 def validate_version_deleted(self, cv_name, version):
     """Ensures the version is deleted from selected CV"""
     element = self.search(cv_name)
     if element is None:
         raise UINoSuchElementError('Could not find CV %s', cv_name)
     element.click()
     self.wait_for_ajax()
     strategy, value = locators['contentviews.version_name']
     removed_version = self.find_element((strategy, value % version))
     if removed_version:
         raise UIError(
             'Selected version "{0}" was not deleted successfully'.format(
                 version))
Exemple #30
0
 def update(self, old_name, new_name):
     """Updates existing compute profile entity"""
     element = self.search(old_name)
     if element is None:
         raise UINoSuchElementError(
             'Could not find compute profile {0}'.format(old_name))
     if element:
         strategy, value = locators['profile.dropdown']
         self.click((strategy, value % old_name))
         strategy, value = locators['profile.rename']
         self.click((strategy, value % old_name))
         self.field_update('profile.name', new_name)
         self.click(common_locators['submit'])