def test_reset_correctness_after_changing_answer(self, input_value, correctness, next_input): """ Scenario: Test that formula problem can be resetted after changing the answer. Given I am attempting a formula problem type with randomization:always configuration When I input an answer Then the mathjax generated preview should be visible When I submit the problem, I can see the correctness status When I only input another answer Then the correctness status is no longer visible And I am able to see the reset button And when I click the reset button Then input pane contents are cleared """ problem_page = ProblemPage(self.browser) problem_page.fill_answer_numerical(input_value) problem_page.verify_mathjax_rendered_in_preview() problem_page.click_submit() self.assertEqual(problem_page.get_simpleprob_correctness(), correctness) problem_page.fill_answer_numerical(next_input) self.assertIsNone(problem_page.get_simpleprob_correctness()) self.assertTrue(problem_page.is_reset_button_present()) problem_page.click_reset() self.assertEqual(problem_page.get_numerical_input_value, '')
def test_score_reset_after_resetting_problem(self, input_value, correctness, score_before_reset, score_after_reset): """ Scenario: Test that score resets after the formula problem is resetted. Given I am attempting a formula problem type with randomization:always configuration When I input the answer Then I should be able to see the MathJax generated preview When I submit the problem Then I should be able to view the score that I received And The reset button should be present and is clickable When the reset button is clicked Then the score resets to zero """ problem_page = ProblemPage(self.browser) problem_page.fill_answer_numerical(input_value) problem_page.verify_mathjax_rendered_in_preview() problem_page.click_submit() self.assertEqual(problem_page.get_simpleprob_correctness(), correctness) self.assertIn(score_before_reset, problem_page.problem_progress_graded_value) self.assertTrue(problem_page.is_reset_button_present()) problem_page.click_reset() self.assertIn(score_after_reset, problem_page.problem_progress_graded_value)
def test_reset_problem_after_submission(self, input_value, correctness): """ Scenario: Test that reset button works regardless the submission correctness status. Given I am attempting a formula problem type with randomization:always configuration When I input the answer Then I should be able to see the MathJax generated preview When I submit the problem Then I should be able to see the reset button When reset button is clicked Then the input pane contents should be clear """ problem_page = ProblemPage(self.browser) problem_page.fill_answer_numerical(input_value) problem_page.verify_mathjax_rendered_in_preview() problem_page.click_submit() self.assertEqual(problem_page.get_simpleprob_correctness(), correctness) self.assertTrue(problem_page.is_reset_button_present()) problem_page.click_reset() self.assertEqual(problem_page.get_numerical_input_value, '')