diff --git a/tests/console/include/policy_functions.py b/tests/console/include/policy_functions.py index 65665a903a..7ec9a34280 100644 --- a/tests/console/include/policy_functions.py +++ b/tests/console/include/policy_functions.py @@ -51,3 +51,24 @@ def add_collection_to_policy(driver,policy_name,collection_name): driver.find_element_by_xpath('//*[@id="main"]/table[2]/tbody/tr/td[3]/input').click() driver.find_element_by_xpath('//*[@id="table3-0-4"]/a/img').click() + + +def apply_policy_to_agent(driver,policy_name,list_agent): + + #Example by list_agent: list_agent=("PAN_14_1","PAN_14_2") + + search_policy(driver,policy_name,go_to_policy=True) + driver.find_element_by_xpath('//*[@id="menu_tab"]/ul/li[10]/a/img').click() + + for agent in list_agent: + Select(driver.find_element_by_id("id_agents")).select_by_visible_text(agent) + + driver.find_element_by_xpath('//*[@id="image-add1"]').click() + alert = driver.switch_to_alert() + alert.accept() + + driver.find_element_by_xpath('//*[@id="menu_tab"]/ul/li[9]/a/img').click() + + driver.find_element_by_xpath('//*[@id="main"]/div[4]/form[2]').click() + alert = driver.switch_to_alert() + alert.accept()