def TCID_1_user_enters_any_item_in_search_bar(context): search_bar_locator = LOCATORS['search bar'] search_bar_locator_type = search_bar_locator['type'] search_bar_locator_text = search_bar_locator['locator'] webcommon.type_into_element(context, "iphone", search_bar_locator_type, search_bar_locator_text)
def type_password_into_password_of_login_form(context, password): password_locator_type = locatorsconfig.MY_ACCOUNT_LOCATORS[ 'login_user_password']['type'] password_locator_string = locatorsconfig.MY_ACCOUNT_LOCATORS[ 'login_user_password']['locator'] webcommon.type_into_element(context, password, password_locator_type, password_locator_string)
def tcid_3_search_for_items_from_list(context): search_list = ["cucumber", "java", "selenium web browser automation"] for i in search_list: search_bar = GOOGLE['search bar'] search_bar_type = search_bar['type'] search_bar_locator = search_bar['locator'] webcommon.type_into_element(context, i, search_bar_type, search_bar_locator) search_button = GOOGLE['search button'] search_button_type = search_button['type'] search_button_locator = search_button['locator'] webcommon.click(context, search_button_type, search_button_locator) result_link = GOOGLE['result link'] result_link_type = result_link['type'] result_link_locator = result_link['locator'] link = webcommon.get_element_text(context, result_link_type, result_link_locator) search_result = GOOGLE['search result'] search_result_type = search_result['type'] search_result_locator = search_result['locator'] webcommon.click(context, search_result_type, search_result_locator) webcommon.assert_url_contains(context, link) webcommon.back(context)
def type_email_into_username_of_login_form(context, email): email_locator_type = locatorsconfig.MY_ACCOUNT_LOCATORS['login_user_name'][ 'type'] email_locator_string = locatorsconfig.MY_ACCOUNT_LOCATORS[ 'login_user_name']['locator'] webcommon.type_into_element(context, email, email_locator_type, email_locator_string)
def TCID_2_user_enters_text(context, input_value): search_bar = WIKI['search bar'] search_bar_type = search_bar['type'] search_bar_locator = search_bar['locator'] webcommon.type_into_element(context, input_value, search_bar_type, search_bar_locator)
def i_apply_coupon_to_the_cart(context): coupon_field_locator = CART_PAGE_LOCATORS['coupon_code_field'] apply_coupon_locator = CART_PAGE_LOCATORS['apply_coupon_button'] webcommon.type_into_element(context, context.coupon_code, coupon_field_locator['type'], coupon_field_locator['locator']) webcommon.click(context, apply_coupon_locator['type'], apply_coupon_locator['locator'])
def type_password_into_password_of_login_form(context, password): """ :param context: :return: """ pass_locator_type = MY_ACCOUNT_LOCATORS['login_user_password']['type'] pass_locator_string = MY_ACCOUNT_LOCATORS['login_user_password']['locator'] webcommon.type_into_element(context, password, pass_locator_type, pass_locator_string)
def tcid_4_search_for_item(context, item): search_bar = EBAY['search bar'] search_bar_type = search_bar['type'] search_bar_locator = search_bar['locator'] webcommon.type_into_element(context, item, search_bar_type, search_bar_locator) logger.info("Typing into element: search bar") search_button = EBAY['search button'] search_button_type = search_button['type'] search_button_locator = search_button['locator'] webcommon.click(context, search_button_type, search_button_locator) logger.info("Clicking element: search button")
def tcid_3_search_for_items_from_list(context): search_list = ["cucumber", "java", "selenium web browser automation"] for i in search_list: search_bar = GOOGLE['search bar'] search_bar_type = search_bar['type'] search_bar_locator = search_bar['locator'] webcommon.type_into_element(context, i, search_bar_type, search_bar_locator) search_button = GOOGLE['search button'] search_button_type = search_button['type'] search_button_locator = search_button['locator'] webcommon.click(context, search_button_type, search_button_locator) webcommon.back(context)
def type_email_into_username_of_login_form(context, email): """ :param context: :param email: :return: """ import ipdb ipdb.set_trace() email_locator_type = MY_ACCOUNT_LOCATORS['login_user_name']['type'] email_locator_string = MY_ACCOUNT_LOCATORS['login_user_name']['locator'] webcommon.type_into_element(context, email, email_locator_type, email_locator_string)
def i_fill_in_the_billing_details_form(context): rand_name = generate_random_first_and_last_names() f_name = rand_name['f_name'] l_name = rand_name['l_name'] addr_1 = '123 Main st.' city = 'San Francisco' _zip = 94111 phone = '5101111111' email = generate_random_email_and_password()['email'] f_name_locator = CHECKOUT_PAGE_LOCATORS['billing_f_name_input'] l_name_locator = CHECKOUT_PAGE_LOCATORS['billing_l_name_input'] street_locator = CHECKOUT_PAGE_LOCATORS['billing_address1_input'] city_locator = CHECKOUT_PAGE_LOCATORS['billing_city_input'] zip_locator = CHECKOUT_PAGE_LOCATORS['billing_zip_input'] phone_locator = CHECKOUT_PAGE_LOCATORS['billing_phone_input'] email_locator = CHECKOUT_PAGE_LOCATORS['billing_email_input'] # start input the values webcommon.type_into_element(context, f_name, f_name_locator['type'], f_name_locator['locator']) webcommon.type_into_element(context, l_name, l_name_locator['type'], l_name_locator['locator']) webcommon.type_into_element(context, addr_1, street_locator['type'], street_locator['locator']) webcommon.type_into_element(context, city, city_locator['type'], city_locator['locator']) webcommon.type_into_element(context, _zip, zip_locator['type'], zip_locator['locator']) webcommon.type_into_element(context, phone, phone_locator['type'], phone_locator['locator']) webcommon.type_into_element(context, email, email_locator['type'], email_locator['locator'])
def i_fill_in_the_billing_details_form(context): rand_name = generate_random_first_and_last_name() f_name = rand_name['f_name'] l_name = rand_name['l_name'] address_1 = '39 Queens Road' city = 'York' _zip = 'LS16 7HR' phone = '011427326632' email = generate_random_email_and_password()['email'] f_name_locator = CHECKOUT_PAGE_LOCATORS['billing_f_name_input'] l_name_locator = CHECKOUT_PAGE_LOCATORS['billing_l_name_input'] street_locator = CHECKOUT_PAGE_LOCATORS['billing_address1_input'] city_locator = CHECKOUT_PAGE_LOCATORS['billing_city_input'] zip_locator = CHECKOUT_PAGE_LOCATORS['billing_zip_input'] phone_locator = CHECKOUT_PAGE_LOCATORS['billing_phone_input'] email_locator = CHECKOUT_PAGE_LOCATORS['billing_email_input'] webcommon.type_into_element(context, f_name, f_name_locator['type'], f_name_locator['locator']) webcommon.type_into_element(context, l_name, l_name_locator['type'], l_name_locator['locator']) webcommon.type_into_element(context, address_1, street_locator['type'], street_locator['locator']) webcommon.type_into_element(context, city, city_locator['type'], city_locator['locator']) webcommon.type_into_element(context, _zip, zip_locator['type'], zip_locator['locator']) webcommon.type_into_element(context, phone, phone_locator['type'], phone_locator['locator']) webcommon.type_into_element(context, email, email_locator['type'], email_locator['locator'])