class AllGenericObjectInstanceView(BaseLoggedInPage): @View.nested class toolbar(View): # noqa reload = Button(title=VersionPick({ Version.lowest(): 'Reload current display', '5.9': 'Refresh this page' })) policy = Dropdown(text='Policy') download = Dropdown(text='Download') view_selector = View.nested(ItemsToolBarViewSelector) title = Text('.//div[@id="main-content"]//h1') including_entities = View.include(BaseEntitiesView, use_parent=True) @property def is_displayed(self): return self.title.text == '{} (All Generic Objects)'.format( self.context['object'].name)
class VolumeBackupAllView(VolumeBackupView): """The all Volume Backup page""" toolbar = View.nested(VolumeBackupToolbar) search = View.nested(Search) including_entities = View.include(BaseEntitiesView, use_parent=True) @property def is_displayed(self): return ( self.in_volume_backup and self.title.text == 'Cloud Volume Backups') @View.nested class my_filters(Accordion): # noqa ACCORDION_NAME = "My Filters" navigation = BootstrapNav('.//div/ul') tree = ManageIQTree()
class ConfigManagementDetailsView(ConfigManagementView): """The details page""" toolbar = View.nested(ConfigManagementToolbar) sidebar = View.nested(ConfigManagementSideBar) including_entities = View.include(ConfigManagementEntities, use_parent=True) @property def is_displayed(self): """Is this view being displayed?""" titles = [ 'Configuration Profiles under Red Hat Satellite Provider ' # continued ... '"{name} Configuration Manager"', 'Inventory Groups under Ansible Tower Provider "{name} Automation Manager"' ] return (self.in_config and self.entities.title.text in [ t.format(name=self.context['object'].name) for t in titles ])
class FloatingIpView(BaseLoggedInPage): """ Represents whole All FloatingIP page """ toolbar = View.nested(FloatingIpToolBar) search = View.nested(Search) including_entities = View.include(FloatingIpEntities, use_parent=True) @property def is_displayed(self): return (self.navigation.currently_selected == ['Networks', 'Floating IPs'] and self.entities.title.text == 'Floating IPs') @View.nested class my_filters(Accordion): # noqa ACCORDION_NAME = "My Filters" navigation = BootstrapNav('.//div/ul') tree = ManageIQTree()
class PhysicalServersView(ComputePhysicalInfrastructureServersView): toolbar = View.nested(PhysicalServersToolbar) sidebar = View.nested(PhysicalServerSideBar) search = View.nested(Search) including_entities = View.include(PhysicalServerEntitiesView, use_parent=True) @property def is_displayed(self): return (self.in_compute_physical_infrastructure_servers and self.title.text == "Physical Servers") @View.nested class my_filters(Accordion): # noqa ACCORDION_NAME = "My Filters" navigation = BootstrapNav('.//div/ul') tree = ManageIQTree()
class ConfigManagementAllView(ConfigManagementView): """The main list view""" toolbar = View.nested(ConfigManagementToolbar) sidebar = View.nested(ConfigManagementSideBar) search = View.nested(Search) including_entities = View.include(ConfigManagementEntities, use_parent=True) @property def is_displayed(self): """Is this view being displayed?""" if self.context['object'].type == 'Ansible Tower': title_text = 'All Ansible Tower Providers' else: title_text = 'All Configuration Management Providers' return ( self.in_config and self.entities.title.text == title_text )
class VmsTemplatesAllView(InfraVmView): """ The collection page for instances """ toolbar = View.nested(VMToolbar) sidebar = View.nested(VmsTemplatesAccordion) including_entities = View.include(VMEntities, use_parent=True) pagination = View.nested(NonJSPaginationPane) @property def is_displayed(self): return ( self.in_infra_vms and self.sidebar.vmstemplates.tree.currently_selected == 'All VMs & Templates' and self.entities.title.text == 'All VMs & Templates') def reset_page(self): self.entities.search.clear_search()
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'
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'
class AvailabilityZoneAllView(AvailabilityZoneView): """Collect the view components into a single view""" @property def is_displayed(self): return( self.in_availability_zones and self.entities.title.text == 'Availability Zones') search = View.nested(Search) toolbar = View.nested(AvailabilityZoneToolBar) including_entities = View.include(AvailabilityZoneEntities, use_parent=True) @View.nested class my_filters(Accordion): # noqa ACCORDION_NAME = "My Filters" navigation = BootstrapNav('.//div/ul') tree = ManageIQTree()
class ResourcePoolAllView(ResourcePoolView): """The "all" view -- a list of app the resource pools""" @property def is_displayed(self): return ( self.in_resource_pool and self.entities.title.text == 'Resource Pools') toolbar = View.nested(ResourcePoolToolbar) 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()
class ObjectStoreObjectAllView(ObjectStoreObjectView): """The all Object Store Object page""" toolbar = View.nested(ObjectStoreObjectToolbar) search = View.nested(Search) including_entities = View.include(BaseEntitiesView, use_parent=True) @property def is_displayed(self): return ( self.in_object and self.title.text == 'Cloud Object Store Objects') @View.nested class my_filters(Accordion): # noqa ACCORDION_NAME = "My Filters" navigation = BootstrapNav('.//div/ul') tree = ManageIQTree()
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() search = View.nested(Search) 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"
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()
class InfraMappingWizardNetworksView(InfraMappingForm): include_buttons_set2 = View.include(InfraMappingWizardCommon) source_networks = MultiSelectList('source_networks') target_networks = MultiSelectList('target_networks') next_btn = Button( "Create") # overriding, since 'Next' is called 'Create' in this form cluster_selector = BootstrapSelect(id='cluster_select') @property def is_displayed(self): return ( self.source_networks.is_displayed and self.target_networks.is_displayed and (len(self.browser.elements(".//div[contains(@class,'spinner')]")) == 0)) def fill(self, values): """Use to add all mappings specified in values. Args: values: format as following: { 'cluster_name': { 'mappings': [ { 'sources':['item1','item2'], 'target':['item_target'] }, ... ] }, ... } """ for cluster in (values if isinstance(values, dict) else []): if self.cluster_selector.is_displayed: self.cluster_selector.fill(cluster) for mapping in values[cluster]['mappings']: self.source_networks.fill(mapping['sources']) self.target_networks.fill(mapping['target']) self.add_mapping.click() was_change = not self.mappings_tree.is_empty self.after_fill(was_change) return was_change
class ImageProviderAllView(CloudInstanceView): """View for the Image collection""" toolbar = View.nested(ImageToolbar) sidebar = View.nested(InstanceAccordion) including_entities = View.include(VMEntities, use_parent=True) @property def is_displayed(self): try: provider = self.context['object'].provider.name except AttributeError: provider = self.context['object'].filters['provider'].name expected_title = 'Images under Provider "{}"'.format(provider) accordion = self.sidebar.images_by_provider return ( self.in_cloud_instance and accordion.is_opened and accordion.tree.selected_item.text == provider and self.entities.title.text == expected_title)
class CloudNetworkView(BaseLoggedInPage): """ Represents whole All Cloud network page """ toolbar = View.nested(CloudNetworkToolBar) sidebar = View.nested(CloudNetworkSideBar) search = View.nested(Search) including_entities = View.include(NetworkProviderEntities, use_parent=True) @property def is_displayed(self): return (super(BaseLoggedInPage, self).is_displayed and self.navigation.currently_selected == ['Networks', 'Networks'] and self.entities.title.text == 'Cloud Networks') @View.nested class my_filters(Accordion): # noqa ACCORDION_NAME = "My Filters" navigation = BootstrapNav('.//div/ul') tree = ManageIQTree()
class ClusterAllView(ClusterView): """The all view page for clusters""" @property def is_displayed(self): """Determine if this page is currently being displayed""" return ( self.in_cluster and self.entities.title.text == 'Clusters') toolbar = View.nested(ClusterToolbar) 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()
class InstanceProviderAllView(CloudInstanceView): @property def is_displayed(self): try: provider = self.context['object'].filters.get('provider').name except AttributeError: provider = self.context['object'].provider.name return (self.in_cloud_instance and self.entities.title.text == 'Instances under Provider "{}"'.format(provider) and self.sidebar.instances_by_provider.is_opened) toolbar = View.nested(VMToolbar) sidebar = View.nested(InstanceAccordion) including_entities = View.include(VMEntities, use_parent=True) @View.nested class instances_by_provider(Accordion): # noqa ACCORDION_NAME = 'Instances by Provider' tree = ManageIQTree()
class AllInfraMappingView(InfrastructureMappingView): """All infrastructure mapping View""" infra_mapping_list = InfraMappingList("infra-mappings-list-view") create_infra_mapping = Text(locator='(//a|//button)[text()="Create Infrastructure Mapping"]') configure_providers = Text(locator='//a[text()="Configure Providers"]') paginator_view = View.include(V2VPaginatorPane, use_parent=True) search_box = TextInput(locator=".//div[contains(@class,'input-group')]/input") clear_filters = Text(".//a[text()='Clear All Filters']") sort_order = Text(".//button[./span[contains(@class,'sort-direction')]]") filter_by_dropdown = SelectorDropdown("id", "filterFieldTypeMenu") sort_by_dropdown = SelectorDropdown("id", "sortTypeMenu") @property def is_displayed(self): return len(self.browser.elements(".//div[contains(@class,'spinner')]")) == 0 and ( self.create_infra_mapping.is_displayed or self.infra_mapping_list.is_displayed or self.configure_providers.is_displayed )
class MyServicesView(BaseLoggedInPage): toolbar = View.nested(MyServiceToolbar) search = View.nested(Search) including_entities = View.include(BaseEntitiesView, use_parent=True) @property def in_myservices(self): return (self.logged_in_as_current_user and self.navigation.currently_selected == ["Services", "My Services"]) @property def is_displayed(self): return (self.in_myservices and self.toolbar.configuration.is_displayed and not self.myservice.is_dimmed) @View.nested class myservice(Accordion): # noqa ACCORDION_NAME = 'Services' tree = ManageIQTree()
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()
class ProviderTemplatesView(BaseLoggedInPage): """ represents Templates view (exists for Infra providers) """ title = Text('//div[@id="main-content"]//h1') including_entities = View.include(BaseEntitiesView, use_parent=True) @View.nested class toolbar(View): # noqa configuration = Dropdown(text='Configuration') policy = Dropdown(text='Policy') download = Dropdown(text='Download') view_selector = View.nested(ItemsToolBarViewSelector) @property def is_displayed(self): title = '{name} (All Miq Templates)'.format( name=self.context['object'].name) return (self.logged_in_as_current_user and self.navigation.currently_selected == ['Compute', 'Infrastructure', 'Providers'] and self.title.text == title)
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"
class MigrationPlanView(MigrationView): dashboard_cards = View.nested(DashboardCards) paginator_view = View.include(V2VPaginatorPane, use_parent=True) title = Text('.//div[contains(@class, "pull-left")]//h3') create_migration_plan = Text(locator='(//a|//button)[text()="Create Migration Plan"]') configure_providers = Text(locator='//a[text()="Configure Providers"]') sort_type_dropdown = SelectorDropdown("id", "sortTypeMenu") sort_direction = Text(locator=".//span[contains(@class,'sort-direction')]") progress_card = MigrationProgressBar() search_box = SearchBox(locator=".//div[contains(@class,'input-group')]/input") clear_filters = Text(".//a[text()='Clear All Filters']") @property def in_migration_plan(self): return ( self.in_explorer and self.create_migration_plan.is_displayed and len(self.browser.elements('.//div[contains(@class,"card-pf")]')) > 0 and len(self.browser.elements(PFIcon.icons.WARNING)) < 1 ) @property def is_displayed(self): return self.in_migration_plan
class InfraMappingWizardClustersView(InfraMappingForm): include_buttons_set2 = View.include(InfraMappingWizardCommon) source_clusters = MultiSelectList('source_clusters') target_clusters = MultiSelectList('target_clusters') @property def is_displayed(self): return ( self.source_clusters.is_displayed and self.target_clusters.is_displayed and (len(self.browser.elements(".//div[contains(@class,'spinner')]")) == 0)) def fill(self, values): """Use to add all mappings specified in values. Args: values: format as following: { 'mappings': [ { 'sources':['item1', 'item2'], 'target':['item_target'] } ] ... } """ for mapping in (values.get('mappings', []) if isinstance(values, dict) else []): self.source_clusters.fill(mapping['sources']) self.target_clusters.fill(mapping['target']) self.add_mapping.click() was_change = not self.mappings_tree.is_empty self.after_fill(was_change) return was_change
class MyServicesView(BaseLoggedInPage): toolbar = View.nested(MyServiceToolbar) search = View.nested(Search) including_entities = View.include(BaseEntitiesView, use_parent=True) @property def in_myservices(self): # Slicing in currently_selected is workaround for BZ-1733489 nav_selected = (self.navigation.currently_selected[:2] if BZ(1733489).blocks else self.navigation.currently_selected) return (self.logged_in_as_current_user and nav_selected == ["Services", "My Services"]) @property def is_displayed(self): return (self.in_myservices and self.toolbar.configuration.is_displayed and not self.myservice.is_dimmed) @View.nested class myservice(Accordion): # noqa # Note: Services in tree now hidden to improve performance BZ-1692531 ACCORDION_NAME = 'Services' tree = ManageIQTree()
class basic_info(WaitTab): # noqa TAB_NAME = 'Basic Info' included_form = View.include(BasicInfoForm)
class TenantEditTagEntities(View): """The entities on the edit tags page""" breadcrumb = BreadCrumb() title = Text('#explorer_title_text') included_widgets = View.include(BaseNonInteractiveEntitiesView, use_parent=True)
class ImageAllView(ContainerObjectAllBaseView): """Container Images All view""" SUMMARY_TEXT = "Container Images" # ProviderEntity has its own fields, image view should rather use BaseEntity instead including_entities = View.include(BaseEntitiesView, use_parent=True)