Commit cc5c2727 by Jacek Bzdak

Tests for suppressing question level feedback

parent e612181c
...@@ -63,7 +63,7 @@ class PopupCheckMixin(object): ...@@ -63,7 +63,7 @@ class PopupCheckMixin(object):
self.assertFalse(item_feedback_popup.is_displayed()) self.assertFalse(item_feedback_popup.is_displayed())
class ProblemBuilderBaseTest(SeleniumXBlockTest, PopupCheckMixin): class ProblemBuilderBaseTest(SeleniumXBlockTest, PopupCheckMixin, ScrollToMixin):
""" """
The new base class for integration tests. The new base class for integration tests.
Scenarios can be loaded and edited on the fly. Scenarios can be loaded and edited on the fly.
......
...@@ -249,10 +249,18 @@ class ProblemBuilderQuestionnaireBlockTest(ProblemBuilderBaseTest): ...@@ -249,10 +249,18 @@ class ProblemBuilderQuestionnaireBlockTest(ProblemBuilderBaseTest):
self.click_choice(mrq, "Its elegance") self.click_choice(mrq, "Its elegance")
self.assertTrue(submit.is_enabled()) self.assertTrue(submit.is_enabled())
def test_does_not_persist_mcq_feedback_on_page_reload_if_disabled(self): @ddt.unpack
@ddt.data(
# Standard scenario
("feedback_persistence.xml", ),
# Like feedback_persistence but instead of tips in MCQ
# has a question level feedback. This feedback should also be suppressed.
("feedback_persistence_no_tips_in_mcq.xml", )
)
def test_does_not_persist_mcq_feedback_on_page_reload_if_disabled(self, scenario):
with mock.patch("problem_builder.mentoring.MentoringBlock.get_options") as patched_options: with mock.patch("problem_builder.mentoring.MentoringBlock.get_options") as patched_options:
patched_options.return_value = {'pb_mcq_hide_previous_answer': True} patched_options.return_value = {'pb_mcq_hide_previous_answer': True}
mentoring = self.load_scenario("feedback_persistence.xml") mentoring = self.load_scenario(scenario)
answer, mcq, mrq, rating = self._get_controls(mentoring) answer, mcq, mrq, rating = self._get_controls(mentoring)
messages = self._get_messages_element(mentoring) messages = self._get_messages_element(mentoring)
......
<vertical_demo>
<problem-builder url_name="feedback" enforce_dependency="false">
<pb-answer name="feedback_answer_1" />
<pb-mcq name="feedback_mcq_2" question="Do you like this MCQ?" correct_choices='["yes"]' message="Question level Feedback">
<pb-choice value="yes">Yes</pb-choice>
<pb-choice value="maybenot">Maybe not</pb-choice>
<pb-choice value="understand">I don't understand</pb-choice>
</pb-mcq>
<pb-mrq name="feedback_mrq_3" question="What do you like in this MRQ?" required_choices='["elegance","gracefulness","beauty"]'>
<pb-choice value="elegance">Its elegance</pb-choice>
<pb-choice value="beauty">Its beauty</pb-choice>
<pb-choice value="gracefulness">Its gracefulness</pb-choice>
<pb-choice value="bugs">Its bugs</pb-choice>
<pb-tip values='["elegance"]'>This is something everyone has to like about this MRQ</pb-tip>
<pb-tip values='["beauty"]'>This is something everyone has to like about beauty</pb-tip>
<pb-tip values='["gracefulness"]'>This MRQ is indeed very graceful</pb-tip>
<pb-tip values='["bugs"]'>Nah, there aren't any!</pb-tip>
</pb-mrq>
<pb-rating name="feedback_rating_4" low="Not good at all" high="Extremely good" question="How do you rate this MCQ?" correct_choices='["4","5"]'>
<pb-choice value="notwant">I don't want to rate it</pb-choice>
<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>
</pb-rating>
<pb-message type="completed">All Good</pb-message>
<pb-message type="incomplete">Not done yet</pb-message>
</problem-builder>
</vertical_demo>
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