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.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() StaffPage(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] )
def _goto_staff_page(self): """ Open staff page with assertion """ self.courseware_page.visit() staff_page = StaffPage(self.browser, self.course_id) self.assertEqual(staff_page.staff_view_mode, 'Staff') return staff_page
def test_gated_subsection_in_lms_for_staff(self): """ Given that I am a staff member When I visit the LMS Courseware Then I can see all gated subsections Displayed along with notification banners Then if I masquerade as a student Then I cannot see a gated subsection When I fufill the gating prerequisite Then I can see the gated subsection (without a banner) """ self._setup_prereq() self._setup_gated_subsection() # Fulfill prerequisites for specific student self._auto_auth(self.STUDENT_USERNAME, self.STUDENT_EMAIL, False) self.courseware_page.visit() self._fulfill_prerequisite() self._auto_auth(self.STAFF_USERNAME, self.STAFF_EMAIL, True) self.courseware_page.visit() staff_page = StaffPage(self.browser, self.course_id) self.assertEqual(staff_page.staff_view_mode, 'Staff') self.assertEqual(self.courseware_page.num_subsections, 2) # Click on gated section and check for banner self.courseware_page.q(css='.chapter-content-container a').nth(1).click() self.courseware_page.wait_for_page() self.assertTrue(self.courseware_page.has_banner()) self.courseware_page.q(css='.chapter-content-container a').nth(0).click() self.courseware_page.wait_for_page() staff_page.set_staff_view_mode('Student') self.assertEqual(self.courseware_page.num_subsections, 1) self.assertFalse(self.courseware_page.has_banner()) staff_page.set_staff_view_mode_specific_student(self.STUDENT_USERNAME) self.assertEqual(self.courseware_page.num_subsections, 2) self.courseware_page.q(css='.chapter-content-container a').nth(1).click() self.courseware_page.wait_for_page() self.assertFalse(self.courseware_page.has_banner())
def test_masquerade_visibility_override(self): """ Given that a timed exam problem exists in the course And a student has taken that exam And that exam is hidden to the student And I am a staff user masquerading as the student Then I should be able to see the exam content """ self._setup_and_take_timed_exam() LogoutPage(self.browser).visit() self._auto_auth("STAFF_TESTER", "*****@*****.**", True) self.courseware_page.visit() staff_page = StaffPage(self.browser, self.course_id) self.assertEqual(staff_page.staff_view_mode, 'Staff') staff_page.set_staff_view_mode_specific_student(self.USERNAME) self.assertFalse(self.courseware_page.has_submitted_exam_message())
def test_gated_subsection_in_lms_for_staff(self): """ Given that I am a staff member When I visit the LMS Courseware Then I can see all gated subsections Displayed along with notification banners Then if I masquerade as a student Then I cannot see a gated subsection When I fufill the gating prerequisite Then I can see the gated subsection (without a banner) """ self._setup_prereq() self._setup_gated_subsection() # Fulfill prerequisites for specific student self._auto_auth(self.STUDENT_USERNAME, self.STUDENT_EMAIL, False) self.courseware_page.visit() self._fulfill_prerequisite() self._auto_auth(self.STAFF_USERNAME, self.STAFF_EMAIL, True) self.courseware_page.visit() staff_page = StaffPage(self.browser, self.course_id) self.assertEqual(staff_page.staff_view_mode, 'Staff') self.assertEqual(self.courseware_page.num_subsections, 2) # Click on gated section and check for banner self.courseware_page.q( css='.chapter-content-container a').nth(1).click() self.courseware_page.wait_for_page() self.assertTrue(self.courseware_page.has_banner()) self.courseware_page.q( css='.chapter-content-container a').nth(0).click() self.courseware_page.wait_for_page() staff_page.set_staff_view_mode('Student') self.assertEqual(self.courseware_page.num_subsections, 1) self.assertFalse(self.courseware_page.has_banner()) staff_page.set_staff_view_mode_specific_student(self.STUDENT_USERNAME) self.assertEqual(self.courseware_page.num_subsections, 2) self.courseware_page.q( css='.chapter-content-container a').nth(1).click() self.courseware_page.wait_for_page() self.assertFalse(self.courseware_page.has_banner())