diff --git a/tests/console/Alerts.py b/tests/console/Alerts.py index 05524a0688..e27702dea9 100644 --- a/tests/console/Alerts.py +++ b/tests/console/Alerts.py @@ -93,6 +93,55 @@ class Alerts (PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//a[contains(.,"'+template_name+'")]') self.assertIsInstance(element,WebElement) + def test_D_edit_template_created(self): + + u""" + Create a new template and edit template created, verify the changes + """ + + template_name = gen_random_string(6) + + driver = self.driver + + self.login() + + detect_and_pass_all_wizards(driver) + + field_list = ["_agentcustomid_","_address_","_module_","_modulecustomid_"] + + days_list=["monday","wednesday","saturday"] + + create_new_template_to_alert(driver,template_name,"Databases","Mail to Admin","Critical",list_days=days_list,description="Template with test C",field_list=field_list) + + element = driver.find_element_by_xpath('//td[contains(.,"Successfully")]') + self.assertIsInstance(element,WebElement) + + time.sleep(3) + + click_menu_element(driver,"Templates") + + element = driver.find_element_by_xpath('//a[contains(.,"'+template_name+'")]') + self.assertIsInstance(element,WebElement) + + new_field_list = ["_agent_","_agentdescription_","_data_","_alert_description_"] + + edit_template_to_alert(driver,template_name,new_action="Create a ticket in Integria IMS",new_field_list=new_field_list) + + element = driver.find_element_by_xpath('//td[contains(.,"Successfully")]') + self.assertIsInstance(element,WebElement) + + click_menu_element(driver,"Templates") + + driver.find_element_by_xpath('//a[contains(.,"'+template_name+'")]').click() + + driver.find_element_by_id("submit-next").click() + + self.assertEqual("Create a ticket in Integria IMS" in driver.page_source,True) + + driver.find_element_by_id("submit-next").click() + + self.assertEqual("_agentdescription_" in driver.page_source,True) + if __name__ == "__main__": unittest2.main() diff --git a/tests/console/include/alert_functions.py b/tests/console/include/alert_functions.py index 70c617c6d4..bf5617981e 100644 --- a/tests/console/include/alert_functions.py +++ b/tests/console/include/alert_functions.py @@ -111,7 +111,6 @@ def create_new_template_to_alert(driver,template_name,group,action_name,conditio #If list_days is None, we select all days. Example list_days = ["monsday","friday"] #alert_recovery is disabled by defect. Choose True for pyt in enabled status - click_menu_element(driver,"Templates") driver.find_element_by_id("submit-create").click() @@ -123,10 +122,10 @@ def create_new_template_to_alert(driver,template_name,group,action_name,conditio driver.find_element_by_xpath('//option[contains(.,"'+group+'")]').click() if description != None: + driver.find_element_by_id("textarea_description").clear() driver.find_element_by_id('textarea_description').send_keys(description) - driver.find_element_by_id("submit-next").click() time.sleep(3) @@ -177,3 +176,31 @@ def create_new_template_to_alert(driver,template_name,group,action_name,conditio i=i+1 driver.find_element_by_id("submit-finish").click() + +def edit_template_to_alert(driver,template_name,new_action=None,new_field_list=None): + + click_menu_element(driver,"Templates") + + driver.find_element_by_xpath('//a[contains(.,"'+template_name+'")]').click() + + #Go to Step 2 + driver.find_element_by_id("submit-next").click() + + if new_action != None: + + driver.find_element_by_xpath('//option[contains(.,"'+new_action+'")]').click() + + #Go to Step 3 + driver.find_element_by_id("submit-next").click() + + if new_field_list != None: + + i=1 + for field in new_field_list: + + driver.find_element_by_id("textarea_field"+str(i)).clear() + driver.find_element_by_id("textarea_field"+str(i)).send_keys(field) + i=i+1 + + driver.find_element_by_id("submit-finish").click() +