def test_re_login_smoke(self, setup_logging, set_capabilities): """ Scenarios: Verify after re-login with same user "Whats New" screen will not be visible """ global_contents = Globals(setup_logging) ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) assert ios_main_dashboard_page.get_drawer_icon( ).text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME assert ios_main_dashboard_page.load_account_screen( ).text == strings.PROFILE_SCREEN_TITLE assert ios_main_dashboard_page.log_out().text == strings.LOGIN setup_logging.info('{} is successfully logged out'.format( global_contents.login_user_name)) ios_login_page = IosLogin(set_capabilities, setup_logging) ios_login_page.login(global_contents.login_user_name, global_contents.login_password) setup_logging.info('{} is successfully logged in'.format( global_contents.target_environment)) assert ios_main_dashboard_page.get_drawer_icon( ).text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME assert ios_main_dashboard_page.load_account_screen( ).text == strings.PROFILE_SCREEN_TITLE assert ios_main_dashboard_page.log_out().text == strings.LOGIN
def test_login_smoke(self, set_capabilities, setup_logging): """ Scenario: Verify that app shows proper error msg/dialog when user try to login with wrong Username or password Verify that user can login with valid Username and Password Verify that user can log out and back to login screen """ global_contents = Globals(setup_logging) ios_login_page = IosLogin(set_capabilities, setup_logging) assert ios_login_page.login( global_contents.login_wrong_user_name, global_contents.login_wrong_password) is False ios_login_page.login(global_contents.login_user_name, global_contents.login_password) setup_logging.info('{} is successfully logged in'.format( global_contents.login_user_name)) ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) assert ios_main_dashboard_page.get_drawer_icon( ).text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME assert ios_main_dashboard_page.get_account_options( )[3].text == strings.ACCOUNT_LOGOUT assert ios_main_dashboard_page.log_out().text == strings.LOGIN setup_logging.info('{} is successfully logged out'.format( global_contents.login_user_name))
def test_landscape_smoke(self, set_capabilities, setup_logging): """ Scenarios: Landscape support is added for Whats New screen with following cases, Change device orientation to Landscape mode Verify Whats New screen is loaded successfully after login Verify following contents are visible on screen, "Screen Title", "Cross Icon", "Main Feature Image", "Feature Title", "Feature Details", "Done" Verify all screen contents have their default values Verifies that user can navigate between features Verifies that user can close New Feature screen and move to Main Dashboard screen Verify after re-login with same user "Whats New" screen will not be visible Change device orientation to Portrait mode """ global_contents = Globals(setup_logging) ios_login_page = IosLogin(set_capabilities, setup_logging) ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) assert ios_main_dashboard_page.get_drawer_icon( ).text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME assert ios_main_dashboard_page.get_account_options( )[3].text == strings.ACCOUNT_LOGOUT assert ios_main_dashboard_page.log_out().text == strings.LOGIN # assert ios_login_page.login(global_contents.login_user_name, global_contents.login_password) global_contents.turn_orientation(set_capabilities, global_contents.LANDSCAPE_ORIENTATION) ios_login_page = IosLogin(set_capabilities, setup_logging) login_output = ios_login_page.login(global_contents.login_user_name, global_contents.login_password, False) assert ios_main_dashboard_page.get_drawer_icon( ).text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME assert ios_main_dashboard_page.get_account_options( )[3].text == strings.ACCOUNT_LOGOUT assert ios_main_dashboard_page.log_out().text == strings.LOGIN setup_logging.info('{} is successfully logged out'.format( global_contents.login_user_name)) ios_login_page = IosLogin(set_capabilities, setup_logging) login_output = ios_login_page.login(global_contents.login_user_name, global_contents.login_password, False) assert login_output.text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME setup_logging.info('{} is successfully logged in'.format( global_contents.target_environment)) global_contents.turn_orientation(set_capabilities, global_contents.PORTRAIT_ORIENTATION) setup_logging.info('-- Ending Test Case')
def login(set_capabilities, setup_logging): """ Login user based on env given, it will be reusable in tests Arguments: set_capabilities(webdriver): webdriver object setup_logging (logger): logger object Returns: True: if login is successful """ log = setup_logging global_contents = Globals(log) is_first_time = True if global_contents.target_environment == strings.ANDROID: android_new_landing_page = AndroidNewLanding(set_capabilities, setup_logging) android_login_page = AndroidLogin(set_capabilities, setup_logging) assert android_new_landing_page.on_screen( ) == Globals.DISCOVERY_LAUNCH_ACTIVITY_NAME assert android_new_landing_page.load_login_screen( ) == Globals.LOGIN_ACTIVITY_NAME log.info('Login screen successfully loaded') login_output = android_login_page.login( global_contents.login_user_name, global_contents.login_password) setup_logging.info('{} is successfully logged in'.format( global_contents.login_user_name)) assert login_output == Globals.WHATS_NEW_ACTIVITY_NAME elif global_contents.target_environment == strings.IOS: ios_new_landing_page = IosNewLanding(set_capabilities, setup_logging) ios_login_page = IosLogin(set_capabilities, setup_logging) assert ios_new_landing_page.get_welcome_message( ).text == strings.NEW_LANDING_MESSAGE_IOS assert ios_new_landing_page.load_login_screen().text == strings.LOGIN log.info('Login screen successfully loaded') ios_login_page.login(global_contents.login_user_name, global_contents.login_password) is_first_time = False log.info('{} is successfully logged in'.format( global_contents.login_user_name)) return is_first_time
def test_start_my_courses_list_smoke(self, set_capabilities, setup_logging): """ Scenarios: Verify that from Main Dashboard tapping Courses tab will load My Courses list(of specific logged in user) in its tab """ setup_logging.info('-- Starting Test Case') global_contents = Globals(setup_logging) ios_new_landing_page = IosNewLanding(set_capabilities, setup_logging) ios_login_page = IosLogin(set_capabilities, setup_logging) ios_whats_new_page = IosWhatsNew(set_capabilities, setup_logging) ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) assert ios_new_landing_page.get_welcome_message( ).text == strings.NEW_LANDING_MESSAGE_IOS assert ios_new_landing_page.load_login_screen().text == strings.LOGIN assert ios_login_page.login(global_contents.login_user_name, global_contents.login_password, global_contents.is_first_time) setup_logging.info('{} is successfully logged in'.format( global_contents.login_user_name)) if global_contents.is_first_time: assert ios_whats_new_page.exit_features( ).text == strings.BLANK_FIELD else: assert ios_main_dashboard_page.get_drawer_icon( ).text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME assert ios_main_dashboard_page.load_courses_tab( ).text == strings.SELECTED_BY_DEFAULT
def test_login_smoke(self, set_capabilities, setup_logging): """ Scenario: Verify that app shows proper error msg/dialog when user try to login with wrong Username or password Verify that user cannot login with wrong username and password Verify that user cannot login with wrong username and correct password Verify that user cannot login with correct username and wrong password Verify that user can login with valid Username and Password Verify that user can log out and back to login screen """ global_contents = Globals(setup_logging) ios_login_page = IosLogin(set_capabilities, setup_logging) assert ios_login_page.login(global_contents.login_wrong_user_name, global_contents.login_password) is False assert ios_login_page.login( global_contents.login_user_name, global_contents.login_wrong_password) is False assert ios_login_page.login( global_contents.login_wrong_user_name, global_contents.login_wrong_password) is False ios_login_page.login(global_contents.login_user_name, global_contents.login_password) if strings.IS_FIRST_TIME: ios_whats_new_page = IosWhatsNew(set_capabilities, setup_logging) assert ios_whats_new_page.exit_features( ).text == strings.BLANK_FIELD else: setup_logging.info('navigate_features is not needed') setup_logging.info('{} is successfully logged in'.format( global_contents.login_user_name)) ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) assert ios_main_dashboard_page.get_drawer_icon( ).text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME ios_main_dashboard_page.get_drawer_icon().click() assert ios_main_dashboard_page.log_out().text == strings.LOGIN setup_logging.info('{} is successfully logged out'.format( global_contents.login_user_name))
def test_register_smoke(self, set_capabilities, setup_logging): """ Verify that tapping "Create your account" button after filling all required input(valid) types, will validate all inputs and load "Whats new feature screen" with specific user logged in Verify that tapping "Create your account" button after filling all required input(valid) types, will validate all inputs and load "Whats new feature screen" with specific user logged in Verify that following input types are optional, "Gender" spinner "Year of birth" spinner "Highest level of education completed" spinner "Tell us why you're interested in edX" label with edit-field below Verify that user should be able to log out and re-login with new created account credentials """ ios_register_page = IosRegister(set_capabilities, setup_logging) ios_login_page = IosLogin(set_capabilities, setup_logging) ios_whats_new_page = IosWhatsNew(set_capabilities, setup_logging) ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) global_contents = Globals(setup_logging) user_name = global_contents.generate_random_credentials(4) email = user_name + '@example.com' first_name = global_contents.generate_random_credentials(4) last_name = global_contents.generate_random_credentials(4) full_name = (first_name + ' ' + last_name) password = global_contents.generate_random_credentials(8) setup_logging.info( 'Email - {}, Username - {}, Full Name - {}, Password -{}'.format( email, user_name, full_name, password)) ios_register_page.submit_register_form(email, full_name, user_name, password, global_contents.country) assert ios_whats_new_page.get_title_textview() assert ios_whats_new_page.navigate_features( ).text == strings.WHATS_NEW_DONE assert ios_whats_new_page.exit_features( ).text == strings.MAIN_DASHBOARD_SCREEN_TITLE logout_option = ios_main_dashboard_page.get_account_options()[ global_contents.fourth_existence].text assert logout_option == strings.ACCOUNT_LOGOUT assert ios_main_dashboard_page.log_out().text == strings.LOGIN setup_logging.info('{} is successfully logged out'.format(user_name)) assert ios_login_page.login(user_name, password, False) setup_logging.info('{} is successfully logged in'.format(user_name)) assert ios_main_dashboard_page.get_title_textview_portrait_mode( ).text == strings.MAIN_DASHBOARD_SCREEN_TITLE setup_logging.info('-- Ending Test Case')
def test_landscape_smoke(self, set_capabilities, setup_logging): """ Scenarios: Landscape support is added for Main Dashboard screen with following cases, Change device orientation to Landscape mode Verify following contents are visible on screen, Logged in user's avatar, Screen Title, Account Icon Courses Tab, Discovery Tab Verify that Courses tab will be selected by default Verify on tapping Courses will load Courses contents in its tab Verify on tapping Discovery will load Discovery contents in its tab Verify tapping user's avatar will load User Profile screen Verify tapping back/cancel icon from User Profile screen should get back to Main Dashboard screen """ global_contents = Globals(setup_logging) ios_login_page = IosLogin(set_capabilities, setup_logging) ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) assert ios_login_page.login(global_contents.login_user_name, global_contents.login_password) setup_logging.info('{} is successfully logged in'.format( global_contents.login_user_name)) global_contents.turn_orientation(set_capabilities, global_contents.LANDSCAPE_ORIENTATION) assert ios_main_dashboard_page.get_title_textview_landscape_mode( ).text == strings.BLANK_FIELD assert ios_main_dashboard_page.get_drawer_icon( ).text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME assert ios_main_dashboard_page.get_courses_tab( ).text == strings.SELECTED_BY_DEFAULT assert ios_main_dashboard_page.get_programs_tab( ).text == strings.MAIN_DASHBOARD_PROGRAMS_TAB assert ios_main_dashboard_page.get_discovery_tab( ).text == strings.MAIN_DASHBOARD_DISCOVERY_TAB assert ios_main_dashboard_page.load_discovery_tab( ).text == strings.SELECTED_BY_DEFAULT assert ios_main_dashboard_page.get_courses_tab( ).text == strings.MAIN_DASHBOARD_COURSES_TAB assert ios_main_dashboard_page.load_courses_tab( ).text == strings.SELECTED_BY_DEFAULT assert ios_main_dashboard_page.load_programs_tab( ).text == strings.SELECTED_BY_DEFAULT assert ios_main_dashboard_page.get_discovery_tab( ).text == strings.MAIN_DASHBOARD_DISCOVERY_TAB
def test_landscape_smoke(self, set_capabilities, setup_logging): """ Scenarios: Landscape support is added for Main Dashboard screen with following cases, Change device orientation to Landscape mode Verify following contents are visible on screen, Logged in user's avatar, Screen Title, Account Icon Courses Tab, Discovery Tab Verify that Courses tab will be selected by default Verify on tapping Courses will load Courses contents in its tab Verify on tapping Discovery will load Discovery contents in its tab Verify tapping user's avatar will load User Profile screen Verify tapping back/cancel icon from User Profile screen should get back to Main Dashboard screen Verify tapping Account Icon will load Account Screen Verify tapping back/cancel icon from Account Screen should get back to Main Dashboard screen Verify that user can log out successfully, and back on Login screen """ global_contents = Globals(setup_logging) ios_login_page = IosLogin(set_capabilities, setup_logging) ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) assert ios_login_page.login(global_contents.login_user_name, global_contents.login_password, False) setup_logging.info('{} is successfully logged in'.format(global_contents.login_user_name)) global_contents.turn_orientation(set_capabilities, global_contents.LANDSCAPE_ORIENTATION) assert ios_main_dashboard_page.get_profile_icon().text == strings.MAIN_DASHBOARD_PROFILE assert ios_main_dashboard_page.get_title_textview_landscape_mode().text == strings.MAIN_DASHBOARD_SCREEN_TITLE assert ios_main_dashboard_page.get_drawer_icon().text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME assert ios_main_dashboard_page.get_courses_tab().text == strings.SELECTED_BY_DEFAULT assert ios_main_dashboard_page.get_discovery_tab().text == strings.MAIN_DASHBOARD_DISCOVERY_TAB assert ios_main_dashboard_page.load_discovery_tab().text == strings.SELECTED_BY_DEFAULT assert ios_main_dashboard_page.get_courses_tab().text == strings.MAIN_DASHBOARD_COURSES_TAB assert ios_main_dashboard_page.load_courses_tab().text == strings.SELECTED_BY_DEFAULT assert ios_main_dashboard_page.get_discovery_tab().text == strings.MAIN_DASHBOARD_DISCOVERY_TAB assert ios_main_dashboard_page.load_profile_screen().text == strings.PROFILE_SCREEN_TITLE set_capabilities.back() assert ios_main_dashboard_page.load_account_screen().text == strings.ACCOUNT_SCREEN_TITLE set_capabilities.back() assert ios_main_dashboard_page.get_account_options()[3].text == strings.ACCOUNT_LOGOUT assert ios_main_dashboard_page.log_out().text == strings.LOGIN setup_logging.info('{} is successfully logged out'.format(global_contents.login_user_name)) global_contents.turn_orientation(set_capabilities, global_contents.PORTRAIT_ORIENTATION) setup_logging.info('-- Ending Test Case')
def test_landscape_smoke(self, set_capabilities, setup_logging): """ Scenarios: Landscape support is added for Login screen with following cases, Change device orientation to Landscape mode Verify following contents are visible on screen, "Back icon", "Sign In" Title, "User name or e-mail address" label, User Name edit-field Password edit-field, "Forgot your password?" option, "Sign In" button, "Or sing in with" label, "Facebook" button, "Google" button, "By signing in to this app, you agree to the" label , "edX Terms of Service and Honor Code" option Verify all screen contents have their default values Verify tapping back icon from 'Sign In' screen navigate user back to 'New Landing' screen. Verify that user is able to load EULA screen and get back to Login Screen Verify that user is able to load Terms screen and get back to Login Screen Verify that user is able to load Privacy screen and get back to Login Screen Verify tapping 'Forgot your password?' will load 'Reset Password' alert Verify following contents are visible on 'Reset Password' alert, Alert Title, Alert Message, Email edit field, Cancel & OK buttons Verify tapping 'Cancel' will close 'Reset Password' alert Verify that app shows proper error msg/dialog when user try to login with wrong Username or password Verifies that user can login with valid Username and Password """ global_contents = Globals(setup_logging) ios_login_page = IosLogin(set_capabilities, setup_logging) global_contents.turn_orientation(set_capabilities, global_contents.LANDSCAPE_ORIENTATION) assert ios_login_page.get_logo().text == strings.LOGIN_EDX_LOGO assert ios_login_page.get_username_editfield( ).text == strings.LOGIN_USER_NAME_WATER_MARK assert ios_login_page.get_password_editfield( ).text == strings.LOGIN_PASSWORD_WATER_MARK assert ios_login_page.get_forgot_password_textview( ).text == strings.LOGIN_FORGOT_PASSWORD ios_login_page.get_forgot_password_alert() assert ios_login_page.get_forgot_password_alert_title( ).text == strings.LOGIN_RESET_PASSWORD_ALERT_TITLE assert ios_login_page.get_forgot_password_alert_msg( ).text == strings.LOGIN_RESET_PASSWORD_ALERT_MSG assert ios_login_page.get_forgot_password_alert_ok_button( ).text == strings.LOGIN_RESET_PASSWORD_ALERT_OK cancel_button_text = ios_login_page.get_forgot_password_alert_cancel_button( ).text assert cancel_button_text == strings.LOGIN_RESET_PASSWORD_ALERT_CANCEL assert ios_login_page.close_forgot_password_alert() # global_contents.scroll_from_element(set_capabilities, ios_login_page.get_forgot_password_textview()) assert ios_login_page.get_sign_in_button().text == strings.LOGIN assert ios_login_page.get_login_with_email_divider_textview( ).text == strings.LOGIN_IOS_WITH_EMAIL_DIVIDER assert ios_login_page.get_facebook_textview( ).text == strings.LOGIN_FACEBOOK_OPTION assert ios_login_page.get_google_textview( ).text == strings.LOGIN_GOOGLE_OPTION assert ios_login_page.get_agreement_textview( ).text == strings.LOGIN_IOS_AGREEMENT assert ios_login_page.get_eula_textview().text == strings.LOGIN_EULA assert ios_login_page.get_terms_textview().text == strings.LOGIN_TERMS assert ios_login_page.get_privacy_textview( ).text == strings.LOGIN_PRIVACY assert ios_login_page.back_and_forth_new_landing() # commenting these lines temporary till get the updated id's for these elements # global_contents.scroll_from_element(set_capabilities, ios_login_page.get_forgot_password_textview()) # assert ios_login_page.load_eula_screen().text == strings.LOGIN # assert ios_login_page.load_terms_screen().text == strings.LOGIN # assert ios_login_page.load_privacy_screen().text == strings.LOGIN assert ios_login_page.back_and_forth_new_landing() assert ios_login_page.login( global_contents.login_wrong_user_name, global_contents.login_wrong_password) is False ios_login_page.login(global_contents.login_user_name, global_contents.login_password) setup_logging.info('{} is successfully logged in'.format( global_contents.login_user_name)) global_contents.turn_orientation(set_capabilities, global_contents.PORTRAIT_ORIENTATION) ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) ios_main_dashboard_page.get_drawer_icon().click() assert ios_main_dashboard_page.log_out().text == strings.LOGIN landing_page = ios_main_dashboard_page.load_ios_landing_page( set_capabilities, setup_logging) assert landing_page.text == strings.NEW_LANDING_MESSAGE_IOS setup_logging.info('-- Ending Test Case')
def test_register_smoke(self, set_capabilities, setup_logging): """ Verify that tapping "Create your account" button after filling all required input(valid) types, will validate all inputs and load "Whats new feature screen" with specific user logged in Verify that tapping "Create your account" button after filling all required input(valid) types, will validate all inputs and load "Whats new feature screen" with specific user logged in Verify that following input types are optional, "Gender" spinner "Year of birth" spinner "Highest level of education completed" spinner "Tell us why you're interested in edX" label with edit-field below Verify that user should be able to log out and re-login with new created account credentials """ ios_register_page = IosRegister(set_capabilities, setup_logging) ios_login_page = IosLogin(set_capabilities, setup_logging) ios_whats_new_page = IosWhatsNew(set_capabilities, setup_logging) ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) global_contents = Globals(setup_logging) user_name = global_contents.generate_random_credentials(5) email = user_name + '@example.com' first_name = global_contents.generate_random_credentials(4) last_name = global_contents.generate_random_credentials(4) full_name = (first_name + ' ' + last_name) password = global_contents.generate_random_credentials(8) ios_register_page.submit_register_form('', full_name, user_name, password, click_country=False) ios_register_page.validate_required_optional_fields() assert ios_register_page.get_email_validation_textview( ).text == strings.REGISTER_EMAIL_BLANK_ERROR ios_register_page.submit_register_form(email, '', user_name, password, click_country=False) ios_register_page.validate_required_optional_fields() assert ios_register_page.get_full_name_validation_textview( ).text == strings.REGISTER_FULL_NAME_BLANK_ERROR ios_register_page.submit_register_form(email, full_name, '', password, click_country=False) ios_register_page.validate_required_optional_fields() assert ios_register_page.get_username_validation_textview( ).text == strings.REGISTER_USER_NAME_BLANK_ERROR ios_register_page.submit_register_form(email, full_name, user_name, '', click_country=False) ios_register_page.validate_required_optional_fields() assert ios_register_page.get_password_validation_textview( ).text == strings.REGISTER_PASSWORD_BLANK_ERROR setup_logging.info( 'Email - {}, Username - {}, Full Name - {}, Password -{}'.format( email, user_name, full_name, password)) ios_register_page.submit_register_form(email, full_name, user_name, password) assert ios_whats_new_page.get_title_textview() assert ios_whats_new_page.navigate_features( ).text == strings.CLOSE_BUTTON_TEXT assert ios_whats_new_page.exit_features().text == strings.BLANK_FIELD assert ios_main_dashboard_page.load_account_screen( ).text == strings.PROFILE_SCREEN_TITLE assert ios_main_dashboard_page.log_out().text == strings.LOGIN setup_logging.info('{} is successfully logged out'.format(user_name)) assert ios_login_page.login(user_name, password) setup_logging.info('{} is successfully logged in'.format(user_name)) assert ios_main_dashboard_page.get_title_textview_portrait_mode( ).text == strings.MAIN_DASHBOARD_SCREEN_TITLE