Commit fa2b84d9 by Ben Patterson

Merge pull request #7968 from edx/benp/fix-cohort-flakiness

Ensure cohort management section has loaded.
parents 2b6ad20f 609feaae
...@@ -34,6 +34,8 @@ class InstructorDashboardPage(CoursePage): ...@@ -34,6 +34,8 @@ class InstructorDashboardPage(CoursePage):
""" """
self.q(css='a[data-section=cohort_management]').first.click() self.q(css='a[data-section=cohort_management]').first.click()
cohort_management_section = CohortManagementSection(self.browser) cohort_management_section = CohortManagementSection(self.browser)
# The first time cohort management is selected, an ajax call is made.
cohort_management_section.wait_for_ajax()
cohort_management_section.wait_for_page() cohort_management_section.wait_for_page()
return cohort_management_section return cohort_management_section
...@@ -111,7 +113,21 @@ class CohortManagementSection(PageObject): ...@@ -111,7 +113,21 @@ class CohortManagementSection(PageObject):
} }
def is_browser_on_page(self): def is_browser_on_page(self):
return self.q(css='.cohort-management').present """
Cohorts management exists under one class; however, render time can be longer because of sub-classes
that must be rendered beneath it. To determine if the browser is on the cohorts management page (and
allow for it to fully-render), we need to consider three different states of the page:
* When no cohorts have been added yet
* When a new cohort is being added (a confirmation state)
* When cohorts exist (the traditional management page)
"""
cohorts_warning_title = '.message-warning .message-title'
if self.q(css=cohorts_warning_title).visible:
return self.q(css='.message-title').text[0] == u'You currently have no cohorts configured'
# The page may be in either the traditional management state, or an 'add new cohort' state.
# Confirm the CSS class is visible because the CSS class can exist on the page even in different states.
return self.q(css='.cohort-management-nav').visible or self.q(css='.new-cohort-form').visible
def _bounded_selector(self, selector): def _bounded_selector(self, selector):
""" """
...@@ -480,13 +496,8 @@ class CohortManagementSection(PageObject): ...@@ -480,13 +496,8 @@ class CohortManagementSection(PageObject):
""" """
Shows the discussion topics. Shows the discussion topics.
""" """
EmptyPromise( self.q(css=self._bounded_selector(".toggle-cohort-management-discussions")).first.click()
lambda: self.q(css=self._bounded_selector('.toggle-cohort-management-discussions')).results != 0, self.wait_for_element_visibility("#cohort-management-discussion-topics", "Waiting for discussions to appear")
"Waiting for discussion section to show"
).fulfill()
# If the discussion topic section has not yet been toggled on, click on the toggle link.
self.q(css=self._bounded_selector(".toggle-cohort-management-discussions")).click()
def discussion_topics_visible(self): def discussion_topics_visible(self):
""" """
......
...@@ -4,7 +4,6 @@ End-to-end tests related to the cohort management on the LMS Instructor Dashboar ...@@ -4,7 +4,6 @@ End-to-end tests related to the cohort management on the LMS Instructor Dashboar
""" """
from datetime import datetime from datetime import datetime
from flaky import flaky
from pytz import UTC, utc from pytz import UTC, utc
from bok_choy.promise import EmptyPromise from bok_choy.promise import EmptyPromise
...@@ -719,7 +718,6 @@ class CohortDiscussionTopicsTest(UniqueCourseTest, CohortTestMixin): ...@@ -719,7 +718,6 @@ class CohortDiscussionTopicsTest(UniqueCourseTest, CohortTestMixin):
self.reload_page() self.reload_page()
self.assertEqual(self.cohort_management_page.get_cohorted_topics_count(key), cohorted_topics) self.assertEqual(self.cohort_management_page.get_cohorted_topics_count(key), cohorted_topics)
@flaky # TODO: fix this, see TNL-2120
def test_cohort_course_wide_discussion_topic(self): def test_cohort_course_wide_discussion_topic(self):
""" """
Scenario: cohort a course-wide discussion topic. Scenario: cohort a course-wide discussion topic.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment