def vfl_employees(driver, employee): """Send given Employees string value to the Employees Spoken to field on the Details tab. Field accepts plain string values, so employee can equal anything you like""" common_page_objects.send_value( driver, "//*[@id='formDetails']/div/section[2]/section[2]/div/div/input", employee)
def generate_basic_vfl_activity_summary_report(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) select_vfl_activity_summary_report_submit(driver) time.sleep(6)
def edit_action(driver, duedate, priority, description, assignee): """Object expands latest Act and edits the latest Action. All read only fields are checked and then Duedate, Priority, Description and AssignedTo are updated.""" expand_latest_act(driver) function_module.wait_for_element_CSS(driver, "i.fa.fa-pencil") driver.find_element_by_css_selector("i.fa.fa-pencil").click() common_page_objects.send_value(driver, "//*[@id='DueDate']", duedate) common_page_objects.select_dropdown_value(driver, "//*[@id='Priority']", priority) common_page_objects.send_value(driver, "//*[@id='Description']", description) function_module.field_is_read_only_css(driver, "#Status") function_module.field_is_read_only_css(driver, "#FullName") time.sleep(1) function_module.wait_for_element_XPATH(driver, "//*[@id='update_modalAction']") driver.find_element_by_xpath("//*[@id='update_modalAction']").click()
def vfl_comment(driver, comment): """Send given Comment string value to the Comment to field on the Details tab. Field accepts plain string values, so comment can equal anything you like""" common_page_objects.send_value(driver, "//*[@id='Comments']", comment)
def vfl_participants(driver, participant): """Send given Participant User string value to the Participants field on the Details tab. Participant should be a user taken from Client Variables file. User will have to a different user than the one used to login at the beginning of the test""" common_page_objects.send_value(driver, "//*[@id='s2id_autogen2']", participant)
def vfl_workgroup_selector(driver, workgroup): """Send given WorkGroup string value to the WorkGroup field on the Details tab. WorkGroup should always come from Client Variables file.""" common_page_objects.send_value(driver, "//*[@id='s2id_autogen1']", workgroup)
def set_vfl_workgroup(driver, workgroup): """fucntions assigns a given workGroup to the WorkGroup filter""" common_page_objects.send_value(driver, "//*[@id='s2id_autogen3']", workgroup)
def set_vfl_creator(driver, user): """function selects a user for the CreatedBy field""" common_page_objects.send_value(driver, "//*[@id='s2id_autogen1']", user)
def set_vfl_to_date(driver, date): """fucntions assigns a given date to the To Date filter""" common_page_objects.send_value(driver, "//*[@id='CreatedOnTo']", date)
def add_action(driver, duedate, priority, description, assignee): """Object adds an Action to the latest VFL Act. On opening the Action form all mandatory and read only fields, as well as default values are checked. Also the object will check that the current user is selected from AssignedBy by default. For the purpose of a smooth test run, if the current user is not selected, the object will failed the verification, but add the current user so the whole test doesnt fail.""" function_module.wait_for_element_CSS(driver, "i.fa.fa-file-text-o.glyphicon-size") driver.find_element_by_css_selector("i.fa.fa-file-text-o.glyphicon-size").click() function_module.wait_for_element_XPATH(driver, "//*[@id='DueDate']") #Verify all mandatory fields and default values function_module.field_is_mandatory_css(driver, "#DueDate") function_module.field_is_mandatory_css(driver, "#Priority") function_module.field_is_mandatory_css(driver, "#Description") function_module.field_is_mandatory_css(driver, "#AssignedTo") user_assigned = True current_user = driver.find_element_by_xpath("//*[@id='AssignedBy']/option[2]") try: assert current_user.text == client_variables.fullname1 except AssertionError: function_module.log_to_file('Test_VFL_Module:Page_Object_add_action:Actions AssignedBy field is not automatically populated with current user', 'FAILED') print 'ERROR - ASSERTION EXCEPTION - Actions AssignedBy field was not automatically populated with current user' email_module.error_mail('VFL add_action Page Object', 'When creating a new VFL Action, the AssignedBy field was not populated with the current user by default', 'AssertionError') user_assigned = False else: function_module.log_to_file('Test_VFL_Module:Page_Object_add_action:Actions AssignedBy field was automatically populated with current user', 'PASSED') print 'Asserted that Actions AssignedBy field is automatically populated with current user' time.sleep(1) #If Current User is not Assigned already, MAKE IT SO! if user_assigned == False: driver.find_element_by_xpath("//*[@id='AssignedBy']/option[2]").click() driver.find_element_by_xpath("//*[@id='AssignedBy']/option[2]").send_keys(client_variables.fullname1) time.sleep(5) driver.find_element_by_xpath("//*[@id='AssignedBy']/option[2]").send_keys(Keys.RETURN) time.sleep(1) print "AssignedBy field is now populated with current user" else: print "AssignedBy field already populated" function_module.field_is_read_only_css(driver, "#Status") status = driver.find_element_by_css_selector("#Status") status_value = status.get_attribute("value") try: assert status_value == 'Not Started' except AssertionError: function_module.log_to_file('Test_VFL_Module:Page_Object_add_action:Actions Status is NOT "Not Started" by default', 'FAILED') print 'ERROR - ASSERTION EXCEPTION - Actions Status is NOT "Not Started" by default' email_module.error_mail('VFL add_action Page Object', 'When creating a new VFL Action, the Status field was not set to "Not Started" by default', 'AssertionError') else: function_module.log_to_file('Test_VFL_Module:Page_Object_add_action:Actions Status is "Not Started" by default', 'PASSED') print 'Asserted that Actions Status is "Not Started" by default' time.sleep(1) common_page_objects.send_value(driver, "//*[@id='DueDate']", duedate) common_page_objects.select_dropdown_value(driver, "//*[@id='Priority']", priority) common_page_objects.send_value(driver, "//*[@id='Description']", description) common_page_objects.send_value(driver, "//*[@id='s2id_autogen1']", assignee) time.sleep(1) #Assert AssignedTo user added successfully assigned_to_user = driver.find_element_by_xpath(".//*[@id='s2id_AssignedTo']/ul/li[1]/div").text try: assert assigned_to_user == client_variables.fullname2 except AssertionError: function_module.log_to_file('Test_VFL_Module:Page_Object_add_action:AssinedTo user was NOT added successfully', 'FAILED') print 'ERROR - ASSERTION EXCEPTION - AssignedTo user was NOT added successfully' email_module.error_mail('VFL add_action Page Object', 'When creating a new VFL Action, the test failed to successfully assigned a user to the AssignedTo field', 'AssertionError') else: function_module.log_to_file('Test_VFL_Module:Page_Object_add_action:AssinedTo user was added successfully', 'PASSED') print 'Asserted that AssinedTo user was added successfully' time.sleep(1) function_module.wait_for_element_XPATH(driver, "//*[@id='submit_modalAction']") driver.find_element_by_xpath("//*[@id='submit_modalAction']").click()
def vfl_time(driver, time_in, time_out): """Send given Time_in and Time_out values. Ensure that time_out is greater than time_in, otherwise the Details form will throw an error as Total Minutes cannot be a negative number""" common_page_objects.send_value(driver, "//*[@id='TimeIn']", time_in) common_page_objects.send_value(driver, "//*[@id='TimeOut']", time_out)
def set_vfl_participant(driver, user): """function selects a user for the Participants field""" common_page_objects.send_value(driver, "//*[@id='s2id_autogen2']", user)
def add_action(driver, duedate, priority, description, assignee): """Object adds an Action to the latest VFL Act. On opening the Action form all mandatory and read only fields, as well as default values are checked. Also the object will check that the current user is selected from AssignedBy by default. For the purpose of a smooth test run, if the current user is not selected, the object will failed the verification, but add the current user so the whole test doesnt fail.""" function_module.wait_for_element_CSS(driver, "i.fa.fa-file-text-o.glyphicon-size") driver.find_element_by_css_selector( "i.fa.fa-file-text-o.glyphicon-size").click() function_module.wait_for_element_XPATH(driver, "//*[@id='DueDate']") #Verify all mandatory fields and default values function_module.field_is_mandatory_css(driver, "#DueDate") function_module.field_is_mandatory_css(driver, "#Priority") function_module.field_is_mandatory_css(driver, "#Description") function_module.field_is_mandatory_css(driver, "#AssignedTo") user_assigned = True current_user = driver.find_element_by_xpath( "//*[@id='AssignedBy']/option[2]") try: assert current_user.text == client_variables.fullname1 except AssertionError: function_module.log_to_file( 'Test_VFL_Module:Page_Object_add_action:Actions AssignedBy field is not automatically populated with current user', 'FAILED') print 'ERROR - ASSERTION EXCEPTION - Actions AssignedBy field was not automatically populated with current user' email_module.error_mail( 'VFL add_action Page Object', 'When creating a new VFL Action, the AssignedBy field was not populated with the current user by default', 'AssertionError') user_assigned = False else: function_module.log_to_file( 'Test_VFL_Module:Page_Object_add_action:Actions AssignedBy field was automatically populated with current user', 'PASSED') print 'Asserted that Actions AssignedBy field is automatically populated with current user' time.sleep(1) #If Current User is not Assigned already, MAKE IT SO! if user_assigned == False: driver.find_element_by_xpath("//*[@id='AssignedBy']/option[2]").click() driver.find_element_by_xpath( "//*[@id='AssignedBy']/option[2]").send_keys( client_variables.fullname1) time.sleep(5) driver.find_element_by_xpath( "//*[@id='AssignedBy']/option[2]").send_keys(Keys.RETURN) time.sleep(1) print "AssignedBy field is now populated with current user" else: print "AssignedBy field already populated" function_module.field_is_read_only_css(driver, "#Status") status = driver.find_element_by_css_selector("#Status") status_value = status.get_attribute("value") try: assert status_value == 'Not Started' except AssertionError: function_module.log_to_file( 'Test_VFL_Module:Page_Object_add_action:Actions Status is NOT "Not Started" by default', 'FAILED') print 'ERROR - ASSERTION EXCEPTION - Actions Status is NOT "Not Started" by default' email_module.error_mail( 'VFL add_action Page Object', 'When creating a new VFL Action, the Status field was not set to "Not Started" by default', 'AssertionError') else: function_module.log_to_file( 'Test_VFL_Module:Page_Object_add_action:Actions Status is "Not Started" by default', 'PASSED') print 'Asserted that Actions Status is "Not Started" by default' time.sleep(1) common_page_objects.send_value(driver, "//*[@id='DueDate']", duedate) common_page_objects.select_dropdown_value(driver, "//*[@id='Priority']", priority) common_page_objects.send_value(driver, "//*[@id='Description']", description) common_page_objects.send_value(driver, "//*[@id='s2id_autogen1']", assignee) time.sleep(1) #Assert AssignedTo user added successfully assigned_to_user = driver.find_element_by_xpath( ".//*[@id='s2id_AssignedTo']/ul/li[1]/div").text try: assert assigned_to_user == client_variables.fullname2 except AssertionError: function_module.log_to_file( 'Test_VFL_Module:Page_Object_add_action:AssinedTo user was NOT added successfully', 'FAILED') print 'ERROR - ASSERTION EXCEPTION - AssignedTo user was NOT added successfully' email_module.error_mail( 'VFL add_action Page Object', 'When creating a new VFL Action, the test failed to successfully assigned a user to the AssignedTo field', 'AssertionError') else: function_module.log_to_file( 'Test_VFL_Module:Page_Object_add_action:AssinedTo user was added successfully', 'PASSED') print 'Asserted that AssinedTo user was added successfully' time.sleep(1) function_module.wait_for_element_XPATH(driver, "//*[@id='submit_modalAction']") driver.find_element_by_xpath("//*[@id='submit_modalAction']").click()
def vfl_employees(driver, employee): """Send given Employees string value to the Employees Spoken to field on the Details tab. Field accepts plain string values, so employee can equal anything you like""" common_page_objects.send_value(driver, "//*[@id='formDetails']/div/section[2]/section[2]/div/div/input", employee)
def vfl_date(driver, date): """Send given date string value to the Date field on the Details tab""" common_page_objects.send_value(driver, "//*[@id='VflDate']", date)