Skip to content

Commit f3bdb4a

Browse files
Merge pull request #54 from splunk/feature/fix-alert-action-tests
Fixed Alert Action singleselect component
2 parents 38e661b + 12a6ee9 commit f3bdb4a

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ workflows:
287287
- "test_splunk_ta_example_addon_input"
288288
- "test_splunk_ta_example_addon_proxy"
289289
- "test_splunk_ta_example_addon_custom"
290+
- "test_splunk_ta_example_addon_alert_actions"
290291
- approval-tag-alpha:
291292
requires:
292293
- build

pytest_splunk_addon_ui_smartx/alert_actions/components/account_select.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5+
from selenium.common.exceptions import TimeoutException
56
from ...components.controls.single_select import SingleSelect
67
from ...components.base_component import Selector, BaseComponent
78

@@ -16,6 +17,19 @@ def __init__(self, browser, container):
1617
"cancel_selected": Selector(select=container.select + ' button[data-icon-only="true"]')
1718
})
1819

20+
def wait_for_values(self):
21+
"""
22+
Wait for dynamic values to load in SingleSelect
23+
"""
24+
def _wait_for_values(driver):
25+
try:
26+
return self.get_single_value()
27+
except Exception as e:
28+
print("Wait_for_values failed with ::{}".format(str(e)))
29+
try:
30+
self.wait_for(_wait_for_values, msg="No values found in SingleSelect")
31+
except TimeoutException:
32+
return True
1933

2034
def list_of_values(self):
2135
"""
@@ -26,7 +40,20 @@ def list_of_values(self):
2640
list_of_values = []
2741
for each in self.get_elements('values'):
2842
list_of_values.append(each.text.strip())
43+
self.wait_to_be_clickable("dropdown")
2944
self.dropdown.click()
3045
self.wait_for("internal_container")
31-
self.wait_to_be_clickable("dropdown")
3246
return list_of_values
47+
48+
def get_single_value(self):
49+
"""
50+
Return one value from Single Select
51+
"""
52+
self.wait_to_be_clickable("dropdown")
53+
self.dropdown.click()
54+
single_element = self.get_element('values')
55+
56+
self.wait_to_be_clickable("dropdown")
57+
self.dropdown.click()
58+
self.wait_for("internal_container")
59+
return single_element

0 commit comments

Comments
 (0)