def validate_general_section_titles(): xpath_section = FusionSANManagersPage.ID_MENU_VIEW_MAIN_BTN xpath_title1 = FusionSANManagersPage.ID_VIEW_GENERAL_SAN_MANAGER xpath_title3 = FusionSANManagersPage.ID_VIEW_ACTIVITY_SAN_MANAGER xpath_title4 = FusionSANManagersPage.ID_VIEW_MAP_SAN_MANAGER try: ui_lib.wait_for_element_visible(xpath_section, 5) except: pass ui_lib.wait_for_element_and_click(xpath_section) title = "General" if ((ui_lib.get_text(xpath_title1, 1)) == title): logger._log_to_console_and_log_file(title + "Section found") else: ui_lib.fail_test("unable to find the" + title + "section") title = "Activity" if ((ui_lib.get_text(xpath_title3, 1)) == title): logger._log_to_console_and_log_file(title + "Section found") else: ui_lib.fail_test("unable to find the" + title + "section") title = "Map" if ((ui_lib.get_text(xpath_title4, 1)) == title): logger._log_to_console_and_log_file(title + "Section found") else: ui_lib.fail_test("unable to find the" + title + "section") return True
def verify_sanmanagers_count_dashboard(*sanmanager_obj): logger._log_to_console_and_log_file( "Function call to Add dashboard panel and validate sanmanagers count from Dashboard" ) s2l = ui_lib.get_s2l() """ Navigate to SAN Manager Page """ if not s2l._is_element_present(FusionSANManagersPage.ID_PAGE_LABEL): if not navigate(): return False san_managers_count = ui_lib.get_text( FusionSANManagersPage.ID_SAN_MANAGERS_COUNT, 2) """ Retrieve data from datasheet """ if isinstance(sanmanager_obj, test_data.DataObj): sanmanager_obj = [sanmanager_obj] elif isinstance(sanmanager_obj, tuple): sanmanager_obj = list(sanmanager_obj) """ Navigate to Dashboard Page *sanmanager_obj """ fusion_ui.dashboard.navigate() fusion_ui.dashboard.create_dashboard(sanmanager_obj) # fusion_ui.dashboard.verify_dashboard_exist(sanmanager_obj) fusion_ui.dashboard.navigate() san_managers_count_dashboard = ui_lib.get_text( FusionSANManagersPage.ID_DASHBOARD_SAN_MANAGERS_COUNT, 1) if (san_managers_count == san_managers_count_dashboard): logger._log_to_console_and_log_file( "successfully verified dashboard san managers count") return True else: message = "Dashboard san managers count failed to match with actual sanmanagers count" raise AssertionError(message)
def validate_all_states_filter(): xpath_states = FusionSANPage.ID_SAN_ALL_STATES logger._log_to_console_and_log_file( "Validate All States Filter on the SAN Page %s") try: ui_lib.wait_for_element_visible(xpath_states, 10) except: pass ui_lib.wait_for_element_and_click(xpath_states) if (ui_lib.get_text(FusionSANPage.ID_SAN_ALL_STATES_DISCOVERED, 1) == "Discovered"): logger._log_to_console_and_log_file("State Discovered found") else: ui_lib.fail_test( "unable to find the Discovered State, the value is" + ui_lib.get_text(FusionSANPage.ID_SAN_ALL_STATES_DISCOVERED, 1)) if (ui_lib.get_text(FusionSANPage.ID_SAN_ALL_STATES_MANAGED, 1) == "Managed"): logger._log_to_console_and_log_file("Status Managed found") else: ui_lib.fail_test( "unable to find the Managed State, the value is" + ui_lib.get_text(FusionSANPage.ID_SAN_ALL_STATES_MANAGED, 1))
def get_scope_name(cls, timeout=5, fail_if_false=True, hidden_element=False): logger.debug("Scope Name is : %s" % ui_lib.get_text(GeneralScopesElements.ID_SCOPE_NAME, timeout, fail_if_false, hidden_element)) return ui_lib.get_text(GeneralScopesElements.ID_SCOPE_NAME, timeout, fail_if_false, hidden_element)
def get_scope_description(cls, timeout=5, fail_if_false=True, hidden_element=False): logger.debug( "Scope Description is : %s" % ui_lib.get_text(GeneralScopesElements.ID_SCOPE_DESCRIPTION, timeout, fail_if_false, hidden_element)) return ui_lib.get_text(GeneralScopesElements.ID_SCOPE_DESCRIPTION, timeout, fail_if_false, hidden_element)
def _report_page_alert_dateils(index): alert_details = {} alert_details["severity"] = ui_lib.get_text(FusionReportsPage.ID_ACTIVE_ALERT_DETAILS % index + "/td[2]") if alert_details["severity"] == "Critical": alert_details["severity"] = "error" alert_details["name"] = ui_lib.get_text(FusionReportsPage.ID_ACTIVE_ALERT_DETAILS % index + "/td[5]") alert_details["resolution"] = ui_lib.get_text(FusionReportsPage.ID_ACTIVE_ALERT_DETAILS % index + "/td[9]") alert_details["resource"] = ui_lib.get_text(FusionReportsPage.ID_ACTIVE_ALERT_DETAILS % index + "/td[6]") alert_details["resource_type"] = ui_lib.get_text(FusionReportsPage.ID_ACTIVE_ALERT_DETAILS % index + "/td[7]") return alert_details
def __checkSystemProfilesSummaryStatus(expectedStatus): # read counters from the UI try: ui_lib.wait_for_element_visible(DashboardPage.SYSTEM_PROFILES_CONTAINER_PATH) CriticalCounter = int(ui_lib.get_text(DashboardPage.SYSTEM_PROFILES_CRITICAL_COUNTER, timeout=2)) WarningCounter = int(ui_lib.get_text(DashboardPage.SYSTEM_PROFILES_WARNING_COUNTER, timeout=2)) OKCounter = int(ui_lib.get_text(DashboardPage.SYSTEM_PROFILES_OK_COUNTER, timeout=2)) logger._log_to_console_and_log_file("\t- Counters found: Critical = %i | Warning = %i | OK = %i" % (CriticalCounter, WarningCounter, OKCounter)) except Exception, e: logger._log_to_console_and_log_file(e) logger._log_to_console_and_log_file("\tWarning! At least one of the summary counters is not available") return False
def get_port_vlan_data(cls, index, timeout=5): logger.debug("Get Vlan Network data") j = index + 1 ui_lib.wait_for_element_and_click(GeneralSwitchesElements.ID_SWITCH_EXPAND_TABLE_ROW % index, 90) if not ui_lib.wait_for_element_and_click(GeneralSwitchesElements.ID_SWITCH_PORT_TABLE_VLAN_LABEL % j, 120): ui_lib.fail_test("Vlan ID Lable is not visible") vlan_data = ui_lib.get_text(GeneralSwitchesElements.ID_SWITCH_PORT_TABLE_VLAN_DATA % j, 180) if not vlan_data: vlan_data = ui_lib.get_text(GeneralSwitchesElements.ID_SWITCH_PORT_TABLE_VLAN_DATA % j, 240) if not ui_lib.wait_for_element_and_click(GeneralSwitchesElements.ID_SWITCH_PORT_TABLE_VLAN_LABEL % j, 180): logger.debug("retrying to collapse the expanded port...") ui_lib.wait_for_element_visible(GeneralSwitchesElements.ID_SWITCH_PORT_TABLE_VLAN_LABEL % j, 90) ui_lib.wait_for_element_and_click(GeneralSwitchesElements.ID_SWITCH_PORT_TABLE_VLAN_LABEL % j, 150) ui_lib.wait_for_element_and_click(GeneralSwitchesElements.ID_SWITCH_EXPAND_TABLE_ROW % index, 90) return vlan_data
def verify_drive_enclosure_temperature(cls, view, expect_value, timeout=5, fail_if_false=True): if expect_value: logger.info( "verify [ Temperature ] in %s view, expected value is [ %s ]" % (view, expect_value)) FusionUIBase.verify_element_text( "Temperature", DriveEnclosuresElements.ID_TEMPERATURE, expect_value, timeout, fail_if_false) else: temperature = ui_lib.get_text( DriveEnclosuresElements.ID_TEMPERATURE, timeout=10, fail_if_false=True) try: tempvalue = int(temperature) logger.info('Drive enclosure temperature is %s' % tempvalue) except ValueError: logger.info( 'Driver enclosure temperature is not integer -- %s' % temperature) ui_lib.fail_test( 'Driver enclosure temperature is not integer -- %s' % temperature)
def _validate_error_object_hyper_link(component): """ validating dash board component's error object hyper link """ if not ui_lib.wait_for_element(FusionDashboardPage.ID_PAGE_LABEL): navigate() ui_lib.wait_for_element( FusionDashboardPage.ID_OK_COUNT_SUMMARY % component, PerfConstants.DEFAULT_SYNC_TIME) ok_obj_count = int( ui_lib.get_text(FusionDashboardPage.ID_OK_COUNT_SUMMARY % component)) logger._log_to_console_and_log_file( "number of ok status are:{0}".format(ok_obj_count)) ui_lib.wait_for_element(FusionDashboardPage.ID_OK_COUNT_SUMMARY % component) ui_lib.wait_for_element_and_click(FusionDashboardPage.ID_OK_COUNT_SUMMARY % component) if int(ok_obj_count) == 0: logger._log_to_console_and_log_file( "'{0}' Component does not have any ok status".format(component)) return True else: if not _validate_dashboard_component_hyper_link( component, ok_obj_count): return False
def get_scope_error_message(cls, timeout=5, fail_if_false=True, hidden_element=False): logger.debug("Get scope error message") return ui_lib.get_text(GeneralScopesElements.ID_SCOPE_ERROR_TEXT, timeout, fail_if_false, hidden_element)
def get_scope_count(cls, timeout=5, fail_if_false=True, hidden_element=False): logger.debug("Get Scope Count") return ui_lib.get_text(GeneralScopesElements.ID_SCOPE_COUNT, timeout, fail_if_false, hidden_element)
def get_contents_from_UI(): go_system_profiles_wait_for_contents_to_load() cData = ui_lib.get_text(systemprofilesPage.OVERVIEW_CONTENTS) logger._log_to_console_and_log_file( "Creating a Dictionary from the following Text from System profile UI: \n\"%s\"" % cData) cData = cData.split() logger._log_to_console_and_log_file( "Contents from UI after split: \"%s\"\n" % cData) ss_count = get_text_from_contents_storage(cData) spt_count = get_text_from_server_profile_template(cData) rack_total = Rack() rack_total.clusters = get_text_from_contents_clusters(cData) rack_total.enclosures = get_text_from_contents_enclosures(cData) rack_total.interconnects = get_text_from_contents_interconnects(cData) rack_total.mngHosts = get_text_from_contents_management_hosts(cData) rack_total.racks = get_text_from_contents_racks(cData) ui_contents = Converged_System([rack_total], ss_count, spt_count) return ui_contents
def _validate_critical_object_hyper_link(component): """ validating dash board component's critical object hyper link """ if not ui_lib.wait_for_element(FusionDashboardPage.ID_PAGE_LABEL): navigate() ui_lib.wait_for_element( FusionDashboardPage.ID_CRITICAL_OBJECTS_COUNT % component, PerfConstants.DEFAULT_SYNC_TIME) critical_obj_count = ui_lib.get_text( FusionDashboardPage.ID_CRITICAL_OBJECTS_COUNT % component) logger._log_to_console_and_log_file( "number of objects with critical status :{0}".format( critical_obj_count)) ui_lib.wait_for_element(FusionDashboardPage.ID_CRITICAL_OBJECTS_COUNT % component) ui_lib.wait_for_element_and_click( FusionDashboardPage.ID_CRITICAL_OBJECTS_COUNT % component) if int(critical_obj_count) == 0: logger._log_to_console_and_log_file( "'{0}' Component does not have any critical status".format( component)) return True else: if not _validate_dashboard_component_hyper_link( component, critical_obj_count): return False
def verify_error_message_when_add_invalid_or_duplicated_license( cls, negative_type, timeout=5, fail_if_false=True): logger.debug( "Verify the error message is correct as input : {}".format( negative_type)) errtxt_locater = AddLicensesElements.ID_TEXT_ADD_DUPLICATED_ERROR if "DUPLICATE" in negative_type.upper( ) else AddLicensesElements.ID_TEXT_ADD_INVALID_ERROR return ui_lib.get_text(errtxt_locater, timeout, fail_if_false)
def get_storage_pool_status(cls, storage_pool_name, storage_system_name, timeout=5, fail_if_false=True): ''' Get the status of a specific storage pool ''' logger.debug("get storage pool '%s' status ..." % storage_pool_name) ret = ui_lib.get_text(GeneralStoragePoolElements.ID_STATUS_STORAGE_POOL % (storage_pool_name, storage_system_name), timeout=timeout, fail_if_false=fail_if_false, hidden_element=True) logger.debug("status of storage pool '%s (%s)' is '%s'" % (storage_pool_name, storage_system_name, ret)) return ret
def verify_dashboard_exist(*dashboard_obj): """ Verify Dashboard Should Exist """ selenium2lib = ui_lib.get_s2l() # resources that does not match with Dashboard page label resources = { "alerts": 'activity', "fc-device-managers": "san managers", "firmware-drivers": "firmware Bundles", "grouprolemappings": "users and groups", "tasks": "activity", "ethernet-networks": "networks", "fc-networks": "networks", "power-devices": "power delivery devices", "users": "users and groups" } if not selenium2lib._is_element_present(FusionDashboardPage.ID_PAGE_LABEL): navigate() if type(dashboard_obj) is test_data.DataObj: dashboard_obj = [dashboard_obj] elif type(dashboard_obj) is tuple: dashboard_obj = list(dashboard_obj[0]) for dashboard in dashboard_obj: if len(dashboard.title.strip()) > 0: logger._log_to_console_and_log_file( "\nVerifying Dashboard %s exist..." % dashboard.title) if selenium2lib._is_visible( FusionDashboardPage.ID_LINK_DASHBOARD_NAME % dashboard.title): logger._log_to_console_and_log_file( "Dashboard exist, verifying Dashboard link...") ui_lib.wait_for_element_and_click( FusionDashboardPage.ID_LINK_DASHBOARD_NAME % dashboard.title) ui_lib.wait_for_element_visible( FusionDashboardPage.ID_LINK_ADD_DASHBOARD) pagelabel = ui_lib.get_text( FusionDashboardPage.ID_PAGE_LABEL_TEXT) for key in resources: if key == dashboard.title: dashboardlabel = resources[key] else: dashboardlabel = dashboard.title.replace('-', ' ') if pagelabel.lower() == dashboardlabel.lower(): logger._log_to_console_and_log_file( "Verified Dashboard link accessible") return True else: message = "Dashboard -- %s link is not accessible" % dashboard.title raise AssertionError(message) else: locator = FusionDashboardPage.ID_LINK_DASHBOARD_NAME % dashboard.title message = "Dashboard is not visible in the Dashboards Page with element %s" % locator raise AssertionError(message) else: message = "\n%s has Dashboard title name is empty" % dashboard.name raise AssertionError(message)
def get_port_status(cls, port, timeout=5): logger.debug("Get switch port status") ui_lib.wait_for_element_and_click(GeneralSwitchesElements.ID_SWITCH_ACTION_BTN) ui_lib.wait_for_element_and_click(GeneralSwitchesElements.ID_SWITCH_EDIT_BTN) if not ui_lib.wait_for_element_visible(GeneralSwitchesElements.ID_SWITCH_EDIT_LABEL): return None status = ui_lib.get_text(GeneralSwitchesElements.ID_SWITCH_PORTSTATUS % port) ui_lib.wait_for_element_and_click(GeneralSwitchesElements.ID_SWITCH_OK_BTN) return status
def edit_switch_port(cls, port, timeout=5): logger.debug("Enable or Disable switch port ") ui_lib.wait_for_element_and_click(GeneralSwitchesElements.ID_SWITCH_ACTION_BTN) ui_lib.wait_for_element_and_click(GeneralSwitchesElements.ID_SWITCH_EDIT_BTN) if not ui_lib.wait_for_element_visible(GeneralSwitchesElements.ID_SWITCH_EDIT_LABEL, 10): return None if not ui_lib.wait_for_element_and_click(GeneralSwitchesElements.ID_SWITCH_CHECKBOX % port, 10): return ui_lib.get_text(GeneralSwitchesElements.ID_SWITCH_TABLE_ROW_COUNT) return True
def validate_all_statuses_filter(): xpath_statuses = FusionSANPage.ID_SAN_ALL_STATUSES logger._log_to_console_and_log_file( "Validate All Statuses Filter on the SAN Page %s") try: ui_lib.wait_for_element_visible(xpath_statuses, 10) except: pass ui_lib.wait_for_element_and_click(xpath_statuses) if (ui_lib.get_text(FusionSANPage.ID_SAN_STATUSES_CRITICAL, 1) == "Critical"): logger._log_to_console_and_log_file("Status Critical found") else: ui_lib.fail_test( "unable to find the Critical Status, the value is" + ui_lib.get_text(FusionSANPage.ID_SAN_STATUSES_CRITICAL, 1)) if (ui_lib.get_text(FusionSANPage.ID_SAN_STATUSES_WARNING, 1) == "Warning"): logger._log_to_console_and_log_file("Status Warning found") else: ui_lib.fail_test( "unable to find the Warning Status, the value is" + ui_lib.get_text(FusionSANPage.ID_SAN_STATUSES_WARNING, 1)) if (ui_lib.get_text(FusionSANPage.ID_SAN_STATUSES_OK, 1) == "OK"): logger._log_to_console_and_log_file("Status OK found") else: ui_lib.fail_test("unable to find the OK Status, the value is" + ui_lib.get_text(FusionSANPage.ID_SAN_STATUSES_OK, 1)) if (ui_lib.get_text(FusionSANPage.ID_SAN_STATUSES_UNKNOWN, 1) == "Unknown"): logger._log_to_console_and_log_file("Status Unknown found") else: ui_lib.fail_test( "unable to find the Unknown Status, the value is" + ui_lib.get_text(FusionSANPage.ID_SAN_STATUSES_UNKNOWN, 1)) if (ui_lib.get_text(FusionSANPage.ID_SAN_STATUSES_DISABLED, 1) == "Disabled"): logger._log_to_console_and_log_file("Status Disabled found") else: ui_lib.fail_test( "unable to find the Disabled Status, the value is" + ui_lib.get_text(FusionSANPage.ID_SAN_STATUSES_DISABLED, 1))
def validate_section_on_san_screen(section_name): logger._log_to_console_and_log_file("section_name=%s" % section_name) xpath_section = FusionSANPage.ID_SAN_SECTION_NAME try: ui_lib.wait_for_element_visible(xpath_section, 12) except: pass logger._log_to_console_and_log_file("Validate %s section on SAN screen" % section_name) logger._log_to_console_and_log_file("get text value=%s" % ui_lib.get_text(xpath_section, 1)) if (section_name != "General"): # and section_name != "SAN Endpoints"): BuiltIn().should_be_equal(ui_lib.get_text(xpath_section, 1), (section_name + " Edit")) else: BuiltIn().should_be_equal(ui_lib.get_text(xpath_section, 1), section_name)
def input_select_lig(cls, enc_no, switch_no, switch_lig, timeout=5): logger.debug("input and select logical interconnect group [ %s ] for <enclosure: %s, bay: %s>" % (switch_lig, enc_no, switch_no)) BuiltIn().sleep(5) ui_lib.wait_for_element_and_input_text(CreateEnclosureGroupElements.ID_TBIRD_INPUT_CHOOSE_LIG % (enc_no, switch_no), switch_lig, timeout, fail_if_false=True) ui_lib.wait_for_element_visible(CreateEnclosureGroupElements.ID_TBIRD_CHOOSE_LIG_LAYER % (enc_no, switch_no), timeout, fail_if_false=True) ui_lib.wait_for_element_and_click(CreateEnclosureGroupElements.ID_TBIRD_SELECT_OPTION_CHOOSE_LIG % (enc_no, switch_no, switch_lig), timeout, fail_if_false=True, js_click=True) if ui_lib.wait_for_element_visible(EditEnclosureGroupElements.ID_TBIRD_TEXT_CHANGE_LIG_NOTIFICATION_HEADER, timeout, fail_if_false=False): msg_notification = ui_lib.get_text(EditEnclosureGroupElements.ID_TBIRD_TEXT_CHANGE_LIG_NOTIFICATION, timeout, fail_if_false=True) logger.info(msg_notification) ui_lib.wait_for_element_and_click(EditEnclosureGroupElements.ID_TBIRD_BUTTON_CHANGE_LIG_CONFIRM, timeout, fail_if_false=True) ui_lib.wait_for_element_hidden(CreateEnclosureGroupElements.ID_TBIRD_CHOOSE_LIG_LAYER % (enc_no, switch_no), timeout, fail_if_false=True)
def sanmanager_actions_flatsan_validate(): xpath_tab = FusionSANManagersPage.ID_MENU_ACTION_MAIN_BTN xpath_tab_option1 = FusionSANManagersPage.ID_ACTIONS_ADD_SAN_MANAGER xpath_tab_option2 = FusionSANManagersPage.ID_ACTIONS_EDIT_SAN_MANAGER xpath_tab_option3 = FusionSANManagersPage.ID_ACTIONS_REFRESH_SAN_MANAGER xpath_tab_option4 = FusionSANManagersPage.ID_ACTIONS_REMOVE_SAN_MANAGER try: ui_lib.wait_for_element_visible(xpath_tab, 10) except: pass ui_lib.wait_for_element_and_click(xpath_tab) tab_name = "Add" if ((ui_lib.get_text(xpath_tab_option1, 1)) == tab_name): logger._log_to_console_and_log_file(tab_name + "Tab found") else: ui_lib.fail_test("unable to find the" + tab_name + "tab") tab_name = "Refresh" if ((ui_lib.get_text(xpath_tab_option3, 1)) == tab_name): logger._log_to_console_and_log_file(tab_name + "Tab found") else: ui_lib.fail_test("unable to find the" + tab_name + "tab") tab_name = "Edit" if ((ui_lib.get_text(xpath_tab_option2, 1)) == tab_name): ui_lib.fail_test("Error- " + tab_name + "tab was found in action menu for flatsan") logger._log_to_console_and_log_file(tab_name + "Tab found- error") else: logger._log_to_console_and_log_file(tab_name + "Tab not found - pass") tab_name = "Remove" if ((ui_lib.get_text(xpath_tab_option4, 1)) == tab_name): ui_lib.fail_test("Error- " + tab_name + "tab was found in action menu for flatsan") logger._log_to_console_and_log_file(tab_name + "Tab found- error") else: logger._log_to_console_and_log_file(tab_name + "Tab not found - pass") return True
def get_scopename_validate_message(cls, timeout=5, fail_if_false=True, hidden_element=False): logger.debug("Get scopename validate mesaage") if ui_lib.is_visible(GeneralScopesElements.ID_SCOPE_NAME_VALIDATE_MSG, timeout, fail_if_false): return ui_lib.get_text( GeneralScopesElements.ID_SCOPE_NAME_VALIDATE_MSG, timeout, fail_if_false, hidden_element) else: return None
def validate_filter_message(msg): logger._log_to_console_and_log_file( "Validating filter message= %s is as expected" % msg) xpath_msg = FusionSANPage.ID_SAN_ENDPOINTS_MESSAGE try: ui_lib.wait_for_element_visible(xpath_msg, 30) except: pass msg = "There are no available SAN endpoints to display." BuiltIn().should_be_equal(ui_lib.get_text(xpath_msg, 1), msg)
def compare_resource(loop_cnt, activity): '''For particular Activity name, checks Resource field correct or not''' if ui_lib.wait_for_element( FusionActivityPage.ID_ACTIVITY_SOURCE_DETAILS % (loop_cnt), PerfConstants.DEFAULT_SYNC_TIME): if ui_lib.get_text( FusionActivityPage.ID_ACTIVITY_SOURCE_DETAILS % (loop_cnt), PerfConstants.DEFAULT_SYNC_TIME) == activity.resource: return True else: return False
def validate_for_report(san_name): xpath_heading = FusionSANPage.ID_UNEXPECTED_ZONING_REPORT_HEADING xpath_message = FusionSANPage.ID_UNEXPECTED_ZONING_REPORT_MESSAGE BuiltIn().sleep(5) heading = "Unexpected Zoning Report for %s on 172.18.15.1" % san_name message = "No unexpected zoning was found" selenium2lib = ui_lib.get_s2l() logger._log_to_console_and_log_file( "Validate Unexpected Zoning Report for heading and message for %s" % san_name) ui_lib.select_window_by_title("OneView", 5) BuiltIn().sleep(5) if (message == ui_lib.get_text(xpath_message, 1)): logger._log_to_console_and_log_file(message + " msg found") else: ui_lib.fail_test("unable to find the" + message + " msg") if (heading == ui_lib.get_text(xpath_heading, 1)): logger._log_to_console_and_log_file(heading + " found") else: ui_lib.fail_test("unable to find the " + heading + " msg") selenium2lib.close_window()
def click_firmware_bundle(cls, spp_name, firmware_version, timeout=5, fail_if_false=True): firmware_bundle_name = spp_name + ', ' + firmware_version logger.debug("Select firmware_bundle [%s]" % firmware_bundle_name) if not ui_lib.wait_for_element_and_click(FusionFirmwareBundlePage.ID_TABLE_FIRMWARE_BUNDLE % (spp_name, firmware_version), timeout=timeout, fail_if_false=fail_if_false): logger.warn("Failed to select firmware bundle") return False str_title = ui_lib.get_text(FusionFirmwareBundlePage.ID_FWDRIVER_TITLE, timeout=timeout, fail_if_false=fail_if_false) if firmware_bundle_name.strip() == str_title.strip(): logger.info("Selected the Firmware Bundle %s with version %s successfully" % (spp_name, firmware_version)) return True else: msg = "Fail in selecting Firmware Bundle %s with version %s" % (spp_name, firmware_version) return FusionUIBase.fail_test_or_return_false(msg, fail_if_false=fail_if_false)
def validate_filter(line_count): logger._log_to_console_and_log_file( "Validating count= %s on san endpoints page is as expected" % line_count) xpath_count = FusionSANPage.ID_SAN_ENDPOINTS_COUNT try: ui_lib.wait_for_element_visible(xpath_count, 20) except: pass BuiltIn().should_be_equal(ui_lib.get_text(xpath_count, 1), line_count)
def compare_name(loop_cnt, activity): '''Compares the Activity name''' if ui_lib.wait_for_element( FusionActivityPage.ID_ACTIVITY_NAME_DETAILS % (loop_cnt), PerfConstants.DEFAULT_SYNC_TIME): if ui_lib.get_text( FusionActivityPage.ID_ACTIVITY_NAME_DETAILS % (loop_cnt), PerfConstants.DEFAULT_SYNC_TIME) == activity.name: return True else: return False