def test_sign_out_smoke(self, set_capabilities, setup_logging): """ Scenarios: 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 logout from main dashboard screen """ global_contents = Globals(setup_logging) android_main_dashboard_page = AndroidMainDashboard( set_capabilities, setup_logging) assert android_main_dashboard_page.load_account_screen( ) == global_contents.ACCOUNT_ACTIVITY_NAME set_capabilities.back() assert android_main_dashboard_page.get_logout_account_option( ).text == strings.PROFILE_OPTIONS_SIGNOUT_BUTTON assert android_main_dashboard_page.log_out( ) == global_contents.DISCOVERY_LAUNCH_ACTIVITY_NAME 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'.format( TestAndroidMainDashboard.__name__))
def test_upgrade_app(self, set_capabilities, setup_logging): """ Verifies that user can upgrade app """ global_contents = Globals(setup_logging) assert global_contents.upgrade_target_app(set_capabilities)
def test_load_course_details_smoke(self, set_capabilities, setup_logging): """ Scenarios: Verify that tapping any course should load specific Course Dashboard screen Verity that from Course Dashboard tapping back should load My Courses List screen Verify that user should be able to scroll courses Verify on tapping "Find a Course" button will load Discovery screen Verity that from Course Dashboard tapping back should load My Courses List screen """ android_main_dashboard_page = AndroidMainDashboard( set_capabilities, setup_logging) android_my_courses_list_page = AndroidMyCoursesList( set_capabilities, setup_logging) global_contents = Globals(setup_logging) if android_my_courses_list_page.get_my_courses_list_row(): course_dashboard_screen = android_my_courses_list_page.load_course_details_screen( ) assert course_dashboard_screen == global_contents.COURSE_DASHBOARD_ACTIVITY_NAME set_capabilities.back() assert android_main_dashboard_page.on_screen( ) == global_contents.MAIN_DASHBOARD_ACTIVITY_NAME global_contents.swipe_screen(set_capabilities) course_discovery_screen = android_my_courses_list_page.load_discovery_screen( ) assert course_discovery_screen == global_contents.WEB_VIEW_FIND_COURSES_ACTIVITY_NAME set_capabilities.back() assert android_main_dashboard_page.on_screen( ) == global_contents.MAIN_DASHBOARD_ACTIVITY_NAME
def test_update_profile_information(self, set_capabilities, setup_logging): """ Scenarios: Verify that user can update information """ ios_profile_page = IosProfile(set_capabilities, setup_logging) ios_edit_profile_page = IosEditProfile(set_capabilities, setup_logging) global_contents = Globals(setup_logging) ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) edit_profile_about_me = global_contents.get_element_by_id( set_capabilities, ios_elements.edit_profile_about_me) edit_profile_about_me.click() ios_edit_profile_page.change_user_info() ios_profile_page.get_edit_profile_back_icon().click() about_me_info = ios_edit_profile_page.get_information_on_edit_profile() assert about_me_info.get_attribute( 'value') in strings.EDIT_PROFILE_NEW_INFO_TEXT ios_profile_page.get_profile_back_icon().click() ios_profile_page.get_back_icon().click() assert ios_main_dashboard_page.load_account_screen( ).text == strings.PROFILE_SCREEN_TITLE assert ios_main_dashboard_page.log_out().text == strings.LOGIN assert ios_main_dashboard_page.load_ios_landing_page( set_capabilities, setup_logging).text == strings.NEW_LANDING_MESSAGE_IOS setup_logging.info('{} is successfully logged out'.format( global_contents.login_user_name)) setup_logging.info(' Ending Test Case --')
def test_update_profile_language(self, set_capabilities, setup_logging): """ Scenarios: Verify that user can update language """ ios_profile_page = IosProfile(set_capabilities, setup_logging) ios_edit_profile_page = IosEditProfile(set_capabilities, setup_logging) global_contents = Globals(setup_logging) edit_profile_change_language = global_contents.get_element_by_id( set_capabilities, ios_elements.edit_profile_change_language) edit_profile_change_language.click() esperanto_language = ios_edit_profile_page.update_profile_elements( strings.EDIT_PROFILE_USER_ESPERANTO_LANGUAGE) ios_profile_page.get_edit_profile_back_icon().click() assert ios_edit_profile_page.get_language_on_edit_profile( ).get_attribute('value') == esperanto_language edit_profile_change_language = global_contents.get_element_by_id( set_capabilities, ios_elements.edit_profile_change_language) edit_profile_change_language.click() english_language = ios_edit_profile_page.update_profile_elements( strings.EDIT_PROFILE_USER_ENGLISH_LANGUAGE) ios_profile_page.get_edit_profile_back_icon().click() assert ios_edit_profile_page.get_language_on_edit_profile( ).get_attribute('value') == english_language
def test_update_profile_location(self, set_capabilities, setup_logging): """ Scenarios: Verify that user can update location Verify that user can update language Verify that user can update information """ ios_profile_page = IosProfile(set_capabilities, setup_logging) ios_edit_profile_page = IosEditProfile(set_capabilities, setup_logging) global_contents = Globals(setup_logging) edit_profile_full_view = global_contents.get_element_by_id( set_capabilities, ios_elements.edit_profile_full_view) edit_profile_full_view.click() edit_profile_change_location = global_contents.get_element_by_id( set_capabilities, ios_elements.edit_profile_change_location) edit_profile_change_location.click() new_location = ios_edit_profile_page.update_profile_elements( strings.EDIT_PROFILE_ALGERIA_LOCATION) ios_profile_page.get_edit_profile_back_icon().click() assert ios_edit_profile_page.get_location_on_edit_profile( ).get_attribute('value') == new_location edit_profile_change_location = global_contents.get_element_by_id( set_capabilities, ios_elements.edit_profile_change_location) edit_profile_change_location.click() old_location = ios_edit_profile_page.update_profile_elements( strings.EDIT_PROFILE_ALBANIA_LOCATION) ios_profile_page.get_edit_profile_back_icon().click() assert ios_edit_profile_page.get_location_on_edit_profile( ).get_attribute('value') == old_location
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 Programs will load Programs 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) android_main_dashboard_page = AndroidMainDashboard( set_capabilities, setup_logging) 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 login_output = android_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)) assert login_output == Globals.MAIN_DASHBOARD_ACTIVITY_NAME global_contents.turn_orientation(set_capabilities, global_contents.LANDSCAPE_ORIENTATION) assert android_main_dashboard_page.get_title_textview( ).text == strings.MAIN_DASHBOARD_SCREEN_TITLE assert android_main_dashboard_page.get_menu_icon( ).text == strings.BLANK_FIELD assert android_main_dashboard_page.get_courses_tab( ).text == strings.MAIN_DASHBOARD_COURSES_TAB assert android_main_dashboard_page.get_programs_tab( ).text == strings.MAIN_DASHBOARD_PROGRAMS_TAB assert android_main_dashboard_page.get_discovery_tab( ).text == strings.MAIN_DASHBOARD_DISCOVERY_TAB assert android_main_dashboard_page.load_programs_tab( ).text == strings.MAIN_DASHBOARD_PROGRAMS_TAB assert android_main_dashboard_page.load_programs_tab().is_selected() assert android_main_dashboard_page.load_discovery_tab( ).text == strings.MAIN_DASHBOARD_DISCOVERY_TAB assert android_main_dashboard_page.load_discovery_tab().is_selected() assert android_main_dashboard_page.load_courses_tab( ).text == strings.MAIN_DASHBOARD_COURSES_TAB assert android_main_dashboard_page.load_courses_tab().is_selected()
def test_validate_video_settings_cell_elements(self, set_capabilities, setup_logging): """ Verify that video settings cell will show following contents: Close icon "Profile" as Title Video Settings label Wifi only download Wifi switch Video download quality label Video quality description """ android_main_dashboard_page = AndroidMainDashboard( set_capabilities, setup_logging) profile_options_page = AndroidProfileOptions(set_capabilities, setup_logging) global_contents = Globals(setup_logging) menu_icon = android_main_dashboard_page.get_menu_icon() assert menu_icon.get_attribute( 'content-desc') == strings.PROFILE_SCREEN_TITLE android_main_dashboard_page.get_menu_icon().click() navigation_icon = profile_options_page.get_all_image_buttons()[0] assert navigation_icon.get_attribute( 'content-desc') == strings.PROFILE_OPTIONS_SCREEN_NAVIGATION_ICON navigation_icon.click() android_main_dashboard_page.get_menu_icon().click() screen_title = profile_options_page.get_all_textviews()[0] assert screen_title.text == strings.PROFILE_OPTIONS_SCREEN_TITLE video_settings_option_label = profile_options_page.get_all_textviews( )[1] assert video_settings_option_label.text == strings.PROFILE_OPTIONS_VIDEO_SETTINGS_OPTION_LABEL wifi_only_download_label = profile_options_page.get_all_textviews()[2] assert wifi_only_download_label.text == strings.PROFILE_OPTIONS_VIDEO_SETTINGS_DESCRIPTION_LABEL wifi_switch = global_contents.get_element_by_id( set_capabilities, android_elements.profile_options_wifi_switch) assert wifi_switch.text == strings.PROFILE_OPTIONS_WIFI_TOGGLE_ON_ANDROID download_content_subtitle = profile_options_page.get_all_textviews()[3] assert download_content_subtitle.text == strings.SETTINS_SCREEN_DOWNLOAD_CONTENT_TEXT_ANDROID video_download_quality_description = profile_options_page.get_all_textviews( )[4] assert video_download_quality_description.text == strings.PROFILE_OPTIONS_VIDEO_QUALITY_DESCRIPTION_LABEL video_quality_subtitle_label = global_contents.get_element_by_id( set_capabilities, android_elements.profile_options_video_quality_subtitle_label) assert video_quality_subtitle_label.text == strings.VIDEO_DOWNLOAD_AUTO_QUALITY
def test_landscape_smoke(self, set_capabilities, setup_logging): """ Scenarios: Change device orientation to Landscape mode Verify that from Main Dashboard tapping Courses tab will load My Courses list(of specific logged in user) in its tab Verify following contents on Header, Profile icon, "Courses" title, Account Icon Verify that My Courses(enrolled) List has following contents in each course, Course Name, Course Start/End date Verify that "Looking for a new challenge?" label and "Find a Course" button are available Verify that tapping any course should load specific Course Dashboard screen Verity that from Course Dashboard tapping back should load My Courses List screen Verify that user should be able to scroll courses Verify on tapping "Find a Course" button will load Discovery screen Verity that from Course Dashboard tapping back should load My Courses List screen Verify user is able to change device orientation back to Portrait Mode """ global_contents = Globals(setup_logging) ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) ios_my_courses_list = IosMyCoursesList(set_capabilities, setup_logging) 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.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_discovery_tab( ).text == strings.MAIN_DASHBOARD_DISCOVERY_TAB if ios_my_courses_list.get_my_courses_list_row_landscape(): assert ios_my_courses_list.get_my_courses_list_row_landscape() assert ios_my_courses_list.get_my_course_details() course_name = ios_my_courses_list.get_my_courses_list_row_landscape( ).text assert ios_my_courses_list.get_my_courses_list_row_landscape( ).text in course_name set_capabilities.back() else: setup_logging.info('No course enrolled by this user.') # assert ios_my_courses_list.get_find_courses_message().text == strings.MY_COURSES_LIST_FIND_COURSES_MESSAGE # assert ios_my_courses_list.get_find_course_button().text == strings.MY_COURSES_LIST_FIND_COURSES_BUTTON_IOS ios_my_courses_list.load_discovery_screen() setup_logging.info(set_capabilities.context) assert ios_main_dashboard_page.load_courses_tab( ).text == strings.SELECTED_BY_DEFAULT
def test_my_courses_list_ui_elements_smoke(self, set_capabilities, setup_logging): """ Scenarios: Verify that from Main Dashboard tapping Courses tab will load My Courses contents(of specific logged in user) in its tab Verify that Courses tab/screen will show following header contents, Header Contents Profile icon "Courses" title Account Icon Courses Tab Discovery Tab Verify that My Courses(enrolled) List with followings in each course, Course image Course Name Course Start/End date "Looking for a new challenge?" label "Find a Course" button """ android_main_dashboard_page = AndroidMainDashboard( set_capabilities, setup_logging) android_my_courses_list_page = AndroidMyCoursesList( set_capabilities, setup_logging) global_contents = Globals(setup_logging) assert android_main_dashboard_page.get_profile_icon( ).text == strings.BLANK_FIELD assert android_main_dashboard_page.get_title_textview( ).text == strings.MAIN_DASHBOARD_SCREEN_TITLE assert android_main_dashboard_page.get_menu_icon( ).text == strings.BLANK_FIELD assert android_main_dashboard_page.get_courses_tab( ).text == strings.MAIN_DASHBOARD_COURSES_TAB assert android_main_dashboard_page.get_discovery_tab( ).text == strings.MAIN_DASHBOARD_DISCOVERY_TAB if android_my_courses_list_page.get_my_courses_list(): assert android_my_courses_list_page.get_my_courses_list_row() android_my_courses_list_page.get_contents_from_list() global_contents.swipe_screen(set_capabilities) else: setup_logging.info('No course enrolled by this user.') find_courses_message = android_my_courses_list_page.get_find_courses_message( ).text assert find_courses_message == strings.MY_COURSES_LIST_FIND_COURSES_MESSAGE find_courses_button = android_my_courses_list_page.get_find_course_button( ).text assert find_courses_button == strings.MY_COURSES_LIST_FIND_COURSES_BUTTON_ANDROID
def test_validate_video_help_cell_elements(self, set_capabilities, setup_logging): """ Verify that help cell will show following contents: Help cell Submit feedback title Submit feedback description Email support team button Get support cell title Get support description View FAQ button """ global_contents = Globals(setup_logging) help_cell = global_contents.get_element_by_id( set_capabilities, ios_elements.profile_options_help_cell) assert help_cell.get_attribute('visible') == 'true' help_cell_feedback_label = global_contents.get_element_by_id( set_capabilities, ios_elements.profile_options_help_cell_feedback_label) assert help_cell_feedback_label.text == strings.PROFILE_OPTIONS_FEEDBACK_LABEL help_cell_subtitle_label = global_contents.get_element_by_id( set_capabilities, ios_elements.profile_options_help_cell_subtitle_label) assert help_cell_subtitle_label.text == strings.PROFILE_OPTIONS_FEEDBACK_SUBTITLE_LABEL help_cell_support_label = global_contents.get_element_by_id( set_capabilities, ios_elements.profile_options_help_cell_support_label) assert help_cell_support_label.text == strings.PROFILE_OPTIONS_SUPPORT_LABEL help_cell_support_subtitle_label = global_contents.get_element_by_id( set_capabilities, ios_elements.profile_options_help_cell_support_subtitle_label) assert help_cell_support_subtitle_label.text == strings.PROFILE_OPTIONS_SUPPORT_SUBTITLE_LABEL help_cell_option_label = global_contents.get_element_by_id( set_capabilities, ios_elements.profile_options_help_cell_option_label) assert help_cell_option_label.get_attribute('visible') == 'true' email_feedback_button = global_contents.get_element_by_id( set_capabilities, ios_elements.profile_options_email_feedback_button) assert email_feedback_button.text == strings.PROFILE_OPTIONS_EMAIL_FEEDBACK_BUTTON view_faq_button = global_contents.get_element_by_id( set_capabilities, ios_elements.profile_options_view_faq_button) assert view_faq_button.text == strings.PROFILE_OPTIONS_FAQ_BUTTON
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 user should be able to log out and re-login with new created account credentials """ android_register_page = AndroidRegister(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) name = first_name + ' ' + last_name full_name = name password = global_contents.generate_random_credentials(8) setup_logging.info( 'Email - {}, Username - {}, Full Name - {}, Password -{}'.format( email, user_name, full_name, password)) android_register_page.back_and_forth_register() register_output = android_register_page.register( email, full_name, user_name, password, global_contents.country) global_contents.wait_for_android_activity_to_load( set_capabilities, global_contents.REGISTER_ACTIVITY_NAME) # assert register_output == Globals.WHATS_NEW_ACTIVITY_NAME android_whats_new_page = AndroidWhatsNew(set_capabilities, setup_logging) android_whats_new_page.navigate_features() assert android_whats_new_page.navigate_features( ).text == strings.WHATS_NEW_DONE assert android_whats_new_page.exit_features( ) == Globals.MAIN_DASHBOARD_ACTIVITY_NAME android_main_dashboard_page = AndroidMainDashboard( set_capabilities, setup_logging) assert android_main_dashboard_page.get_logout_account_option( ).text == strings.ACCOUNT_LOGOUT assert android_main_dashboard_page.log_out( ) == Globals.DISCOVERY_LAUNCH_ACTIVITY_NAME android_new_landing_page = AndroidNewLanding(set_capabilities, setup_logging) assert android_new_landing_page.load_login_screen( ) == Globals.LOGIN_ACTIVITY_NAME android_login_page = AndroidLogin(set_capabilities, setup_logging) login_output = android_login_page.login(user_name, password, False) assert login_output == Globals.MAIN_DASHBOARD_ACTIVITY_NAME setup_logging.info('{} is successfully logged in'.format(user_name)) setup_logging.info('-- Ending {} Test Case'.format( TestAndroidRegister.__name__))
def test_start_login_smoke(self, set_capabilities, setup_logging): """ Scenario: Verify Login screen is loaded successfully """ setup_logging.info('-- Starting Test Case') global_contents = Globals(setup_logging) global_contents.turn_orientation(set_capabilities, global_contents.PORTRAIT_ORIENTATION) ios_new_landing_page = IosNewLanding(set_capabilities, setup_logging) assert ios_new_landing_page.load_login_screen().text == strings.LOGIN setup_logging.info('Login screen successfully loaded')
def test_profile_views_smoke(self, set_capabilities, setup_logging): """ Scenarios: Verify that all content should be enabled for full profile view Verify that these contents will be disabled for limited profile view location language about me """ ios_profile_page = IosProfile(set_capabilities, setup_logging) global_contents = Globals(setup_logging) edit_profile_full_view = global_contents.get_element_by_id( set_capabilities, ios_elements.edit_profile_full_view) edit_profile_full_view.click() edit_profile_change_location = global_contents.get_element_by_id( set_capabilities, ios_elements.edit_profile_change_location) assert edit_profile_change_location.text == strings.EDIT_PROFILE_LOCATION_TEXT edit_profile_change_location.click() assert ios_profile_page.get_subsection_title( ).text == strings.EDIT_PROFILE_LOCATION_TITLE ios_profile_page.get_edit_profile_back_icon().click() edit_profile_change_language = global_contents.get_element_by_id( set_capabilities, ios_elements.edit_profile_change_language) assert edit_profile_change_language.text == strings.EDIT_PROFILE_LANGUAGE_TEXT edit_profile_change_language.click() assert ios_profile_page.get_subsection_title( ).text == strings.EDIT_PROFILE_LANGUAGE_TITLE ios_profile_page.get_edit_profile_back_icon().click() edit_profile_about_me = global_contents.get_element_by_id( set_capabilities, ios_elements.edit_profile_about_me) assert edit_profile_about_me.text == strings.EDIT_PROFILE_ABOUT_ME_TEXT edit_profile_about_me.click() assert ios_profile_page.get_subsection_title( ).text == strings.EDIT_PROFILE_ABOUT_ME_TITLE ios_profile_page.get_edit_profile_back_icon().click() edit_profile_limited_view = global_contents.get_element_by_id( set_capabilities, ios_elements.edit_profile_limited_view) edit_profile_limited_view.click() edit_profile_change_location = global_contents.get_element_by_id( set_capabilities, ios_elements.edit_profile_change_location) edit_profile_change_location.click() assert ios_profile_page.get_subsection_title().get_attribute( 'value') == strings.EDIT_PROFILE_SCREEN_TITLE edit_profile_change_language = global_contents.get_element_by_id( set_capabilities, ios_elements.edit_profile_change_language) edit_profile_change_language.click() assert ios_profile_page.get_subsection_title().get_attribute( 'value') == strings.EDIT_PROFILE_SCREEN_TITLE
def test_sign_out_smoke(self, set_capabilities, setup_logging): """ Scenarios: Verify that user can logout from my profile options screen """ global_contents = Globals(setup_logging) sign_out_button = global_contents.get_element_by_id( set_capabilities, android_elements.profile_options_signout_button) sign_out_button.click() assert global_contents.wait_for_android_activity_to_load( set_capabilities, global_contents.NEW_LOGISTRATION_ACTIVITY_NAME ) == global_contents.DISCOVERY_LAUNCH_ACTIVITY_NAME 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_check_login_smoke(self, login, set_capabilities, setup_logging): """ Scenarios: Verify Main Dashboard screen is loaded successfully after successful login """ global_contents = Globals(setup_logging) whats_new_page = IosWhatsNew(set_capabilities, setup_logging) setup_logging.info('-- Starting {} Test Case'.format( IosLoginSmoke.__name__)) if login: setup_logging.info('{} is successfully logged in'.format( global_contents.login_user_name)) if strings.IS_FIRST_TIME: assert whats_new_page.exit_features().text == strings.BLANK_FIELD strings.IS_FIRST_TIME = False else: main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) assert main_dashboard_page.get_drawer_icon( ).text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME setup_logging.info('{} is successfully logged in'.format( global_contents.login_user_name))
def test_ui_elements_smoke(self, set_capabilities, setup_logging): """ Scenarios: Verify that Account screen will show following contents: Back icon Specific "Account" as Title Profile Settings Submit_feedback Logout """ global_contents = Globals(setup_logging) android_accounts_screen = AndroidAccunts(set_capabilities, setup_logging) android_main_dashboard_page = AndroidMainDashboard( set_capabilities, setup_logging) assert android_main_dashboard_page.load_account_screen( ) == global_contents.ACCOUNT_ACTIVITY_NAME assert android_accounts_screen.get_navigation_icon().get_attribute('content-desc') \ == strings.ACCOUNT_SCREEN_NAVIGATION_ICON assert android_accounts_screen.get_profile_row( ).text == strings.PROFILE_SCREEN_TITLE assert android_accounts_screen.get_settings_row( ).text == strings.ACCOUNT_SETTINGS assert android_accounts_screen.get_submit_feedback_row( ).text == strings.ACCOUNT_SUBMIT_FEEDBACK assert android_accounts_screen.get_logout_row( ).text == strings.ACCOUNT_LOGOUT
def test_load_contents_smoke(self, set_capabilities, setup_logging): """ Scenarios: Verify on tapping "Back icon" will load Main dashboard screen Verify on tapping "Profile" will load Profile Verify on tapping "Settings" will load Settings screen Verify on tapping "Logout" will logout user """ global_contents = Globals(setup_logging) android_main_dashboard_page = AndroidMainDashboard( set_capabilities, setup_logging) android_accounts_screen = AndroidAccunts(set_capabilities, setup_logging) android_accounts_screen.get_navigation_icon().click() assert android_accounts_screen.on_screen( ) == global_contents.MAIN_DASHBOARD_ACTIVITY_NAME assert android_main_dashboard_page.load_account_screen( ) == global_contents.ACCOUNT_ACTIVITY_NAME assert android_accounts_screen.load_profile_activity( ) == global_contents.PROFILE_ACTIVITY_NAME set_capabilities.back() assert android_accounts_screen.load_settings_activity( ) == global_contents.SETTINGS_ACTIVITY_NAME set_capabilities.back() assert android_main_dashboard_page.log_out( ) == global_contents.DISCOVERY_LAUNCH_ACTIVITY_NAME
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'.format( TestAndroidMyCoursesList.__name__)) global_contents = Globals(setup_logging) android_new_landing_page = AndroidNewLanding(set_capabilities, setup_logging) android_login_page = AndroidLogin(set_capabilities, setup_logging) android_whats_new_page = AndroidWhatsNew(set_capabilities, setup_logging) android_main_dashboard_page = AndroidMainDashboard( set_capabilities, setup_logging) assert android_new_landing_page.on_screen( ) == global_contents.DISCOVERY_LAUNCH_ACTIVITY_NAME assert android_new_landing_page.load_login_screen( ) == Globals.LOGIN_ACTIVITY_NAME assert android_login_page.login( global_contents.login_user_name, global_contents.login_password, global_contents.is_first_time) == Globals.WHATS_NEW_ACTIVITY_NAME setup_logging.info('{} is successfully logged in'.format( global_contents.login_user_name)) assert android_whats_new_page.navigate_features() assert android_whats_new_page.exit_features( ) == Globals.MAIN_DASHBOARD_ACTIVITY_NAME assert android_main_dashboard_page.load_courses_tab()
def test_ui_elements_smoke(self, set_capabilities, setup_logging): """ Scenarios: Verify that Course Resources tab will show Back icon, Verify that user should be able to go back by clicking Back icon """ global_contents = Globals(setup_logging) android_course_dashboard_page = AndroidCourseDashboard(set_capabilities, setup_logging) android_my_courses_list_page = AndroidMyCoursesList(set_capabilities, setup_logging) android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) assert android_main_dashboard_page.load_courses_tab() if android_my_courses_list_page.get_my_courses_list_row(): android_my_courses_list_page.get_first_course().click() else: setup_logging.info('No course enrolled by this user.') resources_tab_element = android_course_dashboard_page.get_resources_tab() resources_tab_element.click() assert resources_tab_element.get_attribute('selected') == 'true' navigation_icon = android_course_dashboard_page.get_navigation_icon() assert navigation_icon.get_attribute('content-desc') == strings.COURSE_DASHBOARD_NAVIGATION_ICON android_course_dashboard_page.get_navigation_icon().click() assert android_main_dashboard_page.on_screen() == global_contents.MAIN_DASHBOARD_ACTIVITY_NAME android_my_courses_list_page.load_course_details_screen() android_course_dashboard_page.get_resources_tab().click()
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) android_main_dashboard_page = AndroidMainDashboard( set_capabilities, setup_logging) assert android_main_dashboard_page.get_logout_account_option( ).text == strings.ACCOUNT_LOGOUT assert android_main_dashboard_page.log_out( ) == global_contents.NEW_LOGISTRATION_ACTIVITY_NAME setup_logging.info('{} is successfully logged out'.format( global_contents.login_user_name)) android_login_page = AndroidLogin(set_capabilities, setup_logging) android_new_landing_page = AndroidNewLanding(set_capabilities, setup_logging) assert android_new_landing_page.load_login_screen( ) == Globals.LOGIN_ACTIVITY_NAME login_output = android_login_page.login( global_contents.login_user_name, global_contents.login_password, False) assert login_output == Globals.MAIN_DASHBOARD_ACTIVITY_NAME setup_logging.info('{} is successfully logged in'.format( global_contents.target_environment)) setup_logging.info('-- Ending Test Case')
def test_update_profile_language(self, set_capabilities, setup_logging): """ Scenarios: Verify that user can update language """ global_contents = Globals(setup_logging) edit_profile_screen = AndroidEditProfile(set_capabilities, setup_logging) android_profile_screen = AndroidProfile(set_capabilities, setup_logging) android_profile_screen.get_edit_profile_screen().click() edit_profile_screen.get_by_class_from_elements( android_elements.all_textviews, global_contents.seventh_existence).click() edit_profile_screen.change_user_language()[1].click() assert edit_profile_screen.get_by_class_from_elements( android_elements.all_textviews, global_contents.seventh_existence).text == strings.EDIT_PROFILE_SELECT_LANGUAGE_TEXT edit_profile_screen.get_by_class_from_elements( android_elements.all_textviews, global_contents.seventh_existence).click() edit_profile_screen.change_user_language()[0].click() assert edit_profile_screen.get_by_class_from_elements( android_elements.all_textviews, global_contents.seventh_existence).text == strings.EDIT_PROFILE_UPDATE_LANGUAGE_TEXT
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_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_validate_ui_elements_smoke(self, set_capabilities, setup_logging): """ Scenarios: 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 """ global_contents = Globals(setup_logging) if global_contents.is_first_time: ios_whats_new_page = IosWhatsNew(set_capabilities, setup_logging) assert ios_whats_new_page.get_title_textview() assert ios_whats_new_page.get_close_button( ).text == strings.WHATS_NEW_Close_button assert ios_whats_new_page.get_main_image() assert ios_whats_new_page.get_feature_title_textview() assert ios_whats_new_page.get_feature_details() # assert ios_whats_new_page.get_done_button().text == strings.WHATS_NEW_DONE else: setup_logging.info('validate_ui_elements is not needed') assert True
def test_load_contents_smoke(self, set_capabilities, setup_logging): """ Scenarios: 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 """ android_main_dashboard_page = AndroidMainDashboard( set_capabilities, setup_logging) global_contents = Globals(setup_logging) assert android_main_dashboard_page.load_discovery_tab( ).text == strings.MAIN_DASHBOARD_DISCOVERY_TAB assert android_main_dashboard_page.load_discovery_tab().is_selected() assert android_main_dashboard_page.get_courses_tab( ).text == strings.MAIN_DASHBOARD_COURSES_TAB assert android_main_dashboard_page.load_courses_tab().is_selected() assert android_main_dashboard_page.load_profile_screen( ) == global_contents.PROFILE_ACTIVITY_NAME set_capabilities.back() assert android_main_dashboard_page.load_account_screen( ) == global_contents.ACCOUNT_ACTIVITY_NAME set_capabilities.back()
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.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))
def test_validate_ui_elements_smoke(self, set_capabilities, setup_logging): """ Scenarios: Verify that from My Courses list tapping any Course will load Course Dashboard screen/contents(of this specific course) in its tab Verify on tapping "Videos" tab will load Videos screen """ global_contents = Globals(setup_logging) ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) ios_course_dashboard_page = IosCourseDashboard(set_capabilities, setup_logging) ios_my_courses_list = IosMyCoursesList(set_capabilities, setup_logging) assert ios_main_dashboard_page.get_drawer_icon( ).text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME if ios_my_courses_list.get_my_courses_list_row(): course_name = ios_my_courses_list.get_my_courses_list_row().text assert ios_my_courses_list.load_course_details_screen().text assert ios_course_dashboard_page.get_course_title().text in course_name assert ios_course_dashboard_page.get_videos_tab( ).text == strings.COURSE_DASHBOARD_VIDEOS_TAB ios_course_dashboard_page.load_videos_tab() assert ios_course_dashboard_page.get_videos_tab( ).text == global_contents.is_selected
def test_update_profile_location(self, set_capabilities, setup_logging): """ Scenarios: Verify that user can update location Verify that user can update language Verify that user can update information """ global_contents = Globals(setup_logging) edit_profile_screen = AndroidEditProfile(set_capabilities, setup_logging) android_profile_screen = AndroidProfile(set_capabilities, setup_logging) if (edit_profile_screen.get_by_class_from_elements( android_elements.all_textviews, global_contents.seventh_existence).get_attribute('enabled') == 'false'): edit_profile_screen.get_element_by_id(android_elements.edit_profile_full_view).click() edit_profile_screen.get_by_class_from_elements( android_elements.all_textviews, global_contents.sixth_existence).click() user_new_location = edit_profile_screen.change_user_location().text edit_profile_screen.change_user_location().click() assert user_new_location in edit_profile_screen.get_by_class_from_elements( android_elements.all_textviews, global_contents.sixth_existence).text android_profile_screen.get_navigation_icon().click() assert user_new_location in android_profile_screen.get_user_profile_location().text