From 116466627c8ed889ef041144125e587978fab167 Mon Sep 17 00:00:00 2001
From: cesar991 <cesar.espinosa@artica.es>
Date: Mon, 3 Oct 2016 12:26:27 +0200
Subject: [PATCH] Add test C in Alerts.py

---
 tests/console/Alerts.py                  | 27 ++++++++++++++++++++++--
 tests/console/include/alert_functions.py |  4 ++--
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/tests/console/Alerts.py b/tests/console/Alerts.py
index 5a25a25953..05524a0688 100644
--- a/tests/console/Alerts.py
+++ b/tests/console/Alerts.py
@@ -38,7 +38,6 @@ class Alerts (PandoraWebDriverTestCase):
 		element = driver.find_element_by_xpath('//a[contains(.,"'+action_name+'")]')
 		self.assertIsInstance(element,WebElement)
 
-
 	def test_B_create_new_action_command(self):
 		
 		u"""
@@ -68,7 +67,31 @@ class Alerts (PandoraWebDriverTestCase):
 		element = driver.find_element_by_xpath('//a[contains(.,"'+action_name+'")]')
 		self.assertIsInstance(element,WebElement)	
 
-		driver.find_element_by_xpath('//a[contains(.,"'+action_name+'")]').click()
+	def test_C_create_new_template(self):
+		
+		u"""
+		Create a new template (Unknown Status) and check that changes are applied
+		"""
+		
+		template_name = gen_random_string(6)
+
+		driver = self.driver
+
+		field_list = ["_agent_","_agentdescription_","_data_","_alert_description_"]		
+
+		days_list=["wednesday","saturday"]
+
+		create_new_template_to_alert(driver,template_name,"Applications","Mail to Admin","Unknown status",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)
 
 if __name__ == "__main__":
 	unittest2.main()
diff --git a/tests/console/include/alert_functions.py b/tests/console/include/alert_functions.py
index 1f579436c8..70c617c6d4 100644
--- a/tests/console/include/alert_functions.py
+++ b/tests/console/include/alert_functions.py
@@ -118,13 +118,13 @@ def create_new_template_to_alert(driver,template_name,group,action_name,conditio
 	time.sleep(3)
 
 	driver.find_element_by_id("text-name").clear()
-	driver.find_element_by_xpath('text-name').send_keys(template_name)
+	driver.find_element_by_id('text-name').send_keys(template_name)
 
 	driver.find_element_by_xpath('//option[contains(.,"'+group+'")]').click()
 
 	if description != None:
 		driver.find_element_by_id("textarea_description").clear()
-		driver.find_element_by_xpath('textarea_description').send_keys(description)
+		driver.find_element_by_id('textarea_description').send_keys(description)
 
 	
 	driver.find_element_by_id("submit-next").click()