Beispiel #1
0
    def test_logout_after_click_redirect(self):
        """
        1) User goes to a problem page.
        2) User fills out an answer to the problem.
        3) User is logged out because their session id is invalidated or removed.
        4) User clicks "check", and sees a confirmation modal asking them to
           re-authenticate, since they've just been logged out.
        5) User clicks "ok".
        6) User is redirected to the login page.
        7) User logs in.
        8) User is redirected back to the problem page they started out on.
        9) User is able to submit an answer
        """
        self.courseware_page.visit()
        problem_page = ProblemPage(self.browser)
        self.assertEqual(problem_page.problem_name, 'TEST PROBLEM')
        problem_page.fill_answer_numerical('1')

        self.log_user_out()
        with problem_page.handle_alert(confirm=True):
            problem_page.click_submit()

        login_page = CombinedLoginAndRegisterPage(self.browser)
        login_page.wait_for_page()

        login_page.login(self.email, self.password)

        problem_page.wait_for_page()
        self.assertEqual(problem_page.problem_name, 'TEST PROBLEM')

        problem_page.fill_answer_numerical('1')
        problem_page.click_submit()
        self.assertTrue(problem_page.simpleprob_is_correct())
    def test_logout_after_click_redirect(self):
        """
        1) User goes to a problem page.
        2) User fills out an answer to the problem.
        3) User is logged out because their session id is invalidated or removed.
        4) User clicks "check", and sees a confirmation modal asking them to
           re-authenticate, since they've just been logged out.
        5) User clicks "ok".
        6) User is redirected to the login page.
        7) User logs in.
        8) User is redirected back to the problem page they started out on.
        9) User is able to submit an answer
        """
        self.courseware_page.visit()
        problem_page = ProblemPage(self.browser)
        self.assertEqual(problem_page.problem_name, 'TEST PROBLEM')
        problem_page.fill_answer_numerical('1')

        self.log_user_out()
        with problem_page.handle_alert(confirm=True):
            problem_page.click_submit()

        login_page = CombinedLoginAndRegisterPage(self.browser)
        login_page.wait_for_page()

        login_page.login(self.email, self.password)

        problem_page.wait_for_page()
        self.assertEqual(problem_page.problem_name, 'TEST PROBLEM')

        problem_page.fill_answer_numerical('1')
        problem_page.click_submit()
        self.assertTrue(problem_page.simpleprob_is_correct())
Beispiel #3
0
    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, '')
    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, '')
Beispiel #5
0
    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_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())
Beispiel #7
0
    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, '')