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
示例#2
0
    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_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()
示例#4
0
    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_sign_out_smoke(self, set_capabilities, setup_logging):
        """
        Scenarios:
            Verify that user can logout from course resources screen
        """

        android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging)
        android_course_dashboard_page = AndroidCourseDashboard(set_capabilities, setup_logging)
        android_course_dashboard_page.get_navigation_icon().click()

        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() == Globals.DISCOVERY_LAUNCH_ACTIVITY_NAME
        setup_logging.info('Ending Test Case --')
    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_resources_tab_smoke(self, set_capabilities, setup_logging):
        """
        Scenarios:
        Verify that resources tab will selected after loading
        Verify that Course Resources tab will show following contents,
            Resources as Title, Share icon,
        """

        global_contents = Globals(setup_logging)
        android_course_dashboard_page = AndroidCourseDashboard(set_capabilities, setup_logging)
        resources_tab_element = android_course_dashboard_page.get_resources_tab()

        assert resources_tab_element.get_attribute('selected') == 'true'
        share_icon = android_course_dashboard_page.get_course_share_icon()
        assert share_icon.get_attribute('content-desc') == strings.COURSE_DASHBOARD_SHARE_COURSE_ANDROID

        resources_tab_title = global_contents.get_by_class_from_elements(
            set_capabilities,
            android_elements.all_textviews,
            global_contents.first_existence)
        assert resources_tab_title.text == strings.COURSE_DASHBOARD_RESOURCES_TAB
    def test_handouts_smoke(self, set_capabilities, setup_logging):
        """
        Scenarios:
            Verify that user should be able to view:
            Handouts as Row title
            Subtitle of the row,
            Handouts icon in row,
            Handouts can be clickable and it will navigate to handouts page
            Handouts as Title of the page
        """

        global_contents = Globals(setup_logging)
        android_course_dashboard_page = AndroidCourseDashboard(set_capabilities, setup_logging)

        handouts_row_title = global_contents.get_by_id_from_elements(
            set_capabilities,
            android_elements.course_resources_row_title,
            global_contents.first_existence)
        assert handouts_row_title.text == strings.COURSE_DASHBOARD_HANDOUTS_TITLE

        handouts_row_subtitle = global_contents.get_by_id_from_elements(
            set_capabilities,
            android_elements.course_resources_row_subtitle,
            global_contents.first_existence)
        assert handouts_row_subtitle.text == strings.COURSE_DASHBOARD_HANDOUTS_ROW

        handouts_icon_element = global_contents.get_by_id_from_elements(
            set_capabilities,
            android_elements.course_resources_row_icon_type,
            global_contents.first_existence)
        assert handouts_icon_element.get_attribute('displayed') == 'true'

        handouts_row_title.click()
        handouts_page_title = global_contents.get_by_class_from_elements(
            set_capabilities,
            android_elements.all_textviews,
            global_contents.first_existence)
        assert handouts_page_title.text == strings.COURSE_DASHBOARD_HANDOUTS_TITLE

        android_course_dashboard_page.get_navigation_icon().click()
示例#9
0
    def test_video_tab_contents_smoke(self, set_capabilities, setup_logging):
        """
        Verify Video tab showing following content:
        Videos as title
        course share icon
        Video TV title
        Video TV sub-title
        Video icon
        Download to device toggle
        Verify download to device permission dialouge contents:
        Allow button
        Deny Button
        Permission message
        """

        global_contents = Globals(setup_logging)
        android_course_dashboard_page = AndroidCourseDashboard(
            set_capabilities, setup_logging)
        android_course_dashboard_page.get_videos_tab().click()
        assert android_course_dashboard_page.get_all_text_views()[0].text \
            == strings.COURSE_DASHBOARD_VIDEOS_TAB
        assert android_course_dashboard_page.get_course_share_icon().get_attribute('content-desc') \
            == strings.COURSE_DASHBOARD_SHARE_COURSE_ANDROID

        assert global_contents.get_element_by_id(
            set_capabilities, android_elements.video_dashboard_tv_title
        ).text == strings.VIDEO_DASHBOARD_TV_TITLE

        assert global_contents.get_element_by_id(
            set_capabilities, android_elements.video_dashboard_tv_subtitle
        ).text == strings.VIDEO_DASHBOARD_TV_SUBTITLE

        assert global_contents.get_element_by_id(
            set_capabilities, android_elements.video_dahboard_video_icon)

        assert global_contents.get_element_by_id(
            set_capabilities,
            android_elements.video_dashboard_bulk_download_toggle)

        assert global_contents.get_element_by_id(
            set_capabilities, android_elements.video_dashboard_download_bar)
        assert android_course_dashboard_page.get_course_content_header().text
示例#10
0
    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
        """

        android_course_dashboard_page = AndroidCourseDashboard(
            set_capabilities, setup_logging)

        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'

        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'

        setup_logging.info('-- Ending Test Case --')
    def test_video_tab_contents_smoke(self, set_capabilities, setup_logging):
        """
        Verify Video tab showing following content:
        Videos as title
        course share icon
        Video TV title
        Video TV sub-title
        Video icon
        Download to device toggle
        Verify download to device permission dialouge contents:
        Allow button
        Deny Button
        Permission message
        """

        global_contents = Globals(setup_logging)
        android_course_dashboard_page = AndroidCourseDashboard(
            set_capabilities, setup_logging)
        android_course_section_page = AndroidCourseSubsection(
            set_capabilities, setup_logging)

        android_course_dashboard_page.get_videos_tab().click()
        topic_name = android_course_section_page.get_course_row_title().text
        android_course_section_page.get_course_row_title().click()

        assert topic_name in android_course_dashboard_page.get_all_text_views(
        )[0].text

        assert global_contents.get_element_by_id(
            set_capabilities, android_elements.video_dashboard_tv_title
        ).text == strings.VIDEO_DASHBOARD_TV_TITLE

        assert global_contents.get_element_by_id(
            set_capabilities, android_elements.video_dashboard_tv_subtitle
        ).text == strings.VIDEO_SUBSECTION_TV_SUBTITLE

        assert global_contents.get_element_by_id(
            set_capabilities, android_elements.video_dahboard_video_icon)

        assert global_contents.get_element_by_id(
            set_capabilities,
            android_elements.video_dashboard_bulk_download_toggle)

        assert global_contents.get_element_by_id(
            set_capabilities, android_elements.video_dashboard_download_bar)
        assert android_course_dashboard_page.get_course_content_header().text
    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_subsection_elements_smoke(self, set_capabilities, setup_logging):
        """
        Scenarios:
            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
        """

        android_course_dashboard_page = AndroidCourseDashboard(
            set_capabilities, setup_logging)
        android_course_section_page = AndroidCourseSubsection(
            set_capabilities, setup_logging)

        assert android_course_dashboard_page.get_course_content_header()
        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_row_title(
        ).text

        android_course_section_page.get_course_row_title().click()
        assert android_course_dashboard_page.get_all_text_views(
        )[0].text in course_topic_content
        set_capabilities.back()

        course_video_content = android_course_section_page.get_course_video_row(
        ).text
        android_course_section_page.get_course_video_row().click()
        navigation_icon = android_course_dashboard_page.get_navigation_icon()
        assert navigation_icon.get_attribute(
            'content-desc') == strings.COURSE_DASHBOARD_NAVIGATION_ICON
        assert android_course_dashboard_page.get_all_text_views(
        )[0].text in course_video_content
    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()