Fix for flaky behavior in cohort search tests. TNL-2362

This commit is contained in:
Ben Patterson
2015-06-10 07:46:35 -04:00
parent 242b3736a0
commit 35aed4bf87

View File

@@ -299,6 +299,11 @@ class CohortManagementSection(PageObject):
textinput.send_keys(user)
textinput.send_keys(",")
self.q(css=self._bounded_selector("div.cohort-management-group-add .action-primary")).first.click()
# Expect the confirmation message substring. (The full message will differ depending on 1 or >1 students added)
self.wait_for(
lambda: "added to this cohort" in self.get_cohort_confirmation_messages(wait_for_messages=True)[0],
"Student(s) added confirmation message."
)
def get_cohort_student_input_field_value(self):
"""
@@ -393,14 +398,14 @@ class CohortManagementSection(PageObject):
return self._get_messages(title_css, detail_css, wait_for_messages=wait_for_messages)
def _get_cohort_messages(self, type):
def _get_cohort_messages(self, type, wait_for_messages=False):
"""
Returns array of messages related to manipulating cohorts directly through the UI for the given type.
"""
title_css = "div.cohort-management-group-add .cohort-" + type + " .message-title"
detail_css = "div.cohort-management-group-add .cohort-" + type + " .summary-item"
return self._get_messages(title_css, detail_css)
return self._get_messages(title_css, detail_css, wait_for_messages)
def get_csv_messages(self):
"""
@@ -428,12 +433,12 @@ class CohortManagementSection(PageObject):
messages.append(detail.text)
return messages
def get_cohort_confirmation_messages(self):
def get_cohort_confirmation_messages(self, wait_for_messages=False):
"""
Returns an array of messages present in the confirmation area of the cohort management UI.
The first entry in the array is the title. Any further entries are the details.
"""
return self._get_cohort_messages("confirmations")
return self._get_cohort_messages("confirmations", wait_for_messages)
def get_cohort_error_messages(self):
"""