class AnalysisProfileAllView(BaseLoggedInPage):
    """View for the Analysis Profile collection page"""
    @property
    def is_displayed(self):
        return (self.logged_in_as_current_user
                and self.sidebar.accordions.settings.tree.selected_item.text
                == 'Analysis Profiles'
                and self.entities.title.text == 'Settings Analysis Profiles')

    toolbar = View.nested(AnalysisProfileToolbar)
    sidebar = View.nested(ConfigurationView)
    entities = View.nested(AnalysisProfileEntities)
    paginator = PaginationPane()
Esempio n. 2
0
class ProvidersView(BaseLoggedInPage):
    """
     represents Main view displaying all providers
    """
    @property
    def is_displayed(self):
        return self.logged_in_as_current_user

    paginator = PaginationPane()
    toolbar = View.nested(ProviderToolBar)
    sidebar = View.nested(ProviderSideBar)
    search = View.nested(Search)
    including_entities = View.include(ProviderEntitiesView, use_parent=True)
Esempio n. 3
0
class AllSavedReportsView(CloudIntelReportsView):
    title = Text("#explorer_title_text")
    table = Table(".//div[@id='records_div']/table")
    paginator = PaginationPane()

    @property
    def is_displayed(self):
        return (
            self.in_intel_reports and
            self.saved_reports.is_opened and
            self.saved_reports.tree.currently_selected == ["All Saved Reports"] and
            self.title.text == "All Saved Reports"
        )
Esempio n. 4
0
class ScheduleAllView(ConfigurationView):
    """ Shedule All view on the shedule configuration page"""
    toolbar = View.nested(ScheduleToolbar)
    table = Table(locator="//div[@id='records_div' or @id='main_div']//table")
    paginator = PaginationPane()

    @property
    def is_displayed(self):
        return (self.in_configuration
                and self.accordions.settings.tree.currently_selected == [
                    self.context['object'].zone.region.settings_string,
                    'Schedules'
                ] and self.title == 'Settings Schedules')
Esempio n. 5
0
class MyServicesView(MyServiceForm):
    title = Text(locator='//li[@class="active"]')
    results = Text(
        locator='//div[contains(@class, "toolbar-pf-results")]/*/h5')
    paginator = PaginationPane()

    @property
    def in_myservices(self):
        return (self.logged_in_as_current_user
                and self.navigation.currently_selected == ["", "My Services"])

    @property
    def is_displayed(self):
        return self.in_myservices and self.title.text == "My Services"
Esempio n. 6
0
class AllGroupView(ConfigurationView):
    """ All Groups View in CFME UI """
    configuration = Dropdown('Configuration')
    policy = Dropdown('Policy')

    table = Table("//div[@id='main_div']//table")
    paginator = PaginationPane()

    @property
    def is_displayed(self):
        return (
            self.accordions.accesscontrol.is_opened and
            self.title.text == 'Access Control EVM Groups'
        )
class ScheduleAllView(ConfigurationView):
    """ Shedule All view on the shedule configuration page"""
    toolbar = View.nested(ScheduleToolbar)
    table = Table('//div[@id="main_div"]//table')
    paginator = PaginationPane()

    @property
    def is_displayed(self):
        expected_tree = [
            self.context['object'].appliance.server.zone.region.
            settings_string, 'Schedules'
        ]
        return (self.in_configuration
                and self.accordions.settings.tree.currently_selected
                == expected_tree and self.title.text == 'Settings Schedules')
Esempio n. 8
0
class KeyPairAllView(KeyPairView):
    @property
    def is_displayed(self):
        return (self.in_keypair and self.entities.title.text == 'Key Pairs')

    paginator = PaginationPane()
    toolbar = View.nested(KeyPairToolbar)
    search = View.nested(Search)
    including_entities = View.include(BaseEntitiesView, use_parent=True)

    @View.nested
    class my_filters(Accordion):  # noqa
        ACCORDION_NAME = "My Filters"

        navigation = BootstrapNav('.//div/ul')
        tree = ManageIQTree()
Esempio n. 9
0
class CredentialsListView(CredentialsBaseView):
    @View.nested
    class toolbar(View):  # noqa
        configuration = Dropdown("Configuration")
        policy = Dropdown(text='Policy')

    credentials = Table(
        VersionPick({
            Version.lowest(): ".//div[@id='list_grid']/table",
            "5.9": ".//div[@id='miq-gtl-view']//table"
        }))
    paginator = PaginationPane()

    @property
    def is_displayed(self):
        return self.in_ansible_credentials and self.title.text == "Credentials"
Esempio n. 10
0
class InstanceAllView(CloudInstanceView):
    """
    The collection page for instances
    """
    @property
    def is_displayed(self):
        return (self.in_cloud_instance
                and self.entities.title.text == 'All Instances'
                and self.sidebar.instances.is_opened)

    actions = View.nested(CompareToolBarActionsView)
    toolbar = View.nested(VMToolbar)
    sidebar = View.nested(InstanceAccordion)
    search = View.nested(Search)
    including_entities = View.include(VMEntities, use_parent=True)
    paginator = PaginationPane()
Esempio n. 11
0
class HostsView(ComputeInfrastructureHostsView):
    toolbar = View.nested(HostsToolbar)

    @View.nested
    class filters(Accordion):  # noqa
        ACCORDION_NAME = "Filters"

        navigation = BootstrapNav('.//div/ul')
        tree = ManageIQTree()

    default_filter_btn = Button(title="Set the current filter as my default")
    paginator = PaginationPane()
    including_entities = View.include(HostEntitiesView, use_parent=True)

    @property
    def is_displayed(self):
        return self.in_compute_infrastructure_hosts and self.title.text in "Hosts / Nodes"
Esempio n. 12
0
class HostAggregatesAllView(HostAggregatesView):
    toolbar = HostAggregatesToolBar()
    paginator = PaginationPane()
    search = View.nested(Search)
    including_entities = View.include(HostAggregatesEntities, use_parent=True)

    @View.nested
    class my_filters(Accordion):  # noqa
        ACCORDION_NAME = "My Filters"

        navigation = BootstrapNav('.//div/ul')
        tree = ManageIQTree()

    @property
    def is_displayed(self):
        return (self.in_host_aggregates
                and self.entities.title.text == 'Host Aggregates')
Esempio n. 13
0
class FlavorAllView(FlavorView):
    toolbar = FlavorToolBar()
    paginator = PaginationPane()
    search = View.nested(Search)
    including_entities = View.include(FlavorEntities, use_parent=True)

    @View.nested
    class my_filters(Accordion):  # noqa
        ACCORDION_NAME = "My Filters"

        navigation = BootstrapNav('.//div/ul')
        tree = ManageIQTree()

    @property
    def is_displayed(self):
        return (self.in_availability_zones
                and self.entities.title.text == 'Flavors')
Esempio n. 14
0
class ReportDetailsView(CloudIntelReportsView):
    title = Text("#explorer_title_text")
    reload_button = Button(title='Refresh this page')
    paginator = PaginationPane()

    @View.nested
    class report_info(WaitTab):  # noqa
        TAB_NAME = "Report Info"
        # Keeping `group_title` empty since the summary form has no title
        report_id = SummaryFormItem("", "ID")
        title = SummaryFormItem("", "Title")
        primary_filter = SummaryFormItem("", "Primary (Record) Filter")
        secondary_filter = SummaryFormItem("", "Secondary (Display) Filter")
        sort_by = SummaryFormItem("", "Sort By")
        based_on = SummaryFormItem("", "Based On")
        user = SummaryFormItem("", "User")
        group = SummaryFormItem("", "EVM Group")
        updated_on = SummaryFormItem("", "Updated On")
        # xpath is defined based on the value of the second title head of table
        report_schedule_data = Table(
            '//*[@id="report_info"]//th[contains(text(), "Name")]'
            '/parent::tr/parent::thead/parent::table'
        )
        report_widgets_data = Table(
            '//*[@id="report_info"]//th[contains(text(), "Title")]'
            '/parent::tr/parent::thead/parent::table'
        )
        queue_button = Button("Queue")

    @View.nested
    class saved_reports(WaitTab):  # noqa
        TAB_NAME = "Saved Reports"
        table = Table(".//div[@id='records_div' or @class='miq-data-table']/table")
        paginator = PaginationPane()

    @property
    def is_displayed(self):
        expected_title = 'Report "{}"'.format(self.context["object"].menu_name)
        return (
            self.in_intel_reports and
            self.reports.is_opened and
            self.report_info.is_displayed and
            self.reports.tree.currently_selected == self.context["object"].tree_path and
            self.title.text == expected_title
        )
Esempio n. 15
0
class SavedReportDetailsView(CloudIntelReportsView):
    title = Text("#explorer_title_text")
    table = VanillaTable(".//div[@id='report_html_div']/table")
    # PaginationPane() is not working on Report Details page
    # TODO: double check and raise GH to devs
    paginator = PaginationPane()
    view_selector = View.nested(ReportToolBarViewSelector)

    @View.nested
    class data_view(View):  # noqa
        def child_widget_accessed(self, widget):
            if self.parent.view_selector.selected != "Data View":
                self.parent.view_selector.select("Data View")

        table = Table('//*[@id="report_list_div"]//table')
        paginator = PaginationPane()
        field = SelectorDropdown("id", "filterFieldTypeMenu")
        search_text = SearchBox(
            locator='//input[contains(@placeholder, "search text")]')

    @ParametrizedView.nested
    class download(ParametrizedView):  # noqa
        PARAMETERS = ("format", )
        ALL_LINKS = ".//a[starts-with(@name, 'download_choice__render_report_')]"
        download = Button(title="Download")
        link = Text(
            ParametrizedLocator(".//a[normalize-space()={format|quote}]"))

        def __init__(self, *args, **kwargs):
            ParametrizedView.__init__(self, *args, **kwargs)
            self.download.click()
            self.link.click()

        @classmethod
        def all(cls, browser):
            return [(browser.text(e), )
                    for e in browser.elements(cls.ALL_LINKS)]

    @property
    def is_displayed(self):
        return (self.in_intel_reports and self.reports.is_opened
                and self.reports.tree.currently_selected
                == self.context["object"].tree_path
                and self.context["object"].queued_datetime_in_title
                in self.title.text)
Esempio n. 16
0
class RequestsView(RequestBasicView):
    table = Table(locator='//*[@id="list_grid"]/table')
    paginator = PaginationPane()

    def find_request(self, cells, partial_check=False):
        """Finds the request and returns the row element
        Args:
            cells: Search data for the requests table.
            partial_check: If to use the ``__contains`` operator
        Returns: row
        """
        contains = '' if not partial_check else '__contains'
        column_list = self.table.attributized_headers
        cells = copy(cells)
        for key in cells.keys():
            for column_name, column_text in column_list.items():
                if key == column_text:
                    cells['{}{}'.format(column_name,
                                        contains)] = cells.pop(key)
                    break

        # TODO Replace Paginator with paginator_pane after 1450002 gets resolved
        from cfme.web_ui import paginator
        for page in paginator.pages():
            rows = list(self.table.rows(**cells))
            if len(rows) == 0:
                # row not on this page, assume it has yet to appear
                # it might be nice to add an option to fail at this point
                continue
            elif len(rows) > 1:
                raise RequestException(
                    'Multiple requests with matching content found - be more specific!'
                )
            else:
                # found the row!
                row = rows[0]
                logger.debug(' Request Message: %s', row.last_message.text)
                return row
        else:
            raise Exception("The requst specified by {} not found!".format(
                str(cells)))

    @property
    def is_displayed(self):
        return self.in_requests and self.title.text == 'Requests'
Esempio n. 17
0
class TenantAllView(TenantView):
    """The all tenants page"""
    toolbar = View.nested(TenantToolbar)
    including_entities = View.include(TenantEntities, use_parent=True)
    paginator = PaginationPane()
    search = View.nested(Search)

    @View.nested
    class my_filters(Accordion):  # noqa
        ACCORDION_NAME = "My Filters"

        navigation = BootstrapNav('.//div/ul')
        tree = ManageIQTree()

    @property
    def is_displayed(self):
        """This is page currently being displayed"""
        return self.in_tenants and self.entities.title.text == 'Cloud Tenants'
Esempio n. 18
0
class StackAllView(StackView):
    """The main list page"""
    toolbar = View.nested(StackToolbar)
    search = View.nested(Search)
    including_entities = View.include(StackEntities, use_parent=True)
    paginator = PaginationPane()

    @View.nested
    class my_filters(Accordion):  # noqa
        ACCORDION_NAME = "My Filters"

        navigation = BootstrapNav('.//div/ul')
        tree = ManageIQTree()

    @property
    def is_displayed(self):
        """Is this page currently being displayed"""
        return self.in_stacks and self.entities.title.text == 'Orchestration Stacks'
Esempio n. 19
0
class SavedReportDetailsView(CloudIntelReportsView):
    title = Text("#explorer_title_text")
    table = VanillaTable(".//div[@id='report_html_div']/table")
    # PaginationPane() is not working on Report Details page
    # TODO: double check and raise GH to devs
    paginator = PaginationPane()
    view_selector = View.nested(ReportToolBarViewSelector)

    @ParametrizedView.nested
    class download(ParametrizedView):  # noqa
        PARAMETERS = ("format", )
        ALL_LINKS = ".//a[starts-with(@name, 'download_choice__render_report_')]"
        download_button = Button(title="Download")
        link = Text(
            ParametrizedLocator(".//a[normalize-space()={format|quote}]"))

        def __init__(self, *args, **kwargs):
            ParametrizedView.__init__(self, *args, **kwargs)
            self.download_button.click()
            self.link.click()

        @classmethod
        def all(cls, browser):
            return [(browser.text(e), )
                    for e in browser.elements(cls.ALL_LINKS)]

    @property
    def is_displayed(self):
        expected_tree = [
            "All Reports", self.context["object"].report.type
            or self.context["object"].report.company_name,
            self.context["object"].report.subtype or "Custom",
            self.context["object"].report.menu_name,
            self.context["object"].datetime_in_tree
        ]
        expected_title = 'Saved Report "{} - {}"'.format(
            self.context["object"].report.title
            or self.context['object'].report.menu_name,
            self.context["object"].queued_datetime_in_title)
        return (self.in_intel_reports and self.reports.is_opened
                and self.reports.tree.currently_selected == expected_tree
                and self.title.text == expected_title)
Esempio n. 20
0
class ProvidersView(BaseLoggedInPage):
    """
     represents Main view displaying all providers
    """
    @property
    def is_displayed(self):
        return self.logged_in_as_current_user

    paginator = PaginationPane()
    toolbar = View.nested(ProviderToolBar)
    sidebar = View.nested(ProviderSideBar)
    search = View.nested(Search)
    including_entities = View.include(ProviderEntitiesView, use_parent=True)

    @View.nested
    class my_filters(Accordion):  # noqa
        ACCORDION_NAME = "My Filters"

        navigation = BootstrapNav('.//div/ul')
        tree = ManageIQTree()
Esempio n. 21
0
class CustomSavedReportDetailsView(CloudIntelReportsView):
    title = Text("#explorer_title_text")
    table = VanillaTable(".//div[@id='report_html_div']/table")
    paginator = PaginationPane()

    @ParametrizedView.nested
    class download(ParametrizedView):  # noqa
        PARAMETERS = ("format", )
        ALL_LINKS = ".//a[starts-with(@name, 'download_choice__render_report_')]"
        download_button = Button(title="Download")
        link = Text(ParametrizedLocator(".//a[normalize-space()={format|quote}]"))

        def __init__(self, *args, **kwargs):
            ParametrizedView.__init__(self, *args, **kwargs)
            self.download_button.click()
            self.link.click()

        @classmethod
        def all(cls, browser):
            return [(browser.text(e), ) for e in browser.elements(cls.ALL_LINKS)]

    @property
    def is_displayed(self):
        return (
            self.in_intel_reports and
            self.reports.is_opened and
            self.reports.tree.currently_selected == [
                "All Reports",
                "My Company (All EVM Groups)",
                "Custom",
                self.context["object"].report.menu_name,
                self.context["object"].datetime_in_tree
            ] and
            self.title.text == 'Saved Report "{} - {}"'.format(
                self.context["object"].report.title,
                self.context["object"].queued_datetime_in_title
            )
        )
Esempio n. 22
0
class HostsView(ComputeInfrastructureHostsView):
    toolbar = View.nested(HostsToolbar)

    @View.nested
    class filters(Accordion):  # noqa
        ACCORDION_NAME = "Filters"

        @View.nested
        class navigation(VerticalNavigation): # noqa
            DIV_LINKS_MATCHING = './/div/ul/li/a[contains(text(), {txt})]'

            def __init__(self, parent, logger=None):
                VerticalNavigation.__init__(self, parent, '#Host_def_searches', logger=logger)

        tree = ManageIQTree()

    default_filter_btn = Button(title="Set the current filter as my default")
    paginator = PaginationPane()
    including_entities = View.include(HostEntitiesView, use_parent=True)

    @property
    def is_displayed(self):
        return self.in_compute_infrastructure_hosts and self.title.text in "Hosts / Nodes"
Esempio n. 23
0
class SavedReportDetailsView(CloudIntelReportsView):
    title = Text("#explorer_title_text")
    table = VanillaTable(".//div[@id='report_html_div']/table")
    # PaginationPane() is not working on Report Details page
    # TODO: double check and raise GH to devs
    paginator = PaginationPane()
    view_selector = View.nested(ReportToolBarViewSelector)
    download = Dropdown("Download")

    @View.nested
    class data_view(View):  # noqa
        table = Table('//*[@id="report_list_div"]//table')
        field = SelectorDropdown("id", "filterFieldTypeMenu")
        search_text = SearchBox(
            locator='//input[contains(@placeholder, "search text")]')

        # TODO: Write a separate paginator for data view
        def child_widget_accessed(self, widget):
            if self.parent.view_selector.selected != "Data View":
                self.parent.view_selector.select("Data View")

        @property
        def is_displayed(self):
            return (self.field.is_displayed and self.search_text.is_displayed
                    and self.table.is_displayed)

    @property
    def is_displayed(self):
        return (self.in_intel_reports and self.reports.is_opened
                and self.reports.tree.currently_selected
                == self.context["object"].tree_path
                and self.context["object"].queued_datetime_in_title
                in self.title.text and self.breadcrumb.locations == [
                    "Overview", "Reports", "Reports",
                    self.context["object"].datetime_in_tree
                ])
Esempio n. 24
0
 class saved_reports(Tab):  # noqa
     TAB_NAME = "Saved Reports"
     table = Table(
         ".//div[@id='records_div' or @class='miq-data-table']/table")
     paginator = PaginationPane()
Esempio n. 25
0
class NodeAllView(NodeView):
    @property
    def is_displayed(self):
        return (self.in_cloud_instance and match_page(summary='Nodes'))

    paginator = PaginationPane()
Esempio n. 26
0
"""A set of functions for dealing with the paginator controls."""
from cfme.exceptions import PaginatorException
from widgetastic_manageiq import PaginationPane
from utils.appliance import get_or_create_current_appliance

appliance = get_or_create_current_appliance()
new_paginator = PaginationPane(parent=appliance.browser.widgetastic)


def page_controls_exist():
    """ Simple check to see if page controls exist. """
    return new_paginator.is_displayed


def _page_nums():
    return new_paginator.pages_amount


def check_all():
    """ selects all items """
    new_paginator.check_all()


def uncheck_all():
    """ unselects all items """
    new_paginator.uncheck_all()


def next():
    """ Returns the Next button locator."""
    new_paginator.next_page()
Esempio n. 27
0
class VMPropertyDetailView(View):
    title = Text(
        '//div[@id="main-content"]//h1//span[@id="explorer_title_text"]')
    table = Table('//div[@id="gtl_div"]//table')

    paginator = PaginationPane()
Esempio n. 28
0
class ProvisionView(BaseLoggedInPage):
    """
    The provisioning view, with nested ProvisioningForm as `form` attribute.
    Handles template selection before Provisioning form with `before_fill` method
    """
    title = Text('#explorer_title_text')
    breadcrumb = BreadCrumb()
    image_table = Table('//div[@id="pre_prov_div"]//table')
    paginator = PaginationPane()

    @View.nested
    class sidebar(View):  # noqa
        increase_button = Text(
            locator='//div[contains(@class, "resize-right")]')
        decrease_button = Text(
            locator='//div[contains(@class, "resize-left")]')

    @View.nested
    class form(BasicProvisionFormView):  # noqa
        """First page of provision form is image selection
        Second page of form is tabbed with nested views
        """
        continue_button = Button(
            'Continue')  # Continue button on 1st page, image selection
        submit_button = Button('Submit')  # Submit for 2nd page, tabular form
        cancel_button = Button('Cancel')

        def _select_template(self, template_name, provider_name):
            try:
                self.parent.paginator.find_row_on_pages(
                    self.parent.image_table,
                    name=template_name,
                    provider=provider_name).click()
            # image was not found, therefore raise an exception
            except IndexError:
                raise ItemNotFound(
                    'Cannot find template "{}" for provider "{}"'.format(
                        template_name, provider_name))

        def before_fill(self, values):
            # Provision from image is a two part form,
            # this completes the image selection before the tabular parent form is filled
            template_name = values.get('template_name')
            provider_name = values.get('provider_name')
            if template_name is None or provider_name is None:
                logger.error(
                    'template_name "{}", or provider_name "{}" not passed to '
                    'provisioning form', template_name, provider_name)
            # try to find the template anyway, even if values weren't passed
            self._select_template(template_name, provider_name)
            # workaround for provision table template select(template was not clicked)
            if self.continue_button.disabled:
                self.parent.sidebar.decrease_button.click()
                self._select_template(template_name, provider_name)
            self.continue_button.click()
            wait_for(self.browser.plugin.ensure_page_safe,
                     delay=.1,
                     num_sec=10)

        def after_fill(self, was_change):
            wait_for(self.browser.plugin.ensure_page_safe,
                     delay=.1,
                     num_sec=10)

    is_displayed = displayed_not_implemented
Esempio n. 29
0
def new_paginator():
    """ Simple function to avoid module level import """
    appliance = get_or_create_current_appliance()
    paginator = PaginationPane(parent=appliance.browser.widgetastic)
    return paginator
class ProvDiagAllEntities(View):
    """All entities view - no view selector, not using BaseEntitiesView"""
    title = Text('#explorer_title_text')
    table = Table("//div[@id='records_div']//table")
    paginator = PaginationPane()