Ejemplo n.º 1
0
class BaseLoggedInView(View):
    menu = SatVerticalNavigation(
        './/div[@id="vertical-nav" or contains(@class, "nav-pf-vertical")]/ul')
    taxonomies = ContextSelector()
    flash = SatFlashMessages()
    validations = ValidationErrors()
    current_user = Text("//a[@id='account_menu']")
    account_menu = Text("//a[@id='account_menu']")
    logout = Text("//a[@href='/users/logout']")

    def select_logout(self):
        """logout from satellite"""
        self.account_menu.click()
        self.logout.click()

    def read(self, widget_names=None):
        """Reads the contents of the view and presents them as a dictionary.

        widget_names: If specified , will read only the widgets which names is in the list.

        Returns:
            A :py:class:`dict` of ``widget_name: widget_read_value`` where the values are retrieved
            using the :py:meth:`Widget.read`.
        """
        if widget_names is None:
            return super().read()
        if not isinstance(widget_names, (list, tuple)):
            widget_names = [widget_names]
        values = {}
        for widget_name in widget_names:
            values[widget_name] = get_widget_by_name(self, widget_name).read()
        return normalize_dict_values(values)
Ejemplo n.º 2
0
class BaseLoggedInView(View):
    menu = SatVerticalNavigation(
        './/div[@id="vertical-nav" or contains(@class, "nav-pf-vertical")]/ul')
    taxonomies = ContextSelector()
    flash = SatFlashMessages(
        locator='//div[@class="toast-notifications-list-pf"]')
    validations = ValidationErrors()
    # TODO Defining current user procedure needs to be improved as it is not
    # simple field, but a dropdown menu that contains more items/actions
    current_user = Text("//a[@id='account_menu']")

    def read(self, widget_names=None):
        """Reads the contents of the view and presents them as a dictionary.

        widget_names: If specified , will read only the widgets which names is in the list.

        Returns:
            A :py:class:`dict` of ``widget_name: widget_read_value`` where the values are retrieved
            using the :py:meth:`Widget.read`.
        """
        if widget_names is None:
            return super().read()
        if not isinstance(widget_names, (list, tuple)):
            widget_names = [widget_names]
        values = {}
        for widget_name in widget_names:
            values[widget_name] = get_widget_by_name(self, widget_name).read()
        return normalize_dict_values(values)
Ejemplo n.º 3
0
class BaseLoggedInView(View):
    menu = SatVerticalNavigation('.//div[@id="vertical-nav"]/ul')
    taxonomies = ContextSelector()
    flash = SatFlashMessages(
        locator='//div[@class="toast-notifications-list-pf"]')
    validations = ValidationErrors()
    # TODO Defining current user procedure needs to be improved as it is not
    # simple field, but a dropdown menu that contains more items/actions
    current_user = Text("//a[@id='account_menu']")