def card_selection(account_type): """ Select a card and personalize. @param : Instance of SeleniumTestScript class. @param accout_type: card selection based on registered or one time user. """ sel = selenium if account_type == 'mcp': # select a paid card to send as mcp account. sel.open('/ecards/search.pd?printOrEcard=EcardsA&strSearch=woofy birthday&navtype=topsearch') sel.wait_for_page_to_load("60000") sel.click("small-thumb-3267180") elif account_type == 'rfu' or account_type == 'afu': # select a free card to send as rfu and afu account. sel.open("/ecards/search.pd?printOrEcard=EcardsA&strSearch=just poppin' up&navtype=topsearch") sel.wait_for_page_to_load("60000") sel.click("id=small-thumb-3024857") elif account_type == 'cnp': wait_element("link=Print At Home >") sel.click("link=Print At Home >") sel.wait_for_page_to_load("60000") wait_element("widget-ag-searchtext-printables") sel.click("widget-ag-searchtext-printables") # select a printable card to send. sel.type("widget-ag-searchtext-printables", "celebrate") sel.click("ag-search-submit-printables-actual") sel.wait_for_page_to_load("60000") wait_element("link=view all") sel.click("link=view all") wait_element("thumb-link-3170895") sel.click("thumb-link-3170895") wait_element("//a[@id='personalize']/div/div") sel.click("//a[@id='personalize']/div/div")
def pof(credit_card_type): """ Validate the change payment information functionality of AG intractive site. @param : instance of browser to automate @param credit_card_type: It's shortform of credit card name. """ sel = selenium card_security_code = "187" # Updating payment information. wait_element("name=_cc_name") sel.click("name=_cc_name") sel.type("name=_cc_name", "TestMastercard") verify_element_text("TestMastercard", "name=_cc_name") sel.click("name=_cc_num") sel.type("name=_cc_num", credit(credit_card_type)) verify_element_text(credit(credit_card_type), "name=_cc_num") sel.click("name=_cvv2") sel.type("name=_cvv2", card_security_code) verify_element_text(card_security_code, "name=_cvv2") sel.click("id=agi-update") sel.wait_for_page_to_load("90000") verify_text("You have successfully changed your payment information")
def resend_ecard(): """ Functionality used to re-send a e-card. @param : Instance of SeleniumTestScript class. """ sel = selenium # Temporary re-send date. resend_date = "label=August 2013" wait_element("xpath=//*[@id='header-links']//a[.='my account']") sel.click("xpath=//*[@id='header-links']//a[.='my account']") sel.wait_for_page_to_load("60000") sel.click("xpath=//*[@id='ag-myag-content']//a[.='ecard Outbox']") wait_element("name=delivdate") sel.select("name=delivdate", resend_date) pause_test_execution(3) wait_element("link=resend") sel.click("link=resend") sel.wait_for_page_to_load("60000")
def locate_a_store(location): """steps for find a store by city zipcode. @param : instance of browser to automate @param location: location of "Find a retailer" link on page. """ sel = selenium if location == "tab" or location == "header": wait_element("xpath=//*[@id='header-links']//a[.='find a retailer']") sel.click("xpath=//*[@id='header-links']//a[.='find a retailer']") elif location == 'footer': wait_element("xpath=//div[@id='ag-interest-products']//a[.='Find a Retailer']") sel.click("xpath=//div[@id='ag-interest-products']//a[.='Find a Retailer']") wait_element("id=storelocator_zip") sel.click("id=storelocator_zip") sel.type("id=storelocator_zip", zip_code()) verify_element_text(zip_code(), "id=storelocator_zip") sel.click("id=storelocator_go") sel.wait_for_page_to_load("60000") verify_element_text("WALMART", "xpath=//*[@id='results-list']/li[1]/a/h2")
def confirm_pd_message(): """ Function validating confirmation message. @param : Instance of SeleniumTestScript class. """ wait_element("xpath=//h2[.='Your 7 day free trial has started!']");