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_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_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_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_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(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)) 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.MAIN_DASHBOARD_ACTIVITY_NAME android_main_dashboard_page = AndroidMainDashboard( set_capabilities, setup_logging) assert android_main_dashboard_page.load_account_screen( ) == global_contents.ACCOUNT_ACTIVITY_NAME 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 Register Test Case --')
def test_ui_elements_smoke(self, set_capabilities, setup_logging): """ Scenarios: User should be able to see the following contents by tapping on edit button from profile screen Edit profile screen title Edit Profile image User Name Change photo button Profile label Full profile button Limited profile button Limited profile instructions Birth Year Location Primary Language About Me """ global_contents = Globals(setup_logging) android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) android_profile_screen = AndroidProfile(set_capabilities, setup_logging) edit_profile_screen = AndroidEditProfile(set_capabilities, setup_logging) assert android_main_dashboard_page.load_account_screen() == global_contents.ACCOUNT_ACTIVITY_NAME android_profile_screen.get_edit_profile_screen().click() assert edit_profile_screen.get_by_class_from_elements( android_elements.all_textviews, global_contents.first_existence).text == strings.EDIT_PROFILE_SCREEN_TITLE assert edit_profile_screen.get_element_by_id(android_elements.edit_profile_screen_image)\ .get_attribute('displayed') == 'true' assert strings.EDIT_PROFILE_USER_NAME in edit_profile_screen.get_element_by_id( android_elements.edit_profile_user_name).get_attribute('content-desc') assert edit_profile_screen.get_element_by_id(android_elements.edit_profile_change_photo)\ .get_attribute('content-desc') == strings.EDIT_PROFILE_CHANGE_PHOTO_TEXT assert edit_profile_screen.get_element_by_id( android_elements.edit_profile_label).text == strings.EDIT_PROFILE_LABEL_TEXT assert edit_profile_screen.get_element_by_id( android_elements.edit_profile_full_view).text == strings.EDIT_PROFILE_FULL_VIEW_TEXT assert edit_profile_screen.get_element_by_id( android_elements.edit_profile_limited_view).text == strings.EDIT_PROFILE_LIMITED_VIEW_TEXT assert edit_profile_screen.get_element_by_id( android_elements.edit_profile_instructions).text == strings.EDIT_PROFILE_INSTRUCTIONS_TEXT assert strings.EDIT_PROFILE_LOCATION_TEXT in edit_profile_screen.get_by_class_from_elements( android_elements.all_textviews, global_contents.sixth_existence).text assert strings.EDIT_PROFILE_LANGUAGE_TEXT in edit_profile_screen.get_by_class_from_elements( android_elements.all_textviews, global_contents.seventh_existence).text assert strings.EDIT_PROFILE_ABOUT_ME_TEXT in edit_profile_screen.get_by_class_from_elements( android_elements.all_textviews, global_contents.eight_existence).text
def test_course_discovery_ui_elements_smoke(self, set_capabilities, setup_logging): """ Scenarios: Verify that Discovery tab will show following contents, Header contents, Profile icon, "Discovery" as screen Title, Discovery edit-field in place title(Android Only), Account Icon Three tabs Courses, Programs, Degrees "Browse By Subject" Section below, Subject Background Image, Subject Name "Viewing <total number of available results" Filter courses option """ android_main_dashboard_page = AndroidMainDashboard( set_capabilities, setup_logging) android_course_discovery_page = AndroidCourseDiscovery( 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.COURSES_DISCOVERY_SCREEN_TITLE assert android_course_discovery_page.get_search_icon( ).text == strings.BLANK_FIELD search_editfield = android_course_discovery_page.load_search_editfield( ).text assert search_editfield == strings.COURSES_DISCOVERY_SEARCH_EDIT_FIELD assert android_main_dashboard_page.get_menu_icon( ).text == strings.BLANK_FIELD browse_by_subject_heading = android_course_discovery_page.get_browse_by_subject_heading( ).text assert browse_by_subject_heading == strings.COURSES_DISCOVERY_BROWSE_BY_SUBJECT_LABEL assert android_course_discovery_page.get_subject_name( ).text == strings.COURSES_DISCOVERY_SUBJECT_NAME assert android_course_discovery_page.get_subject_image( ).text == strings.BLANK_FIELD # Log out assert android_main_dashboard_page.load_account_screen( ) == global_contents.ACCOUNT_ACTIVITY_NAME 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)) setup_logging.info('-- Ending Course Disovery Test Case --')
def test_ui_elements_smoke(self, set_capabilities, setup_logging): """ Scenarios: Verify that Profile screen will show following contents: Back icon "Profile" as Title Edit Profile Image User Name Verify that Profile screen will show following contents for limited profile: Age limit text Account settings Button Verify that Profile screen will show following contents for Full profile: location Language (if selected) User Bio """ global_contents = Globals(setup_logging) android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) android_profile_screen = AndroidProfile(set_capabilities, setup_logging) assert android_main_dashboard_page.load_account_screen() == global_contents.ACCOUNT_ACTIVITY_NAME android_profile_screen.get_edit_profile_screen().click() android_profile_screen.get_navigation_icon().click() android_profile_screen.get_edit_profile_screen().click() android_profile_screen.get_navigation_icon().click() assert android_profile_screen.get_user_profile_image().get_attribute('displayed') == 'true' assert android_profile_screen.get_user_profile_name().get_attribute('displayed') == 'true' if android_profile_screen.get_limited_profile_view(): if android_profile_screen.get_profile_account_settings_button(): assert android_profile_screen.get_profile_age_text_note().text == strings.PROFILE_AGE_LIMIT_TEXT assert android_profile_screen.get_profile_account_settings_button().text \ == strings.PROFILE_ACCOUNT_SETTINGS_BUTTON else: assert android_profile_screen.get_user_profile_location().get_attribute('displayed') == 'true' if android_profile_screen.get_user_profile_language(): assert android_profile_screen.get_user_profile_language().get_attribute('displayed') == 'true' assert android_profile_screen.get_user_profile_bio().get_attribute('displayed') == 'true' set_capabilities.back() assert android_main_dashboard_page.log_out() == Globals.DISCOVERY_LAUNCH_ACTIVITY_NAME
def test_main_dashboard_logout_smoke(self, set_capabilities, setup_logging): """ Scenario: Verify that user can log out successfully, and back on Login screen """ android_main_dashboard_page = AndroidMainDashboard( set_capabilities, setup_logging) global_contents = Globals(setup_logging) assert android_main_dashboard_page.load_account_screen( ) == global_contents.ACCOUNT_ACTIVITY_NAME 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))
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) 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_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 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() 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() assert android_main_dashboard_page.get_logout_account_option( ).text == strings.ACCOUNT_LOGOUT 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__))