Skip to content

Commit

Permalink
Test for new review tips feature
Browse files Browse the repository at this point in the history
  • Loading branch information
bradenmacdonald committed Sep 5, 2015
1 parent 74fc6b0 commit 77ca788
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
50 changes: 50 additions & 0 deletions problem_builder/tests/integration/test_assessment.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,56 @@ def test_assessment(self, params):
if extended_feedback:
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):
"""
No 'Next Question' button on single question assessment.
Expand Down
15 changes: 15 additions & 0 deletions problem_builder/tests/integration/xml_templates/assessment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
<pb-tip values='["yes"]'>Great!</pb-tip>
<pb-tip values='["maybenot"]'>Ah, damn.</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-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"]'>
Expand All @@ -30,6 +35,11 @@
<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='["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-mrq name="mrq_1_1" question="What do you like in this MRQ?" required_choices='["gracefulness","elegance","beauty"]'>
Expand All @@ -41,6 +51,11 @@
<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='["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-message type="on-assessment-review">
Expand Down

0 comments on commit 77ca788

Please sign in to comment.