Commit d8d093af by Eric Fischer Committed by cahrens

Staff Grade Required bok choy tests

Includes fixing my previous work on the staff assessment test to
use the required flow, not the override. Also refactors full workflow
tests and adds a new one to include a required staff grading step.
parent 650d9650
...@@ -98,10 +98,10 @@ class StaffAreaA11yTest(OpenAssessmentA11yTest): ...@@ -98,10 +98,10 @@ class StaffAreaA11yTest(OpenAssessmentA11yTest):
""" """
Test the accessibility of the staff area. Test the accessibility of the staff area.
This is testing a problem with "self assessment only". This is testing a problem with "staff assessment only".
""" """
def setUp(self): def setUp(self):
super(StaffAreaA11yTest, self).setUp('self_only', staff=True) super(StaffAreaA11yTest, self).setUp('staff_only', staff=True)
self.staff_area_page = StaffAreaPage(self.browser, self.problem_loc) self.staff_area_page = StaffAreaPage(self.browser, self.problem_loc)
def test_staff_tools_panel(self): def test_staff_tools_panel(self):
...@@ -120,12 +120,26 @@ class StaffAreaA11yTest(OpenAssessmentA11yTest): ...@@ -120,12 +120,26 @@ class StaffAreaA11yTest(OpenAssessmentA11yTest):
self.staff_area_page.click_staff_toolbar_button("staff-info") self.staff_area_page.click_staff_toolbar_button("staff-info")
self._check_a11y(self.staff_area_page) self._check_a11y(self.staff_area_page)
def test_staff_grading_panel(self):
"""
Check the accessibility of the "Staff Grading" panel
"""
self.submission_page.visit().submit_response(self.SUBMISSION)
self.assertTrue(self.submission_page.has_submitted)
self.staff_area_page.visit()
self.staff_area_page.expand_staff_grading_section()
self._check_a11y(self.staff_area_page)
def test_learner_info(self): def test_learner_info(self):
""" """
Check the accessibility of the learner information sections of the "Staff Tools" panel. Check the accessibility of the learner information sections of the "Staff Tools" panel.
""" """
# Create an assessment for a user. self.auto_auth_page.visit()
username = self.do_self_assessment() username = self.auto_auth_page.get_username()
self.submission_page.visit().submit_response(self.SUBMISSION)
self.assertTrue(self.submission_page.has_submitted)
self.staff_area_page.visit() self.staff_area_page.visit()
...@@ -139,24 +153,14 @@ class StaffAreaA11yTest(OpenAssessmentA11yTest): ...@@ -139,24 +153,14 @@ class StaffAreaA11yTest(OpenAssessmentA11yTest):
""" """
Check the accessibility of the Staff Grade section, as shown to the learner. Check the accessibility of the Staff Grade section, as shown to the learner.
""" """
self.auto_auth_page.visit()
username = self.auto_auth_page.get_username()
self.submission_page.visit().submit_response(self.SUBMISSION) self.submission_page.visit().submit_response(self.SUBMISSION)
self.assertTrue(self.submission_page.has_submitted) self.assertTrue(self.submission_page.has_submitted)
# Submit a staff override self.do_staff_assessment(options_selected=self.STAFF_OVERRIDE_OPTIONS_SELECTED)
self.staff_area_page.visit()
self.staff_area_page.show_learner(username)
self.staff_area_page.expand_learner_report_sections()
self.staff_area_page.assess("staff", self.STAFF_OVERRIDE_OPTIONS_SELECTED)
# Refresh the page, and learner completes a self-assessment. # Refresh the page, then verify accessibility of the Staff Grade section (marked Complete).
# Then verify accessibility of the Staff Grade section (marked Complete).
self.browser.refresh() self.browser.refresh()
self.self_asmnt_page.wait_for_page().wait_for_response() self._verify_staff_grade_section(self.STAFF_GRADE_EXISTS, None)
self.self_asmnt_page.assess("self", self.OPTIONS_SELECTED).wait_for_complete()
self.assertTrue(self.self_asmnt_page.is_complete)
self._verify_staff_grade_section(self.STAFF_OVERRIDE_EXISTS, None)
self._check_a11y(self.staff_asmnt_page) self._check_a11y(self.staff_asmnt_page)
...@@ -169,7 +173,7 @@ class FullWorkflowA11yTest(OpenAssessmentA11yTest, FullWorkflowMixin): ...@@ -169,7 +173,7 @@ class FullWorkflowA11yTest(OpenAssessmentA11yTest, FullWorkflowMixin):
""" """
def setUp(self): def setUp(self):
super(FullWorkflowA11yTest, self).setUp('full_workflow', staff=True) super(FullWorkflowA11yTest, self).setUp('full_workflow_staff_override', staff=True)
self.staff_area_page = StaffAreaPage(self.browser, self.problem_loc) self.staff_area_page = StaffAreaPage(self.browser, self.problem_loc)
def test_training_peer_self_staff_override(self): def test_training_peer_self_staff_override(self):
......
...@@ -462,6 +462,13 @@ class StaffAreaPage(OpenAssessmentPage, AssessmentMixin): ...@@ -462,6 +462,13 @@ class StaffAreaPage(OpenAssessmentPage, AssessmentMixin):
panels = self.q(css=self._bounded_selector(".wrapper--ui-staff")) panels = self.q(css=self._bounded_selector(".wrapper--ui-staff"))
return [panel.get_attribute('class') for panel in panels if u'is--hidden' not in panel.get_attribute('class')] return [panel.get_attribute('class') for panel in panels if u'is--hidden' not in panel.get_attribute('class')]
def is_button_visible(self, button_name):
"""
Returns True if button_name is visible, else False
"""
button = self.q(css=self._bounded_selector(".button-{button_name}".format(button_name=button_name)))
return button.is_present()
def click_staff_toolbar_button(self, button_name): def click_staff_toolbar_button(self, button_name):
""" """
Presses the button to show the panel with the specified name. Presses the button to show the panel with the specified name.
...@@ -491,6 +498,50 @@ class StaffAreaPage(OpenAssessmentPage, AssessmentMixin): ...@@ -491,6 +498,50 @@ class StaffAreaPage(OpenAssessmentPage, AssessmentMixin):
submit_button.first.click() submit_button.first.click()
self.wait_for_element_visibility(".staff-info__student__report", "Student report is present") self.wait_for_element_visibility(".staff-info__student__report", "Student report is present")
def expand_staff_grading_section(self):
"""
Clicks the staff grade control to expand staff grading section for use in staff required workflows.
"""
self.click_staff_toolbar_button("staff-grading")
self.q(css=self._bounded_selector(".staff__grade__show-form")).first.click()
self.wait_for_element_visibility("#staff__assessment__rubric__question--0__0", "staff grading is present")
@property
def available_checked_out_numbers(self):
"""
Gets "N available and M checked out" information from staff grading sections.
Returns tuple of (N, M)
"""
if not 'GRADE AVAILABLE RESPONSES' in self.selected_button_names:
self.expand_staff_grading_section()
raw_string = self.q(css=self._bounded_selector(".staff__grade__value")).text[0]
ret = tuple(int(s) for s in raw_string.split() if s.isdigit())
if len(ret) != 2:
raise PageConfigurationError("Unable to parse available and checked out numbers")
return ret
def verify_available_checked_out_numbers(self, expected_value):
"""
Waits until the expected value for available and checked out numbers appears. If it does not appear, fails the test.
expected_value should be a tuple as described in the available_checked_out_numbers property above.
"""
EmptyPromise(
lambda: self.available_checked_out_numbers == expected_value,
"Expected avaiable and checked out values present"
).fulfill()
def submissions_available(self):
"""
Utility method to check if there are any more learner responses to grade in the staff grading section.
"""
found = self.q(
css=self._bounded_selector(".staff__grade__content")
)
if found.text[0] == "No other learner responses are available for grading at this time.":
return False
return True
@property @property
def learner_report_text(self): def learner_report_text(self):
""" """
...@@ -557,11 +608,24 @@ class StaffAreaPage(OpenAssessmentPage, AssessmentMixin): ...@@ -557,11 +608,24 @@ class StaffAreaPage(OpenAssessmentPage, AssessmentMixin):
css=self._bounded_selector(".staff-info__student__response .ui-toggle-visibility__content") css=self._bounded_selector(".staff-info__student__response .ui-toggle-visibility__content")
).text[0] ).text[0]
def submit_assessment(self): def staff_assess(self, options_selected, continue_after=False):
for criterion_num, option_num in enumerate(options_selected):
sel = "#staff__assessment__rubric__question--{criterion_num}__{option_num}".format(
assessment_type="staff",
criterion_num=criterion_num,
option_num=option_num
)
self.q(css=self._bounded_selector(sel)).first.click()
self.submit_assessment(continue_after)
def submit_assessment(self, continue_after=False):
""" """
Submit a staff assessment of the problem. Submit a staff assessment of the problem.
""" """
self.submit(button_css=".wrapper--staff-assessment .action--submit") filter_text = "Submit assessment"
if continue_after:
filter_text += " and continue grading"
self.q(css=self._bounded_selector("button.action--submit")).filter(text=filter_text).first.click()
def cancel_submission(self): def cancel_submission(self):
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment