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_button_not_rendered_after_correct_submission(self): """ Scenario: Verify that formula problem can not be resetted after an incorrect submission. Given I am attempting a formula response problem type When I input a correct answer Then I should be able to see the mathjax generated preview When I submit the answer Then the correct status is visible And reset button is not rendered """ problem_page = ProblemPage(self.browser) problem_page.fill_answer_numerical('R_1*R_2/R_3') problem_page.verify_mathjax_rendered_in_preview() problem_page.click_submit() self.assertTrue(problem_page.simpleprob_is_correct()) self.assertFalse(problem_page.is_reset_button_present())
def test_reset_problem_after_incorrect_submission(self): """ Scenario: Verify that formula problem can be resetted after an incorrect submission. Given I am attempting a formula response problem type When I input an incorrect answer Then the answer preview is generated using MathJax When I submit the problem Then I can see incorrect status and a reset button When I click reset, the input pane contents get clear """ problem_page = ProblemPage(self.browser) problem_page.fill_answer_numerical('R_1*R_2') problem_page.verify_mathjax_rendered_in_preview() problem_page.click_submit() self.assertFalse(problem_page.simpleprob_is_correct()) self.assertTrue(problem_page.is_reset_button_present()) problem_page.click_reset() self.assertEqual(problem_page.get_numerical_input_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, '')
def test_reset_problem_after_changing_correctness(self): """ Scenario: Verify that formula problem can be resetted after changing the correctness. Given I am attempting a formula problem type When I answer it correctly Then the correctness status should be visible And reset button is not rendered When I change my submission to incorrect Then the reset button appears and is clickable """ problem_page = ProblemPage(self.browser) problem_page.fill_answer_numerical('R_1*R_2/R_3') problem_page.verify_mathjax_rendered_in_preview() problem_page.click_submit() self.assertTrue(problem_page.simpleprob_is_correct()) self.assertFalse(problem_page.is_reset_button_present()) problem_page.fill_answer_numerical('R_1/R_3') problem_page.click_submit() self.assertFalse(problem_page.simpleprob_is_correct()) self.assertTrue(problem_page.is_reset_button_present()) problem_page.click_reset() self.assertEqual(problem_page.get_numerical_input_value, '')