Add new test in Network_components.py and repair a few errors in network_components_functions.py

This commit is contained in:
cesar991 2016-09-26 15:45:42 +02:00
parent c3d07bfe12
commit 5b1a5f4863
2 changed files with 50 additions and 4 deletions

View File

@ -16,7 +16,7 @@ from selenium.webdriver.remote.webelement import WebElement
import unittest2, time, re
class PAN13(PandoraWebDriverTestCase):
class Network_components(PandoraWebDriverTestCase):
test_name = u'Planned_downtime'
@ -73,6 +73,53 @@ class PAN13(PandoraWebDriverTestCase):
self.assertEqual(network_component_name in driver.page_source,True)
def test_B_create_plugin_component(self):
u"""
Create and search new plug-in component
"""
driver = self.driver
agent_name = gen_random_string(6)
plugin_component_name = gen_random_string(6)
activate_api(driver,"1234")
params = [agent_name,"127.0.0.1","0","4","0","300","2","pandorafms","2","0","0","pruebas"]
create_agent_api(driver,params,user="admin",pwd="pandora")
lista = driver.current_url.split('/')
url = lista[0]+'//'+lista[2]+'/pandora_console'
driver.get(url)
create_plugin_component(driver,plugin_component_name,"Generic numeric","Network Management","Application",max_warning=50,max_critical=100,description="New plugin component")
search_agent(driver,agent_name,go_to_agent=True)
driver.find_element_by_xpath('//ul[@class="mn"]/li/a/img[@data-title="Manage"]').click()
driver.find_element_by_xpath('//ul[@class="mn"]/li/a/img[@data-title="Modules"]').click()
Select(driver.find_element_by_id("moduletype")).select_by_visible_text("Create a new plug-in server module")
driver.find_element_by_xpath('//*[@id="main"]/form/table/tbody/tr/td[5]/input').click()
driver.find_element_by_xpath('//a[contains(.,"Advanced options")]').click()
Select(driver.find_element_by_id("network_component_group")).select_by_visible_text("Network Management")
time.sleep(3)
Select(driver.find_element_by_id("network_component")).select_by_visible_text(plugin_component_name)
driver.find_element_by_id("submit-crtbutton").click()
search_module (driver,agent_name,plugin_component_name,go_to_module=False)
self.assertEqual(plugin_component_name in driver.page_source,True)
if __name__ == "__main__":
unittest2.main()

View File

@ -84,9 +84,8 @@ def create_plugin_component(driver,name,type_component,group,module_group,min_wa
click_menu_element(driver,"Network components")
driver.find_element_by_id("id_component_type").click()
Select(driver.find_element_by_id("id_component_type")).select_by_visible_text("Create a new plug-in component")
driver.find_element_by_xpath('//*[@id="id_component_type"]/option[2]').click()
driver.find_element_by_id("submit-crt").click()
driver.find_element_by_id("text-name").click()