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()
Example #2
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()
Example #3
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()
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()