Пример #1
0
    def test_course_updated_with_entrance_exam(self):
        """
        Given that I visit an empty course before import
        I should not see a section named 'Section' or 'Entrance Exam'
        When I visit the import page
        And I upload a course that has an entrance exam section named 'Entrance Exam'
        And I visit the course outline page again
        The section named 'Entrance Exam' should now be available.
        And when I switch the view mode to student view and Visit CourseWare
        Then I see one section in the sidebar that is 'Entrance Exam'
        """
        self.landing_page.visit()
        # Should not exist yet.
        self.assertRaises(IndexError, self.landing_page.section, "Section")
        self.assertRaises(IndexError, self.landing_page.section,
                          "Entrance Exam")
        self.import_page.visit()
        self.import_page.wait_for_choose_file_click_handler()
        self.import_page.upload_tarball(self.tarball_name)
        self.import_page.wait_for_upload()
        self.landing_page.visit()
        # There should be two sections. 'Entrance Exam' and 'Section' on the landing page.
        self.landing_page.section("Entrance Exam")
        self.landing_page.section("Section")

        self.landing_page.view_live()
        courseware = CoursewarePage(self.browser, self.course_id)
        courseware.wait_for_page()
        StaffCoursewarePage(self.browser,
                            self.course_id).set_staff_view_mode('Student')
        self.assertEqual(courseware.num_sections, 1)
        self.assertIn("To access course materials, you must score",
                      courseware.entrance_exam_message_selector.text[0])
Пример #2
0
 def _goto_staff_page(self):
     """
     Open staff page with assertion
     """
     self.courseware_page.visit()
     staff_page = StaffCoursewarePage(self.browser, self.course_id)
     self.assertEqual(staff_page.staff_view_mode, 'Staff')
     return staff_page
Пример #3
0
    def test_course_updated_with_entrance_exam(self):
        """
        Given that I visit an empty course before import
        I should not see a section named 'Section' or 'Entrance Exam'
        When I visit the import page
        And I upload a course that has an entrance exam section named 'Entrance Exam'
        And I visit the course outline page again
        The section named 'Entrance Exam' should now be available
        When I visit the LMS Course Home page
        Then I should see a section named 'Section' or 'Entrance Exam'
        When I switch the view mode to student view
        Then I should only see a section named 'Entrance Exam'
        When I visit the courseware page
        Then a message regarding the 'Entrance Exam'
        """
        self.landing_page.visit()
        # Should not exist yet.
        self.assertRaises(IndexError, self.landing_page.section, "Section")
        self.assertRaises(IndexError, self.landing_page.section,
                          "Entrance Exam")
        self.import_page.visit()
        self.import_page.upload_tarball(self.tarball_name)
        self.import_page.wait_for_upload()
        self.landing_page.visit()
        # There should be two sections. 'Entrance Exam' and 'Section' on the landing page.
        self.landing_page.section("Entrance Exam")
        self.landing_page.section("Section")

        self.landing_page.view_live()

        course_home = CourseHomePage(self.browser, self.course_id)
        course_home.visit()
        self.assertEqual(course_home.outline.num_sections, 2)
        course_home.preview.set_staff_view_mode('Learner')
        self.assertEqual(course_home.outline.num_sections, 1)

        courseware = CoursewarePage(self.browser, self.course_id)
        courseware.visit()
        StaffCoursewarePage(self.browser,
                            self.course_id).set_staff_view_mode('Learner')
        self.assertIn("To access course materials, you must score",
                      courseware.entrance_exam_message_selector.text[0])