示例#1
0
 def test_check_hint(self):
     """
     Test clicking Check shows the extended hint in the problem message.
     """
     self.courseware_page.visit()
     problem_page = ProblemPage(self.browser)
     self.assertEqual(problem_page.problem_text[0], u'question text')
     problem_page.fill_answer('C')
     problem_page.click_check()
     self.assertEqual(problem_page.message_text, u'Incorrect: aa bb cc')
     # Check for corresponding tracking event
     actual_events = self.wait_for_events(
         event_filter={'event_type': 'edx.problem.hint.feedback_displayed'},
         number_of_matches=1)
     self.assert_events_match([{
         'event': {
             'hint_label': u'Incorrect',
             'trigger_type': 'single',
             'student_answer': [u'C'],
             'correctness': False,
             'question_type': 'stringresponse',
             'hints': [{
                 'text': '<a href="#">aa bb</a> cc'
             }]
         }
     }], actual_events)
示例#2
0
 def test_conditional_displays_content(self):
     self.install_course_fixture()
     self.courseware_page.visit()
     # Answer the problem
     problem_page = ProblemPage(self.browser)
     problem_page.fill_answer('correct string')
     problem_page.click_submit()
     # The conditional does not update on its own, so we need to reload the page.
     self.courseware_page.visit()
     # Verify that we can see the content.
     conditional_page = ConditionalPage(self.browser)
     self.assertTrue(conditional_page.is_content_visible())
 def test_conditional_displays_content(self):
     self.install_course_fixture()
     self.courseware_page.visit()
     # Answer the problem
     problem_page = ProblemPage(self.browser)
     problem_page.fill_answer('correct string')
     problem_page.click_submit()
     # The conditional does not update on its own, so we need to reload the page.
     self.courseware_page.visit()
     # Verify that we can see the content.
     conditional_page = ConditionalPage(self.browser)
     self.assertTrue(conditional_page.is_content_visible())
示例#4
0
 def verify_check_hint(self, answer, answer_text, expected_events):
     """
     Verify clicking Check shows the extended hint in the problem message.
     """
     self.courseware_page.visit()
     problem_page = ProblemPage(self.browser)
     self.assertEqual(problem_page.problem_text[0], u'question text')
     problem_page.fill_answer(answer)
     problem_page.click_submit()
     self.assertEqual(problem_page.message_text, answer_text)
     # Check for corresponding tracking event
     actual_events = self.wait_for_events(
         event_filter={'event_type': 'edx.problem.hint.feedback_displayed'},
         number_of_matches=1)
     self.assert_events_match(expected_events, actual_events)
示例#5
0
 def verify_check_hint(self, answer, answer_text, expected_events):
     """
     Verify clicking Check shows the extended hint in the problem message.
     """
     self.courseware_page.visit()
     problem_page = ProblemPage(self.browser)
     self.assertEqual(problem_page.problem_text[0], u'question text')
     problem_page.fill_answer(answer)
     problem_page.click_submit()
     self.assertEqual(problem_page.message_text, answer_text)
     # Check for corresponding tracking event
     actual_events = self.wait_for_events(
         event_filter={'event_type': 'edx.problem.hint.feedback_displayed'},
         number_of_matches=1
     )
     self.assert_events_match(expected_events, actual_events)
示例#6
0
    def test_python_execution_in_problem(self):
        # Navigate to the problem page
        self.course_home_page.visit()
        self.course_home_page.outline.go_to_section('Test Section', 'Test Subsection')

        problem_page = ProblemPage(self.browser)
        self.assertEqual(problem_page.problem_name.upper(), 'PYTHON PROBLEM')

        # Does the page have computation results?
        self.assertIn("What is the sum of 17 and 3?", problem_page.problem_text)

        # Fill in the answer correctly.
        problem_page.fill_answer("20")
        problem_page.click_submit()
        self.assertTrue(problem_page.is_correct())

        # Fill in the answer incorrectly.
        problem_page.fill_answer("4")
        problem_page.click_submit()
        self.assertFalse(problem_page.is_correct())
示例#7
0
文件: test_lms.py 项目: fdns/eol-edx
    def test_python_execution_in_problem(self):
        # Navigate to the problem page
        self.course_home_page.visit()
        self.course_home_page.outline.go_to_section('Test Section', 'Test Subsection')

        problem_page = ProblemPage(self.browser)
        self.assertEqual(problem_page.problem_name.upper(), 'PYTHON PROBLEM')

        # Does the page have computation results?
        self.assertIn("What is the sum of 17 and 3?", problem_page.problem_text)

        # Fill in the answer correctly.
        problem_page.fill_answer("20")
        problem_page.click_submit()
        self.assertTrue(problem_page.is_correct())

        # Fill in the answer incorrectly.
        problem_page.fill_answer("4")
        problem_page.click_submit()
        self.assertFalse(problem_page.is_correct())
 def test_check_hint(self):
     """
     Test clicking Check shows the extended hint in the problem message.
     """
     self.courseware_page.visit()
     problem_page = ProblemPage(self.browser)
     self.assertEqual(problem_page.problem_text[0], u'question text')
     problem_page.fill_answer('C')
     problem_page.click_check()
     self.assertEqual(problem_page.message_text, u'Incorrect: aa bb cc')
     # Check for corresponding tracking event
     actual_events = self.wait_for_events(
         event_filter={'event_type': 'edx.problem.hint.feedback_displayed'},
         number_of_matches=1
     )
     self.assert_events_match(
         [{'event': {'hint_label': u'Incorrect',
                     'trigger_type': 'single',
                     'student_answer': [u'C'],
                     'correctness': False,
                     'question_type': 'stringresponse',
                     'hints': [{'text': '<a href="#">aa bb</a> cc'}]}}],
         actual_events)