Merge pull request #14827 from edx/robrap/LEARNER-418

Refactor more tests to use course home page.
This commit is contained in:
Robert Raposa
2017-04-05 17:29:30 -04:00
committed by GitHub
5 changed files with 58 additions and 27 deletions

View File

@@ -730,19 +730,21 @@ class StaffLockTest(CourseOutlineTest):
Given I have a course with two sections
When I enable explicit staff lock on one section
And I click the View Live button to switch to staff view
Then I see two sections in the sidebar
And I visit the course home with the outline
Then I see two sections in the outline
And when I switch the view mode to student view
Then I see one section in the sidebar
Then I see one section in the outline
"""
self.course_outline_page.visit()
self.course_outline_page.add_section_from_top_button()
self.course_outline_page.section_at(1).set_staff_lock(True)
self.course_outline_page.view_live()
courseware = CoursewarePage(self.browser, self.course_id)
courseware.wait_for_page()
self.assertEqual(courseware.num_sections, 2)
StaffCoursewarePage(self.browser, self.course_id).set_staff_view_mode('Student')
self.assertEqual(courseware.num_sections, 1)
course_home_page = CourseHomePage(self.browser, self.course_id)
course_home_page.visit()
self.assertEqual(course_home_page.outline.num_sections, 2)
course_home_page.preview.set_staff_view_mode('Student')
self.assertEqual(course_home_page.outline.num_sections, 1)
def test_locked_subsections_do_not_appear_in_lms(self):
"""
@@ -750,18 +752,20 @@ class StaffLockTest(CourseOutlineTest):
Given I have a course with two subsections
When I enable explicit staff lock on one subsection
And I click the View Live button to switch to staff view
Then I see two subsections in the sidebar
And I visit the course home with the outline
Then I see two subsections in the outline
And when I switch the view mode to student view
Then I see one section in the sidebar
Then I see one subsection in the outline
"""
self.course_outline_page.visit()
self.course_outline_page.section_at(0).subsection_at(1).set_staff_lock(True)
self.course_outline_page.view_live()
courseware = CoursewarePage(self.browser, self.course_id)
courseware.wait_for_page()
self.assertEqual(courseware.num_subsections, 2)
StaffCoursewarePage(self.browser, self.course_id).set_staff_view_mode('Student')
self.assertEqual(courseware.num_subsections, 1)
course_home_page = CourseHomePage(self.browser, self.course_id)
course_home_page.visit()
self.assertEqual(course_home_page.outline.num_subsections, 2)
course_home_page.preview.set_staff_view_mode('Student')
self.assertEqual(course_home_page.outline.num_subsections, 1)
def test_toggling_staff_lock_on_section_does_not_publish_draft_units(self):
"""