class HostEditView(HostCreateView): breadcrumb = BreadCrumb() submit = Text('//input[@name="commit"]') toggle_manage = Text("//a[contains(@href, '/toggle_manage')]") @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element( self.breadcrumb, exception=False) return ( breadcrumb_loaded and self.breadcrumb.locations[0] == 'All Hosts' and self.breadcrumb.read().startswith('Edit ') )
class ContentViewCopyView(BaseLoggedInView): breadcrumb = BreadCrumb() new_name = TextInput(id='copy_name') create = Text(".//button[@type='submit']") @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False) return (breadcrumb_loaded and self.breadcrumb.locations[0] == 'Content Views' and len(self.breadcrumb.locations) == 3 and self.breadcrumb.read() == 'Copy')
class SmartVariableCreateView(BaseLoggedInView): breadcrumb = BreadCrumb() variable = SmartVariableContent(locator="//div[@class='tab-pane fields']") submit = Text('//input[@name="commit"]') @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element( self.breadcrumb, exception=False) return ( breadcrumb_loaded and self.breadcrumb.locations[0] == 'Smart variables' and self.breadcrumb.read() == 'Create Smart Variable' )
class ProvisioningTemplateDetailsView(BaseLoggedInView): breadcrumb = BreadCrumb() submit = Text('//input[@name="commit"]') @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False) return (breadcrumb_loaded and self.breadcrumb.locations[0] == 'Provisioning Templates' and self.breadcrumb.read().startswith('Edit ')) @View.nested class template(SatTab): name = TextInput(id='provisioning_template_name') default = Checkbox(id='provisioning_template_default') template_editor = View.nested(TemplateEditor) audit = TextInput(id='provisioning_template_audit_comment') @View.nested class inputs(RemovableWidgetsItemsListView, SatTab): ITEMS = ".//div[contains(@class, 'template_inputs')]/following-sibling::div" ITEM_WIDGET_CLASS = TemplateInputItem add_item_button = Text(".//a[@data-association='template_inputs']") @View.nested class type(SatTab): snippet = Checkbox(id='provisioning_template_snippet') template_type = FilteredDropdown( id='provisioning_template_template_kind') @View.nested class association(SatTab): applicable_os = MultiSelect( id='ms-provisioning_template_operatingsystem_ids') @View.nested class hg_environment_combination(RemovableWidgetsItemsListView): ROOT = "//div[@id='association']" ITEMS = ".//fieldset[@id='template_combination']/div" ITEM_WIDGET_CLASS = TemplateHostEnvironmentAssociation add_item_button = Text(".//a[text()='+ Add Combination']") @View.nested class locations(SatTab): resources = MultiSelect(id='ms-provisioning_template_location_ids') @View.nested class organizations(SatTab): resources = MultiSelect(id='ms-provisioning_template_organization_ids')
class LCECreateView(BaseLoggedInView): breadcrumb = BreadCrumb() name = TextInput(id='name') label = TextInput(id='label') description = TextInput(id='description') submit = Text("//button[contains(@ng-click, 'handleSave')]") @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False) return (breadcrumb_loaded and self.breadcrumb.locations[0] == 'Environments List' and self.breadcrumb.read() == 'New Environment')
class JobInvocationStatusView(BaseLoggedInView): breadcrumb = BreadCrumb() @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False) return (breadcrumb_loaded and self.breadcrumb.locations[0] == 'Jobs' and len(self.breadcrumb.locations) == 2) rerun = Text("//a[text()='Rerun']") rerun_failed = Text("//a[text()='Rerun failed']") job_task = Text("//a[text()='Job Task']") cancel_job = Text("//a[text()='Cancel Job']") abort_job = Text("//a[text()='Abort Job']") @View.nested class overview(SatTab): job_status = Text( "//div[@id='job_invocations_chart_container']" "//*[name()='tspan'][contains(@class,'donut-title-small-pf')]") job_status_progress = Text( "//div[@id='job_invocations_chart_container']" "//*[name()='tspan'][contains(@class,'donut-title-big-pf')]") hosts_table = SatTable( './/table', column_widgets={ 'Host': Text('./a'), 'Actions': ActionsDropdown("./div[contains(@class, 'btn-group')]"), }) total_hosts = Text("//h2[contains(., 'Total hosts')]" "/span[@class='card-pf-aggregate-status-count']") def wait_for_result(self, timeout=600, delay=1): """Wait for invocation job to finish""" wait_for( lambda: (self.is_displayed and self.overview.job_status.is_displayed and self.overview.job_status_progress.is_displayed), timeout=timeout, delay=delay, logger=self.logger, ) wait_for(lambda: (self.overview.job_status.read() != 'Pending' and self .overview.job_status_progress.read() == '100%'), timeout=timeout, delay=1, logger=self.logger)
class ConfigGroupCreateView(BaseLoggedInView): breadcrumb = BreadCrumb() name = TextInput(id='config_group_name') submit = Text('//input[@name="commit"]') classes = PuppetClassesMultiSelect(locator='.//form') @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element( self.breadcrumb, exception=False) return ( breadcrumb_loaded and self.breadcrumb.locations[0] == 'Config Groups' and self.breadcrumb.locations[1] == 'Create Config Group' )
class SelectPuppetModuleVersionView(BaseLoggedInView, SearchableViewMixin): breadcrumb = BreadCrumb() table = Table( locator='.//table', column_widgets={'Actions': Text('./button[@ng-click="selectVersion(item)"]')}, ) @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False) return ( breadcrumb_loaded and self.breadcrumb.locations[0] == 'Content Views' and self.breadcrumb.read() == 'Version for Module:' )
class OrganizationCreateSelectHostsView(BaseLoggedInView): breadcrumb = BreadCrumb() assign_all = Text("//a[text()='Assign All']") assign_manually = Text("//a[text()='Manually Assign']") proceed = Text("//a[text()='Proceed to Edit']") @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element( self.breadcrumb, exception=False) return ( breadcrumb_loaded and self.breadcrumb.locations[0] == 'Organizations' and self.breadcrumb.read() == 'Assign Hosts to' )
class ManagePoliciesView(BaseLoggedInPage): """ Manage policies page """ policy_profiles = CheckableBootstrapTreeview(VersionPicker({ Version.lowest(): "protectbox", "5.11": "protect_treebox" })) breadcrumb = BreadCrumb() # some views have breadcrumb, some not entities = View.nested(BaseNonInteractiveEntitiesView) save = Button('Save') reset = Button('Reset') cancel = Button('Cancel') is_displayed = displayed_not_implemented
class BookmarkEditView(BaseLoggedInView): breadcrumb = BreadCrumb() name = TextInput(id='bookmark_name') query = TextInput(id='bookmark_query') public = Checkbox(id='bookmark_public') submit = Text(".//input[@type='submit']") cancel = Text(".//a[text()='Cancel']") @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False) return (breadcrumb_loaded and self.breadcrumb.locations[0] == 'Bookmarks' and self.breadcrumb.read().startswith('Edit'))
class HostCollectionCreateView(BaseLoggedInView): breadcrumb = BreadCrumb() name = TextInput(id='name') unlimited_hosts = Checkbox(name='limit') max_hosts = TextInput(id='max_hosts') description = TextInput(id='description') submit = Text("//button[contains(@ng-click, 'handleSave')]") @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False) return (breadcrumb_loaded and self.breadcrumb.locations[0] == 'Host Collections' and self.breadcrumb.read() == 'New Host Collection')
class ArchitectureDetailsView(BaseLoggedInView): breadcrumb = BreadCrumb() name = TextInput(locator="//input[@id='architecture_name']") submit = Text('//input[@name="commit"]') operatingsystems = MultiSelect(id='ms-architecture_operatingsystem_ids') @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element( self.breadcrumb, exception=False) return ( breadcrumb_loaded and self.breadcrumb.locations[0] == 'Architectures' and self.breadcrumb.read().startswith('Edit ') )
class LocationCreateView(BaseLoggedInView): breadcrumb = BreadCrumb() name = TextInput(id='location_name') description = TextInput(id='location_description') submit = Text('//input[@name="commit"]') @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element( self.breadcrumb, exception=False) return ( breadcrumb_loaded and self.breadcrumb.locations[0] == 'Locations' and self.breadcrumb.read() == 'New Location' )
class ReportTemplateGenerateView(BaseLoggedInView): breadcrumb = BreadCrumb() email = Checkbox(id='report_template_report_send_mail') email_to = TextInput(id='report_template_report_mail_to') inputs = TextInputsGroup(locator='.//form') submit = Text('//input[@name="commit"]') generating = Text('//div[@id="template_generator"]/div/span[2]') @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False) return (breadcrumb_loaded and self.breadcrumb.locations[0] == 'Report Templates' and self.breadcrumb.read() == 'Generate a Report')
class ContentCredentialCreateView(BaseLoggedInView): breadcrumb = BreadCrumb() name = TextInput(id='name') content_type = Select(id='content_type') content = TextInput(name='content') upload_file = FileInput(name='file_path') submit = Text("//button[contains(@ng-click, 'handleSave')]") @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False) return (breadcrumb_loaded and self.breadcrumb.locations[0] == 'Content Credential' and self.breadcrumb.read() == 'New Content Credential')
class ContentViewVersionPublishView(BaseLoggedInView): breadcrumb = BreadCrumb() version = Text('//div[@label="Version"]/div/span') description = TextInput(id='description') force_metadata_regeneration = Checkbox(id='forceMetadataRegeneration') save = Text('//button[contains(@ng-click, "handleSave()")]') cancel = Text('//button[contains(@ng-click, "handleCancel()")]') @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False) return (breadcrumb_loaded and self.breadcrumb.locations[0] == 'Content Views' and self.breadcrumb.read() == 'Publish')
class DeploymentRoleEditTagsView(DeploymentRoleView): """The edit tags of Deployment Role""" breadcrumb = BreadCrumb() title = Text('#explorer_title_text') select_tag = BootstrapSelect('tag_cat') select_value = BootstrapSelect('tag_add') save_button = Button('Save') reset_button = Button('Reset') cancel = Button('Cancel') @property def is_displayed(self): """Is this page currently being displayed""" return (self.in_dep_role and self.breadcrumb.active_location == 'Tag Assignment')
class TrendEditView(BaseLoggedInView): breadcrumb = BreadCrumb() table = Table('.//table', column_widgets={ 'Display Name': TextInput(locator=".//input[@type='text']"), }) submit = Text('//input[@name="commit"]') @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False) return (breadcrumb_loaded and self.breadcrumb.locations[0] == 'Trends' and self.breadcrumb.read().startswith('Edit '))
class HardwareModelCreateView(BaseLoggedInView): breadcrumb = BreadCrumb() name = TextInput(id='model_name') hardware_model = TextInput(id='model_hardware_model') vendor_class = TextInput(id='model_vendor_class') info = TextInput(id='model_info') submit = Text('//input[@name="commit"]') @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False) return (breadcrumb_loaded and self.breadcrumb.locations[0] == 'Hardware Models' and self.breadcrumb.read() == 'Create Model')
class SCAPContentEditView(SCAPContentCreateView): scap_file_name = Text('//div[@class="col-md-4"]/b') breadcrumb = BreadCrumb() @View.nested class file_upload(SatTab): TAB_NAME = 'File Upload' title = TextInput(id='scap_content_title') uploaded_scap_file = Text(locator="//label[@for='scap_file']/following-sibling::div/b") scap_file = FileInput(id='scap_content_scap_file') @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False) return breadcrumb_loaded and self.breadcrumb.locations[0] == 'Scap Contents'
class ComputeProfileDetailView(BaseLoggedInView): breadcrumb = BreadCrumb() table = Table('.//table', column_widgets={ 'Compute Resource': Text('./a'), }) @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False) return (breadcrumb_loaded and self.breadcrumb.locations[0] == 'Compute Profiles' and self.breadcrumb.read() != 'Create Compute Profile' and self.breadcrumb.read() != 'Edit Compute Profile')
class AddSubscriptionView(BaseLoggedInView): breadcrumb = BreadCrumb() table = SatTable( locator='.//table', column_widgets={ 'Subscription Name': Text('.//a'), 'Quantity to Allocate': TextInput(locator='.//input'), }, ) submit_button = Button('Submit') cancel_button = Button('Cancel') @property def is_displayed(self): return self.browser.wait_for_element(self.table, visible=True, exception=False) is not None
class TaskDetailsView(BaseLoggedInView): """Common view for task details screen. Can be found for most of tasks for various entities like Products, Repositories, Errata etc. """ breadcrumb = BreadCrumb() action_type = ReadOnlyEntry(name='Action Type') user = ReadOnlyEntry(name='User') started_at = ReadOnlyEntry(name='Started At') finished_at = ReadOnlyEntry(name='Finished At') parameters = ReadOnlyEntry(name='Parameters') state = ReadOnlyEntry(name='State') result = ReadOnlyEntry(name='Result') progressbar = ProgressBar() details = ReadOnlyEntry(name='Details')
class DeploymentRoleAllForProviderView(DeploymentRoleView): """The Deployment Role for Provider page""" breadcrumb = BreadCrumb() toolbar = View.nested(DeploymentRoleToolbar) sidebar = View.nested(DeploymentRoleDetailsAccordion) including_entities = View.include(BaseEntitiesView, use_parent=True) @property def is_displayed(self): """Is this page currently being displayed""" expected_title = '{} (All Deployment Roles)'.format( self.context['object'].provider.name) return (self.logged_in_as_current_user and self.breadcrumb.active_location == expected_title)
class ProviderTimelinesView(TimelinesView, BaseLoggedInPage): """ represents Timelines page """ breadcrumb = BreadCrumb() @property def is_displayed(self): expected_name = self.context['object'].name return ( self.logged_in_as_current_user and self.navigation.currently_selected == ['Compute', 'Infrastructure', 'Providers'] and ('{} (Summary)'.format(expected_name) in self.breadcrumb.locations or '{} (Dashboard)'.format(expected_name) in self.breadcrumb.locations) and self.is_timelines)
class ContentViewVersionDetailsView(BaseLoggedInView): breadcrumb = BreadCrumb() @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element( self.breadcrumb, exception=False) return ( breadcrumb_loaded and len(self.breadcrumb.locations) > 3 and self.breadcrumb.locations[0] == 'Content Views' and self.breadcrumb.locations[2] == 'Versions' ) @View.nested class yum_repositories(SatSecondaryTab, SearchableViewMixin): TAB_NAME = 'Yum Repositories' table = Table('.//table') @View.nested class docker_repositories(SatSecondaryTab, SearchableViewMixin): TAB_NAME = 'Docker Repositories' table = Table('.//table') @View.nested class rpm_packages(EntitySearchView): TAB_NAME = 'rpm Packages' @View.nested class module_streams(EntitySearchView): TAB_NAME = 'Module Streams' @View.nested class errata(SatSecondaryTab, SearchableViewMixin): table = Table( locator='.//table', column_widgets={'Title': Text('./a')} ) @View.nested class puppet_modules(SatSecondaryTab, SearchableViewMixin): TAB_NAME = 'Puppet Modules' table = Table('.//table') @View.nested class details(SatSecondaryTab): description = ReadOnlyEntry(name='Description') environments = ReadOnlyEntry(name='Environments')
class ContainerDetailsView(BaseLoggedInView): breadcrumb = BreadCrumb() @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False) return (breadcrumb_loaded and self.breadcrumb.locations[0] == 'All Containers') commit = Button('Commit') power_on = Button('Power On') power_off = Button('Power Off') delete = Button('Delete') properties = SatTableWithUnevenStructure( ".//table[@id='properties_table']")
class HostDetailsView(ComputeInfrastructureHostsView): """Main Host details page.""" breadcrumb = BreadCrumb(locator='.//ol[@class="breadcrumb"]') toolbar = View.nested(HostDetailsToolbar) entities = View.nested(HostDetailsEntities) @View.nested class security_accordion(Accordion): # noqa ACCORDION_NAME = "Security" navigation = BootstrapNav('.//div/ul') @property def is_displayed(self): title = "{name} (Summary)".format(name=self.context["object"].name) return self.in_compute_infrastructure_hosts and self.breadcrumb.active_location == title
class CloudProviderImagesView(BaseLoggedInPage): """ The collection page for provider images """ @property def is_displayed(self): location = VersionPicker({ Version.lowest(): 'Cloud Providers', '5.11': self.context['object'].name }).pick() return (self.breadcrumb.locations[-2] == location and self.entities.title.text == self.breadcrumb.active_location) breadcrumb = BreadCrumb() toolbar = View.nested(CloudProviderImagesToolbar) including_entities = View.include(VMEntities, use_parent=True)