Skip to content

Commit 68c74d6

Browse files
feat(code): added clear_text function (#391)
* feat(code): added clear_text function * test(ui): add test for clear_text function * ci: update label quotes --------- Co-authored-by: Artem Rys <rysartem@gmail.com>
1 parent 635fbb4 commit 68c74d6

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

pytest_splunk_addon_ui_smartx/components/controls/multi_select.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ def search(self, value):
6161
"""
6262
self.input.send_keys(value)
6363

64+
def clear_text(self):
65+
"""
66+
Clears the search box value in the multiselect field
67+
"""
68+
self.input.clear()
69+
6470
def search_get_list(self, value):
6571
"""
6672
search with the multiselect input and return the list

tests/ui/test_splunk_ta_example_addon_custom.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def test_custom_required_field_test_number(
195195
def test_custom_valid_input_test_number(
196196
self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
197197
):
198-
"""This test case checks test number field should be interger"""
198+
"""This test case checks test number field should be integer"""
199199
custom = Custom(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
200200
custom.test_string.set_value("test_str")
201201
custom.test_number.set_value("a")
@@ -370,21 +370,44 @@ def test_custom_select_multiple_values_test_multiselect(
370370
def test_custom_search_value_test_multiselect(
371371
self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
372372
):
373-
"""This test case checks multiple select seach funtionality"""
373+
"""This test case checks multiple select search functionality"""
374374
custom = Custom(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
375375
self.assert_util(
376376
custom.test_multiselect.search_get_list,
377377
["Option A"],
378378
left_args={"value": "Option A"},
379379
)
380380

381+
@pytest.mark.execute_enterprise_cloud_true
382+
@pytest.mark.forwarder
383+
@pytest.mark.custom
384+
def test_custom_clear_text_test_multiselect(
385+
self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
386+
):
387+
"""This test case checks multiple select clear_text functionality"""
388+
custom = Custom(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
389+
self.assert_util(
390+
len(custom.test_multiselect.search_get_list("Option")),
391+
2,
392+
)
393+
custom.test_multiselect.clear_text()
394+
self.assert_util(
395+
len(custom.test_multiselect.search_get_list("Option A")),
396+
1,
397+
)
398+
custom.test_multiselect.clear_text()
399+
self.assert_util(
400+
len(custom.test_multiselect.search_get_list("Option B")),
401+
1,
402+
)
403+
381404
@pytest.mark.execute_enterprise_cloud_true
382405
@pytest.mark.forwarder
383406
@pytest.mark.custom
384407
def test_custom_deselect_test_multiselect(
385408
self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
386409
):
387-
"""This test case checks deselect funtionality of multiple select"""
410+
"""This test case checks deselect functionality of multiple select"""
388411
custom = Custom(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
389412
selected_values = ["Option A", "Option B"]
390413
for each in selected_values:

0 commit comments

Comments
 (0)