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_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 test_validate_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: Limited profile message Verify that Profile screen will show following contents for Full profile: location Language (if selected) User Bio """ ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) ios_profile_page = IosProfile(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() ios_profile_page.get_personal_information_profile_cell().click() assert ios_profile_page.get_subsection_title( ).text == strings.PROFILE_SCREEN_TITLE assert ios_profile_page.get_navigation_icon( ).text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME assert ios_profile_page.get_profile_screen_edit_profile_button().text == \ strings.IOS_PROFILE_SCREEN_EDIT_PROFILE_BUTTON_TEXT assert ios_profile_page.get_profile_screen_username_label( ).get_attribute('visible') == 'true' ios_profile_page.get_profile_screen_edit_profile_button().click() assert ios_profile_page.get_subsection_title().get_attribute( 'value') == strings.EDIT_PROFILE_SCREEN_TITLE ios_profile_page.get_edit_profile_back_icon().click() if ios_profile_page.get_profile_screen_limited_view_message(): assert ios_profile_page.get_profile_screen_limited_view_message().text == \ strings.IOS_PROFILE_SCREEN_LIMITED_VIEW_MESSAGE else: assert ios_profile_page.get_profile_screen_country_label( ).get_attribute('visible') == 'true' assert ios_profile_page.get_profile_screen_bio_text( ).get_attribute('visible') == 'true' if ios_profile_page.get_profile_screen_language_label(): assert ios_profile_page.get_profile_screen_language_label( ).get_attribute('visible') == 'true'
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 that from My Courses list tapping any Course will load Course Dashboard screen/contents(of this specific course) in its tab Verify that Course Dashboard screen will show following contents, Header contents, Back icon, Specific "<course name>" as Title, Share icon, Footer Content, Course, Videos, Discussion, Dates, Resources Verify that user should be able to view these Course contents: Course Image, Course Name, Course Provider, Course Ending date, Last accessed(if any), Course Content """ 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 in course_name assert ios_course_dashboard_page.get_share_icon().text == strings.COURSE_DASHBOARD_SHARE_COURSE assert ios_course_dashboard_page.get_course_image() assert ios_course_dashboard_page.get_course_title().text in course_name assert ios_course_dashboard_page.get_course_date() resume_element = ios_course_dashboard_page.get_course_resume_row() assert resume_element.get_attribute('label') == strings.COURSE_DASHBOARD_RESUME_ROW assert ios_course_dashboard_page.get_course_section_header() assert ios_course_dashboard_page.get_course_item_title() assert ios_course_dashboard_page.get_course_item_download_icon()
def test_validate_ui_elements_smoke(self, set_capabilities, setup_logging): """ Scenarios: 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 """ ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) ios_my_courses_list = IosMyCoursesList(set_capabilities, setup_logging) assert ios_main_dashboard_page.get_profile_icon( ).text == strings.MAIN_DASHBOARD_PROFILE assert ios_main_dashboard_page.get_title_textview_portrait_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 assert ios_my_courses_list.get_my_courses_list_row() if ios_my_courses_list.get_my_courses_list_row(): assert ios_my_courses_list.get_my_course_name() assert ios_my_courses_list.get_my_course_details() else: setup_logging.info('No course enrolled by this user.')
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: 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.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 if ios_my_courses_list.get_my_courses_list_row(): assert ios_my_courses_list.get_my_course_name() assert ios_my_courses_list.get_my_course_details() course_name = ios_my_courses_list.get_my_courses_list_row().text assert ios_my_courses_list.load_course_details_screen( ).text == 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 global_contents.turn_orientation(set_capabilities, global_contents.PORTRAIT_ORIENTATION) setup_logging.info('-- Ending Test Case')
def test_validate_ui_elements_smoke(self, set_capabilities, setup_logging): """ Verify that Course Subsection screen will show following Header contents: Back icon Specific "<Topic name>" as Title Verify that user should be able to go back by clicking Back icon """ ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) ios_my_courses_list = IosMyCoursesList(set_capabilities, setup_logging) ios_subsection = IosCourseSubsection(set_capabilities, setup_logging) assert ios_main_dashboard_page.get_drawer_icon( ).text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME assert strings.COURSE_NAME_IOS in ios_my_courses_list.load_course_details_screen( ).text assert ios_subsection.get_subsection_component_title() section_name = ios_subsection.get_subsection_component_title().text ios_subsection.get_subsection_component_title().click() assert ios_subsection.get_subsection_title()[0].text == section_name back_icon = ios_subsection.get_navigation_back_icon()[0] assert back_icon.get_attribute('visible') == 'true' back_icon.click()
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_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_validate_ui_elements_smoke(self, set_capabilities, setup_logging): """ Scenarios: Verify that Course Html Component screen will show following Header contents, Back icon Specific "<Topic name>" as Title Verify that user should be able to go back by clicking Back icon Verify that user should be able to view these: Topic name Verify that footer should have Previous and Next button in it Verify that user should be able to navigate between Previous and Next Button from footer """ 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) ios_subsection = IosCourseSubsection(set_capabilities, setup_logging) ios_html_component = IosCourseHtmlComponent(set_capabilities, setup_logging) assert ios_main_dashboard_page.get_drawer_icon( ).text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME assert strings.COURSE_NAME_IOS in ios_my_courses_list.load_course_details_screen( ).text assert ios_subsection.get_subsection_component_title() section_name = ios_subsection.get_subsection_component_title().text ios_subsection.get_subsection_component_title().click() assert ios_subsection.get_subsection_title()[0].text == section_name back_icon = ios_subsection.get_navigation_back_icon()[0] assert back_icon.get_attribute('visible') == 'true' back_icon.click() assert ios_course_dashboard_page.get_course_title( ).text in strings.COURSE_NAME_IOS subsection_component = ios_subsection.get_subsection_component()[0] subsection_component.click() assert ios_subsection.get_course_subsection_header_label() assert ios_subsection.get_subsection_html_topic_title() html_component = ios_subsection.get_subsection_component()[0] html_component.click() assert ios_subsection.get_subsection_title( )[0].text == strings.COURSE_SUBSECTION_CONTENT_ROW_TEXT_IOS previous_navigation_button = ios_html_component.get_all_buttons()[1] next_navigation_button = ios_html_component.get_all_buttons()[2] assert previous_navigation_button.text == strings.COURSE_HTML_COMPONENT_PREV_BUTTON assert strings.COURSE_HTML_COMPONENT_NEXT_BUTTON in next_navigation_button.text next_navigation_button.click() assert strings.COURSE_HTML_COMPONENT_PREV_BUTTON in previous_navigation_button.text ios_html_component.get_all_buttons()[1].click() assert ios_subsection.get_subsection_title( )[0].text == strings.COURSE_SUBSECTION_CONTENT_ROW_TEXT_IOS
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_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 """ ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) ios_profile_page = IosProfile(set_capabilities, setup_logging) global_contents = Globals(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() ios_profile_page.get_personal_information_profile_cell().click() assert ios_profile_page.get_subsection_title( ).text == strings.PROFILE_SCREEN_TITLE assert ios_profile_page.get_navigation_icon( ).text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME assert ios_profile_page.get_profile_screen_edit_profile_button().get_attribute('label') == \ strings.IOS_PROFILE_SCREEN_EDIT_PROFILE_BUTTON_TEXT assert ios_profile_page.get_profile_screen_username_label( ).get_attribute('visible') == 'true' ios_profile_page.get_profile_screen_edit_profile_button().click() title_element = ios_profile_page.get_subsection_title() assert title_element.get_attribute( 'value') == strings.EDIT_PROFILE_SCREEN_TITLE edit_profile_screen_image = global_contents.get_element_by_id( set_capabilities, ios_elements.edit_profile_screen_image) assert edit_profile_screen_image.get_attribute('enabled') == 'true' edit_profile_user_name = global_contents.get_element_by_id( set_capabilities, ios_elements.edit_profile_user_name) assert edit_profile_user_name.get_attribute('visible') == 'true' edit_profile_change_photo = global_contents.get_element_by_id( set_capabilities, ios_elements.edit_profile_change_photo) assert edit_profile_change_photo.get_attribute('visible') == 'true'
def test_sign_out_smoke(self, set_capabilities, setup_logging): """ Scenarios: Verify that user can logout from course subsection 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_course_dashboard_page.navigate_to_main_dashboard(set_capabilities) ios_main_dashboard_page.get_drawer_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_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_validate_ui_elements_smoke(self, set_capabilities, setup_logging): """ Scenarios: 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 """ ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) assert ios_main_dashboard_page.get_profile_icon().text == strings.MAIN_DASHBOARD_PROFILE assert ios_main_dashboard_page.get_title_textview_portrait_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
def test_start_whats_new_smoke(self, login, setup_logging, set_capabilities): """ Scenarios: Verify Whats New screen is loaded successfully """ global_contents = Globals(setup_logging) setup_logging.info('-- Starting Test Case') if login: setup_logging.info('{} is successfully logged in'.format(global_contents.login_user_name)) if global_contents.is_first_time: assert IosWhatsNew(set_capabilities, setup_logging).get_title_textview() else: textview_screen_title = IosMainDashboard(set_capabilities, setup_logging) assert textview_screen_title.get_drawer_icon().text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME
def test_start_main_dashboard_smoke(self, login, set_capabilities, setup_logging): """ Scenarios: Verify Main Dashboard screen is loaded successfully """ global_contents = Globals(setup_logging) setup_logging.info('-- Starting Test Case') if login: setup_logging.info('{} is successfully logged in'.format(global_contents.login_user_name)) ios_whats_new_page = IosWhatsNew(set_capabilities, setup_logging) ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) if global_contents.is_first_time: assert ios_whats_new_page.exit_features().text == strings.MAIN_DASHBOARD_SCREEN_TITLE else: assert ios_main_dashboard_page.get_drawer_icon().text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME
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 that user should be able to go back by clicking Back icon """ 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) ios_course_resources_page = IosCourseResources(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 in course_name assert ios_course_dashboard_page.get_resources_tab().text == strings.COURSE_DASHBOARD_RESOURCES_TAB ios_course_dashboard_page.load_resources_tab() assert ios_course_dashboard_page.get_share_icon().text == strings.COURSE_DASHBOARD_SHARE_COURSE assert ios_course_resources_page.get_subsection_title()[0].text == strings.COURSE_DASHBOARD_RESOURCES_TAB assert ios_course_resources_page.get_navigation_back_icon()[0].text == 'Courses'
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_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 """ global_contents = Globals(setup_logging) ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) ios_profile_options_page = IosProfileOptions(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_profile_options_page.get_all_textviews( )[1].text == strings.PROFILE_SCREEN_TITLE profile_options_close_button = global_contents.get_element_by_id( set_capabilities, ios_elements.profile_options_close_button) assert profile_options_close_button.text == strings.CLOSE_BUTTON_TEXT profile_options_close_button.click() ios_main_dashboard_page.get_drawer_icon().click() wifi_switch = global_contents.get_element_by_id( set_capabilities, ios_elements.profile_options_wifi_switch) assert wifi_switch.text video_settings_option_label = global_contents.get_element_by_id( set_capabilities, ios_elements.profile_options_video_settings_option_label) assert video_settings_option_label.text == strings.PROFILE_OPTIONS_VIDEO_SETTINGS_OPTION_LABEL videos_setting_cell = global_contents.get_element_by_id( set_capabilities, ios_elements.profile_options_videos_setting_cell) assert videos_setting_cell.get_attribute('visible') == 'true' video_settings_description_label = global_contents.get_element_by_id( set_capabilities, ios_elements.profile_options_video_settings_description_label) assert video_settings_description_label.text == strings.PROFILE_OPTIONS_VIDEO_SETTINGS_DESCRIPTION_LABEL video_quality_description_label = global_contents.get_element_by_id( set_capabilities, ios_elements.profile_options_video_quality_description_label) assert video_quality_description_label.text == strings.PROFILE_OPTIONS_VIDEO_QUALITY_DESCRIPTION_LABEL video_quality_subtitle_label = global_contents.get_element_by_id( set_capabilities, ios_elements.profile_options_video_quality_subtitle_label) assert video_quality_subtitle_label.text == strings.VIDEO_DOWNLOAD_AUTO_QUALITY wifi_cell = global_contents.get_element_by_id( set_capabilities, ios_elements.profile_options_wifi_cell) assert wifi_cell.get_attribute('visible') == 'true'
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 Verify on tapping "Discussion" tab will load Discussions screen Verify that Course Discussions Dashboard tab will show following contents, Header contents, Back icon, Discussions as Title, Verify that user should be able to view these Course contents: Search posts, All posts, Posts I'm following, General Verify all screen contents have their default values """ global_contents = Globals(setup_logging) ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) ios_my_courses_list = IosMyCoursesList(set_capabilities, setup_logging) ios_course_dashboard_page = IosCourseDashboard(set_capabilities, setup_logging) ios_discussions_page = IosDiscussionsDashboard(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 in course_name assert ios_course_dashboard_page.get_courses_tab().text == global_contents.is_selected 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 assert ios_course_dashboard_page.get_discussion_tab().text == strings.COURSE_DASHBOARD_DISCUSSION_TAB ios_course_dashboard_page.load_discussion_tab() assert ios_course_dashboard_page.get_discussion_tab().text == global_contents.is_selected assert ios_discussions_page.get_share_icon().text == strings.COURSE_DASHBOARD_SHARE_COURSE assert ios_discussions_page.get_subsection_title().text == strings.DISCUSSION_DASHBOARD_TITLE assert ios_discussions_page.get_navigation_icon().text == 'Courses' assert ios_discussions_page.get_posts_search_element().text == strings.DISCUSSION_SEARCH_POST all_posts_element = global_contents.get_by_class_from_elements( set_capabilities, ios_elements.discussions_topic_title_cell, global_contents.first_existence ) assert all_posts_element.text == strings.DISCUSSION_ALL_POSTS following_posts_element = global_contents.get_by_class_from_elements( set_capabilities, ios_elements.discussions_topic_title_cell, global_contents.second_existence ) assert following_posts_element.text == " Posts I'm Following" course_feedback_element = global_contents.get_by_class_from_elements( set_capabilities, ios_elements.discussions_topic_title_cell, global_contents.third_existence ) assert course_feedback_element.text == strings.DISCUSSION_COURSE_QnA
def test_ui_elements_smoke(self, set_capabilities, setup_logging): """ Scenarios: Verify that from Main Dashboard tapping on Discovery tab will load Discovery contents in its tab Verify that Discovery tab will show following contents, Header contents, "Discovery" as screen Title, Account Icon Three tabs Courses, Programs, Degrees Search Courses option "Browse By Subject" Section below, Subject Background Image, Subject Name Verify that from discovery screen, courses and programs tab are loaded """ ios_main_dashboard_page = IosMainDashboard(set_capabilities, setup_logging) global_contents = Globals(setup_logging) 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 title_element = global_contents.get_all_views_on_ios_screen( set_capabilities, ios_elements.all_textviews)[0] assert title_element.text == strings.MAIN_DASHBOARD_DISCOVERY_TAB assert ios_main_dashboard_page.get_drawer_icon( ).text == strings.MAIN_DASHBOARD_NAVIGATION_MENU_NAME course_discovery_tab = global_contents.get_all_views_on_ios_screen( set_capabilities, ios_elements.all_buttons)[4] assert course_discovery_tab.get_attribute( 'label') == strings.COURSES_DISCOVERY_COURSES_TAB course_discovery_tab.click() programs_discovery_tab = global_contents.get_all_views_on_ios_screen( set_capabilities, ios_elements.all_buttons)[5] assert programs_discovery_tab.get_attribute( 'label') == strings.COURSES_DISCOVERY_PROGRAMS_TAB programs_discovery_tab.click() degrees_discovery_tab = global_contents.get_all_views_on_ios_screen( set_capabilities, ios_elements.all_buttons)[6] assert degrees_discovery_tab.get_attribute( 'label') == strings.COURSES_DISCOVERY_DEGREES_TAB degrees_discovery_tab.click() course_discovery_tab.click() course_discovery_search_courses = global_contents.get_element_by_id( set_capabilities, ios_elements.course_discovery_search_courses) assert course_discovery_search_courses.get_attribute( 'label') == strings.COURSES_DISCOVERY_SEARCH_COURSE_IOS course_discovery_browse_by_subject = global_contents.get_element_by_id( set_capabilities, ios_elements.course_discovery_browse_by_subject) assert course_discovery_browse_by_subject.get_attribute('label') \ == strings.COURSES_DISCOVERY_BROWSE_BY_SUBJECT_IOS 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.load_discovery_tab( ).text == strings.SELECTED_BY_DEFAULT