Skip to content

Commit a58e80b

Browse files
fix: singleselect is_editable() (#404)
* fix: singleselect is_editable works for listbox and combobox * fix: singleselect is_editable works for listbox and combobox * chore: review fixes * chore: review fixes * chore: add tests for SingleSelect is_editable() method
1 parent 23b2d8a commit a58e80b

File tree

2 files changed

+19
-22
lines changed

2 files changed

+19
-22
lines changed

pytest_splunk_addon_ui_smartx/components/controls/single_select.py

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -348,27 +348,9 @@ def _wait_for_search_list(driver):
348348
_wait_for_search_list, msg="No values found in SingleSelect search"
349349
)
350350

351-
def is_editable(self):
351+
def is_editable(self) -> bool:
352352
"""
353-
Returns True if the Textbox is editable, False otherwise
353+
Returns True if the SingleSelect is editable, False otherwise
354354
"""
355-
if self.searchable:
356-
if self.allow_new_values:
357-
self.elements.update(
358-
{
359-
"input": Selector(
360-
select=self.container.select + ' [data-test="textbox"]'
361-
)
362-
}
363-
)
364-
else:
365-
self.root.click()
366-
popover_id = "#" + self.root.get_attribute("data-test-popover-id")
367-
self.elements.update(
368-
{"input": Selector(select=popover_id + ' [data-test="textbox"]')}
369-
)
370-
return not bool(
371-
self.input.get_attribute("readonly")
372-
or self.input.get_attribute("readOnly")
373-
or self.input.get_attribute("disabled")
374-
)
355+
self.get_element("root")
356+
return True if self.allow_new_values else False

tests/ui/test_splunk_ta_example_addon_input_1.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,3 +1351,18 @@ def test_inputs_textarea_scroll(
13511351
input_page.entity1.text_area.scroll("UP", 40)
13521352
screenshot_after = input_page.entity1.text_area.screenshot()
13531353
self.assert_util(screnshot_before, screenshot_after, operator="!=")
1354+
1355+
@pytest.mark.execute_enterprise_cloud_true
1356+
@pytest.mark.forwarder
1357+
@pytest.mark.input
1358+
def test_single_select_is_editable(
1359+
self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
1360+
):
1361+
"""
1362+
Verifies that SingleSelect value is editable or not
1363+
"""
1364+
input_page = InputPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
1365+
input_page.create_new_input.select("Example Input One")
1366+
self.assert_util(input_page.entity1.single_select_group_test.is_editable, True)
1367+
self.assert_util(input_page.entity1.index.is_editable, True)
1368+
self.assert_util(input_page.entity1.example_account.is_editable, False)

0 commit comments

Comments
 (0)