From 8ecc2a2bf17c7d92d25db9d3b6a26cd8811615d2 Mon Sep 17 00:00:00 2001 From: cesar991 Date: Mon, 18 Jul 2016 12:02:06 +0200 Subject: [PATCH] Add search_policy and add_module_policy functions in policy_functions.py --- tests/console/include/policy_functions.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/console/include/policy_functions.py b/tests/console/include/policy_functions.py index 962cfcd7eb..70a8d24b42 100644 --- a/tests/console/include/policy_functions.py +++ b/tests/console/include/policy_functions.py @@ -21,3 +21,20 @@ def create_policy(driver,policy_name,group,description=None): driver.find_element_by_id("textarea_description").send_keys(description) driver.find_element_by_id("submit-crt").click() + + +def search_policy(driver,policy_name,go_to_policy=True): + click_menu_element(driver,"Manage policies") + driver.find_element_by_id("text-text_search").clear() + driver.find_element_by_id("text-text_search").send_keys(policy_name) + driver.find_element_by_id("submit-submit").click() + # If go_to_policy is True, this function enter in options of this policy + + if go_to_policy == True: + driver.find_element_by_xpath('//*[@id="policies_list-0-1"]/span/strong/a/span').click() + + +def add_module_policy(driver,policy_name,module_type,*args,**kwargs): + search_policy(driver,policy_name,go_to_policy=True) + driver.find_element_by_xpath('//*[@id="menu_tab"]/ul/li[2]/a/img').click() + create_module(module_type,*args,**kwargs)