def type_email_into_username_of_registration_form(context, user_number): #import pdb; pdb.set_trace() converted_user_number = int(user_number) wc = WebCommon() email = context.users_list[converted_user_number][7] password = context.users_list[converted_user_number][8] email_locator_type = locatorsconfig.MY_ACCOUNT_LOCATORS[ 'register_user_name']['type'] email_locator_string = locatorsconfig.MY_ACCOUNT_LOCATORS[ 'register_user_name']['locator'] wc.type_into_element(context, email, email_locator_type, email_locator_string) password_locator_type = locatorsconfig.MY_ACCOUNT_LOCATORS[ 'register_user_password']['type'] password_locator_string = locatorsconfig.MY_ACCOUNT_LOCATORS[ 'register_user_password']['locator'] wc.type_into_element(context, password, password_locator_type, password_locator_string) register_locator_type = locatorsconfig.MY_ACCOUNT_LOCATORS[ 'register_user_confirm']['type'] register_locator_string = locatorsconfig.MY_ACCOUNT_LOCATORS[ 'register_user_confirm']['locator'] wc.click(context, register_locator_type, register_locator_string) registered_locator_type = locatorsconfig.MY_ACCOUNT_LOCATORS[ 'register_user_confirmed']['type'] registered_locator_string = locatorsconfig.MY_ACCOUNT_LOCATORS[ 'register_user_confirmed']['locator'] wc.assert_element_visible(context, registered_locator_type, registered_locator_string) wc.click(context, registered_locator_type, registered_locator_string)
def user_should_be_logged_in(context): wc = WebCommon() nav_bar_type = locatorsconfig.MY_ACCOUNT_LOCATORS['left_nav']['type'] nav_bar_text = locatorsconfig.MY_ACCOUNT_LOCATORS['left_nav']['locator'] logout_type = locatorsconfig.MY_ACCOUNT_LOCATORS['left_nav_logout_btn'][ 'type'] logout_text = locatorsconfig.MY_ACCOUNT_LOCATORS['left_nav_logout_btn'][ 'locator'] wc.assert_element_visible(context, nav_bar_type, nav_bar_text) wc.assert_element_visible(context, logout_type, logout_text)
def users_can_log_in(context): number_of_users = len(context.users_list) wc = WebCommon() for i in range(0, number_of_users): type_email_into_username_of_login_form(context, context.users_list[i][7]) type_password_into_password_of_login_form(context, context.users_list[i][8]) click_on_button_name(context, 'login') registered_locator_type = locatorsconfig.MY_ACCOUNT_LOCATORS[ 'register_user_confirmed']['type'] registered_locator_string = locatorsconfig.MY_ACCOUNT_LOCATORS[ 'register_user_confirmed']['locator'] wc.assert_element_visible(context, registered_locator_type, registered_locator_string) wc.click(context, registered_locator_type, registered_locator_string)