def clear_filters_alt(driver): """function selects the alternative Clear Filters button (inside the Filter Panel next to the Apply Filters button)and waits for VFL records to load""" expand_filters(driver) common_page_objects.click_button( driver, "//*[@id='dtFilterFormContainerVfl']/div/div/div/a[1]") wait_for_vfl_records(driver)
def add_vfl_act(driver, radio, act_type): """Add a VFL act. Object expects "radio" int parameter which is converted to a string to complete the xpath locator. 1 = Safe & 2 = Unsafe. Second parameter expects a string and is used to select the act type from the dropdown. The act type should be sourced from the client variables file""" radio_string = str(radio) function_module.wait_for_element_XPATH(driver, "//*[@id='formActs']/div/section[1]/div/label["+radio_string+"]/i") driver.find_element_by_xpath("//*[@id='formActs']/div/section[1]/div/label["+radio_string+"]/i").click() Select(driver.find_element_by_xpath("//*[@id='Acts']")).select_by_visible_text(act_type) common_page_objects.click_button(driver, "//*[@id='btnSubmitFormActs']")
def generate_basic_vfl_activity_summary_report_with_subgroups(driver, workgroup): """Object used the select_vfl_summary_report object to open the summary report dialog box, enter a given high level workgroup, and don't select the SubGroups checkbox and finally submit the search parameters. NOTE - The given workgroup should be sourced from the client variables file""" select_vfl_activity_summary_report(driver) common_page_objects.send_value(driver, "//*[@id='s2id_autogen2']", workgroup) common_page_objects.click_button(driver, "//*[@id='formSettings']/section[2]/div[2]/label/i") select_vfl_activity_summary_report_submit(driver) time.sleep(30)
def select_vfl_activity_summary_report(driver): """selects the VFL Summary Report. NOTE - The existing Report page is most likely due to change in V8 to incorporate multiple modules. Upon opening the Report form, the object will check mandatory fields.""" common_page_objects.click_button( driver, "//*[@id='widDtReports']/div/div[2]/div[1]/a") function_module.wait_for_element_XPATH(driver, "//*[@id='submit_modalSettings']") function_module.field_is_mandatory_xpath( driver, "//*[@class='select required-select2']/input")
def vfl_reports_button(driver): """Object selects the VFL Reports button. NOTE - In version 8 this might move to Common Objects as generic open Reports Module button""" common_page_objects.click_button(driver, "//*[@id='left-panel']/nav/ul/li[3]/a/i") function_module.verify_value( driver, "//*[@id='content']/div[1]/div[1]/h1", 'Reports', 'VFL', 'Moving to Reports Module', 'Asserted that we have successfully moved to the Report section', 'Failed to access to the Report tab')
def generate_basic_vfl_activity_summary_report_with_subgroups( driver, workgroup): """Object used the select_vfl_summary_report object to open the summary report dialog box, enter a given high level workgroup, and don't select the SubGroups checkbox and finally submit the search parameters. NOTE - The given workgroup should be sourced from the client variables file""" select_vfl_activity_summary_report(driver) common_page_objects.send_value(driver, "//*[@id='s2id_autogen2']", workgroup) common_page_objects.click_button( driver, "//*[@id='formSettings']/section[2]/div[2]/label/i") select_vfl_activity_summary_report_submit(driver) time.sleep(30)
def add_vfl_act(driver, radio, act_type): """Add a VFL act. Object expects "radio" int parameter which is converted to a string to complete the xpath locator. 1 = Safe & 2 = Unsafe. Second parameter expects a string and is used to select the act type from the dropdown. The act type should be sourced from the client variables file""" radio_string = str(radio) function_module.wait_for_element_XPATH( driver, "//*[@id='formActs']/div/section[1]/div/label[" + radio_string + "]/i") driver.find_element_by_xpath( "//*[@id='formActs']/div/section[1]/div/label[" + radio_string + "]/i").click() Select(driver.find_element_by_xpath( "//*[@id='Acts']")).select_by_visible_text(act_type) common_page_objects.click_button(driver, "//*[@id='btnSubmitFormActs']")
def delete_multiple_vfl_records(driver): """Function first checks whether the Delete Multiple Records button is enabled. If it is currently disabled, it will select all vfl records and then delete them. If you don't want this function to delete all records on the page, please use the 'select_multiple_vfl_records' object in your script before this one.""" button_disabled = function_module.field_is_read_only_xpath(driver, "//*[@id='removeVfl']") button_enabled = function_module.field_is_not_read_only_xpath(driver, "//*[@id='removeVfl']") if button_disabled == True: print 'Delete All VFL Records Button currently disabled' select_all_vfl_records(driver) time.sleep(1) print 'Selected all VFL records on current page' common_page_objects.click_button(driver, "//*[@id='removeVfl']/i") common_page_objects.click_button(driver, "//*[@id='bot2-Msg1']") print 'Successfully deleted all existing VFL Records' elif button_enabled == True: print 'Delete All VFL Records Button already enabled' common_page_objects.click_button(driver, "//*[@id='removeVfl']/i") common_page_objects.click_button(driver, "//*[@id='bot2-Msg1']") print 'Successfully deleted multiple existing VFL Records'
def delete_multiple_vfl_records(driver): """Function first checks whether the Delete Multiple Records button is enabled. If it is currently disabled, it will select all vfl records and then delete them. If you don't want this function to delete all records on the page, please use the 'select_multiple_vfl_records' object in your script before this one.""" button_disabled = function_module.field_is_read_only_xpath( driver, "//*[@id='removeVfl']") button_enabled = function_module.field_is_not_read_only_xpath( driver, "//*[@id='removeVfl']") if button_disabled == True: print 'Delete All VFL Records Button currently disabled' select_all_vfl_records(driver) time.sleep(1) print 'Selected all VFL records on current page' common_page_objects.click_button(driver, "//*[@id='removeVfl']/i") common_page_objects.click_button(driver, "//*[@id='bot2-Msg1']") print 'Successfully deleted all existing VFL Records' elif button_enabled == True: print 'Delete All VFL Records Button already enabled' common_page_objects.click_button(driver, "//*[@id='removeVfl']/i") common_page_objects.click_button(driver, "//*[@id='bot2-Msg1']") print 'Successfully deleted multiple existing VFL Records'
def edit_vfl_settings(driver): """function selects the first rows edit button in the VFL Settings Dialog box""" common_page_objects.click_button( driver, "//*[@id='dtSettingsContainer']/tr/td[3]/div/div/a[1]/i") print "Editing VFL Settings - First Row"
def submit_vfl_settings(driver): """function selects the submit button in the VFL Settings Dialog box""" common_page_objects.click_button(driver, "//*[@id='btnSubmitFormSettings']")
def select_all_vfl_records(driver): """Select the Select All VFL Records checkbox""" common_page_objects.click_button(driver, "//*[@id='dtVFL']/thead/tr/th[1]/input")
def select_vfl_workgroup_subgroups(driver): """function clicks the WorkGroup SubGroups checkbox""" common_page_objects.click_button(driver, "//*[@id='dtFilterFormContainerVfl']/form/div/div/div[6]/div/label[3]/i")
def view_latest_vfl_record(driver): """Select the View Latest VFL button""" common_page_objects.click_button( driver, "//*[@id='dtVFL']/tbody/tr[1]/td[8]/div[2]/div/a[1]/i")
def open_vfl_settings(driver): """function opens the VFL settings dialog box""" common_page_objects.click_button(driver, "//*[@id='content']/div[1]/div[2]/div/a") function_module.wait_for_element_XPATH(driver, "//*[@id='Year']")
def clear_filters_alt(driver): """function selects the alternative Clear Filters button (inside the Filter Panel next to the Apply Filters button)and waits for VFL records to load""" expand_filters(driver) common_page_objects.click_button(driver, "//*[@id='dtFilterFormContainerVfl']/div/div/div/a[1]") wait_for_vfl_records(driver)
def update_edit_vfl_settings(driver): """function selects the update button when editing a VFL Settings row, in the VFL Settings Dialog box""" common_page_objects.click_button(driver, "//*[@id='btnUpdateFormSettings']")
def cancel_edit_vfl_settings(driver): """function selects the cancel button when editing a VFL Settings row, in the VFL Settings Dialog box""" common_page_objects.click_button(driver, "//*[@id='btnCancelFormSettings']") print "Canceled Editing of VFL Settings - First Row"
def delete_latest_vfl_record(driver): """Select the Delete Latest VFL button""" common_page_objects.click_button(driver, "//*[@id='dtVFL']/tbody/tr[1]/td[8]/div[2]/div/a[3]/i") common_page_objects.click_button(driver, "//*[@id='bot2-Msg1']")
def delete_vfl_settings(driver): """function selects the first rows delete button in the VFL Settings Dialog box""" common_page_objects.click_button(driver, "//*[@id='dtSettingsContainer']/tr/td[3]/div/div/a[2]/i") common_page_objects.click_button(driver, "//*[@id='bot2-Msg1']")
def edit_vfl_settings(driver): """function selects the first rows edit button in the VFL Settings Dialog box""" common_page_objects.click_button(driver, "//*[@id='dtSettingsContainer']/tr/td[3]/div/div/a[1]/i") print "Editing VFL Settings - First Row"
def close_vfl_settings(driver): """function selects the close button in the VFL Settings Dialog box""" common_page_objects.click_button(driver, "//*[@id='cancel_modalSettings']")
def select_vfl_workgroup_subgroups(driver): """function clicks the WorkGroup SubGroups checkbox""" common_page_objects.click_button( driver, "//*[@id='dtFilterFormContainerVfl']/form/div/div/div[6]/div/label[3]/i" )
def clear_selected_first_participant(driver): """function selects the X button on the currently selected User in the Participant field""" common_page_objects.click_button( driver, "//*[@id='s2id_Participants']/ul/li[1]/a")
def view_latest_vfl_record(driver): """Select the View Latest VFL button""" common_page_objects.click_button(driver, "//*[@id='dtVFL']/tbody/tr[1]/td[8]/div[2]/div/a[1]/i")
def clear_selected_creator(driver): """function selects the X button on the currently selected User in the CreatedBy field""" common_page_objects.click_button(driver, "//*[@id='s2id_CreatedBy']/ul/li[1]/a")
def select_vfl_activity_summary_report(driver): """selects the VFL Summary Report. NOTE - The existing Report page is most likely due to change in V8 to incorporate multiple modules. Upon opening the Report form, the object will check mandatory fields.""" common_page_objects.click_button(driver, "//*[@id='widDtReports']/div/div[2]/div[1]/a") function_module.wait_for_element_XPATH(driver, "//*[@id='submit_modalSettings']") function_module.field_is_mandatory_xpath(driver, "//*[@class='select required-select2']/input")
def apply_filters(driver): """function selects the Apply Filter button and waits for VFL records to load""" common_page_objects.click_button( driver, "//*[@id='dtFilterFormContainerVfl']/div/div/div/a[2]") wait_for_vfl_records(driver)
def select_vfl_activity_summary_report_submit(driver): """object selects the submit button on the VFL summary reports dialog box""" common_page_objects.click_button(driver, "//*[@id='submit_modalSettings']")
def clear_filters_main(driver): """function selects the primary Clear Filters button (Next to the Expand Filters button) and waits for VFL records to load""" common_page_objects.click_button( driver, "//*[@id='dtFilterHeaderContainerVfl']/div/a[2]") wait_for_vfl_records(driver)
def apply_filters(driver): """function selects the Apply Filter button and waits for VFL records to load""" common_page_objects.click_button(driver, "//*[@id='dtFilterFormContainerVfl']/div/div/div/a[2]") wait_for_vfl_records(driver)
def delete_latest_vfl_record(driver): """Select the Delete Latest VFL button""" common_page_objects.click_button( driver, "//*[@id='dtVFL']/tbody/tr[1]/td[8]/div[2]/div/a[3]/i") common_page_objects.click_button(driver, "//*[@id='bot2-Msg1']")
def vfl_next_button(driver): """function selects the next button on the Details tab""" common_page_objects.click_button(driver, "//*[@id='btnNextSubmit']")
def clear_selected_first_participant(driver): """function selects the X button on the currently selected User in the Participant field""" common_page_objects.click_button(driver, "//*[@id='s2id_Participants']/ul/li[1]/a")
def delete_vfl_settings(driver): """function selects the first rows delete button in the VFL Settings Dialog box""" common_page_objects.click_button( driver, "//*[@id='dtSettingsContainer']/tr/td[3]/div/div/a[2]/i") common_page_objects.click_button(driver, "//*[@id='bot2-Msg1']")
def vfl_finish_button(driver): """function selects the finish button on the Acts tab""" common_page_objects.click_button( driver, "//*[@id='bootstrap-wizard-1']/div[2]/div[3]/div/div/ul/li[2]/a") function_module.wait_for_element_CSS(driver, "i.fa.fa-power-off", 60)
def vfl_finish_button(driver): """function selects the finish button on the Acts tab""" common_page_objects.click_button(driver, "//*[@id='bootstrap-wizard-1']/div[2]/div[3]/div/div/ul/li[2]/a") function_module.wait_for_element_CSS(driver, "i.fa.fa-power-off", 60)
def clear_filters_main(driver): """function selects the primary Clear Filters button (Next to the Expand Filters button) and waits for VFL records to load""" common_page_objects.click_button(driver, "//*[@id='dtFilterHeaderContainerVfl']/div/a[2]") wait_for_vfl_records(driver)
def vfl_reports_button(driver): """Object selects the VFL Reports button. NOTE - In version 8 this might move to Common Objects as generic open Reports Module button""" common_page_objects.click_button(driver, "//*[@id='left-panel']/nav/ul/li[3]/a/i") function_module.verify_value(driver, "//*[@id='content']/div[1]/div[1]/h1", 'Reports', 'VFL', 'Moving to Reports Module', 'Asserted that we have successfully moved to the Report section', 'Failed to access to the Report tab')