def navigate_and_refresh_provider(self): navigate(self.web_session).get("{}//ems_middleware/show_list".format(self.web_session.MIQ_URL)) assert self.ui_utils.waitForTextOnPage('Middleware Providers', 15) view(self.web_session).list_View() assert self.ui_utils.waitForTextOnPage(self.web_session.HAWKULAR_PROVIDER_NAME, 15) self.ui_utils.click_on_row_containing_text(self.web_session.HAWKULAR_PROVIDER_NAME) providers(self.web_session).refresh_provider()
def save_advanced_search(self): navigate(self.web_session).get("{}//ems_middleware/show_list".format( self.web_session.MIQ_URL)) assert self.ui_utils.waitForTextOnPage("Middleware Providers", 15) view(self.web_session).list_View() self.verify_search_exist() self.select_advanced_search_condition() self.provide_search_name() self.verify_saved_filter() return True
def simple_search_provider(self): navigate(self.web_session).get("{}//ems_middleware/show_list".format( self.web_session.MIQ_URL)) assert self.ui_utils.waitForTextOnPage("Middleware Providers", 15) view(self.web_session).list_View() self.verify_search_exist() self.web_driver.find_element_by_id("search_text").send_keys( self.provider_name) self.web_driver.find_element_by_xpath( "//button[@class='btn btn-default']").click() assert self.ui_utils.waitForTextOnPage(self.hostname, 15) return True
def validate_provider_monitoring_timelines(self): navigate(self.web_session).get("{}/ems_middleware/show_list".format(self.web_session.MIQ_URL)) view(self.web_session).list_View() assert self.ui_utils.waitForTextOnPage(self.web_session.HAWKULAR_PROVIDER_NAME, 10) self.ui_utils.click_on_row_containing_text(self.web_session.HAWKULAR_PROVIDER_NAME) assert self.ui_utils.waitForTextOnPage("Summary", 10) self.web_driver.find_element_by_xpath("//*[@title='Monitoring']").click() self.ui_utils.waitForElementOnPage(By.ID, 'ems_middlewarer_monitoring_choice__ems_middleware_timeline', 5) self.web_driver.find_element_by_id('ems_middlewarer_monitoring_choice__ems_middleware_timeline').click() assert self.ui_utils.waitForTextOnPage('Timeline View', 30) # Validate that graphs are present - TBD return True
def delete_provider(self, delete_all_providers=True): navigate(self.web_session).get("{}//ems_middleware/show_list".format( self.web_session.MIQ_URL)) assert ui_utils(self.web_session).waitForTextOnPage( "Middleware Providers", 30) view(self.web_session).list_View() assert ui_utils(self.web_session).waitForTextOnPage( self.web_session.HAWKULAR_PROVIDER_NAME, 30) self.ui_utils.sleep(15) # Delete the provider if delete_all_providers: self.clear_all_providers() else: self.delete_hawkular_provider()
def verify_add_provider_success(self): assert ui_utils(self.web_session).waitForTextOnPage( 'Containers Providers "{}" was saved'.format(self.provider_name), 90) if ui_utils(self.web_session).isElementPresent(By.XPATH, "//a[contains(@title,'Name: {}')]".format( self.provider_name)): self.web_session.logger.info("Container Provider added successfully.") # Navigate to the provider details page and check if the last refresh status is - Success. view(self.web_session).list_View() assert ui_utils(self.web_session).waitForTextOnPage(self.web_session.OPENSHIFT_PROVIDER_NAME, 30) ui_utils(self.web_session).click_on_row_containing_text(self.web_session.OPENSHIFT_PROVIDER_NAME) assert ui_utils(self.web_session).waitForTextOnPage("Status", 30)
def validate_providers_details(self): # Test to validate hawkular provider details like name, hostname, port number # and to validate number of middleware servers, deployments and datasources in releationships section. self.web_session.logger.info("Begin providers details test.") navigate(self.web_session).get("{}//ems_middleware/show_list".format( self.web_session.MIQ_URL)) view(self.web_session).list_View() providers_ui = self.ui_utils.get_list_table() servers_hawk = self.hawkular_api.get_hawkular_servers() deployments_hawk = self.hawkular_api.get_hawkular_deployments() datasources_hawk = self.hawkular_api.get_hawkular_datasources() for prov_ui in providers_ui: if prov_ui.get('Name') == self.web_session.HAWKULAR_PROVIDER_NAME: ui_utils(self.web_session).click_on_row_containing_text( self.web_session.HAWKULAR_PROVIDER_NAME) assert ui_utils(self.web_session).waitForTextOnPage("Status", 15) providers_details_ui = ui_utils( self.web_session).get_generic_table_as_dict() assert (providers_details_ui.get('Name') == self.web_session. HAWKULAR_PROVIDER_NAME), "Provider name mismatch" assert (providers_details_ui.get('Host Name') == self.web_session.HAWKULAR_HOSTNAME), "Hostname mismatch" assert (providers_details_ui.get('Port') == self.web_session.HAWKULAR_PORT), "Port Number mismatch" assert providers_details_ui.get('Middleware Servers') == str( len(servers_hawk)), "Number of servers mismatch" self.web_session.logger.debug("UI Deploys: {} HW Deploys: {}".format( providers_details_ui.get('Middleware Deployments'), str(len(deployments_hawk)))) # assert providers_details_ui.get('Middleware Deployments') == str(len(deployments_hawk)), "Number of Deployments mismatch" #assert providers_details_ui.get('Middleware Datasources') == str(len(datasources_hawk)), "Number of Datasources mismatch" return True
def test_cfui_provider_detail_pdf(web_session, delete_files): if web_session.appliance_version == 'master': web_session.logger.debug( "Download feature not supported for Provider Detail.") pytest.skip( "Skip test - Download feature not supported for Provider Detail - version: master." ) web_session.logger.info("Begin download provider detail PDF text") utils = ui_utils(web_session) web_session.web_driver.get("{}//ems_middleware/show_list".format( web_session.MIQ_URL)) view(web_session).list_View() utils.sleep(2) utils.click_on_row_containing_text(web_session.HAWKULAR_PROVIDER_NAME) utils.waitForTextOnPage('Status', 10) assert download_report(web_session, '').pdf_format() assert_download_exist("{}{}".format( os.getenv("HOME"), '/Downloads/ManageIQ-Providers-Hawkular-Middleware*.pdf'))
def validate_provider_monitoring_timelines(self): navigate(self.web_session).get("{}/ems_middleware/show_list".format( self.web_session.MIQ_URL)) view(self.web_session).list_View() assert self.ui_utils.waitForTextOnPage( self.web_session.HAWKULAR_PROVIDER_NAME, 10) self.ui_utils.click_on_row_containing_text( self.web_session.HAWKULAR_PROVIDER_NAME) assert self.ui_utils.waitForTextOnPage("Summary", 10) self.web_driver.find_element_by_xpath( "//*[@title='Monitoring']").click() self.ui_utils.waitForElementOnPage( By.ID, 'ems_middlewarer_monitoring_choice__ems_middleware_timeline', 5) self.web_driver.find_element_by_id( 'ems_middlewarer_monitoring_choice__ems_middleware_timeline' ).click() assert self.ui_utils.waitForTextOnPage('Timeline View', 30) # Validate that graphs are present - TBD return True
def add_provider(self, delete_if_provider_present=True): self.provider_name = self.web_session.HAWKULAR_PROVIDER_NAME self.host_name = self.web_session.HAWKULAR_HOSTNAME self.port = self.web_session.HAWKULAR_PORT self.hawkular_user = self.web_session.HAWKULAR_USERNAME self.hawkular_password = self.web_session.HAWKULAR_PASSWORD # Check if any provider already exist. If exist, first delete all the providers and then add a provider. if self.does_provider_exist(): self.web_session.logger.info("Middleware Provider already exist.") if delete_if_provider_present: self.delete_provider(delete_all_providers=True) else: return else: self.web_session.logger.info( "Adding Middleware Provider to ManageIQ instance") elem_config = self.web_driver.find_element_by_xpath( "//button[@title='Configuration']") elem_config.click() assert ui_utils(self.web_session).waitForTextOnPage( "Add a New Middleware Provider", 15) elem_add_new_provider = self.web_driver.find_element_by_xpath( "//a[@title='Add a New Middleware Provider']") elem_add_new_provider.click() self.web_driver.implicitly_wait(15) assert ui_utils(self.web_session).waitForTextOnPage( "Confirm Password", 15) # Enter the form details and submit to add the provider self.web_driver.find_element_by_xpath( "//button[@data-id='server_emstype']").click() assert ui_utils(self.web_session).waitForTextOnPage("Hawkular", 30) self.web_driver.find_element_by_xpath( "//span[contains(.,'Hawkular')]").click() assert ui_utils(self.web_session).waitForTextOnPage( "Hostname or IP address", 30) # Enter the name of provider after selecting hawkular type from dropdown to take care of page load issues. elem_provider_name = self.web_driver.find_element_by_xpath( "//input[@id='name']") elem_provider_name.send_keys(self.provider_name) elem_provider_hostname = self.web_driver.find_element_by_xpath( "//input[@id='hostname']") elem_provider_hostname.send_keys(self.host_name) elem_provider_port = self.web_driver.find_element_by_xpath( "//input[@id='port']") elem_provider_port.send_keys(self.port) elem_hawkular_user = self.web_driver.find_element_by_xpath( "//input[@id='default_userid']") elem_hawkular_user.send_keys(self.hawkular_user) elem_hawkular_password = self.web_driver.find_element_by_xpath( "//input[@id='default_password']") elem_hawkular_password.send_keys(self.hawkular_password) elem_hawkularVerify_password = self.web_driver.find_element_by_xpath( "//input[@id='default_verify']") elem_hawkularVerify_password.send_keys(self.hawkular_password) self.web_driver.find_element_by_xpath( "//button[@alt='Add this Middleware Provider']").click() assert ui_utils(self.web_session).waitForTextOnPage( 'Middleware Providers "{}" was saved'.format(self.provider_name), 15) if ui_utils(self.web_session).isElementPresent( By.XPATH, "//a[contains(@title,'Name: {}')]".format(self.provider_name)): self.web_session.logger.info( "Middleware Provider added successfully.") # Navigate to the provider details page and check if the last refresh status is - Success. view(self.web_session).list_View() assert ui_utils(self.web_session).waitForTextOnPage( self.web_session.HAWKULAR_PROVIDER_NAME, 15) ui_utils(self.web_session).click_on_row_containing_text( self.web_session.HAWKULAR_PROVIDER_NAME) assert ui_utils(self.web_session).waitForTextOnPage("Status", 15) assert self.verify_refresh_status_success( ), "The last refresh status is not - Success"
def add_provider(self, delete_if_provider_present=True): self.provider_name = self.web_session.HAWKULAR_PROVIDER_NAME self.host_name = self.web_session.HAWKULAR_HOSTNAME self.port = self.web_session.HAWKULAR_PORT self.hawkular_user = self.web_session.HAWKULAR_USERNAME self.hawkular_password = self.web_session.HAWKULAR_PASSWORD # Check if any provider already exist. If exist, first delete all the providers and then add a provider. if self.does_provider_exist(): self.web_session.logger.info("Middleware Provider already exist.") if delete_if_provider_present: self.delete_provider(delete_all_providers=True) else: return else: self.web_session.logger.info("Adding Middleware Provider to ManageIQ instance") elem_config = self.web_driver.find_element_by_xpath("//button[@title='Configuration']") elem_config.click() assert ui_utils(self.web_session).waitForTextOnPage("Add a New Middleware Provider", 15) elem_add_new_provider = self.web_driver.find_element_by_xpath("//a[@title='Add a New Middleware Provider']") elem_add_new_provider.click() self.web_driver.implicitly_wait(15) assert ui_utils(self.web_session).waitForTextOnPage("Confirm Password", 15) # Enter the form details and submit to add the provider self.web_driver.find_element_by_xpath("//button[@data-id='server_emstype']").click() assert ui_utils(self.web_session).waitForTextOnPage("Hawkular", 30) self.web_driver.find_element_by_xpath("//span[contains(.,'Hawkular')]").click() assert ui_utils(self.web_session).waitForTextOnPage("Hostname or IP address", 30) # Enter the name of provider after selecting hawkular type from dropdown to take care of page load issues. elem_provider_name = self.web_driver.find_element_by_xpath("//input[@id='name']") elem_provider_name.send_keys(self.provider_name) elem_provider_hostname = self.web_driver.find_element_by_xpath("//input[@id='hostname']") elem_provider_hostname.send_keys(self.host_name) elem_provider_port = self.web_driver.find_element_by_xpath("//input[@id='port']") elem_provider_port.send_keys(self.port) elem_hawkular_user = self.web_driver.find_element_by_xpath("//input[@id='default_userid']") elem_hawkular_user.send_keys(self.hawkular_user) elem_hawkular_password = self.web_driver.find_element_by_xpath("//input[@id='default_password']") elem_hawkular_password.send_keys(self.hawkular_password) elem_hawkularVerify_password = self.web_driver.find_element_by_xpath("//input[@id='default_verify']") elem_hawkularVerify_password.send_keys(self.hawkular_password) self.web_driver.find_element_by_xpath("//button[@alt='Add this Middleware Provider']").click() assert ui_utils(self.web_session).waitForTextOnPage( 'Middleware Providers "{}" was saved'.format(self.provider_name), 15) if ui_utils(self.web_session).isElementPresent(By.XPATH, "//a[contains(@title,'Name: {}')]".format( self.provider_name)): self.web_session.logger.info("Middleware Provider added successfully.") # Navigate to the provider details page and check if the last refresh status is - Success. view(self.web_session).list_View() assert ui_utils(self.web_session).waitForTextOnPage(self.web_session.HAWKULAR_PROVIDER_NAME, 15) ui_utils(self.web_session).click_on_row_containing_text(self.web_session.HAWKULAR_PROVIDER_NAME) assert ui_utils(self.web_session).waitForTextOnPage("Status", 15) assert self.verify_refresh_status_success(), "The last refresh status is not - Success"