Commit 8ba19555 by cahrens Committed by Andy Armstrong

Bok choy test for removing student response.

parent 145c8c16
......@@ -465,19 +465,36 @@ class StaffAreaPage(OpenAssessmentPage, AssessmentMixin):
"""
Returns the final score displayed in the learner report.
"""
return int(self.q(css=self._bounded_selector(".grade__value__earned")).text[0])
score = self.q(css=self._bounded_selector(".staff-info__student__grade .ui-toggle-visibility__content"))
if len(score) == 0:
return None
return score.text[0]
def verify_learner_final_score(self, expected_score):
"""
Verifies that the final score in the learner report is equal to the expected_score.
Verifies that the final score in the learner report is equal to the expected value.
"""
EmptyPromise(
lambda: self.learner_final_score == expected_score,
"Learner score is updated"
).fulfill()
@property
def learner_response(self):
return self.q(
css=self._bounded_selector(".staff-info__student__response .ui-toggle-visibility__content")
).text[0]
def submit_assessment(self):
"""
Submit a staff assessment of the problem.
"""
self.submit(button_css=".wrapper--staff-assessment .action--submit")
def cancel_submission(self):
"""
Cancel a learner's assessment.
"""
# Must put a comment to enable the submit button.
self.q(css=self._bounded_selector("textarea.cancel_submission_comments")).fill("comment")
self.submit(button_css=".action--submit-cancel-submission")
......@@ -341,7 +341,6 @@ class StaffAreaTest(OpenAssessmentTest):
self.staff_area_page.show_learner('no-submission-learner')
self.staff_area_page.verify_learner_report_text('A response was not found for this learner.')
@retry()
@attr('acceptance')
def test_staff_override(self):
......@@ -360,18 +359,59 @@ class StaffAreaTest(OpenAssessmentTest):
# Click on staff tools and search for user
self.staff_area_page.show_learner(username)
self.staff_area_page.expand_learner_report_sections()
# Check the learner's current score.
self.assertEqual(self.staff_area_page.learner_final_score, self.EXPECTED_SCORE)
self.staff_area_page.expand_learner_report_sections()
self.staff_area_page.verify_learner_final_score("Final grade: 6 out of 8")
# Do staff override and wait for final score to change.
self.staff_area_page.assess([0, 1])
# Verify that the new student score is different from the original one.
self.assertNotEqual(1, self.EXPECTED_SCORE)
# TODO: this is expected to fail until the regrading API is hooked up.
# self.staff_area_page.verify_learner_final_score(1)
# TODO: uncomment this after hooked up to the API. Also verify other state if appropriate.
# self.staff_area_page.verify_learner_final_score("Final grade: 1 out of 8")
@retry()
@attr('acceptance')
def test_cancel_submission(self):
"""
Scenario: staff can cancel a learner's submission
Given I am viewing the staff area of an ORA problem
When I search for a learner in staff tools
And the learner has submitted a response to an ORA problem with self-assessment
Then I can cancel the learner's submission
And I see an updated message indicating that the submission has been canceled.
"""
username = self.do_self_assessment()
self.staff_area_page.visit()
# Click on staff tools and search for user
self.staff_area_page.show_learner(username)
# Check the learner's current score.
self.staff_area_page.expand_learner_report_sections()
self.staff_area_page.verify_learner_final_score("Final grade: 6 out of 8")
# Cancel the student submission
self.staff_area_page.cancel_submission()
self.staff_area_page.verify_learner_final_score(
"The learner's submission has been removed from peer assessment. "
"The learner receives a grade of zero unless you reset the learner's attempts for the "
"problem to allow them to resubmit a response."
)
# Verify that the staff override and submission removal sections are now gone.
self.assertEqual(
[u'Learner Response', u"Learner's Self Assessment", u"Learner's Final Grade"],
self.staff_area_page.learner_report_sections
)
# Verify that the Learner Response has been replaced with a message about the removal
self.staff_area_page.expand_learner_report_sections()
self.assertIn("Learner submission removed", self.staff_area_page.learner_response)
class FileUploadTest(OpenAssessmentTest):
......
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