class DiagnosticServerWorkersView(ServerDiagnosticsView): toolbar = View.nested(DiagnosticServerWorkersToolbar) workers_table = Table('//div[@id="diagnostics_workers"]//table') @property def is_displayed(self): return (self.workers.is_displayed and self.workers.is_active and self.title.text == 'Diagnostics Server "{} [{}]" (current)'.format( self.context['object'].name, self.context['object'].sid))
class AnalysisProfileDetailsEntities(View): """Main content on an analysis profile details page""" title = Text('//div[@id="main-content"]//h1[@id="explorer_title"]' '/span[@id="explorer_title_text"]') info_name = SummaryFormItem(group_title='Info', item_name='Name') info_description = SummaryFormItem(group_title='Info', item_name='Description') info_type = SummaryFormItem(group_title='Info', item_name='Type') table = Table( '//h3[normalize-space(.)="File Items"]/following-sibling::table')
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")
class ProviderScaleDownView(View): """ represents Scale down view """ table = Table(locator='//div[contains(@class, "form-horizontal")]//table') checkbox = Checkbox(name='host_ids[]') scale_down = Button('Scale Down') cancel = Button('Cancel') is_displayed = displayed_not_implemented
class InstanceEntities(View): title = Text( '//div[@id="main-content"]//h1//span[@id="explorer_title_text"]') adv_search_clear = Text( '//div[@id="main-content"]//h1//span[@id="clear_search"]/a') flash = FlashMessages( './/div[@id="flash_msg_div"]' '/div[@id="flash_text_div" or contains(@class, "flash_text_div")]') search = View.nested(Search) table = Table("//div[@id='list_grid']//table")
class PXECustomizationTemplatesView(PXEMainView): """ represents Customization Template Groups page """ entities = Table(locator='.//div[@id="template_folders_div"]/table') @property def is_displayed(self): return (super(PXECustomizationTemplatesView, self).is_displayed and self.title.text == 'All Customization Templates - System Image Types')
class DomainDetailsView(AutomateExplorerView): title = Text('#explorer_title_text') namespaces = Table('#ns_details_grid') @property def is_displayed(self): return ( self.in_explorer and self.title.text == 'Automate Domain "{}"'.format( self.context['object'].table_display_name))
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
class TemplateTypeView(ServicesCatalogView): templates = Table("//table[@class='table table-striped table-bordered " "table-hover table-selectable]'") @property def is_displayed(self): return ( self.title.text == 'All {}'.format(self.obj.template_type) and self.orchestration_templates.is_opened )
class AlertsAllView(ControlExplorerView): title = Text("#explorer_title_text") table = Table(".//div[@id='alert_list_div' or @class='miq-data-table']/table") @property def is_displayed(self): return ( self.in_control_explorer and self.title.text == "All Alerts" and self.alerts.tree.currently_selected == ["All Alerts"] )
class CredentialsListView(CredentialsBaseView): configuration = Dropdown("Configuration") credentials = Table( VersionPick({ Version.lowest(): ".//div[@id='list_grid']/table", "5.9": ".//div[@id='miq-gtl-view']//table" })) @property def is_displayed(self): return self.in_ansible_credentials and self.title.text == "Credentials"
class AllSavedReportsView(CloudIntelReportsView): title = Text("#explorer_title_text") table = Table(".//div[@id='records_div' or @id='main_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")
class HostDriftHistory(ComputeInfrastructureHostsView): breadcrumb = BreadCrumb(locator='.//ol[@class="breadcrumb"]') history_table = Table(locator='.//div[@id="main_div"]/table') analyze_button = Button( title="Select up to 10 timestamps for Drift Analysis") @property def is_displayed(self): return (self.in_compute_infrastructure_hosts and self.title.text == "Drift History" and self.history_table.is_displayed)
class DomainListView(AutomateExplorerView): title = Text('#explorer_title_text') domains = Table('#ns_list_grid') @property def is_displayed(self): return ( self.in_explorer and self.title.text == 'Datastore' and self.datastore.is_opened and self.datastore.tree.currently_selected == ['Datastore'])
class DriftHistory(BaseLoggedInPage): title = Text('#explorer_title_text') breadcrumb = BreadCrumb(locator='.//ol[@class="breadcrumb"]') history_table = Table(locator='.//div[@id="main_div"]/table') analyze_button = Button( title="Select up to 10 timestamps for Drift Analysis") @property def is_displayed(self): return ("Drift History" in self.title.text and self.history_table.is_displayed)
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")
class TimeProfileAddForm(View): description = Input(id='description') scope = BootstrapSelect('profile_type') timezone = BootstrapSelect('profile_tz') days = BootstrapSwitch(name='all_days') hours = BootstrapSwitch(name='all_hours') save_button = Button(VersionPick({Version.lowest(): 'Add', '5.8': 'Save'})) configuration = Dropdown('Configuration') table = Table("//div[@id='main_div']//table") save_edit_button = Button('Save') cancel_button = Button('Cancel')
class DialogsView(AutomateCustomizationView): title = Text("#explorer_title_text") paginator = PaginationPane() table = Table(".//div[@id='list_grid' or @class='miq-data-table']/table") @property def is_displayed(self): return (self.in_customization and self.title.text == 'All Dialogs' and self.service_dialogs.is_opened and self.service_dialogs.tree.currently_selected == ["All Dialogs"])
class TemplateTypeView(ServicesCatalogView): title = Text('#explorer_title_text') templates = Table("//table[@class='table table-striped table-bordered " "table-hover table-selectable]'") paginator = PaginationPane() @property def is_displayed(self): return (self.title.text == 'All {}'.format( self.context['object'].template_type) and self.orchestration_templates.is_opened)
class AllCatalogItemView(ServicesCatalogView): title = Text('#explorer_title_text') table = Table('//*[@id="miq-gtl-view"]/miq-data-table/div/table') @property def is_displayed(self): return (self.in_explorer and self.title.text == 'All Service Catalog Items' and self.catalog_items.is_opened and self.catalog_items.tree.currently_selected == ['All Catalog Items'])
class NamespaceDetailsView(AutomateExplorerView): title = Text('#explorer_title_text') namespaces = Table('#ns_details_grid') @property def is_displayed(self): return (self.in_explorer and self.title.text == 'Automate Namespace "{}"'.format( self.context['object'].name) and self.datastore.is_opened and check_tree_path(self.datastore.tree.currently_selected, self.context['object'].tree_path))
class ProviderScaleDownView(View): """ represents Scale down view """ table = Table(locator='//div[contains(@class, "form-horizontal")]//table') checkbox = Checkbox(name='host_ids[]') scale_down = Button('Scale Down') cancel = Button('Cancel') @property def is_displayed(self): return False
class ContainersProvidersView(ProvidersView): """ represents Main view displaying all Containers providers """ table = Table(locator="//div[@id='list_grid']//table") @property def is_displayed(self): return (super(ContainersProvidersView, self).is_displayed and self.navigation.currently_selected == ['Compute', 'Containers', 'Providers'] and self.entities.title.text == 'Containers Providers')
class PXEMainView(BaseLoggedInPage): """ represents whole All PXE Servers page """ toolbar = View.nested(PXEToolBar) sidebar = View.nested(PXESideBar) title = Text('//div[@id="main-content"]//h1') entities = Table(locator='.//div[@id="records_div" or @id="main_div"]//table') @property def is_displayed(self): return self.navigation.currently_selected == ['Compute', 'Infrastructure', 'PXE']
class ImportExportWidgetsCommitView(CloudIntelReportsView): title = Text("#explorer_title_text") table = Table(".//form[@id='import-widgets-form']/table") commit_button = Button(value="Commit") cancel_button = Button(value="Cancel") @property def is_displayed(self): return (self.in_intel_reports and self.title.text == "Import / Export" and self.import_export.tree.currently_selected == ["Import / Export", "Widgets"])
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') @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: row = self.parent.image_table.row(name=template_name, provider=provider_name) row.click() except IndexError: raise TemplateNotFound('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() # TODO timing, wait_displayed is timing out and can't get it to stop in is_displayed sleep(3) self.flush_widget_cache() @property def is_displayed(self): return False
class RepositoryAllView(RepositoryBaseView): @View.nested class toolbar(View): # noqa configuration = Dropdown("Configuration") policy = Dropdown(text='Policy') entities = Table(".//div[@id='gtl_div']//table") paginator = PaginationPane() @property def is_displayed(self): return self.in_ansible_repositories and self.title.text == "Repositories"
class CredentialsListView(CredentialsBaseView): @View.nested class toolbar(View): # noqa configuration = Dropdown("Configuration") policy = Dropdown(text='Policy') credentials = Table(".//div[@id='miq-gtl-view']//table") paginator = PaginationPane() @property def is_displayed(self): return self.in_ansible_credentials and self.title.text == "Credentials"
class InstanceDetailsView(AutomateExplorerView): title = Text('#explorer_title_text') table = Table('#instance_fields_grid') @property def is_displayed(self): return (self.in_explorer and self.title.text.startswith( 'Automate Instance [{}'.format(self.context['object'].display_name or self.context['object'].name)) and self.datastore.is_opened and check_tree_path(self.datastore.tree.currently_selected, self.context['object'].tree_path))
class HostEditTagsView(BaseLoggedInPage): """Host's Edit Tags view.""" tag_category = BootstrapSelect("tag_cat") tag = BootstrapSelect("tag_add") chosen_tags = Table(locator='.//div[@id="assignments_div"]/table') save_button = Button("Save") reset_button = Button("Reset") cancel_button = Button("Cancel") @property def is_displayed(self): return False