def test_staff_grade_override(self): """ Scenario: the staff grade section displays correctly Given I am viewing a new self assessment problem as a learner Then there is no Staff Grade section present And if I create a response to the problem Then there is no Staff Grade section present And if a staff member creates a grade override Then when I refresh the page, I see that a staff override exists And the message says that I must complete my steps to view the grade And if I submit my self-assessment Then the Staff Grade section is marked complete with no message And I can see my final grade """ # View the problem-- no Staff Grade area. self.auto_auth_page.visit() username, _ = self.auto_auth_page.get_username_and_email() self.submission_page.visit() self.assertFalse(self.staff_asmnt_page.is_browser_on_page()) self.submission_page.submit_response(self.SUBMISSION) self.assertTrue(self.submission_page.has_submitted) self.assertFalse(self.staff_asmnt_page.is_browser_on_page()) # Submit a staff override self.do_staff_override(username, self.STAFF_OVERRIDE_STAFF_AREA_NOT_COMPLETE) # Refresh the page so the learner sees the Staff Grade section. self.refresh_page() self._verify_staff_grade_section(self.STAFF_GRADE_EXISTS, self.STAFF_OVERRIDE_LEARNER_STEPS_NOT_COMPLETE) # Verify no final grade yet. self.assertIsNone(self.grade_page.wait_for_page().score) # Verify required staff grading section not available self.staff_area_page = StaffAreaPage(self.browser, self.problem_loc) self.assertFalse(self.staff_area_page.is_button_visible('staff-grading')) # Learner does required self-assessment self.self_asmnt_page.wait_for_page().wait_for_response() self.assertIn(self.SUBMISSION, self.self_asmnt_page.response_text) 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_GRADE_EXISTS, None) # Verify the staff override grade self.assertEqual(self.STAFF_OVERRIDE_SCORE, self.grade_page.wait_for_page().score)
def setUp(self): super(FullWorkflowOverrideTest, self).setUp("full_workflow_staff_override", staff=True) self.staff_area_page = StaffAreaPage(self.browser, self.problem_loc)
class FullWorkflowOverrideTest(OpenAssessmentTest, FullWorkflowMixin): """ Tests of complete workflows, combining multiple required steps together. """ def setUp(self): super(FullWorkflowOverrideTest, self).setUp("full_workflow_staff_override", staff=True) self.staff_area_page = StaffAreaPage(self.browser, self.problem_loc) @retry() @attr('acceptance') def test_staff_override_at_end(self): """ Scenario: complete workflow with staff override at the very end Given that I have created a submission, completed training, and done a self assessment And a second learner has also created a submission, training, and self assessment Then I can assess a learner And when another learner assesses me Then I see my score based on the peer assessment And when a staff member overrides the score Then I see the staff override score And all fields in the staff area tool are correct """ learner = self.do_train_self_peer() # At this point, the learner sees the peer assessment score (0). self.assertEqual(self.PEER_ASSESSMENT_SCORE, self.grade_page.wait_for_page().score) self.verify_staff_area_fields( learner, self.STAFF_AREA_PEER_ASSESSMENT, self.STAFF_AREA_SUBMITTED, self.STAFF_AREA_SELF_ASSESSMENT ) self.staff_area_page.verify_learner_final_score(self.PEER_ASSESSMENT_STAFF_AREA_SCORE) self.assertEquals( ['CRITERION', 'PEER MEDIAN GRADE', 'SELF ASSESSMENT GRADE'], self.staff_area_page.learner_final_score_table_headers ) self.assertEquals( ['Poor - 0 points\nPeer 1 - Poor', 'Good', 'Poor - 0 points\nPeer 1 - Poor', 'Excellent'], self.staff_area_page.learner_final_score_table_values ) self.verify_grade_entries([ [(u"PEER MEDIAN GRADE - 0 POINTS", u"Poor"), (u"PEER MEDIAN GRADE - 0 POINTS", u"Poor")], [(u"YOUR SELF ASSESSMENT", u"Good"), (u"YOUR SELF ASSESSMENT", u"Excellent")] ]) # Now do a staff override, changing the score (to 1). self.do_staff_override(learner) self.refresh_page() self._verify_staff_grade_section(self.STAFF_GRADE_EXISTS, None) self.assertEqual(self.STAFF_OVERRIDE_SCORE, self.grade_page.wait_for_page().score) self.verify_staff_area_fields( learner, self.STAFF_AREA_PEER_ASSESSMENT, self.STAFF_AREA_SUBMITTED, self.STAFF_AREA_SELF_ASSESSMENT ) self.staff_area_page.verify_learner_final_score(self.STAFF_AREA_SCORE.format(self.STAFF_OVERRIDE_SCORE)) self.assertEquals( ['CRITERION', 'STAFF GRADE', 'PEER MEDIAN GRADE', 'SELF ASSESSMENT GRADE'], self.staff_area_page.learner_final_score_table_headers ) self.assertEquals( ['Poor - 0 points', 'Peer 1 - Poor', 'Good', 'Fair - 1 point', 'Peer 1 - Poor', 'Excellent'], self.staff_area_page.learner_final_score_table_values ) self.verify_grade_entries([ [(u"STAFF GRADE - 0 POINTS", u"Poor"), (u"STAFF GRADE - 1 POINT", u"Fair")], [(u"PEER MEDIAN GRADE", u"Poor"), (u"PEER MEDIAN GRADE", u"Poor")], [(u"YOUR SELF ASSESSMENT", u"Good"), (u"YOUR SELF ASSESSMENT", u"Excellent")] ]) @retry() @attr('acceptance') def test_staff_override_at_beginning(self): """ Scenario: complete workflow with staff override at the very beginning Given that I have created a submission Then I see no score yet And when a staff member creates a grade override Then I see that an override exists, but I cannot see the score And when a second learner creates a submission Then I can complete my required steps (training, self assessment, peer assesssment) And I see my staff override score And all fields in the staff area tool are correct """ # Create only the initial submission before doing the staff override. learner, learner_email = self.do_submission() # Verify no grade present (and no staff grade section), no assessment information in staff area. self.assertIsNone(self.grade_page.wait_for_page().score) self.assertFalse(self.staff_asmnt_page.is_browser_on_page()) self.verify_staff_area_fields(learner, [], [], []) self.staff_area_page.verify_learner_final_score(self.STAFF_OVERRIDE_STAFF_AREA_NOT_COMPLETE) # Do staff override-- score still not shown due to steps not being complete. self.do_staff_override(learner, self.STAFF_OVERRIDE_STAFF_AREA_NOT_COMPLETE) # Refresh the page so the learner sees the Staff Grade section. self.refresh_page() self._verify_staff_grade_section(self.STAFF_GRADE_EXISTS, self.STAFF_OVERRIDE_LEARNER_STEPS_NOT_COMPLETE) # Now create a second learner so that "learner" has someone to assess. self.do_submission() # Go back to the original learner to complete her workflow and view score. self.login_user(learner, learner_email) # Do training exercise and self assessment self.student_training_page.visit() self.do_training() self.submit_self_assessment(self.SELF_ASSESSMENT) # Verify staff grade still not available, as learner has not done peer assessment. self._verify_staff_grade_section(self.STAFF_GRADE_EXISTS, self.STAFF_OVERRIDE_LEARNER_STEPS_NOT_COMPLETE) self.assertIsNone(self.grade_page.wait_for_page().score) self.verify_staff_area_fields(learner, [], [], self.STAFF_AREA_SELF_ASSESSMENT) self.staff_area_page.verify_learner_final_score(self.STAFF_OVERRIDE_STAFF_AREA_NOT_COMPLETE) # Now do the final required step-- peer grading. self.do_peer_assessment(options=self.SUBMITTED_ASSESSMENT) # Grade is now visible to the learner (even though no student has graded the learner). self._verify_staff_grade_section(self.STAFF_GRADE_EXISTS, None) self.assertEqual(self.STAFF_OVERRIDE_SCORE, self.grade_page.wait_for_page().score) self.verify_staff_area_fields(learner, [], self.STAFF_AREA_SUBMITTED, self.STAFF_AREA_SELF_ASSESSMENT) self.staff_area_page.verify_learner_final_score(self.STAFF_AREA_SCORE.format(self.STAFF_OVERRIDE_SCORE)) self.assertEquals( ['CRITERION', 'STAFF GRADE', 'PEER MEDIAN GRADE', 'SELF ASSESSMENT GRADE'], self.staff_area_page.learner_final_score_table_headers ) self.assertEquals( ['Poor - 0 points', 'Waiting for peer reviews', 'Good', 'Fair - 1 point', 'Waiting for peer reviews', 'Excellent'], self.staff_area_page.learner_final_score_table_values ) self.verify_grade_entries([ [(u"STAFF GRADE - 0 POINTS", u"Poor"), (u"STAFF GRADE - 1 POINT", u"Fair")], [(u'PEER MEDIAN GRADE', u'Waiting for peer reviews'), (u'PEER MEDIAN GRADE', u'Waiting for peer reviews')], [(u"YOUR SELF ASSESSMENT", u"Good"), (u"YOUR SELF ASSESSMENT", u"Excellent")] ])
def setUp(self): super(StaffAreaTest, self).setUp('self_only', staff=True) self.staff_area_page = StaffAreaPage(self.browser, self.problem_loc)
class StaffAreaTest(OpenAssessmentTest): """ Test the staff area. This is testing a problem with "self assessment only". """ def setUp(self): super(StaffAreaTest, self).setUp('self_only', staff=True) self.staff_area_page = StaffAreaPage(self.browser, self.problem_loc) @retry() @attr('acceptance') def test_staff_area_buttons(self): """ Scenario: the staff area buttons should behave correctly Given I am viewing the staff area of an ORA problem Then none of the buttons should be active When I click the "Manage Individual Learners" button Then only the "Manage Individual Learners" button should be active When I click the "View Assignment Statistics" button Then only the "View Assignment Statistics" button should be active When I click the "Staff Info" button again Then none of the buttons should be active """ self.auto_auth_page.visit() self.staff_area_page.visit() self.assertEqual(self.staff_area_page.selected_button_names, []) self.staff_area_page.click_staff_toolbar_button("staff-tools") self.assertEqual(self.staff_area_page.selected_button_names, ["MANAGE INDIVIDUAL LEARNERS"]) self.staff_area_page.click_staff_toolbar_button("staff-info") self.assertEqual(self.staff_area_page.selected_button_names, ["VIEW ASSIGNMENT STATISTICS"]) self.staff_area_page.click_staff_toolbar_button("staff-info") self.assertEqual(self.staff_area_page.selected_button_names, []) @retry() @attr('acceptance') def test_staff_area_panel(self): """ Scenario: the staff area panels should be shown correctly Given I am viewing the staff area of an ORA problem Then none of the panels should be shown When I click a staff button Then only the related panel should be shown When I click the close button in the panel Then none of the panels should be shown """ self.auto_auth_page.visit() self.staff_area_page.visit() # Verify that there is no selected panel initially self.assertEqual(self.staff_area_page.selected_button_names, []) self.assertEqual(self.staff_area_page.visible_staff_panels, []) for panel_name, button_label in [ ("staff-tools", "MANAGE INDIVIDUAL LEARNERS"), ("staff-info", "VIEW ASSIGNMENT STATISTICS"), ]: # Click on the button and verify that the panel has opened self.staff_area_page.click_staff_toolbar_button(panel_name) self.assertEqual(self.staff_area_page.selected_button_names, [button_label]) visible_panels = self.staff_area_page.visible_staff_panels self.assertEqual(1, len(visible_panels)) self.assertIn(u'openassessment__{button_name}'.format(button_name=panel_name), visible_panels[0]) # Click 'Close' and verify that the panel has been closed self.staff_area_page.click_staff_panel_close_button(panel_name) self.assertEqual(self.staff_area_page.selected_button_names, []) self.assertEqual(self.staff_area_page.visible_staff_panels, []) @retry() @attr('acceptance') def test_student_info(self): """ Scenario: staff tools shows learner response information 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 And I've made a staff override assessment of the learner Then I see the correct learner information sections """ username = self.do_self_assessment() self.do_staff_override(username) self.staff_area_page.visit() # Click on staff tools and search for user self.staff_area_page.show_learner(username) self.assertEqual( [u"Learner's Response", u"Learner's Self Assessment", u"Staff Assessment for This Learner", u"Learner's Final Grade", u"Submit Assessment Grade Override", u"Remove Submission From Peer Grading"], self.staff_area_page.learner_report_sections ) self.assertNotIn('A response was not found for this learner', self.staff_area_page.learner_report_text) @retry() @attr('acceptance') def test_student_info_no_submission(self): """ Scenario: staff tools indicates if no submission has been received for a given learner Given I am viewing the staff area of an ORA problem And I myself have submitted a response with self-assessment When I search for a learner in staff tools And the learner has not submitted a response to the ORA problem Then I see a message indicating that the learner has not submitted a response And there are no student information sections displayed """ self.auto_auth_page.visit() # This is to catch a bug that existed when the user viewing staff tools had submitted an assessment, # and had a grade stored (TNL-4060). self.do_self_assessment() self.staff_area_page.visit() # Click on staff tools and search for user 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): """ Scenario: staff can override a learner's grade 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 submit a staff override of the self-assessment And I see the updated final score """ 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(self.STAFF_AREA_SCORE.format(self.EXPECTED_SCORE)) self.assertEquals( ['CRITERION', 'SELF ASSESSMENT GRADE'], self.staff_area_page.learner_final_score_table_headers ) self.assertEquals( ['Fair - 3 points', 'Good - 3 points'], self.staff_area_page.learner_final_score_table_values ) # Do staff override and wait for final score to change. self.staff_area_page.assess("staff-override", self.STAFF_OVERRIDE_OPTIONS_SELECTED) # Verify that the new student score is different from the original one. self.staff_area_page.verify_learner_final_score(self.STAFF_AREA_SCORE.format(self.STAFF_OVERRIDE_SCORE)) self.assertEquals( ['CRITERION', 'STAFF GRADE', 'SELF ASSESSMENT GRADE'], self.staff_area_page.learner_final_score_table_headers ) self.assertEquals( ['Poor - 0 points', 'Fair', 'Fair - 1 point', 'Good'], self.staff_area_page.learner_final_score_table_values ) @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(self.STAFF_AREA_SCORE.format(self.EXPECTED_SCORE)) # 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 delete the learner's state 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's 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) @retry() @attr('acceptance') def test_staff_grade_override(self): """ Scenario: the staff grade section displays correctly Given I am viewing a new self assessment problem as a learner Then there is no Staff Grade section present And if I create a response to the problem Then there is no Staff Grade section present And if a staff member creates a grade override Then when I refresh the page, I see that a staff override exists And the message says that I must complete my steps to view the grade And if I submit my self-assessment Then the Staff Grade section is marked complete with no message And I can see my final grade """ # View the problem-- no Staff Grade area. self.auto_auth_page.visit() username, _ = self.auto_auth_page.get_username_and_email() self.submission_page.visit() self.assertFalse(self.staff_asmnt_page.is_browser_on_page()) self.submission_page.submit_response(self.SUBMISSION) self.assertTrue(self.submission_page.has_submitted) self.assertFalse(self.staff_asmnt_page.is_browser_on_page()) # Submit a staff override self.do_staff_override(username, self.STAFF_OVERRIDE_STAFF_AREA_NOT_COMPLETE) # Refresh the page so the learner sees the Staff Grade section. self.refresh_page() self._verify_staff_grade_section(self.STAFF_GRADE_EXISTS, self.STAFF_OVERRIDE_LEARNER_STEPS_NOT_COMPLETE) # Verify no final grade yet. self.assertIsNone(self.grade_page.wait_for_page().score) # Verify required staff grading section not available self.staff_area_page = StaffAreaPage(self.browser, self.problem_loc) self.assertFalse(self.staff_area_page.is_button_visible('staff-grading')) # Learner does required self-assessment self.self_asmnt_page.wait_for_page().wait_for_response() self.assertIn(self.SUBMISSION, self.self_asmnt_page.response_text) 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_GRADE_EXISTS, None) # Verify the staff override grade self.assertEqual(self.STAFF_OVERRIDE_SCORE, self.grade_page.wait_for_page().score) @retry() @attr('acceptance') def test_staff_grade_override_cancelled(self): """ Scenario: the staff grade section displays cancelled when the submission is cancelled Given I have created a response and a self-assessment And a staff member creates a grade override and then cancels my submission Then when I refresh the page, the Staff Grade section is marked cancelled And I have no final grade """ username = self.do_self_assessment() # Submit a staff override self.do_staff_override(username) # And cancel the submission self.staff_area_page.expand_learner_report_sections() self.staff_area_page.cancel_submission() # Refresh the page so the learner sees the Staff Grade section shows the submission has been cancelled. self.refresh_page() self._verify_staff_grade_section("CANCELLED", None) self.assertIsNone(self.grade_page.wait_for_page().score)
def setUp(self): super(StaffAreaTest, self).setUp('peer_only', staff=True) self.staff_area_page = StaffAreaPage(self.browser, self.problem_loc)
class StaffAreaTest(OpenAssessmentTest): """ Test the staff area. """ def setUp(self): super(StaffAreaTest, self).setUp('peer_only', staff=True) self.staff_area_page = StaffAreaPage(self.browser, self.problem_loc) @retry() @attr('acceptance') def test_staff_area_buttons(self): """ Scenario: the staff area buttons should behave correctly Given I am viewing the staff area of an ORA problem Then none of the buttons should be active When I click the "Staff Tools" button Then only the "Staff Tools" button should be active When I click the "Staff Info" button Then only the "Staff Info" button should be active When I click the "Staff Info" button again Then none of the buttons should be active """ self.auto_auth_page.visit() self.staff_area_page.visit() self.assertEqual(self.staff_area_page.selected_button_names, []) self.staff_area_page.click_staff_toolbar_button("staff-tools") self.assertEqual(self.staff_area_page.selected_button_names, ["STAFF TOOLS"]) self.staff_area_page.click_staff_toolbar_button("staff-info") self.assertEqual(self.staff_area_page.selected_button_names, ["STAFF INFO"]) self.staff_area_page.click_staff_toolbar_button("staff-info") self.assertEqual(self.staff_area_page.selected_button_names, []) @retry() @attr('acceptance') @ddt.data( ("staff-tools", "STAFF TOOLS"), ("staff-info", "STAFF INFO"), ) @ddt.unpack def test_staff_area_panel(self, panel_name, button_label): """ Scenario: the staff area panels should be shown correctly Given I am viewing the staff area of an ORA problem Then none of the panels should be shown When I click a staff button Then only the related panel should be shown When I click the close button in the panel Then none of the panels should be shown """ self.auto_auth_page.visit() self.staff_area_page.visit() # Verify that there is no selected panel initially self.assertEqual(self.staff_area_page.selected_button_names, []) self.assertEqual(self.staff_area_page.visible_staff_panels, []) # Click on the button and verify that the panel has opened self.staff_area_page.click_staff_toolbar_button(panel_name) self.assertEqual(self.staff_area_page.selected_button_names, [button_label]) self.assertEqual( self.staff_area_page.visible_staff_panels, [u'openassessment__{button_name}'.format(button_name=panel_name)]) # Click 'Close' and verify that the panel has been closed self.staff_area_page.click_staff_panel_close_button(panel_name) self.assertEqual(self.staff_area_page.selected_button_names, []) self.assertEqual(self.staff_area_page.visible_staff_panels, [])
class StaffAreaTest(OpenAssessmentTest): """ Test the staff area. """ def setUp(self): super(StaffAreaTest, self).setUp('peer_only', staff=True) self.staff_area_page = StaffAreaPage(self.browser, self.problem_loc) @retry() @attr('acceptance') def test_staff_area_buttons(self): """ Scenario: the staff area buttons should behave correctly Given I am viewing the staff area of an ORA problem Then none of the buttons should be active When I click the "Staff Tools" button Then only the "Staff Tools" button should be active When I click the "Staff Info" button Then only the "Staff Info" button should be active When I click the "Staff Info" button again Then none of the buttons should be active """ self.auto_auth_page.visit() self.staff_area_page.visit() self.assertEqual(self.staff_area_page.selected_button_names, []) self.staff_area_page.click_staff_toolbar_button("staff-tools") self.assertEqual(self.staff_area_page.selected_button_names, ["STAFF TOOLS"]) self.staff_area_page.click_staff_toolbar_button("staff-info") self.assertEqual(self.staff_area_page.selected_button_names, ["STAFF INFO"]) self.staff_area_page.click_staff_toolbar_button("staff-info") self.assertEqual(self.staff_area_page.selected_button_names, []) @retry() @attr('acceptance') @ddt.data( ("staff-tools", "STAFF TOOLS"), ("staff-info", "STAFF INFO"), ) @ddt.unpack def test_staff_area_panel(self, panel_name, button_label): """ Scenario: the staff area panels should be shown correctly Given I am viewing the staff area of an ORA problem Then none of the panels should be shown When I click a staff button Then only the related panel should be shown When I click the close button in the panel Then none of the panels should be shown """ self.auto_auth_page.visit() self.staff_area_page.visit() # Verify that there is no selected panel initially self.assertEqual(self.staff_area_page.selected_button_names, []) self.assertEqual(self.staff_area_page.visible_staff_panels, []) # Click on the button and verify that the panel has opened self.staff_area_page.click_staff_toolbar_button(panel_name) self.assertEqual(self.staff_area_page.selected_button_names, [button_label]) self.assertEqual( self.staff_area_page.visible_staff_panels, [u'openassessment__{button_name}'.format(button_name=panel_name)] ) # Click 'Close' and verify that the panel has been closed self.staff_area_page.click_staff_panel_close_button(panel_name) self.assertEqual(self.staff_area_page.selected_button_names, []) self.assertEqual(self.staff_area_page.visible_staff_panels, [])