Example #1
0
def add_new_contacts(test):
    """ Function contains steps for automate the process of add a new contact.
        @param : Instance of realm.TestCase class.

    """
    contact_first_name = helpers.random_name(7)
    contact_last_name = helpers.random_name(7)
    contact_email_address = helpers.new_email()
    birth_day_year = helpers.random_byear()

    test.browser.find_element_by_link_text("Email Address Book").click()
    test.browser.find_element_by_xpath("//div[@id='agi-leftnav']/ol/li[2]/a").click()

    elem = test.browser.find_element_by_id("firstName")
    elem.send_keys(contact_first_name)

    elem = test.browser.find_element_by_id("lastName")
    elem.send_keys(contact_last_name)

    elem = test.browser.find_element_by_id("email1")
    elem.send_keys(contact_email_address)

    elem = test.browser.find_element_by_id("address1")
    elem.send_keys(data.customer['address1'])

    elem = test.browser.find_element_by_id("city")
    elem.send_keys(data.customer['city'])

    elem = test.browser.find_element_by_id("zip")
    elem.send_keys(data.customer['zip_code'])

    elem = test.browser.find_element_by_id("work_address1")
    elem.send_keys(data.customer['address1'])

    elem = test.browser.find_element_by_id("work_address2")
    elem.send_keys(data.customer['address1'])

    elem = test.browser.find_element_by_id("work_city")
    elem.send_keys(data.customer['city'])

    elem = test.browser.find_element_by_id("work_zip")
    elem.send_keys(data.customer['zip_code'])

    elem = test.browser.find_element_by_id("phone1")
    elem.send_keys(data.customer['phone'])

    elem = Select(test.browser.find_element_by_id("month-B"))
    elem.select_by_visible_text(helpers.random_month('Full'))

    elem = Select(test.browser.find_element_by_id("day-B"))
    elem.select_by_visible_text(helpers.random_bday(2))

    elem = Select(test.browser.find_element_by_id("year-B"))
    elem.select_by_visible_text(birth_day_year)

    test.browser.find_element_by_id("btnSubmit").click()

    test.assertIn("Your contact was added successfully.", test.browser.page_source)
Example #2
0
def m_order1(test):
    """ Steps to add a new user.
        @param self: Instance of SeleniumTestScript class.
        
    """
    new_user_email = helpers.new_email()
    
    #generating new email
    elem = test.browser.find_element_by_id('newemail')
    elem.send_keys(new_user_email)
       
    test.browser.find_element_by_name('twhosubmit').click()
Example #3
0
def m_order2(test, account_type):
    """ Function to enter user information.
        @param self: Instance of SeleniumTestScript class.
        
    """
    #assigning parameters
    contact_first_name = helpers.random_name(7)
    contact_last_name = helpers.random_name(7)
    contact_email_address = helpers.new_email()
    birth_day_year = helpers.random_byear()
    
    tbox = test.browser.find_element_by_id("fname")
    tbox.send_keys(contact_first_name)

    tbox = test.browser.find_element_by_id("lname")
    tbox.send_keys(contact_last_name)

    #hardcoded
    tbox = test.browser.find_element_by_id("password")
    tbox.send_keys('123456') 
    
    #hardcoded
    tbox = test.browser.find_element_by_id("cpassword")
    tbox.send_keys('123456') 

    tbox = test.browser.find_element_by_id("phone")
    tbox.send_keys('1231231234')
    
    drop = Select(test.browser.find_element_by_id("bmonth"))
    drop.select_by_visible_text(helpers.random_month('Num'))

    drop = Select(test.browser.find_element_by_id("bday"))
    drop.select_by_visible_text(helpers.random_bday(2))

    drop = Select(test.browser.find_element_by_id("byear"))
    drop.select_by_visible_text(birth_day_year)