From 96eeb3fcc5dc8b84bb49b42a367c5580756370d2 Mon Sep 17 00:00:00 2001 From: "Albert St. Aubin" Date: Thu, 17 Nov 2016 11:57:15 -0500 Subject: [PATCH 1/2] Additional acceptance test to check the problem meta is not altered by sequence navigation. --- common/test/acceptance/pages/lms/problem.py | 7 ++++ .../tests/lms/test_lms_courseware.py | 32 ++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/common/test/acceptance/pages/lms/problem.py b/common/test/acceptance/pages/lms/problem.py index 03c1083ca8..03f0130e78 100644 --- a/common/test/acceptance/pages/lms/problem.py +++ b/common/test/acceptance/pages/lms/problem.py @@ -47,6 +47,13 @@ class ProblemPage(PageObject): """ return self.q(css="div.problems-wrapper").text[0] + @property + def problem_meta(self): + """ + Return the problem meta text + """ + return self.q(css=".problems-wrapper .problem-progress").text[0] + @property def message_text(self): """ diff --git a/common/test/acceptance/tests/lms/test_lms_courseware.py b/common/test/acceptance/tests/lms/test_lms_courseware.py index e93abf8bf8..f93a18d1b9 100644 --- a/common/test/acceptance/tests/lms/test_lms_courseware.py +++ b/common/test/acceptance/tests/lms/test_lms_courseware.py @@ -663,7 +663,7 @@ class CoursewareMultipleVerticalsTest(UniqueCourseTest, EventsTestMixin): class ProblemStateOnNavigationTest(UniqueCourseTest): """ - Test courseware with problems in multiple verticals + Test courseware with problems in multiple verticals. """ USERNAME = "STUDENT_TESTER" EMAIL = "student101@example.com" @@ -714,6 +714,36 @@ class ProblemStateOnNavigationTest(UniqueCourseTest): ) self.assertEqual(self.problem_page.problem_name, problem_name) + def test_problem_meta_after_submit_and_navigate(self): + """ + Scenario: + I go to sequential position 1 + Facing problem1, I select 'choice_1' + Then I click submit button + Then I go to sequential position 2 + Then I came back to sequential position 1 again + Facing problem1, I observe the problem1 meta and score data is not + altered before and after sequence navigation + """ + # Go to sequential position 1 and assert that we are on problem 1. + self.go_to_tab_and_assert_problem(1, self.problem1_name) + + # Update problem 1's content state by clicking check button. + self.problem_page.click_choice('choice_choice_1') + self.problem_page.click_submit() + self.problem_page.wait_for_expected_status('label.choicegroup_incorrect', 'incorrect') + + before_meta = self.problem_page.problem_meta + + # Go to sequential position 2 and assert that we are on problem 2. + self.go_to_tab_and_assert_problem(2, self.problem2_name) + + # Come back to our original unit in the sequence and assert that the content hasn't changed. + self.go_to_tab_and_assert_problem(1, self.problem1_name) + + after_meta = self.problem_page.problem_meta + self.assertEqual(before_meta, after_meta) + def test_perform_problem_submit_and_navigate(self): """ Scenario: From 25fd6b57af4273331296ac343cf65aa4a425dbfa Mon Sep 17 00:00:00 2001 From: "Albert St. Aubin" Date: Mon, 21 Nov 2016 11:31:17 -0500 Subject: [PATCH 2/2] Test update for PR comments --- .../tests/lms/test_lms_courseware.py | 42 ++++++------------- 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/common/test/acceptance/tests/lms/test_lms_courseware.py b/common/test/acceptance/tests/lms/test_lms_courseware.py index f93a18d1b9..4130e4ad7e 100644 --- a/common/test/acceptance/tests/lms/test_lms_courseware.py +++ b/common/test/acceptance/tests/lms/test_lms_courseware.py @@ -714,36 +714,6 @@ class ProblemStateOnNavigationTest(UniqueCourseTest): ) self.assertEqual(self.problem_page.problem_name, problem_name) - def test_problem_meta_after_submit_and_navigate(self): - """ - Scenario: - I go to sequential position 1 - Facing problem1, I select 'choice_1' - Then I click submit button - Then I go to sequential position 2 - Then I came back to sequential position 1 again - Facing problem1, I observe the problem1 meta and score data is not - altered before and after sequence navigation - """ - # Go to sequential position 1 and assert that we are on problem 1. - self.go_to_tab_and_assert_problem(1, self.problem1_name) - - # Update problem 1's content state by clicking check button. - self.problem_page.click_choice('choice_choice_1') - self.problem_page.click_submit() - self.problem_page.wait_for_expected_status('label.choicegroup_incorrect', 'incorrect') - - before_meta = self.problem_page.problem_meta - - # Go to sequential position 2 and assert that we are on problem 2. - self.go_to_tab_and_assert_problem(2, self.problem2_name) - - # Come back to our original unit in the sequence and assert that the content hasn't changed. - self.go_to_tab_and_assert_problem(1, self.problem1_name) - - after_meta = self.problem_page.problem_meta - self.assertEqual(before_meta, after_meta) - def test_perform_problem_submit_and_navigate(self): """ Scenario: @@ -765,6 +735,7 @@ class ProblemStateOnNavigationTest(UniqueCourseTest): # Save problem 1's content state as we're about to switch units in the sequence. problem1_content_before_switch = self.problem_page.problem_content + before_meta = self.problem_page.problem_meta # Go to sequential position 2 and assert that we are on problem 2. self.go_to_tab_and_assert_problem(2, self.problem2_name) @@ -772,7 +743,10 @@ class ProblemStateOnNavigationTest(UniqueCourseTest): # Come back to our original unit in the sequence and assert that the content hasn't changed. self.go_to_tab_and_assert_problem(1, self.problem1_name) problem1_content_after_coming_back = self.problem_page.problem_content + after_meta = self.problem_page.problem_meta + self.assertEqual(problem1_content_before_switch, problem1_content_after_coming_back) + self.assertEqual(before_meta, after_meta) def test_perform_problem_save_and_navigate(self): """ @@ -795,6 +769,7 @@ class ProblemStateOnNavigationTest(UniqueCourseTest): # Save problem 1's content state as we're about to switch units in the sequence. problem1_content_before_switch = self.problem_page.problem_input_content + before_meta = self.problem_page.problem_meta # Go to sequential position 2 and assert that we are on problem 2. self.go_to_tab_and_assert_problem(2, self.problem2_name) @@ -804,7 +779,10 @@ class ProblemStateOnNavigationTest(UniqueCourseTest): # Come back to our original unit in the sequence and assert that the content hasn't changed. self.go_to_tab_and_assert_problem(1, self.problem1_name) problem1_content_after_coming_back = self.problem_page.problem_input_content + after_meta = self.problem_page.problem_meta + self.assertIn(problem1_content_after_coming_back, problem1_content_before_switch) + self.assertEqual(before_meta, after_meta) def test_perform_problem_reset_and_navigate(self): """ @@ -829,6 +807,7 @@ class ProblemStateOnNavigationTest(UniqueCourseTest): # Save problem 1's content state as we're about to switch units in the sequence. problem1_content_before_switch = self.problem_page.problem_content + before_meta = self.problem_page.problem_meta # Go to sequential position 2 and assert that we are on problem 2. self.go_to_tab_and_assert_problem(2, self.problem2_name) @@ -836,7 +815,10 @@ class ProblemStateOnNavigationTest(UniqueCourseTest): # Come back to our original unit in the sequence and assert that the content hasn't changed. self.go_to_tab_and_assert_problem(1, self.problem1_name) problem1_content_after_coming_back = self.problem_page.problem_content + after_meta = self.problem_page.problem_meta + self.assertEqual(problem1_content_before_switch, problem1_content_after_coming_back) + self.assertEqual(before_meta, after_meta) class SubsectionHiddenAfterDueDateTest(UniqueCourseTest):