Skip to content

Commit b3ef94b

Browse files
fix: added open_dropdown flag to avoid clicking dropdown again
1 parent 28d9a82 commit b3ef94b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pytest_splunk_addon_ui_smartx/components/controls/single_select.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,19 @@ def search_get_list(self, value):
114114
searched_values = list(self._list_visible_values())
115115
else:
116116
self.wait_for_search_list()
117-
searched_values = list(self._list_visible_values())
117+
searched_values = list(self._list_visible_values(open_dropdown=False))
118118
self.input.send_keys(Keys.ESCAPE)
119119
self.wait_for("container")
120120
return searched_values
121121

122-
def _list_visible_values(self):
122+
def _list_visible_values(self, open_dropdown=True):
123123
"""
124124
Gets list of values which are visible. Used while filtering
125+
:param open_dropdown: Whether or not the dropdown should be opened
125126
:returns: List of the values that are visible
126127
"""
127-
self.dropdown.click()
128+
if open_dropdown:
129+
self.dropdown.click()
128130
if self.allow_new_values:
129131
popoverid = '#' + self.combobox.get_attribute("data-test-popover-id")
130132
self.elements.update({
@@ -286,7 +288,7 @@ def wait_for_search_list(self):
286288
Wait for SingleSelect search to populate
287289
"""
288290
def _wait_for_search_list(driver):
289-
return len(list(self._list_visible_values())) > 0
291+
return len(list(self._list_visible_values(open_dropdown=False))) > 0
290292
self.wait_for(_wait_for_search_list, msg="No values found in SingleSelect search")
291293

292294
def is_editable(self):

0 commit comments

Comments
 (0)