Commit 77ca7885 by Braden MacDonald

Test for new review tips feature

parent 74fc6b0f
...@@ -379,6 +379,56 @@ class MentoringAssessmentTest(MentoringAssessmentBaseTest): ...@@ -379,6 +379,56 @@ class MentoringAssessmentTest(MentoringAssessmentBaseTest):
if extended_feedback: if extended_feedback:
self.extended_feedback_checks(mentoring, controls, expected_results) self.extended_feedback_checks(mentoring, controls, expected_results)
def test_review_tips(self):
params = {
"max_attempts": 3,
"extended_feedback": False,
"include_review_tips": True
}
mentoring, controls = self.load_assessment_scenario("assessment.xml", params)
# Get one question wrong and one partially wrong on attempt 1 of 3: ####################
self.freeform_answer(1, mentoring, controls, 'This is the answer', CORRECT)
self.single_choice_question(2, mentoring, controls, 'Maybe not', INCORRECT)
self.rating_question(3, mentoring, controls, "5 - Extremely good", CORRECT)
self.multiple_response_question(4, mentoring, controls, ("Its beauty",), PARTIAL, last=True)
# The review tips for MCQ 2 and the MRQ should be shown:
messages = mentoring.find_element_by_css_selector('.assessment-messages')
self.assertTrue(messages.is_displayed())
self.assertIn('You might consider reviewing the following items', messages.text)
self.assertIn('Take another look at', messages.text)
self.assertIn('Lesson 1', messages.text)
self.assertNotIn('Lesson 2', messages.text) # This MCQ was correct
self.assertIn('Lesson 3', messages.text)
# The on-assessment-review message is also shown if attempts remain:
self.assertIn('Assessment additional feedback message text', messages.text)
self.assert_clickable(controls.try_again)
controls.try_again.click()
# Get no questions wrong on attempt 2 of 3: ############################################
self.freeform_answer(1, mentoring, controls, 'This is the answer', CORRECT, saved_value='This is the answer')
self.single_choice_question(2, mentoring, controls, 'Yes', CORRECT)
self.rating_question(3, mentoring, controls, "5 - Extremely good", CORRECT)
user_selection = ("Its elegance", "Its beauty", "Its gracefulness")
self.multiple_response_question(4, mentoring, controls, user_selection, CORRECT, last=True)
self.assert_messages_text(mentoring, "Assessment additional feedback message text")
self.assertNotIn('You might consider reviewing the following items', messages.text)
self.assert_clickable(controls.try_again)
controls.try_again.click()
# Get some questions wrong again on attempt 3 of 3:
self.freeform_answer(1, mentoring, controls, 'This is the answer', CORRECT, saved_value='This is the answer')
self.single_choice_question(2, mentoring, controls, 'Maybe not', INCORRECT)
self.rating_question(3, mentoring, controls, "1 - Not good at all", INCORRECT)
self.multiple_response_question(4, mentoring, controls, ("Its beauty",), PARTIAL, last=True)
# The review tips will not be shown because no attempts remain:
self.assert_messages_empty(mentoring)
def test_single_question_assessment(self): def test_single_question_assessment(self):
""" """
No 'Next Question' button on single question assessment. No 'Next Question' button on single question assessment.
......
...@@ -22,6 +22,11 @@ ...@@ -22,6 +22,11 @@
<pb-tip values='["yes"]'>Great!</pb-tip> <pb-tip values='["yes"]'>Great!</pb-tip>
<pb-tip values='["maybenot"]'>Ah, damn.</pb-tip> <pb-tip values='["maybenot"]'>Ah, damn.</pb-tip>
<pb-tip values='["understand"]'><div id="test-custom-html">Really?</div></pb-tip> <pb-tip values='["understand"]'><div id="test-custom-html">Really?</div></pb-tip>
{% if include_review_tips %}
<pb-message type="on-assessment-review-question">
<html>Take another look at <a href="#">Lesson 1</a></html>
</pb-message>
{% endif %}
</pb-mcq> </pb-mcq>
<pb-rating name="mcq_1_2" low="Not good at all" high="Extremely good" question="How much do you rate this MCQ?" correct_choices='["4","5"]'> <pb-rating name="mcq_1_2" low="Not good at all" high="Extremely good" question="How much do you rate this MCQ?" correct_choices='["4","5"]'>
...@@ -30,6 +35,11 @@ ...@@ -30,6 +35,11 @@
<pb-tip values='["4","5"]'>I love good grades.</pb-tip> <pb-tip values='["4","5"]'>I love good grades.</pb-tip>
<pb-tip values='["1","2", "3"]'>Will do better next time...</pb-tip> <pb-tip values='["1","2", "3"]'>Will do better next time...</pb-tip>
<pb-tip values='["notwant"]'>Your loss!</pb-tip> <pb-tip values='["notwant"]'>Your loss!</pb-tip>
{% if include_review_tips %}
<pb-message type="on-assessment-review-question">
<html>Take another look at <a href="#">Lesson 2</a></html>
</pb-message>
{% endif %}
</pb-rating> </pb-rating>
<pb-mrq name="mrq_1_1" question="What do you like in this MRQ?" required_choices='["gracefulness","elegance","beauty"]'> <pb-mrq name="mrq_1_1" question="What do you like in this MRQ?" required_choices='["gracefulness","elegance","beauty"]'>
...@@ -41,6 +51,11 @@ ...@@ -41,6 +51,11 @@
<pb-tip values='["gracefulness"]'>This MRQ is indeed very graceful</pb-tip> <pb-tip values='["gracefulness"]'>This MRQ is indeed very graceful</pb-tip>
<pb-tip values='["elegance","beauty"]'>This is something everyone has to like about this MRQ</pb-tip> <pb-tip values='["elegance","beauty"]'>This is something everyone has to like about this MRQ</pb-tip>
<pb-tip values='["bugs"]'>Nah, there aren't any!</pb-tip> <pb-tip values='["bugs"]'>Nah, there aren't any!</pb-tip>
{% if include_review_tips %}
<pb-message type="on-assessment-review-question">
<html>Take another look at <a href="#">Lesson 3</a></html>
</pb-message>
{% endif %}
</pb-mrq> </pb-mrq>
<pb-message type="on-assessment-review"> <pb-message type="on-assessment-review">
......
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