def vfl_visits_negative(driver, amount):
    """function will select the decrement button next to the visits field a given amount. It will then verify that
    the value of the field is 0. This page object is designed to test that the visits field cannot be set to a
    negative value"""
    visits_field = driver.find_element_by_xpath("//*[@id='NoVisits']")
    visits_value = visits_field.get_attribute("aria-valuenow")
    for x in range(amount):
        driver.find_element_by_xpath("//*[@id='formSettings']/div/section[2]/div/span/a[2]").click()
    visits_value_new = visits_field.get_attribute("aria-valuenow")
    visits_string = str(visits_value_new)
    function_module.verify_value_comparison(driver, visits_string, '0', 'VFL', 'Settings Tests',
    'Asserted that Number of Visits field can NOT be assigned a negative value', 'Number of Visits field can be assigned a negative value')
    time.sleep(1)
def vfl_visits_decrement(driver, amount):
    """function will select the decrement button next to the visits field a given amount. It will then verify that
    the value of the field is as expected"""
    visits_field = driver.find_element_by_xpath("//*[@id='NoVisits']")
    visits_value = visits_field.get_attribute("aria-valuenow")
    for x in range(amount):
        driver.find_element_by_xpath("//*[@id='formSettings']/div/section[2]/div/span/a[2]").click()
    visits_value_new = visits_field.get_attribute("aria-valuenow")
    visits_new = int(visits_value) - amount
    visits_new_string = str(visits_new)
    amount_string = str(amount)
    function_module.verify_value_comparison(driver, visits_value_new, visits_new_string, 'VFL', 'Settings Tests',
    'Asserted that the Settings Visits field can be decreased by '+amount_string+'', 'Failed to decrease the year field by '+amount_string+' as expected')
    time.sleep(1)
def vfl_year_increment(driver, amount):
    """function will select the increment button next to the year field a given amount. It will then verify that
    the value of the field is as expected"""
    year_field = driver.find_element_by_xpath("//*[@id='Year']")
    year_value = year_field.get_attribute("aria-valuenow")
    for x in range(amount):
        driver.find_element_by_xpath("//*[@id='formSettings']/div/section[1]/div/span/a[1]").click()
    year_value_new = year_field.get_attribute("aria-valuenow")
    #year_new = datetime.datetime.now().year + amount
    year_new = int(year_value) + amount
    year_new_string = str(year_new)
    amount_string = str(amount)
    function_module.verify_value_comparison(driver, year_value_new, year_new_string, 'VFL', 'Settings Tests',
    'Asserted that the Settings Year field can be increased by '+amount_string+'', 'Failed to increase the year field by '+amount_string+' as expected')
    time.sleep(1)
Beispiel #4
0
def vfl_visits_negative(driver, amount):
    """function will select the decrement button next to the visits field a given amount. It will then verify that
    the value of the field is 0. This page object is designed to test that the visits field cannot be set to a
    negative value"""
    visits_field = driver.find_element_by_xpath("//*[@id='NoVisits']")
    visits_value = visits_field.get_attribute("aria-valuenow")
    for x in range(amount):
        driver.find_element_by_xpath(
            "//*[@id='formSettings']/div/section[2]/div/span/a[2]").click()
    visits_value_new = visits_field.get_attribute("aria-valuenow")
    visits_string = str(visits_value_new)
    function_module.verify_value_comparison(
        driver, visits_string, '0', 'VFL', 'Settings Tests',
        'Asserted that Number of Visits field can NOT be assigned a negative value',
        'Number of Visits field can be assigned a negative value')
    time.sleep(1)
Beispiel #5
0
def vfl_visits_decrement(driver, amount):
    """function will select the decrement button next to the visits field a given amount. It will then verify that
    the value of the field is as expected"""
    visits_field = driver.find_element_by_xpath("//*[@id='NoVisits']")
    visits_value = visits_field.get_attribute("aria-valuenow")
    for x in range(amount):
        driver.find_element_by_xpath(
            "//*[@id='formSettings']/div/section[2]/div/span/a[2]").click()
    visits_value_new = visits_field.get_attribute("aria-valuenow")
    visits_new = int(visits_value) - amount
    visits_new_string = str(visits_new)
    amount_string = str(amount)
    function_module.verify_value_comparison(
        driver, visits_value_new, visits_new_string, 'VFL', 'Settings Tests',
        'Asserted that the Settings Visits field can be decreased by ' +
        amount_string + '', 'Failed to decrease the year field by ' +
        amount_string + ' as expected')
    time.sleep(1)
Beispiel #6
0
def vfl_year_increment(driver, amount):
    """function will select the increment button next to the year field a given amount. It will then verify that
    the value of the field is as expected"""
    year_field = driver.find_element_by_xpath("//*[@id='Year']")
    year_value = year_field.get_attribute("aria-valuenow")
    for x in range(amount):
        driver.find_element_by_xpath(
            "//*[@id='formSettings']/div/section[1]/div/span/a[1]").click()
    year_value_new = year_field.get_attribute("aria-valuenow")
    #year_new = datetime.datetime.now().year + amount
    year_new = int(year_value) + amount
    year_new_string = str(year_new)
    amount_string = str(amount)
    function_module.verify_value_comparison(
        driver, year_value_new, year_new_string, 'VFL', 'Settings Tests',
        'Asserted that the Settings Year field can be increased by ' +
        amount_string + '', 'Failed to increase the year field by ' +
        amount_string + ' as expected')
    time.sleep(1)
def vfl_visits_default_current(driver):
    """function checks that, upon opening the VFL dialog box that the default value for the Visits field is 0. If
    the value is not 0 the verification will fail. However for the purpose of continuing the rest of the VFL
    Settings tests, the function will in this case enter a value of 0"""
    visits_populated = False
    visits_field = driver.find_element_by_xpath("//*[@id='NoVisits']")
    visits_value = visits_field.get_attribute("aria-valuenow")
    visits_populated = function_module.verify_value_comparison(driver, visits_value, '0', 'VFL', 'Settings Tests',
    'Asserted that the Settings Visits field is set to 0 by default', 'The Settings Visits field is NOT set to 0 by default')
    time.sleep(1)
    #If visits field is not 0, MAKE IT SO!
    if visits_populated == False:
        driver.find_element_by_xpath("//*[@id='NoVisits']").click()
        driver.find_element_by_xpath("//*[@id='NoVisits']").send_keys(visits_string)
        time.sleep(2)
        driver.find_element_by_xpath("//*[@id='NoVisits']").send_keys(Keys.RETURN)
        time.sleep(2)
        print "Vists now populated with value = 0"
    else:
        print "Visits field is already populated"
def vfl_year_default_current(driver):
    """function checks that, upon opening the VFL dialog box that the default value for the Year field is the current year. If
    the value is not the current year the verification will fail. However for the purpose of continuing the rest of the VFL
    Settings tests, the function will in this case enter the current year"""
    year_populated = False
    year_field = driver.find_element_by_xpath("//*[@id='Year']")
    year_value = year_field.get_attribute("aria-valuenow")
    current_year = datetime.datetime.now().year
    year_string = str(current_year)
    year_populated = function_module.verify_value_comparison(driver, year_value, year_string, 'VFL', 'Settings Tests',
    'Asserted that the Settings Year field is set to current year by default', 'The Settings Year field is NOT set to current year by default')
    time.sleep(1)
    #If year field is not current year, MAKE IT SO!
    if year_populated == False:
        driver.find_element_by_xpath("//*[@id='Year']").click()
        driver.find_element_by_xpath("//*[@id='Year']").send_keys(year_string)
        time.sleep(2)
        driver.find_element_by_xpath("//*[@id='Year']").send_keys(Keys.RETURN)
        time.sleep(2)
        print "Year field is now populated with current year"
    else:
        print "Year field is already populated"
Beispiel #9
0
def vfl_visits_default_current(driver):
    """function checks that, upon opening the VFL dialog box that the default value for the Visits field is 0. If
    the value is not 0 the verification will fail. However for the purpose of continuing the rest of the VFL
    Settings tests, the function will in this case enter a value of 0"""
    visits_populated = False
    visits_field = driver.find_element_by_xpath("//*[@id='NoVisits']")
    visits_value = visits_field.get_attribute("aria-valuenow")
    visits_populated = function_module.verify_value_comparison(
        driver, visits_value, '0', 'VFL', 'Settings Tests',
        'Asserted that the Settings Visits field is set to 0 by default',
        'The Settings Visits field is NOT set to 0 by default')
    time.sleep(1)
    #If visits field is not 0, MAKE IT SO!
    if visits_populated == False:
        driver.find_element_by_xpath("//*[@id='NoVisits']").click()
        driver.find_element_by_xpath("//*[@id='NoVisits']").send_keys(
            visits_string)
        time.sleep(2)
        driver.find_element_by_xpath("//*[@id='NoVisits']").send_keys(
            Keys.RETURN)
        time.sleep(2)
        print "Vists now populated with value = 0"
    else:
        print "Visits field is already populated"
Beispiel #10
0
def vfl_year_default_current(driver):
    """function checks that, upon opening the VFL dialog box that the default value for the Year field is the current year. If
    the value is not the current year the verification will fail. However for the purpose of continuing the rest of the VFL
    Settings tests, the function will in this case enter the current year"""
    year_populated = False
    year_field = driver.find_element_by_xpath("//*[@id='Year']")
    year_value = year_field.get_attribute("aria-valuenow")
    current_year = datetime.datetime.now().year
    year_string = str(current_year)
    year_populated = function_module.verify_value_comparison(
        driver, year_value, year_string, 'VFL', 'Settings Tests',
        'Asserted that the Settings Year field is set to current year by default',
        'The Settings Year field is NOT set to current year by default')
    time.sleep(1)
    #If year field is not current year, MAKE IT SO!
    if year_populated == False:
        driver.find_element_by_xpath("//*[@id='Year']").click()
        driver.find_element_by_xpath("//*[@id='Year']").send_keys(year_string)
        time.sleep(2)
        driver.find_element_by_xpath("//*[@id='Year']").send_keys(Keys.RETURN)
        time.sleep(2)
        print "Year field is now populated with current year"
    else:
        print "Year field is already populated"