From c4e3d546da6e0a8f12359d50ef9e34682c7efdef Mon Sep 17 00:00:00 2001 From: cesar991 Date: Mon, 11 Jul 2016 13:49:49 +0200 Subject: [PATCH] Delete function --- tests/console/include/common_functions_60.py | 185 ------------------- 1 file changed, 185 deletions(-) diff --git a/tests/console/include/common_functions_60.py b/tests/console/include/common_functions_60.py index 50e5365ad2..0fa2febb79 100644 --- a/tests/console/include/common_functions_60.py +++ b/tests/console/include/common_functions_60.py @@ -52,104 +52,6 @@ def logout(driver,url): driver.get(url+"/pandora_console/index.php") refresh_N_times_until_find_element(driver,2,"nick") -#Report - -def create_report(driver,nombre,group_name,description=None): - click_menu_element(driver,"Custom reporting") - driver.find_element_by_id("submit-create").click() - driver.find_element_by_id("text-name").clear() - driver.find_element_by_id("text-name").send_keys(nombre) - if group_name == "All": - Select(driver.find_element_by_id("id_group")).select_by_visible_text(group_name) - else: - #TODO This will not work when choosing a group within a group within another group - Select(driver.find_element_by_id("id_group")).select_by_visible_text(" "+group_name) - - if description != None: - driver.find_element_by_id("textarea_description").clear() - driver.find_element_by_id("textarea_description").send_keys(description) - - driver.find_element_by_id("submit-add").click() - -def delete_report(driver,report_name): - click_menu_element(driver,"Custom reporting") - driver.find_element_by_id('text-search').clear() - driver.find_element_by_id('text-search').send_keys(report_name) - driver.find_element_by_id('submit-search_submit').click() - driver.find_element_by_id('image-delete2').click() - alert = driver.switch_to_alert() - alert.accept() - -#User - -def add_user_profile(driver,user_name,profile,group): - click_menu_element(driver,"Users management") - driver.find_element_by_css_selector("b").click() - driver.find_element_by_id("text-filter_search").clear() - driver.find_element_by_id("text-filter_search").send_keys(user_name) - driver.find_element_by_id("submit-search").click() - driver.find_element_by_xpath('//*[@id="table3-0-6"]/a[2]').click() - Select(driver.find_element_by_id("assign_profile")).select_by_visible_text(profile) - - if group == "All": - Select(driver.find_element_by_id("assign_group")).select_by_visible_text(group) - else: - #TODO This will not work when choosing a group within a group within another group - Select(driver.find_element_by_id("assign_group")).select_by_visible_text(" "+group) - - #driver.find_element_by_id("image-add2").click() - driver.find_element_by_xpath('//*[@name="add"]').click() - - -def create_user(driver,user_name,userpwd,email=None,profile_list=None): - u""" - Profile list es una LISTA de TUPLAS: - l = [("Chief Operator","All"),("Read Operator","Servers")] - """ - click_menu_element(driver,"Users management") - driver.find_element_by_id("submit-crt").click() - driver.find_element_by_name("id_user").clear() - driver.find_element_by_name("id_user").send_keys(user_name) - driver.find_element_by_name("password_new").clear() - driver.find_element_by_name("password_new").send_keys(userpwd) - driver.find_element_by_name("password_confirm").clear() - driver.find_element_by_name("password_confirm").send_keys(userpwd) - driver.find_element_by_name("email").clear() - if email != None: - driver.find_element_by_name("email").clear() - driver.find_element_by_name("email").send_keys(email) - driver.find_element_by_id("submit-crtbutton").click() - - if profile_list != None: - for profile_name,group_name in profile_list: - add_user_profile(driver,user_name,profile_name,group_name) - -def search_user(driver,user_name): - click_menu_element(driver,"Users management") - driver.find_element_by_css_selector("b").click() - driver.find_element_by_id('text-filter_search').clear() - driver.find_element_by_id("text-filter_search").send_keys(user_name) - driver.find_element_by_id("submit-search").click() - - -def activate_home_screen(driver,mode): - - click_menu_element(driver,"Edit my user") - Select(driver.find_element_by_id("section")).select_by_visible_text(mode) - driver.find_element_by_id("submit-uptbutton").click() - - -def is_element_present(driver, how, what): - from selenium.common.exceptions import NoSuchElementException - try: - driver.implicitly_wait(5) - driver.find_element(by=how, value=what) - except NoSuchElementException: - driver.implicitly_wait(5) - return False - - driver.implicitly_wait(30) - return True #Pass Wizards @@ -179,92 +81,5 @@ def detect_and_pass_all_wizards(driver): detect_and_pass_initial_wizard(driver) detect_and_pass_newsletter_wizard(driver) -#Agent - -def delete_agent (driver,agent_names_list): - - click_menu_element(driver,"Agents operations") - driver.find_element_by_id("option").click() - Select(driver.find_element_by_id("option")).select_by_visible_text("Bulk agent delete") - - for agent_name in agent_names_list: - Select(driver.find_element_by_id("id_agents")).select_by_visible_text(agent_name) - - driver.find_element_by_id("submit-go").click() - -def search_agent(driver,agent_name): - - click_menu_element(driver,"Agent detail") - driver.find_element_by_id("text-search").click() - driver.find_element_by_id("text-search").clear() - driver.find_element_by_id("text-search").send_keys(agent_name) - driver.find_element_by_id("submit-srcbutton").click() - driver.find_element_by_css_selector("b").click() - -def create_agent(driver,agent_name,ip=None,description=None,group=None,os_id=None): - - click_menu_element(driver,"Agent detail") - driver.find_element_by_id("submit-crt").click() - driver.find_element_by_id("text-agente").send_keys(agent_name) - - if ip != None: - driver.find_element_by_id("text-direccion").clear() - driver.find_element_by_id("text-direccion").send_keys(ip) - - if description != None: - driver.find_element_by_id("text-comentarios").clear() - driver.find_element_by_id("text-comentarios").send_keys(description) - - if group != None: - Select(driver.find_element_by_id("grupo")).select_by_visible_text(group) - - if os_id !=None: - Select(driver.find_element_by_id("id_os")).select_by_visible_text(os_id) - - driver.find_element_by_id("submit-crtbutton").click() - - -#Dashboard - -def create_new_dashboard(driver,name,group): - click_menu_element(driver,"Main dashboard") - driver.find_element_by_xpath('//*[@id="menu_tab"]/ul/li[4]/a/img').click() - driver.find_element_by_xpath('//*[@id="table2-0-1"]/a[2]/img').click() - driver.find_element_by_id("text-name").send_keys(name) - Select(driver.find_element_by_id("group")).select_by_visible_text(group) - driver.find_element_by_id('submit-add-btn').click() - -def delete_dashboard(driver,name): - click_menu_element(driver,"Main dashboard") - driver.find_element_by_xpath('//*[@id="menu_tab"]/ul/li[4]/a/img').click() - Select(driver.find_element_by_id("id_dashboard")).select_by_visible_text(name) - driver.find_element_by_xpath('//*[@id="menu_tab"]/ul/li[4]/a/img').click() - driver.find_element_by_xpath('//*[@id="table2-0-1"]/a[1]/img').click() - - -def edit_dashboard(driver,name,new_number_cell=None,new_group=None,new_name=None): - - click_menu_element(driver,"Main dashboard") - driver.find_element_by_xpath('//*[@id="menu_tab"]/ul/li[4]/a/img').click() - Select(driver.find_element_by_id("id_dashboard")).select_by_visible_text(name) - - if new_number_cell != None: - driver.find_element_by_xpath('//*[@id="menu_tab"]/ul/li[4]/a/img').click() - driver.find_element_by_id("text-number_cells").clear() - driver.find_element_by_id("text-number_cells").send_keys(new_number_cell) - driver.find_element_by_id('button-update_cells').click() - time.sleep(3) - - if new_group != None: - driver.find_element_by_xpath('//*[@id="menu_tab"]/ul/li[4]/a/img').click() - Select(driver.find_element_by_id("group_dashboard")).select_by_visible_text(new_group) - driver.find_element_by_id('button-update_group_dashboard').click() - time.sleep(3) - - if new_name != None: - driver.find_element_by_xpath('//*[@id="menu_tab"]/ul/li[4]/a/img').click() - driver.find_element_by_id("text-name_dashboard").clear() - driver.find_element_by_id("text-name_dashboard").send_keys(new_name) - driver.find_element_by_id('button-update_name_dashboard').click()