Esempio n. 1
0
    def test_download_to_device_smoke(self, set_capabilities, setup_logging):
        """
        Verify the following senarios:
        check if download to device toggel off
        click on toggle
        if allow/deny permission popup appears
        check allow, deny and permission elements
        click on allow button
        check and click on progress wheel
        """

        global_contents = Globals(setup_logging)
        android_video_dashboard = AndroidVideoDasboard(set_capabilities,
                                                       setup_logging)
        assert android_video_dashboard.check_videos_status(
            set_capabilities, strings.VIDEO_ICON_ONLINE_STATUS)

        if global_contents.get_element_by_id(
                set_capabilities,
                android_elements.video_dashboard_bulk_download_toggle).text \
                == strings.VIDEO_DASHBOARD_DOWNLOAD_TOGGEL_OFF:

            global_contents.get_element_by_id(
                set_capabilities,
                android_elements.video_dashboard_bulk_download_toggle).click()

            if global_contents.get_by_class_from_elements(
                    set_capabilities,
                    android_elements.video_download_permission_buttons,
                    global_contents.first_existence):

                assert global_contents.get_by_class_from_elements(
                    set_capabilities, android_elements.video_download_permission_buttons,
                    global_contents.first_existence).text \
                        == strings.VIDEO_DOWNLOAD_PERMISSION_ALLOW_BUTTON

                assert global_contents.get_by_class_from_elements(
                    set_capabilities,
                    android_elements.video_download_permission_message,
                    global_contents.first_existence)

                assert global_contents.get_by_class_from_elements(
                    set_capabilities,
                    android_elements.video_download_permission_buttons,
                    global_contents.second_existence
                ).text == strings.VIDEO_DOWNLOAD_PERMISSION_DENY_BUTTON

                global_contents.get_by_class_from_elements(
                    set_capabilities,
                    android_elements.video_download_permission_buttons,
                    global_contents.first_existence).click()

        global_contents.wait_and_get_element(
            set_capabilities, android_elements.video_dahboard_video_icon)

        assert global_contents.get_element_by_id(
            set_capabilities, android_elements.video_dahboard_video_icon)
    def test_load_contents_smoke(self, set_capabilities, setup_logging):
        """
        Scenarios:
            Verify on tapping All Posts will load its screen
            Verify on tapping Posts i'm following will load its screen
            Verify on tapping General will load its screen
            Verify on searching any post in search bar will load results screen
        """

        global_contents = Globals(setup_logging)
        ios_discussions_page = IosDiscussionsDashboard(set_capabilities, setup_logging)

        ios_discussions_page.search_post()
        assert ios_discussions_page.get_subsection_title().text == strings.DISCUSSION_SEARCH_RESULTS
        ios_discussions_page.get_navigation_icon().click()
        assert ios_discussions_page.get_subsection_title().text == strings.DISCUSSION_DASHBOARD_TITLE

        all_posts_element = global_contents.get_by_class_from_elements(
            set_capabilities,
            ios_elements.discussions_topic_title_cell,
            global_contents.first_existence
            )
        all_posts_element.click()
        assert ios_discussions_page.get_subsection_title().text == strings.DISCUSSION_ALL_POSTS
        ios_discussions_page.get_navigation_icon().click()
        assert ios_discussions_page.get_subsection_title().text == strings.DISCUSSION_DASHBOARD_TITLE

        following_posts_element = global_contents.get_by_class_from_elements(
            set_capabilities,
            ios_elements.discussions_topic_title_cell,
            global_contents.second_existence
            )
        following_posts_element.click()
        assert ios_discussions_page.get_subsection_title().text == strings.DISCUSSION_MY_FOLLOWING_POSTS_IOS
        ios_discussions_page.get_navigation_icon().click()
        assert ios_discussions_page.get_subsection_title().text == strings.DISCUSSION_DASHBOARD_TITLE
    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()
    def test_announcement_smoke(self, set_capabilities, setup_logging):
        """
        Scenarios:
            Verify that user should be able to view:
            Announcements as Row title
            Subtitle of the row,
            Announcements icon in row,
            Announcements can be clickable and it will navigate to Announcements page
            Announcements as Title of page
        """
        global_contents = Globals(setup_logging)

        announcement_row_title = global_contents.get_by_id_from_elements(
            set_capabilities,
            android_elements.course_resources_row_title,
            global_contents.second_existence)
        assert announcement_row_title.text == strings.COURSE_DASHBOARD_ANNOUNCEMENT_TITLE

        announcement_row_subtitle = global_contents.get_by_id_from_elements(
            set_capabilities,
            android_elements.course_resources_row_subtitle,
            global_contents.second_existence)
        assert announcement_row_subtitle.text == strings.COURSE_DASHBOARD_ANNOUNCEMENT_ROW

        announcement_icon_element = global_contents.get_by_id_from_elements(
            set_capabilities,
            android_elements.course_resources_row_icon_type,
            global_contents.second_existence)
        assert announcement_icon_element.get_attribute('displayed') == 'true'

        announcement_row_title.click()
        announcement_page_title = global_contents.get_by_class_from_elements(
            set_capabilities,
            android_elements.all_textviews,
            global_contents.first_existence)
        assert announcement_page_title.text == strings.COURSE_DASHBOARD_ANNOUNCEMENT_TITLE
    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