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_ui_elements_smoke(self, set_capabilities, setup_logging): """ Scenarios: 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) 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_second_course().click() else: setup_logging.info('No course enrolled by this user.') navigation_icon = android_course_dashboard_page.get_navigation_icon() assert navigation_icon.get_attribute( 'content-desc') == strings.COURSE_DASHBOARD_NAVIGATION_ICON discussion_tab_element = android_course_dashboard_page.get_discussion_tab( ) discussion_tab_element.click() assert discussion_tab_element.get_attribute('selected') == 'true' assert global_contents.get_element_by_id( set_capabilities, android_elements.discussion_search_post ).text == strings.DISCUSSION_SEARCH_POST all_posts_element = global_contents.get_by_id_from_elements( set_capabilities, android_elements.discussion_all_posts_button, global_contents.first_existence) assert all_posts_element.text == strings.DISCUSSION_ALL_POSTS my_following_posts_element = global_contents.get_by_id_from_elements( set_capabilities, android_elements.discussion_all_posts_button, global_contents.second_existence) assert my_following_posts_element.text == strings.DISCUSSION_MY_FOLLOWING_POSTS general_posts_element = global_contents.get_by_id_from_elements( set_capabilities, android_elements.discussion_all_posts_button, global_contents.third_existence) assert general_posts_element.text == strings.DISCUSSION_COURSE_FEEDBACK
def test_ui_elements_smoke(self, set_capabilities, setup_logging): """ Scenarios: Verify that Course Topics 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 on Every Topic in the list: Topic name Topic icon download icon to video (if available) Verify that on Clicking any topic Specific resource screen should be loaded successfully """ 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) android_course_section_page = AndroidCourseSubsection(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.load_course_details_screen() else: setup_logging.info('No course enrolled by this user.') topic_name = android_course_section_page.get_course_row_header().text android_course_section_page.get_course_row_header().click() assert android_course_dashboard_page.get_navigation_icon().get_attribute('content-desc') \ == strings.COURSE_DASHBOARD_NAVIGATION_ICON android_course_dashboard_page.get_navigation_icon().click() assert android_course_section_page.on_screen() == global_contents.COURSE_DASHBOARD_ACTIVITY_NAME android_course_section_page.get_course_row_header().click() if topic_name: # Verifing the title of the screen assert android_course_dashboard_page.get_all_text_views()[0].text in topic_name assert android_course_dashboard_page.get_course_content_header() assert android_course_section_page.get_course_topic_icon() assert android_course_section_page.get_course_video_icon() assert android_course_section_page.get_course_topic_row().text == strings.COURSE_SUBSECTION_CONTENT_ROW_TEXT assert android_course_section_page.get_course_video_row().text == strings.COURSE_SUBSECTION_VIDEO_ROW_TEXT assert android_course_section_page.get_topic_download_icon() course_topic_content = android_course_section_page.get_course_topic_row().text course_video_content = android_course_section_page.get_course_video_row().text android_course_section_page.get_course_topic_row().click() assert android_course_dashboard_page.get_all_text_views()[0].text in course_topic_content set_capabilities.back() android_course_section_page.get_course_video_row().click() assert android_course_dashboard_page.get_all_text_views()[0].text in course_video_content set_capabilities.back()
def test_load_contents_smoke(self, set_capabilities, setup_logging): """ Scenarios: Verify on tapping "Videos" tab will load Videos screen Verify on tapping "Discussion" tab will load Discussions screen Verify on tapping "Dates" tab will load Dates screen Verify on tapping "Resources" tab will load Resources list Verify on tapping "Handouts" tab will load Handouts screen Verify on tapping "Announcements" tab will load Announcements screen """ 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) discussion_tab_element = android_course_dashboard_page.get_discussion_tab( ) if discussion_tab_element: discussion_tab_element.click() assert discussion_tab_element.get_attribute('selected') == 'true' dates_tab_element = android_course_dashboard_page.get_dates_tab() if dates_tab_element: dates_tab_element.click() assert dates_tab_element.get_attribute('selected') == 'true' resources_tab_element = android_course_dashboard_page.get_resources_tab( ) if resources_tab_element: resources_tab_element.click() assert resources_tab_element.get_attribute('selected') == 'true' course_tab_element = android_course_dashboard_page.get_course_tab() if course_tab_element: course_tab_element.click() assert course_tab_element.get_attribute('selected') == 'true' video_tab_element = android_course_dashboard_page.get_videos_tab() if video_tab_element: video_tab_element.click() assert video_tab_element.get_attribute('selected') == 'true' assert android_course_dashboard_page.get_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.get_second_course().click()
def test_validate_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) 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() android_my_courses_list_page.scroll_course_list_and_click_find_course_button( ) 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_ui_elements_smoke(self, set_capabilities, setup_logging): """ Scenarios: Verify that Course Topics 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 on Every Topic in the list: Topic name Topic icon download icon to video (if available) Verify that on Clicking any topic Specific resource screen should be loaded successfully """ 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) android_course_section_page = AndroidCourseSubsection(set_capabilities, setup_logging) course_html_component = AndroidCourseHTMLComponent(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.load_course_details_screen() else: setup_logging.info('No course enrolled by this user.') topic_name = android_course_section_page.get_course_row_title().text android_course_section_page.get_course_row_title().click() if topic_name: assert android_course_dashboard_page.get_all_text_views()[0].text in topic_name course_topic_content = android_course_section_page.get_course_topic_row().text android_course_section_page.get_course_topic_row().click() assert android_course_dashboard_page.get_all_text_views()[0].text in course_topic_content assert course_html_component.get_next_button().text == strings.COURSE_HTML_COMPONENT_NEXT_BUTTON assert course_html_component.get_prev_button().text == strings.COURSE_HTML_COMPONENT_PREV_BUTTON assert course_html_component.get_next_unit_title() course_html_component.get_next_button().click() assert course_html_component.get_screen_activity_name() == global_contents.COURSE_UNIT_NAVIGATION_ACTIVITY_NAME assert course_html_component.get_prev_unit_title() course_html_component.get_prev_button().click() assert android_course_dashboard_page.get_all_text_views()[0].text in course_topic_content
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_ui_elements_smoke(self, set_capabilities, setup_logging): """ Scenarios: Verify that Course Dashboard tab will show following contents, Header contents, Back icon, Specific "<course name>" as Title, Share icon, Course, Verify that user should be able to go back by clicking Back icon 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, Verify all screen contents have their default values """ 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(): course_name = android_my_courses_list_page.get_first_course().text android_my_courses_list_page.get_first_course().click() else: setup_logging.info('No course enrolled by this user.') assert android_course_dashboard_page.get_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() if course_name: # Verifing the title of the screen assert android_course_dashboard_page.get_all_text_views( )[0].text in course_name assert android_course_dashboard_page.get_course_share_icon().get_attribute('content-desc') \ == strings.COURSE_DASHBOARD_SHARE_COURSE_ANDROID assert android_course_dashboard_page.get_course_image() # verifing course name that is overlapping the course image assert android_course_dashboard_page.get_course_name( ).text in course_name assert android_course_dashboard_page.get_course_date() assert android_course_dashboard_page.get_resume_course_bar() assert android_course_dashboard_page.get_course_content_header()
def test_ui_elements_smoke(self, set_capabilities, setup_logging): """ Scenarios: Verify that Course Topics 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 """ 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) android_course_section_page = AndroidCourseSubsection( 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.load_course_details_screen() else: setup_logging.info('No course enrolled by this user.') assert android_course_section_page.get_course_row_title() topic_name = android_course_section_page.get_course_row_title().text android_course_section_page.get_course_row_title().click() assert android_course_dashboard_page.get_navigation_icon().get_attribute('content-desc') \ == strings.COURSE_DASHBOARD_NAVIGATION_ICON android_course_dashboard_page.get_navigation_icon().click() assert android_course_section_page.on_screen( ) == global_contents.COURSE_DASHBOARD_ACTIVITY_NAME android_course_section_page.get_course_row_title().click() if topic_name: # Verifing the title of the screen assert android_course_dashboard_page.get_all_text_views( )[0].text in topic_name
def test_ui_elements_smoke(self, set_capabilities, setup_logging): """ Scenarios: Verify that Course Dashboard tab will show following contents, Header contents, Back icon, Specific "<course name>" as Title, Share icon, Course, Verify that user should be able to go back by clicking Back icon 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, Verify all screen contents have their default values """ 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_second_course().click() else: setup_logging.info('No course enrolled by this user.')
def test_my_courses_list_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 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 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) 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_COURSES_TAB 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() 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) 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 course_discovery_screen = android_my_courses_list_page.load_discovery_screen( ) assert course_discovery_screen == global_contents.MAIN_DASHBOARD_ACTIVITY_NAME assert android_main_dashboard_page.get_discovery_tab().is_selected() global_contents.turn_orientation(set_capabilities, global_contents.PORTRAIT_ORIENTATION) setup_logging.info('-- Ending My Courses Test Case --')