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()
Esempio n. 2
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()
Esempio n. 3
0
def vfl_location(driver, location):
    """Select given Location string value from the Location dropdown on the Details tab.
    Location should always come from Client Variables file."""
    common_page_objects.select_dropdown_value(driver, "//*[@id='Location']",
                                              location)
Esempio n. 4
0
def vfl_business_unit(driver, bu):
    """Select given Business Unit string value from the Business Unit dropdown on the Details tab.
    Business Unit should always come from Client Variables file."""
    common_page_objects.select_dropdown_value(driver, "//*[@id='ProductLine']",
                                              bu)
def pagination_number_of_records(driver, number, expected_amount):
    """function selects the pagination first button"""
    common_page_objects.select_dropdown_value(driver, "//*[@id='dtVFL_length']/span/label/select", number)
    function_module.wait_for_text_to_be_present(driver, "//*[@id='dtVFL_info']", expected_amount, 20)
def set_vfl_business_unit(driver, bu):
    """function selects a Business Unit from the dropdown Business Unit filter"""
    common_page_objects.select_dropdown_value(driver, "//*[@id='ProductLine']", bu)
def set_vfl_location(driver, location):
    """function selects a location from the dropdown location filter"""
    common_page_objects.select_dropdown_value(driver, "//*[@id='Location']", location)
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_location(driver, location):
    """Select given Location string value from the Location dropdown on the Details tab.
    Location should always come from Client Variables file."""
    common_page_objects.select_dropdown_value(driver, "//*[@id='Location']", location)
def vfl_business_unit(driver, bu):
    """Select given Business Unit string value from the Business Unit dropdown on the Details tab.
    Business Unit should always come from Client Variables file."""
    common_page_objects.select_dropdown_value(driver, "//*[@id='ProductLine']", bu)