Пример #1
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.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)
Пример #2
0
class CustomSavedReportDetailsView(CloudIntelReportsView):
    title = Text("#explorer_title_text")
    table = VanillaTable(".//div[@id='report_html_div']/table")
    # PaginationPane() is not working on Report Details page
    paginator = View.nested(NonJSPaginationPane)
    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):
        return (self.in_intel_reports and self.reports.is_opened
                and self.reports.tree.currently_selected == [
                    "All Reports", self.mycompany_title, "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))
Пример #3
0
class AllReportsView(CloudIntelReportsView):
    title = Text("#explorer_title_text")
    reports_table = VanillaTable(".//div[@id='report_list_div']/table")

    @property
    def is_displayed(self):
        return (self.in_intel_reports and self.reports.is_opened
                and self.reports.tree.currently_selected == ["All Reports"]
                and self.title.text == "All Reports"
                and self.reports_table.is_displayed)
Пример #4
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)