Commit 35aed4bf by Ben Patterson

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

parent 242b3736
...@@ -299,6 +299,11 @@ class CohortManagementSection(PageObject): ...@@ -299,6 +299,11 @@ class CohortManagementSection(PageObject):
textinput.send_keys(user) textinput.send_keys(user)
textinput.send_keys(",") textinput.send_keys(",")
self.q(css=self._bounded_selector("div.cohort-management-group-add .action-primary")).first.click() 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): def get_cohort_student_input_field_value(self):
""" """
...@@ -393,14 +398,14 @@ class CohortManagementSection(PageObject): ...@@ -393,14 +398,14 @@ class CohortManagementSection(PageObject):
return self._get_messages(title_css, detail_css, wait_for_messages=wait_for_messages) 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. 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" title_css = "div.cohort-management-group-add .cohort-" + type + " .message-title"
detail_css = "div.cohort-management-group-add .cohort-" + type + " .summary-item" 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): def get_csv_messages(self):
""" """
...@@ -428,12 +433,12 @@ class CohortManagementSection(PageObject): ...@@ -428,12 +433,12 @@ class CohortManagementSection(PageObject):
messages.append(detail.text) messages.append(detail.text)
return messages 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. 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. 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): def get_cohort_error_messages(self):
""" """
......
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