コード例 #1
0
def delete_action(driver):
    """Object expands latest Act and edits the latest Action, so as to delete it."""
    expand_latest_act(driver)
    function_module.wait_for_element_CSS(driver, "i.fa.fa-times")
    driver.find_element_by_css_selector("i.fa.fa-times").click()
    function_module.wait_for_element_XPATH(driver, "//*[@id='bot2-Msg1']")
    driver.find_element_by_xpath("//*[@id='bot2-Msg1']").click()
コード例 #2
0
def edit_top_act(driver, act_type):
    """Object edits the latest act and changes the act type to the one specified. The desired new
    act type should be sourced from the client variables file."""
    function_module.wait_for_element_CSS(driver, "i.glyphicon.glyphicon-pencil")
    driver.find_element_by_css_selector("i.glyphicon.glyphicon-pencil").click()
    Select(driver.find_element_by_xpath("//*[@class='col col-6']/div/div/label/select")).select_by_visible_text(act_type)
    driver.find_element_by_css_selector(".fa.fa-save.glyphicon-size").click()
コード例 #3
0
def send_value_css(driver, locator, value):
    """object sents value to field at given css locator"""
    function_module.wait_for_element_CSS(driver, locator)
    driver.find_element_by_css_selector(locator).click()
    driver.find_element_by_css_selector(locator).clear()
    driver.find_element_by_css_selector(locator).send_keys(value)
    driver.find_element_by_css_selector(locator).send_keys(Keys.RETURN)
コード例 #4
0
def login(driver, username, password):
    """object logins into the Emex application using given username and password"""
    function_module.wait_for_element_CSS(driver, "button.btn.btn-primary")
    driver.find_element_by_name("UserName").clear()
    driver.find_element_by_name("UserName").send_keys(username)
    driver.find_element_by_name("Password").clear()
    driver.find_element_by_name("Password").send_keys(password)
    driver.find_element_by_css_selector("button.btn.btn-primary").click()
コード例 #5
0
def click_show_hide_checkbox_css(driver):
    """function opens the Show Hide Columns object and selects a checkbox using a CSS locator"""
    function_module.wait_for_element_XPATH(driver, "//div[@id='dtVFL_wrapper']/div/div/button")
    driver.find_element_by_xpath("//div[@id='dtVFL_wrapper']/div/div/button").click()
    function_module.wait_for_element_CSS(driver, "li > label > input[type=\"checkbox\"]")
    driver.find_element_by_css_selector("li > label > input[type=\"checkbox\"]").click()
    main = driver.find_element_by_xpath("//*[@id='main']")
    main.click()
    time.sleep(2)
コード例 #6
0
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()
コード例 #7
0
def add_image(driver, image):
    """Object expands the latest Act and edits the latest conversation so as to attach
    a specified Image to the converstaion.

    NOTE:
    
    NEED TO RETURN TO THIS ISSUE - TRIED VARIOUS APPROACHES TO EXPLICITY WAIT TILL IMAGE IS FULLY UPLOADED, BUT SO FAR NONE WORKED
        
    #function_module.wait_to_be_clickable_XPATH(driver, "//*[@id='update_modalConversation']", 60)
    #driver.find_element_by_xpath("//*[@id='update_modalConversation']").click()

    #element = WebDriverWait(driver, 60).until((EC.element_to_be_clickable(By.XPATH, "//*[@id='update_modalConversation']")))
    #element.click()

    #function_module.wait_for_element_XPATH(driver, "//*[@id='templateUploaded_Files']/div[1]/button", 60)
    #function_module.wait_for_element_CSS(driver, ".ingPreview", 30)"""
    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()
    driver.find_element_by_xpath("//*[@id='btnAdd_Files']/input[@type='file']").send_keys(image)
    time.sleep(6)
    driver.find_element_by_xpath("//*[@id='update_modalConversation']").click()
コード例 #8
0
def edit_conversation(driver, comment):
    """Object expands the latest Act and edits the latest conversation, resetting the
    Commnent field to the given string value."""
    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()
    function_module.wait_for_element_CSS(driver, "#Comment")
    driver.find_element_by_css_selector("#Comment").click()
    driver.find_element_by_css_selector("#Comment").clear()
    driver.find_element_by_css_selector("#Comment").send_keys(comment)
    function_module.wait_for_element_CSS(driver, "#update_modalConversation")
    driver.find_element_by_css_selector("#update_modalConversation").click()
コード例 #9
0
def add_conversation(driver, comment):
    """Object adds a conversation to the latest act, with the given comment string value.
    The object also checks that the comment field is mandatory"""
    function_module.wait_for_element_CSS(driver, "i.fa.fa-comment-o.glyphicon-size")
    driver.find_element_by_css_selector("i.fa.fa-comment-o.glyphicon-size").click()
    function_module.wait_for_element_CSS(driver, "#Comment")
    function_module.field_is_mandatory_css(driver, "#Comment")
    driver.find_element_by_css_selector("#Comment").click()
    driver.find_element_by_css_selector("#Comment").clear()
    driver.find_element_by_css_selector("#Comment").send_keys(comment)
    function_module.wait_for_element_CSS(driver, "#submit_modalConversation")
    driver.find_element_by_css_selector("#submit_modalConversation").click()
コード例 #10
0
def vfl_export(driver, file_type, export_type):
    """function that exports all current VFL records in the given file_type and export_type
    where 1 = All, 2 = Current Page and 3 = Selected Records"""
    driver.find_element_by_css_selector("i.glyphicon.glyphicon-export").click()
    function_module.wait_for_element_XPATH(driver, "//*[@id='formExport']/div[1]/section[1]/div/label["+export_type+"]/i")
    driver.find_element_by_xpath("//*[@id='formExport']/div[1]/section[1]/div/label["+export_type+"]/i").click()
    time.sleep(1)
    Select(driver.find_element_by_xpath("//*[@id='ExportAs']")).select_by_visible_text(file_type)
    if export_type == "1":
        function_module.wait_for_element_CSS(driver, "#submit_modalExport")
        driver.find_element_by_css_selector("#submit_modalExport").click()
        function_module.wait_for_element_CSS(driver, "#bot2-Msg1")
        driver.find_element_by_css_selector("#bot2-Msg1").click()
        time.sleep(2)
    else:
        function_module.wait_for_element_CSS(driver, "#submit_modalExport")
        driver.find_element_by_css_selector("#submit_modalExport").click()
        time.sleep(2)
    if export_type == "1":
        print "Successfully exported all current VFL records - "+file_type+" "
    elif export_type == "2":
        print "Successfully exported current page of VFL records - "+file_type+" "
    else:
        print "Successfully exported all currently selected VFL records - "+file_type+" "
コード例 #11
0
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)
コード例 #12
0
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()
コード例 #13
0
def delete_top_act(driver):
    """Object deletes the latest act"""
    function_module.wait_for_element_CSS(driver, "i.glyphicon.glyphicon-trash")
    driver.find_element_by_css_selector("i.glyphicon.glyphicon-trash").click()
    function_module.wait_for_element_XPATH(driver, "//*[@id='bot2-Msg1']")
    driver.find_element_by_xpath("//*[@id='bot2-Msg1']").click()
コード例 #14
0
def select_dropdown_value_css(driver, locator, value):
    """objects selects value from dropdown at given css locator"""
    function_module.wait_for_element_CSS(driver, locator)
    driver.find_element_by_css_selector(locator).click()
    Select(driver.find_element_by_css_selector(locator)).select_by_visible_text(value)
    driver.find_element_by_css_selector(locator).send_keys(Keys.RETURN)
コード例 #15
0
def click_button_css(driver, locator):
    """object clicks button found at given css locator"""
    function_module.wait_for_element_CSS(driver, locator, 60)
    driver.find_element_by_css_selector(locator).click()