-
Notifications
You must be signed in to change notification settings - Fork 4.3k
End-to-end bok choy test for cohorted courseware. #6540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -266,28 +266,26 @@ def populate_course_fixture(self, course_fixture): | |
| </problem> | ||
| """) | ||
|
|
||
| self.alpha_text = "VISIBLE TO ALPHA" | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to reviewers: making all caps to make the string comparison easier. Currently the LMS uppercases display names. By making the names uppercase initially, we don't have to worry about that (and if the LMS stops uppercasing display names, the test won't need to change). |
||
| self.beta_text = "VISIBLE TO BETA" | ||
| self.everyone_text = "VISIBLE TO EVERYONE" | ||
|
|
||
| course_fixture.add_children( | ||
| XBlockFixtureDesc('chapter', 'Test Section').add_children( | ||
| XBlockFixtureDesc('sequential', 'Test Subsection').add_children( | ||
| XBlockFixtureDesc( | ||
| 'problem', 'Visible to alpha', data=problem_data, metadata={"group_access": {0: [0]}} | ||
| ), | ||
| XBlockFixtureDesc( | ||
| 'problem', 'Visible to beta', data=problem_data, metadata={"group_access": {0: [1]}} | ||
| ), | ||
| XBlockFixtureDesc('problem', 'Visible to everyone', data=problem_data) | ||
| XBlockFixtureDesc('vertical', 'Test Unit').add_children( | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to reviewers: when I wrote this test, I followed the pattern of other tests in the file that put problems directly under subsections. I have changed it now to represent the structure that would be created by Studio (problems in a unit). Because of that, I can't use course_nav.sequence_items, which only returns the display name of the first component on that page (which would be the unit display name). If I put each problem into its own unit it also doesn't work because all students will see each unit, even if it has no content for a particular student. |
||
| XBlockFixtureDesc( | ||
| 'problem', self.alpha_text, data=problem_data, metadata={"group_access": {0: [0]}} | ||
| ), | ||
| XBlockFixtureDesc( | ||
| 'problem', self.beta_text, data=problem_data, metadata={"group_access": {0: [1]}} | ||
| ), | ||
| XBlockFixtureDesc('problem', self.everyone_text, data=problem_data) | ||
| ) | ||
| ) | ||
| ) | ||
| ) | ||
|
|
||
| def _verify_visible_problems(self, expected_items): | ||
| """ | ||
| Verify that the expected problems are visible. | ||
| """ | ||
| course_nav = CourseNavPage(self.browser) | ||
| actual_items = course_nav.sequence_items | ||
| self.assertItemsEqual(expected_items, actual_items) | ||
|
|
||
| def test_staff_sees_all_problems(self): | ||
| """ | ||
| Scenario: Staff see all problems | ||
|
|
@@ -296,8 +294,8 @@ def test_staff_sees_all_problems(self): | |
| When I view the courseware in the LMS with staff access | ||
| Then I see all the problems, regardless of their group_access property | ||
| """ | ||
| self._goto_staff_page() | ||
| self._verify_visible_problems(['Visible to alpha', 'Visible to beta', 'Visible to everyone']) | ||
| course_page = self._goto_staff_page() | ||
| verify_expected_problem_visibility(self, course_page, [self.alpha_text, self.beta_text, self.everyone_text]) | ||
|
|
||
| def test_student_not_in_content_group(self): | ||
| """ | ||
|
|
@@ -310,7 +308,7 @@ def test_student_not_in_content_group(self): | |
| """ | ||
| course_page = self._goto_staff_page() | ||
| course_page.set_staff_view_mode('Student') | ||
| self._verify_visible_problems(['Visible to everyone']) | ||
| verify_expected_problem_visibility(self, course_page, [self.everyone_text]) | ||
|
|
||
| def test_as_student_in_alpha(self): | ||
| """ | ||
|
|
@@ -323,7 +321,7 @@ def test_as_student_in_alpha(self): | |
| """ | ||
| course_page = self._goto_staff_page() | ||
| course_page.set_staff_view_mode('Student in alpha') | ||
| self._verify_visible_problems(['Visible to alpha', 'Visible to everyone']) | ||
| verify_expected_problem_visibility(self, course_page, [self.alpha_text, self.everyone_text]) | ||
|
|
||
| def test_as_student_in_beta(self): | ||
| """ | ||
|
|
@@ -336,4 +334,15 @@ def test_as_student_in_beta(self): | |
| """ | ||
| course_page = self._goto_staff_page() | ||
| course_page.set_staff_view_mode('Student in beta') | ||
| self._verify_visible_problems(['Visible to beta', 'Visible to everyone']) | ||
| verify_expected_problem_visibility(self, course_page, [self.beta_text, self.everyone_text]) | ||
|
|
||
|
|
||
| def verify_expected_problem_visibility(test, courseware_page, expected_problems): | ||
| """ | ||
| Helper method that checks that the expected problems are visible on the current page. | ||
| """ | ||
| test.assertEqual( | ||
| len(expected_problems), courseware_page.num_xblock_components, "Incorrect number of visible problems" | ||
| ) | ||
| for index, expected_problem in enumerate(expected_problems): | ||
| test.assertIn(expected_problem, courseware_page.xblock_components[index].text) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to reviewers: these changes were taken from #6283, which has not yet merged to master.