class AnalysisProfileBaseAddForm(View): """View for the common elements of the two AP forms""" name = TextInput(id='name') description = TextInput(id='description') @View.nested class files(WaitTab): # noqa TAB_NAME = 'File' tab_form = DynamicTable( locator='.//h3[normalize-space(.)="File Entry"]/following-sibling::table', column_widgets={ 'Name': TextInput(id='entry_fname'), 'Collect Contents?': Checkbox(id='entry_content'), 'Actions': Button(title='Add this entry', classes=table_button_classes)}, assoc_column='Name', rows_ignore_top=1, action_row=0) @View.nested class events(WaitTab): # noqa TAB_NAME = 'Event Log' tab_form = EventsTable( locator='.//h3[normalize-space(.)="Event Log Entry"]/following-sibling::table', column_widgets={ 'Name': TextInput(id='entry_name'), 'Filter Message': TextInput(id='entry_message'), 'Level': TextInput(id='entry_level'), 'Source': TextInput(id='entry_source'), '# of Days': TextInput(id='entry_num_days'), 'Actions': Button(title='Add this entry', classes=table_button_classes)}, assoc_column='Name', rows_ignore_top=1, action_row=0)
class InfraMappingWizardGeneralView(View): name = TextInput(name='name') description = TextInput(name='description') include_buttons = View.include(InfraMappingFormControlButtons) def after_fill(self, was_change): if was_change: self.next_btn.click()
class SubnetEditView(BaseLoggedInPage): """ Represents Edit view of subnet """ title = Text('//div[@id="main-content"]//h1') subnet_name = TextInput(name='name') gateway = TextInput(name='gateway_ip') save = Button('Save') is_displayed = displayed_not_implemented
class NetworkRouterAddCloudSubnetView(BaseLoggedInPage): """ Represents Add Interface to Network Router page """ modal_title = Text('//div[@class="modal-header"]//h4') subnet_name = TextInput(id='name') address = TextInput(id='address') netmask = TextInput(id='netmask') gateway = TextInput(id='gateway') add = Button('Add')
class registry(WaitTab): # noqa TAB_NAME = 'Registry' tab_form = DynamicTable( locator='.//h3[normalize-space(.)="Registry Entry"]/following-sibling::table', column_widgets={ 'Registry Hive': Text('.//tr[@id="new_tr"]/td[normalize-space(.)="HKLM"]'), 'Registry Key': TextInput(id='entry_kname'), 'Registry Value': TextInput(id='entry_value'), 'Actions': Button(title='Add this entry', classes=table_button_classes)}, assoc_column='Registry Key', rows_ignore_top=1, action_row=0)
class general(View): # noqa infra_map = BootstrapSelect('infrastructure_mapping') name = TextInput(name='name') name_help_text = Text(locator='.//div[contains(@id,"name")]/span') description = TextInput(name='description') select_vm = RadioGroup('.//div[contains(@id,"vm_choice_radio")]') @property def is_displayed(self): return self.infra_map.is_displayed and self.name.is_displayed
class SubnetEditView(BaseLoggedInPage): """ Represents Edit view of subnet """ title = Text('//div[@id="main-content"]//h1') subnet_name = TextInput(name='name') gateway = TextInput(name='gateway_ip') save = Button('Save') @property def is_displayed(self): return False
class general(InfraMappingCommonButtons): # noqa name = TextInput(name="name") description = TextInput(name="description") plan_type = BootstrapSelect("targetProvider") name_help_text = Text(locator='.//div[contains(@id,"name")]/span') description_help_text = Text(locator='.//div[contains(@id,"description")]/span') fill_strategy = WaitFillViewStrategy() def after_fill(self, was_change): if was_change: self.next_btn.click()
class SubnetEditView(BaseLoggedInPage): """ Represents Edit view of subnet """ title = Text('//div[@id="main-content"]//h1') subnet_name = TextInput(name='name') gateway = TextInput(name='gateway_ip') save = Button('Save') @property def is_displayed(self): raise NotImplementedError( "This view has no unique markers for is_displayed check")
class SubnetAddView(BaseLoggedInPage): """ Represents Add view of subnet """ title = Text('//div[@id="main-content"]//h1') network_manager = Select(name='ems_id') cloud_tenant = Select(name='cloud_tenant_id') network = Select(name='network_id') subnet_name = TextInput(name='name') subnet_cidr = TextInput(name='cidr') gateway = TextInput(name='gateway_ip') add = Button('Add') is_displayed = displayed_not_implemented
class events(WaitTab): # noqa TAB_NAME = 'Event Log' tab_form = EventsTable( locator='.//h3[normalize-space(.)="Event Log Entry"]/following-sibling::table', column_widgets={ 'Name': TextInput(id='entry_name'), 'Filter Message': TextInput(id='entry_message'), 'Level': TextInput(id='entry_level'), 'Source': TextInput(id='entry_source'), '# of Days': TextInput(id='entry_num_days'), 'Actions': Button(title='Add this entry', classes=table_button_classes)}, assoc_column='Name', rows_ignore_top=1, action_row=0)
class InfraMappingWizardGeneralView(InfraMappingForm): name = TextInput(name='name') description = TextInput(name='description') name_help_text = Text(locator='.//div[contains(@id,"name")]/span') description_help_text = Text(locator='.//div[contains(@id,"description")]/span') def after_fill(self, was_change): if was_change: self.next_btn.click() @property def is_displayed(self): return self.name.is_displayed and self.description.is_displayed
class AddMigrationPlanView(View): title = Text(locator='.//h4[contains(@class,"modal-title")]') name = TextInput(name='name') description = TextInput(name='description') back_btn = Button('Back') # Since next is a keyword, suffixing it with btn and other two # because want to keep it consistent next_btn = Button('Next') cancel_btn = Button('Cancel') @property def is_displayed(self): return self.title.text == 'Migration Plan Wizard'
class SubnetEditView(BaseLoggedInPage): """ Represents Edit view of subnet """ title = Text('//div[@id="main-content"]//h1') flash = FlashMessages( './/div[@id="flash_msg_div"]/div[@id="flash_text_div" or ' 'contains(@class, "flash_text_div")]') subnet_name = TextInput(name='name') gateway = TextInput(name='gateway_ip') save = Button('Save') @property def is_displayed(self): return False
class general(View): # noqa infra_map = BootstrapSelect("infrastructure_mapping") name = TextInput(name="name") name_help_text = Text(locator='.//div[contains(@id,"name")]/span') description = TextInput(name="description") select_vm = RadioGroup('.//div[contains(@id,"vm_choice_radio")]') fill_strategy = WaitFillViewStrategy("15s") @property def is_displayed(self): return self.infra_map.is_displayed and self.name.is_displayed def after_fill(self, was_change): self.parent.next_btn.click()
class SubnetAddView(BaseLoggedInPage): """ Represents Add view of subnet """ title = Text('//div[@id="main-content"]//h1') network_manager = Select(name='ems_id') cloud_tenant = Select(name='cloud_tenant_id') network = Select(name='network_id') subnet_name = TextInput(name='name') subnet_cidr = TextInput(name='cidr') gateway = TextInput(name='gateway_ip') add = Button('Add') @property def is_displayed(self): raise NotImplementedError( "This view has no unique markers for is_displayed check")
class InfrastructureMappingView(BaseLoggedInPage): """This is an entire separate page, with many elements similar to what we had in MigrationPlanRequestDetailsView , so re-using some of those Paginator things by renaming those from v2vPaginator to v2vPaginator, etc.""" infra_mapping_list = InfraMappingList("infra-mappings-list-view") create_infrastructure_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']") # Used for Ascending/Descending sort sort_order = Text(".//button[./span[contains(@class,'sort-direction')]]") # Used to select filter_by 'Name' or 'Description' filter_by_dropdown = SelectorDropdown('id', 'filterFieldTypeMenu') # USed to select sort by options like 'Name', 'Number of Associated Plans' sort_by_dropdown = SelectorDropdown('id', 'sortTypeMenu') @property def is_displayed(self): # TODO: Resmove 1st condition, once /manageiq-v2v/issues/768 fix is backported to 510z return ( (self.navigation.currently_selected == ['Compute', 'Migration', 'Overview'] or self.navigation.currently_selected == ['Compute', 'Migration', 'Infrastructure Mappings']) and len( self.browser.elements(".//div[contains(@class,'spinner')]")) == 0 and (self.create_infrastructure_mapping.is_displayed or self.infra_mapping_list.is_displayed or self.configure_providers.is_displayed))
class general(InfraMappingCommonButtons): # noqa name = TextInput(name="name") description = TextInput(name="description") plan_type = BootstrapSelect("targetProvider") name_help_text = Text(locator='.//div[contains(@id,"name")]/span') description_help_text = Text( locator='.//div[contains(@id,"description")]/span') @View.nested class flash(V2VFlashMessages): ROOT = './/div[@class="modal-wizard-alert"]' fill_strategy = WaitFillViewStrategy() def after_fill(self, was_change): if was_change: self.next_btn.click()
class SubnetAddView(BaseLoggedInPage): """ Represents Add view of subnet """ title = Text('//div[@id="main-content"]//h1') flash = FlashMessages( './/div[@id="flash_msg_div"]/div[@id="flash_text_div" or ' 'contains(@class, "flash_text_div")]') network_manager = Select(id='ems_id') cloud_tenant = Select(name='cloud_tenant_id') network = Select(name='cloud_network_id') subnet_name = TextInput(name='name') subnet_cidr = TextInput(name='cidr') gateway = TextInput(name='gateway_ip') add = Button('Add') @property def is_displayed(self): return False
class NetworkRouterEditView(BaseLoggedInPage): """ Represents Edit NetworkRouters page """ router_name = TextInput(name='name') ext_gateway = BootstrapSwitch(name='external_gateway') network_name = Select(name='cloud_network_id') subnet_name = Select(name='cloud_subnet_id') save = Button('Save') is_displayed = displayed_not_implemented
class files(WaitTab): # noqa TAB_NAME = 'File' tab_form = DynamicTable( locator='.//h3[normalize-space(.)="File Entry"]/following-sibling::table', column_widgets={ 'Name': TextInput(id='entry_fname'), 'Collect Contents?': Checkbox(id='entry_content'), 'Actions': Button(title='Add this entry', classes=table_button_classes)}, assoc_column='Name', rows_ignore_top=1, action_row=0)
class vms(View): # noqa import_btn = Button('Import') importcsv = Button('Import CSV') hidden_field = HiddenFileInput(locator='.//input[contains(@accept,".csv")]') # TODO: Replace string keys by integer keys after row indexing issue get fixed # TODO: Replace Text by Button or GenericLocatorWidget after button text get added table = Table('.//div[contains(@class, "container-fluid")]/table', column_widgets={ 'Select': Checkbox(locator=".//input"), 1: Text('.//span/button[contains(@class,"btn btn-link")]')}) filter_by_dropdown = SelectorDropdown('id', 'filterFieldTypeMenu') search_box = TextInput(locator='.//div[contains(@class, "modal-content")]' '//div[contains(@class,"input-group")]/input') clear_filters = Text(".//a[text()='Clear All Filters']") error_text = Text('.//h3[contains(@class,"blank-slate-pf-main-action") and ' 'contains(text(), "Error:")]') error_icon = Text(locator='.//span[contains(@class, "pficon-error-circle-o")]') popover_text = Text(locator='.//div[contains(@class, "popover-content")]') @property def is_displayed(self): return (self.table.is_displayed and (len(self.browser.elements(".//div[contains(@class,'spinner')]")) == 0)) def filter_by_name(self, vm_name): try: # remove `if` cond https://github.com/ManageIQ/manageiq-v2v/issues/771 fixed if self.browser.appliance.version < '5.10': # Don't remove nxt line, remove `if` self.filter_by_dropdown.item_select("VM Name") # just unindent except NoSuchElementException: self.logger.info("`VM Name` not present in filter dropdown!") self.search_box.fill(vm_name) self.browser.send_keys(Keys.ENTER, self.search_box) def filter_by_source_cluster(self, cluster_name): try: self.filter_by_dropdown.item_select("Source Cluster") except NoSuchElementException: self.logger.info("`Source Cluster` not present in filter dropdown!") self.search_box.fill(cluster_name) self.browser.send_keys(Keys.ENTER, self.search_box) def filter_by_path(self, path): try: self.filter_by_dropdown.item_select("Path") except NoSuchElementException: self.logger.info("`Path` not present in filter dropdown!") self.search_box.fill(path) self.browser.send_keys(Keys.ENTER, self.search_box) def select_by_name(self, vm_name): self.filter_by_name(vm_name) vms_selected = [] for row in self.table.rows(): if vm_name in row.read()['VM Name']: row.select.fill(True) vms_selected.append(row.read()['VM Name']) return vms_selected
class CloudNetworkEditView(BaseLoggedInPage): """ Represents Edit view of cloud network """ title = Text('//div[@id="main-content"]//h1') network_name = TextInput(name='name') ext_router = BootstrapSwitch(id='cloud_network_external_facing') administrative_state = BootstrapSwitch(id='cloud_network_enabled') shared = BootstrapSwitch(id='cloud_network_shared') save = Button('Save') is_displayed = displayed_not_implemented
class NetworkRouterEditView(BaseLoggedInPage): """ Represents Edit NetworkRouters page """ router_name = TextInput(name='name') ext_gateway = BootstrapSwitch(name='external_gateway') network_name = Select(name='cloud_network_id') subnet_name = Select(name='cloud_subnet_id') save = Button('Save') @property def is_displayed(self): return False
class NetworkRouterAddView(BaseLoggedInPage): """ Represents Add NetworkRouters page """ network_manager = Select(id='ems_id') router_name = TextInput(name='name') ext_gateway = BootstrapSwitch(name='external_gateway') network_name = Select(name='cloud_network_id') subnet_name = Select(name='cloud_subnet_id') cloud_tenant = Select(name='cloud_tenant_id') add = Button('Add') is_displayed = displayed_not_implemented
class NetworkRouterEditView(BaseLoggedInPage): """ Represents Edit NetworkRouters page """ router_name = TextInput(name='name') ext_gateway = BootstrapSwitch(name='external_gateway') network_name = Select(name='cloud_network_id') subnet_name = Select(name='cloud_subnet_id') save = Button('Save') @property def is_displayed(self): raise NotImplementedError( "This view has no unique markers for is_displayed check")
class CloudNetworkAddView(BaseLoggedInPage): """ Represents Add view of cloud network """ title = Text('//div[@id="main-content"]//h1') network_manager = Select(id='ems_id') cloud_tenant = Select(name='cloud_tenant_id') network_type = Select(name='provider_network_type') network_name = TextInput(name='name') ext_router = BootstrapSwitch(id='cloud_network_external_facing') administrative_state = BootstrapSwitch(id='cloud_network_enabled') shared = BootstrapSwitch(id='cloud_network_shared') add = Button('Add') is_displayed = displayed_not_implemented
class CloudNetworkEditView(BaseLoggedInPage): """ Represents Edit view of cloud network """ title = Text('//div[@id="main-content"]//h1') network_name = TextInput(name='name') ext_router = BootstrapSwitch(id='cloud_network_external_facing') administrative_state = BootstrapSwitch(id='cloud_network_enabled') shared = BootstrapSwitch(id='cloud_network_shared') save = Button('Save') @property def is_displayed(self): raise NotImplementedError( "This view has no unique markers for is_displayed check")
class NetworkRouterAddView(BaseLoggedInPage): """ Represents Add NetworkRouters page """ network_manager = Select(id='ems_id') router_name = TextInput(name='name') ext_gateway = BootstrapSwitch(id='network_router_external_gateway') network_name = Select(name='cloud_network_id') subnet_name = Select(name='cloud_subnet_id') cloud_tenant = Select(name='cloud_tenant_id') add = Button('Add') @property def is_displayed(self): return False
class NetworkRouterAddView(BaseLoggedInPage): """ Represents Add NetworkRouters page """ network_manager = Select(id='ems_id') router_name = TextInput(name='name') ext_gateway = BootstrapSwitch(name='external_gateway') network_name = Select(name='cloud_network_id') subnet_name = Select(name='cloud_subnet_id') cloud_tenant = Select(name='cloud_tenant_id') add = Button('Add') @property def is_displayed(self): raise NotImplementedError( "This view has no unique markers for is_displayed check")