Exemplo n.º 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()
Exemplo n.º 2
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()
def send_value(driver, locator, value):
    """object sends value to field at given xpath locator"""
    function_module.wait_for_element_XPATH(driver, locator)
    driver.find_element_by_xpath(locator).click()
    driver.find_element_by_xpath(locator).clear()
    driver.find_element_by_xpath(locator).send_keys(value)
    driver.find_element_by_xpath(locator).send_keys(Keys.RETURN)
Exemplo n.º 4
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 + " "
def send_value(driver, locator, value):
    """object sends value to field at given xpath locator"""
    function_module.wait_for_element_XPATH(driver, locator)
    driver.find_element_by_xpath(locator).click()
    driver.find_element_by_xpath(locator).clear()
    driver.find_element_by_xpath(locator).send_keys(value)
    driver.find_element_by_xpath(locator).send_keys(Keys.RETURN)
Exemplo n.º 6
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)
Exemplo n.º 7
0
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']")
Exemplo n.º 8
0
def click_show_hide_checkbox_xpath(driver, locator):
    """function opens the Show Hide Columns object and selects a checkbox using an XPATH 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_XPATH(driver, locator)
    driver.find_element_by_xpath(locator).click()
    main = driver.find_element_by_xpath("//*[@id='main']")
    main.click()
    time.sleep(2)
Exemplo n.º 9
0
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 move_to_module(driver, locator):
    """object selects button at given css locator so as to move to a specific module.
    This common object is designed to be used in module specific objects. While it is
    very similar to the 'click_button' object, it mainly exists due to the fact that pre
    V8 there was no homepage, just VFL."""
    #function_module.wait_for_element_CSS(driver, locator)
    function_module.wait_for_element_XPATH(
        driver, "//*[@id='dtVFL']/tbody/tr[1]/td[8]/div[2]/div/a[2]/i",
        60)  #Remove in V8
    driver.find_element_by_css_selector(locator).click()
Exemplo n.º 11
0
def select_multiple_vfl_records(driver, amount):
    """Object will select the given amount of VFL Records. Where Amount will be an Int value and
    the total records selected will be amount - 1"""
    total = amount - 1
    total_string = str(total)
    function_module.wait_for_element_XPATH(driver, "//*[@id='dtVFL']/tbody/tr[1]/td[8]/div[2]/div/a[2]/i", 60)
    for x in range(1,amount):
        y = str(x)
        driver.find_element_by_xpath("//*[@id='dtVFL']/tbody/tr["+y+"]/td[1]/input").click()
    print "Selected top "+total_string+" VFL records on first page of list view"
def move_to_module(driver, locator):
    """object selects button at given css locator so as to move to a specific module.
    This common object is designed to be used in module specific objects. While it is
    very similar to the 'click_button' object, it mainly exists due to the fact that pre
    V8 there was no homepage, just VFL."""
    # function_module.wait_for_element_CSS(driver, locator)
    function_module.wait_for_element_XPATH(
        driver, "//*[@id='dtVFL']/tbody/tr[1]/td[8]/div[2]/div/a[2]/i", 60
    )  # Remove in V8
    driver.find_element_by_css_selector(locator).click()
Exemplo n.º 13
0
def delete_remaining_vfl_records(driver):
    """Function checks the remaining number of VFL records and will remain in loop
    deleting all records on the current page, until there are no more VFL records."""
    function_module.wait_for_element_XPATH(driver, "//*[@id='dtVFL_info']")
    amount_of_records = driver.find_element_by_xpath("//*[@id='dtVFL_info']").text
    time.sleep(1)
    while amount_of_records != '0 to 0 of 0 entries':
        delete_multiple_vfl_records(driver)
        time.sleep(3)
        amount_of_records = driver.find_element_by_xpath("//*[@id='dtVFL_info']").text
        print amount_of_records
Exemplo n.º 14
0
def click_show_hide_checkbox_xpath(driver, locator):
    """function opens the Show Hide Columns object and selects a checkbox using an XPATH 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_XPATH(driver, locator)
    driver.find_element_by_xpath(locator).click()
    main = driver.find_element_by_xpath("//*[@id='main']")
    main.click()
    time.sleep(2)
Exemplo n.º 15
0
def expand_filters(driver):
    """function checks whether the filter panel is currently hidden. If it is hidden then it
    can be expanded. Wait for the required button and then select it in order to expand the filter panel"""
    is_hidden = function_module.field_is_hidden_xpath(driver, "//*[@id='dtFilterFormContainerVfl']")
    if is_hidden == True:
        function_module.wait_for_element_XPATH(driver, "//*[@id='dtFilterHeaderContainerVfl']/div/a[1]")
        driver.find_element_by_xpath("//*[@id='dtFilterHeaderContainerVfl']/div/a[1]").click()
        function_module.wait_for_element_XPATH(driver, "//*[@id='dtFilterFormContainerVfl']/div/div/div/a[2]")
        print "Filter Panel expanded"
    else:
        print "Filter Panel is not Hidden so therefore must alreay be displayed"
Exemplo n.º 16
0
def select_multiple_vfl_records(driver, amount):
    """Object will select the given amount of VFL Records. Where Amount will be an Int value and
    the total records selected will be amount - 1"""
    total = amount - 1
    total_string = str(total)
    function_module.wait_for_element_XPATH(
        driver, "//*[@id='dtVFL']/tbody/tr[1]/td[8]/div[2]/div/a[2]/i", 60)
    for x in range(1, amount):
        y = str(x)
        driver.find_element_by_xpath("//*[@id='dtVFL']/tbody/tr[" + y +
                                     "]/td[1]/input").click()
    print "Selected top " + total_string + " VFL records on first page of list view"
Exemplo n.º 17
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)
Exemplo n.º 18
0
def delete_remaining_vfl_records(driver):
    """Function checks the remaining number of VFL records and will remain in loop
    deleting all records on the current page, until there are no more VFL records."""
    function_module.wait_for_element_XPATH(driver, "//*[@id='dtVFL_info']")
    amount_of_records = driver.find_element_by_xpath(
        "//*[@id='dtVFL_info']").text
    time.sleep(1)
    while amount_of_records != '0 to 0 of 0 entries':
        delete_multiple_vfl_records(driver)
        time.sleep(3)
        amount_of_records = driver.find_element_by_xpath(
            "//*[@id='dtVFL_info']").text
        print amount_of_records
Exemplo n.º 19
0
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']")
Exemplo n.º 20
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()
Exemplo n.º 21
0
def expand_filters(driver):
    """function checks whether the filter panel is currently hidden. If it is hidden then it
    can be expanded. Wait for the required button and then select it in order to expand the filter panel"""
    is_hidden = function_module.field_is_hidden_xpath(
        driver, "//*[@id='dtFilterFormContainerVfl']")
    if is_hidden == True:
        function_module.wait_for_element_XPATH(
            driver, "//*[@id='dtFilterHeaderContainerVfl']/div/a[1]")
        driver.find_element_by_xpath(
            "//*[@id='dtFilterHeaderContainerVfl']/div/a[1]").click()
        function_module.wait_for_element_XPATH(
            driver, "//*[@id='dtFilterFormContainerVfl']/div/div/div/a[2]")
        print "Filter Panel expanded"
    else:
        print "Filter Panel is not Hidden so therefore must alreay be displayed"
Exemplo n.º 22
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()
Exemplo n.º 23
0
def edit_first_row(driver, year, visits):
    """function will edit the first row and set its year and visits field to the given values"""
    year_string = str(year)
    visits_string = str(visits)
    edit_vfl_settings(driver)
    function_module.wait_for_element_XPATH(driver, "//*[@id='Year']")
    driver.find_element_by_xpath("//*[@id='Year']").click()
    driver.find_element_by_xpath("//*[@id='Year']").clear()
    driver.find_element_by_xpath("//*[@id='Year']").send_keys(year_string)
    time.sleep(1)
    #driver.find_element_by_xpath("//*[@id='Year']").send_keys(Keys.RETURN)
    function_module.wait_for_element_XPATH(driver, "//*[@id='NoVisits']")
    driver.find_element_by_xpath("//*[@id='NoVisits']").click()
    driver.find_element_by_xpath("//*[@id='NoVisits']").clear()
    driver.find_element_by_xpath("//*[@id='NoVisits']").send_keys(visits_string)
    time.sleep(1)
    #driver.find_element_by_xpath("//*[@id='NoVisits']").send_keys(Keys.RETURN)
    update_edit_vfl_settings(driver)
Exemplo n.º 24
0
def edit_first_row(driver, year, visits):
    """function will edit the first row and set its year and visits field to the given values"""
    year_string = str(year)
    visits_string = str(visits)
    edit_vfl_settings(driver)
    function_module.wait_for_element_XPATH(driver, "//*[@id='Year']")
    driver.find_element_by_xpath("//*[@id='Year']").click()
    driver.find_element_by_xpath("//*[@id='Year']").clear()
    driver.find_element_by_xpath("//*[@id='Year']").send_keys(year_string)
    time.sleep(1)
    #driver.find_element_by_xpath("//*[@id='Year']").send_keys(Keys.RETURN)
    function_module.wait_for_element_XPATH(driver, "//*[@id='NoVisits']")
    driver.find_element_by_xpath("//*[@id='NoVisits']").click()
    driver.find_element_by_xpath("//*[@id='NoVisits']").clear()
    driver.find_element_by_xpath("//*[@id='NoVisits']").send_keys(
        visits_string)
    time.sleep(1)
    #driver.find_element_by_xpath("//*[@id='NoVisits']").send_keys(Keys.RETURN)
    update_edit_vfl_settings(driver)
Exemplo n.º 25
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+" "
Exemplo n.º 26
0
def wait_for_vfl_records(driver):
    """Object will simply wait for the first VFL records to appear on the list page. Not a full proof
    option, so I might replace at a later date."""
    function_module.wait_for_element_XPATH(driver, "//*[@id='dtVFL']/tbody/tr[1]/td[8]/div[2]/div/a[2]/i", 60)
Exemplo n.º 27
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()
Exemplo n.º 28
0
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")
Exemplo n.º 29
0
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']")
Exemplo n.º 30
0
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 click_button(driver, locator):
    """object clicks button found at given xpath locator"""
    function_module.wait_for_element_XPATH(driver, locator, 60)
    driver.find_element_by_xpath(locator).click()
def click_button(driver, locator):
    """object clicks button found at given xpath locator"""
    function_module.wait_for_element_XPATH(driver, locator, 60)
    driver.find_element_by_xpath(locator).click()
Exemplo n.º 33
0
def wait_for_vfl_records(driver):
    """Object will simply wait for the first VFL records to appear on the list page. Not a full proof
    option, so I might replace at a later date."""
    function_module.wait_for_element_XPATH(
        driver, "//*[@id='dtVFL']/tbody/tr[1]/td[8]/div[2]/div/a[2]/i", 60)
def select_dropdown_value(driver, locator, value):
    """objects selects value from dropdown at given xpath locator"""
    function_module.wait_for_element_XPATH(driver, locator)
    driver.find_element_by_xpath(locator).click()
    Select(driver.find_element_by_xpath(locator)).select_by_visible_text(value)
    driver.find_element_by_xpath(locator).send_keys(Keys.RETURN)
Exemplo n.º 35
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()
Exemplo n.º 36
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()
def select_dropdown_value(driver, locator, value):
    """objects selects value from dropdown at given xpath locator"""
    function_module.wait_for_element_XPATH(driver, locator)
    driver.find_element_by_xpath(locator).click()
    Select(driver.find_element_by_xpath(locator)).select_by_visible_text(value)
    driver.find_element_by_xpath(locator).send_keys(Keys.RETURN)
Exemplo n.º 38
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()