def Clear_All_Data(self, location, button, message): try: self.System_Operation_Data() self.Click_Serial_Number() # Clear the Message Log data # selenium.click( "link="+location) total_file = selenium.get_text( "xpath="+config_element.get("delete_file", "get_allfile_number")) total_file_number = total_file.split()[1] # catch the total number print "The total number is " + total_file_number total_delete_times = str( int(math.ceil(float(total_file_number)/25))) print "The total delete times is " + total_delete_times for delete_times in range(0, int(math.ceil(float(total_file_number)/25))): # wait the previous delete file time.sleep(4) print "Delete " + str(delete_times+1) + " times" selenium.click( "css="+config_element.get("delete_file", "select_allfile_checkbox")) selenium.click( "xpath="+button) selenium.get_confirmation() successfully_request_to_message_log = selenium.get_text( "xpath="+config_element.get("system", "parameter_value_successfully")) if successfully_request_to_message_log == message: print successfully_request_to_message_log else: raise Exception("Get value was not success") except: raise Exception("The all message log was not clear - FAIL")
def Delete_All_Devices(self): try: self.System_Operation_Data() total_file = selenium.get_text( "xpath="+config_element.get("delete_file", "get_allfile_number")) total_file_number = total_file.split()[1] print "The total number is " + total_file_number # catch the total number for delete_times in range(0, int(math.ceil(float(total_file_number)/25))): time.sleep(5) # wait the previous delete file print "Delete " + str(delete_times+1) + " times" selenium.click( "css="+config_element.get("delete_file", "select_allfile_checkbox")) selenium.click( "xpath="+config_element.get("delete_file", "delete_all_device_button")) selenium.get_confirmation() ################### Verify the success message ################ selenium.click( "name="+config_element.get("delete_file", "downframe")) delete_cpe_successfully = selenium.get_text( "xpath="+config_element.get("delete_file", "delete_successfully")) time.sleep(5) if delete_cpe_successfully == "Delete cpe successfully!": print delete_cpe_successfully else: raise Exception("Delete file was not success") print "Delete allfile - PASS" except: raise Exception("Delete file was not success")
def Add_All_Devices(self): try: self.System_Operation_Data() selenium.click( "xpath="+config_element.get("add_file", "click_add_button")) for add_file_times in range(0, 1): print "The " + str(add_file_times+1) + " add the file" time.sleep(1) selenium.click( "name="+config_element.get("add_file", "downframe")) selenium.type("xpath="+config_element.get("add_file", "oui_text"), config_setting.get("add_file", "oui_value")) selenium.type("xpath="+config_element.get("add_file", "product_class"), config_setting.get("add_file", "product_value")) selenium.type("xpath="+config_element.get("add_file", "serial_number"), config_setting.get("add_file", "serial_number") + " - " + str(add_file_times+1)) selenium.click( "css="+config_element.get("add_file", "submit_button")) ################### Verify the success message ################ selenium.click( "name="+config_element.get("add_file", "downframe")) add_cpe_successfully = selenium.get_text( "xpath="+config_element.get("add_file", "add_cpe_successfully")) if add_cpe_successfully == "The CPE has exsited.": print add_cpe_successfully elif add_cpe_successfully == "Add successfully.": print add_cpe_successfully else: raise Exception("Add file was not success") print "Add the file - PASS" except: raise Exception("Add the file was not success")
def HeNS_Request_Message(self, boolean, heMS_SetParameterValues): # try: pyautogui.click(1000, 30) self.System_Operation_Data() self.Click_Serial_Number() # Click the Message Log # selenium.click( "link="+config_element.get("system", "system_message_log")) # Refresh the list content for refresh in range(2): selenium.click( "xpath="+config_element.get("system", "system_refresh_button")) # Select the HeMS detail message print 'Type the serial number.' self.Click_CheckBox() selenium.type("id="+config_element.get("detail_message", "search_askey_root"), config_element.get("detail_message", "input_askey_root")) time.sleep(3) selenium.click( "xpath="+config_element.get("detail_message", "search_button")) print "Select the key code" # Verify the SetParameterValues text can be get setParameterValues = selenium.get_text( "xpath="+config_element.get("detail_message", "parametervalues_text")) if setParameterValues == 'SetParameterValues': print 'Get the SetParameterValues text!!' else: print "Do not Get the SetParameterValues text!!" android = Android() android.Copy_Trace_Folder() raise Exception("Do not Get the SetParameterValues text!!") self.Autoit_Detail_Message(40) # Get the message from Get_clipboard message_log_detail_dialog = self.Get_Clipboard() # Verify the boolean value if '<Value xsi:type="boolean">' + boolean + '</Value>' in message_log_detail_dialog: print 'The boolean was matched - SUCCESS' elif '<Value xsi:type="boolean">' + 'true' + '</Value>' in message_log_detail_dialog: print 'The boolean was matched - SUCCESS' elif '<Value xsi:type="boolean">' + 'false' + '</Value>' in message_log_detail_dialog: print 'The boolean was matched - SUCCESS' else: print "The boolean was not matched - FAIL" android = Android() android.Copy_Trace_Folder() raise Exception("The boolean was not matched - FAIL") time.sleep(1) now = time.strftime("%Y-%m-%d-%H_%M_%S", time.localtime(time.time())) heMS_SetParameterValues = heMS_SetParameterValues + '_' + now + '.txt' fp = open(heMS_SetParameterValues, "w") fp.write(message_log_detail_dialog) autoit.Sleep(1000) autoit.Send("!{F4}") print "Close the Detail page"
def ACS_Initiate_Connection(self): try: self.System_Operation_Data() self.Click_Serial_Number() time.sleep(2) selenium.click( "link="+config_element.get("system", "system_message_queue")) print "Click the message queue" for i in range(2): selenium.click( "xpath="+config_element.get("system", "system_refresh_button")) print "Click the refresh " + str(i+1) + " times" # Verify the SetParameterValues text can be get # time.sleep(1) # Wait the 1 sec for get the acs parametervalues text on 106/06/11 setParameterValues = selenium.get_text( "xpath="+config_element.get("detail_message", "acs_parametervalues_text")) if setParameterValues == 'SetParameterValues': print 'Get the SetParameterValues text!!' else: print "Do not Get the SetParameterValues text!!" android = Android() android.Copy_Trace_Folder() raise Exception("Do not Get the SetParameterValues text!!") self.Autoit_Tab_button(38, 200) autoit.Sleep(2000) autoit.Send("{ENTER}") print 'Click the ACS TCP Initiate Connection was finished' autoit.Sleep(2000) # IE 9 autoit.WinWaitActive( "[title:ACS Notify Page - Windows Internet Explorer]", "") autoit.ControlClick( "ACS Notify Page - Windows Internet Explorer", "", "ToolbarWindow321") self.Autoit_Tab_button(4, 100) autoit.Sleep(2000) autoit.Send("{ENTER}") autoit.Sleep(2000) delete_subfolder = Delete_Subfolder() delete_subfolder.Delete_Path_Subfolder("..\\..\\Result\\femtolog") adbClient = AdbClient() time.sleep(2) adbClient.Swiandroidh_ACS() autoit.WinClose("[class:IEFrame]") # Click the refresh button for i in range(1): selenium.click( "xpath="+config_element.get("system", "system_refresh_button")) print "Click the refresh " + str(i+1) + " times" autoit.Sleep(2000) print "Click the acs initiate connectin button" except: raise Exception("The ace initiate button was not click - FAIL")
def testLinks(self): selenium = self.selenium selenium.open("/selenium-server/tests/html/test_click_page1.html") self.failUnless(selenium.get_text("link").find("Click here for next page") != -1, "link 'link' doesn't contain expected text") links = selenium.get_all_links() self.failUnless(len(links) > 3) self.assertEqual("linkToAnchorOnThisPage", links[3]) selenium.click("link") selenium.wait_for_page_to_load(5000) self.failUnless(selenium.get_location().endswith("/selenium-server/tests/html/test_click_page2.html")) selenium.click("previousPage") selenium.wait_for_page_to_load(5000) self.failUnless(selenium.get_location().endswith("/selenium-server/tests/html/test_click_page1.html"))
def testKeyPress(self): selenium = self.selenium input_id = 'ac4' update_id = 'ac4update' selenium.open("http://www.irian.at/selenium-server/tests/html/ajax/ajax_autocompleter2_test.html") selenium.key_press(input_id, 74) time.sleep(0.5) selenium.key_press(input_id, 97) selenium.key_press(input_id, 110) time.sleep(0.5) self.failUnless('Jane Agnews' == selenium.get_text(update_id)) selenium.key_press(input_id, '\9') time.sleep(0.5) self.failUnless('Jane Agnews' == selenium.get_value(input_id))
def HeNB_Response_Message(self, status, heNB_SetParameterValuesResponse): try: pyautogui.click(1000, 30) self.System_Operation_Data() self.Click_Serial_Number() # Click the Message Log # selenium.click( "link="+config_element.get("system", "system_message_log")) # Select the HeNB detail message print 'Type the serial number.' self.Click_CheckBox() time.sleep(3) selenium.click( "xpath="+config_element.get("detail_message", "search_button")) print "Select the key code" # Verify the SetParameterValuesResponse text can be get setParameterValuesResponse = selenium.get_text( "xpath="+config_element.get("detail_message", "parametervalues_text")) if setParameterValuesResponse == 'SetParameterValuesResponse': print 'Get the SetParameterValuesResponse text!!' else: print "Do not Get the SetParameterValues text!!" android = Android() android.Copy_Trace_Folder() raise Exception("Do not Get the SetParameterValues text!!") self.Autoit_Detail_Message(40) # Get the message from Get_clipboard message_log_detail_dialog = self.Get_Clipboard() # Verify the status value if '<Status>' + status + '</Status>' in message_log_detail_dialog: print 'The status was matched - SUCCESS' else: print "The status was not matched - FAIL" android = Android() android.Copy_Trace_Folder() raise Exception("The status was not matched - FAIL") time.sleep(1) now = time.strftime("%Y-%m-%d-%H_%M_%S", time.localtime(time.time())) heNB_SetParameterValuesResponse = heNB_SetParameterValuesResponse + '_' + now + '.txt' fp = open(heNB_SetParameterValuesResponse, "w") fp.write(message_log_detail_dialog) autoit.Sleep(1000) autoit.Send("!{F4}") print "Close the Detail page" except: raise Exception("The HeNB_Response_Message was not success - FAIL")
def Parameter_List_Adminstate(self, boolean): try: self.System_Operation_Data() self.Click_Serial_Number() selenium.click( "link="+config_element.get("system", "system_parameter_list")) time.sleep(2) print "Click the Parameter List" selenium.click("link="+config_element.get("adminstate", "adminstate_location")) self.Set_Value(boolean) successfully_request_to_message_queue = selenium.get_text( "xpath="+config_element.get("adminstate", "parameter_value_successfully")) if successfully_request_to_message_queue == "Successfully add SetParameterValues request to the Message Queue!": print successfully_request_to_message_queue else: raise Exception("Get value was not success") except: raise Exception("The parameter location was not found - FAIL")
def testMemberViewsAndEditsHisAccountSettings(self): ''' Member views and edits his account settings. Persistance is tested by changing the about field twice and verifying the saved input ''' selenium = self.selenium self.preconditionLoggedIn() selenium.open("/") selenium.wait_for_page_to_load("30000") selenium.click("sidebarMenu-accountSettings") selenium.wait_for_page_to_load("30000") self.assertEqual("page-account-view", selenium.get_attribute("//body@id")) selenium.click("btnEditAccount") selenium.wait_for_page_to_load("30000") self.assertEqual("page-account-edit", selenium.get_attribute("//body@id")) selenium.type("About", "Bonjour!") selenium.click("btnSave") selenium.wait_for_page_to_load("30000") self.assertEqual("page-account-view", selenium.get_attribute("//body@id")) self.assertEqual("Bonjour!", selenium.get_text("valAbout")) selenium.click("btnEditAccount") selenium.wait_for_page_to_load("30000")