From cb7e260c9767eb25a4da964b4fd3afdf19e69f18 Mon Sep 17 00:00:00 2001 From: stu Date: Mon, 13 Feb 2017 17:15:14 -0500 Subject: [PATCH] fix flaky progress page and note tests --- common/test/acceptance/pages/studio/overview.py | 3 +++ common/test/acceptance/tests/lms/test_lms_courseware.py | 2 +- common/test/acceptance/tests/lms/test_lms_edxnotes.py | 5 +++-- common/test/acceptance/tests/lms/test_progress_page.py | 4 +--- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/common/test/acceptance/pages/studio/overview.py b/common/test/acceptance/pages/studio/overview.py index 8218522201..a0c0a051a6 100644 --- a/common/test/acceptance/pages/studio/overview.py +++ b/common/test/acceptance/pages/studio/overview.py @@ -5,6 +5,7 @@ import datetime from bok_choy.page_object import PageObject from bok_choy.promise import EmptyPromise +from bok_choy.javascript import js_defined, wait_for_js from selenium.webdriver import ActionChains from selenium.webdriver.support.ui import Select @@ -18,6 +19,7 @@ from common.test.acceptance.pages.studio.container import ContainerPage from common.test.acceptance.pages.studio.utils import set_input_value_and_save, set_input_value +@js_defined('jQuery') class CourseOutlineItem(object): """ A mixin class for any :class:`PageObject` shown in a course outline. @@ -174,6 +176,7 @@ class CourseOutlineItem(object): element = self.q(css=self._bounded_selector(".status-grading-value")) # pylint: disable=no-member return element.first.text[0] if element.present else None + @wait_for_js def publish(self): """ Publish the unit. diff --git a/common/test/acceptance/tests/lms/test_lms_courseware.py b/common/test/acceptance/tests/lms/test_lms_courseware.py index b8e20a28ef..3299e7094e 100644 --- a/common/test/acceptance/tests/lms/test_lms_courseware.py +++ b/common/test/acceptance/tests/lms/test_lms_courseware.py @@ -436,7 +436,7 @@ class CoursewareMultipleVerticalsTest(UniqueCourseTest, EventsTestMixin): self.courseware_page.visit() self.course_nav = CourseNavPage(self.browser) - @flaky #TODO: fix this, see TNL-5762 + @flaky # TODO: fix this, see TNL-5762 def test_navigation_buttons(self): # start in first section self.assert_navigation_state('Test Section 1', 'Test Subsection 1,1', 0, next_enabled=True, prev_enabled=False) diff --git a/common/test/acceptance/tests/lms/test_lms_edxnotes.py b/common/test/acceptance/tests/lms/test_lms_edxnotes.py index ea833adc47..c81a2df075 100644 --- a/common/test/acceptance/tests/lms/test_lms_edxnotes.py +++ b/common/test/acceptance/tests/lms/test_lms_edxnotes.py @@ -274,7 +274,7 @@ class EdxNotesDefaultInteractionsTest(EdxNotesTestMixin): components = self.note_unit_page.components self.assert_notes_are_removed(components) - @flaky #TODO: fix this, see TNL-6494 + @flaky # TODO: fix this, see TNL-6494 def test_can_create_note_with_tags(self): """ Scenario: a user of notes can define one with tags @@ -1062,7 +1062,7 @@ class EdxNotesPageTest(EventsTestMixin, EdxNotesTestMixin): self.assertNotIn(u"Search Results", self.notes_page.tabs) self.assertEqual(len(self.notes_page.notes), 5) - @flaky #TODO: fix this, see TNL-6493 + @flaky # TODO: fix this, see TNL-6493 def test_open_note_when_accessed_from_notes_page(self): """ Scenario: Ensure that the link to the Unit opens a note only once. @@ -1117,6 +1117,7 @@ class EdxNotesPageTest(EventsTestMixin, EdxNotesTestMixin): note = self.note_unit_page.notes[0] self.assertFalse(note.is_visible) self.courseware_page.go_to_sequential_position(1) + self.courseware_page.wait_for_ajax() note = self.note_unit_page.notes[0] self.assertFalse(note.is_visible) diff --git a/common/test/acceptance/tests/lms/test_progress_page.py b/common/test/acceptance/tests/lms/test_progress_page.py index 38c9f2db86..af3fb04b03 100644 --- a/common/test/acceptance/tests/lms/test_progress_page.py +++ b/common/test/acceptance/tests/lms/test_progress_page.py @@ -5,7 +5,6 @@ progress page. """ import ddt -from bok_choy.javascript import js_defined from contextlib import contextmanager from nose.plugins.attrib import attr from flaky import flaky @@ -127,7 +126,6 @@ class ProgressPageBaseTest(UniqueCourseTest): @attr(shard=9) @ddt.ddt -@js_defined('window.jQuery') class PersistentGradesTest(ProgressPageBaseTest): """ Test that grades for completed assessments are persisted @@ -229,7 +227,7 @@ class PersistentGradesTest(ProgressPageBaseTest): _change_subsection_structure, _change_weight_for_problem ) - @flaky #TODO: fix this, see TNL-6040 + @flaky # TODO: fix this, see TNL-6040 def test_content_changes_do_not_change_score(self, edit): with self._logged_in_session(): self.courseware_page.visit()