From 9d5edfdefaf7cba78dd3af678a2fcbbe1d38a75a Mon Sep 17 00:00:00 2001 From: cesar991 Date: Tue, 26 Jul 2016 09:57:53 +0200 Subject: [PATCH] Add search_service function in service_functions --- tests/console/include/reports_functions.py | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/console/include/reports_functions.py b/tests/console/include/reports_functions.py index 6400ca961a..2b12af820b 100644 --- a/tests/console/include/reports_functions.py +++ b/tests/console/include/reports_functions.py @@ -33,3 +33,27 @@ def delete_report(driver,report_name): driver.find_element_by_id('image-delete2').click() alert = driver.switch_to_alert() alert.accept() + +def search_service(driver,name,group="All",status="Any",mode="Any",go_to_service=True): + + # If go_to_service = False this function can not enter in service + + driver.find_element_by_xpath('//a[contains(.,"Filter")]').click() + driver.find_element_by_id("text-free_search").clear() + driver.find_element_by_id("text-free_search").send_keys(name) + + if group != None: + driver.find_element_by_xpath('//option[contains(.,"'+group+'")]').click() + + if status != "Any": + driver.find_element_by_xpath('//option[contains(.,"'+status+'")]').click() + + if mode != "Any": + driver.find_element_by_xpath('//option[contains(.,"'+mode+'")]').click() + + driver.find_element_by_id("submit-search").click() + + if go_to_service == True: + driver.find_element_by_xpath('//a[contains(.,"'+name+'")]').click() + +