Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,22 @@ def _wait_for_search_list(driver):
_wait_for_search_list, msg="No values found in SingleSelect search"
)

def is_editable(self) -> bool:
def allow_new_values(self) -> bool:
"""
Returns True if the SingleSelect is editable, False otherwise
Returns True if the SingleSelect accepts new values, False otherwise
"""
self.get_element("root")
return True if self.allow_new_values else False

def is_editable(self) -> bool:
"""
Returns True if the SingleSelect is editable, False otherwise
"""
if (
self.root.get_attribute("readonly")
or self.root.get_attribute("readOnly")
or self.root.get_attribute("disabled")
):
return False
else:
return True
3 changes: 3 additions & 0 deletions pytest_splunk_addon_ui_smartx/components/dropdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,6 @@ def get_input_type_list(self):
}
)
return [each.text.strip() for each in self.get_elements("type_filter_list")]

def wait_to_be_stale(self, msg=None):
return super().wait_to_be_stale(key=self.get_element("root"), msg=msg)
8 changes: 6 additions & 2 deletions tests/testdata/Splunk_TA_UCCExample/globalConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,8 @@
"type": "singleSelect",
"label": "Example Account",
"options": {
"referenceName": "account"
"referenceName": "account",
"disableonEdit": true
},
"help": "",
"field": "account",
Expand Down Expand Up @@ -965,7 +966,10 @@
{
"groupName": "group_one",
"groupTitle": "Group One",
"groupServices": ["example_input_three", "example_input_four"]
"groupServices": [
"example_input_three",
"example_input_four"
]
}
],
"description": "Manage your data inputs",
Expand Down
26 changes: 19 additions & 7 deletions tests/ui/test_splunk_ta_example_addon_input_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,14 +880,12 @@ def test_example_input_one_edit_frontend_validation(
"""Verifies the frontend edit functionality of the example input one entity"""
input_page = InputPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
input_page.table.edit_row("dummy_input_one")
input_page.entity1.example_account.wait_for_values()
input_page.entity1.example_checkbox.uncheck()
input_page.entity1.example_radio.select("No")
input_page.entity1.single_select_group_test.select("four")
input_page.entity1.multiple_select_test.deselect("b")
input_page.entity1.interval.set_value("3600")
input_page.entity1.index.select("main")
input_page.entity1.example_account.select("test_input")
input_page.entity1.object.set_value("edit_object")
input_page.entity1.object_fields.set_value("edit_field")
input_page.entity1.order_by.set_value("LastDate")
Expand Down Expand Up @@ -918,14 +916,12 @@ def test_example_input_one_edit_backend_validation(
"""Verifies the backend edit functionality of the example input one entity"""
input_page = InputPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
input_page.table.edit_row("dummy_input_one")
input_page.entity1.example_account.wait_for_values()
input_page.entity1.example_checkbox.uncheck()
input_page.entity1.example_radio.select("No")
input_page.entity1.single_select_group_test.select("Four")
input_page.entity1.multiple_select_test.deselect("b")
input_page.entity1.interval.set_value("3600")
input_page.entity1.index.select("main")
input_page.entity1.example_account.select("test_input")
input_page.entity1.object.set_value("edit_object")
input_page.entity1.object_fields.set_value("edit_field")
input_page.entity1.order_by.set_value("LastDate")
Expand Down Expand Up @@ -1355,14 +1351,30 @@ def test_inputs_textarea_scroll(
@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.input
def test_single_select_is_editable(
def test_single_select_allows_new_values(
self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
):
"""
Verifies that SingleSelect value is editable or not
"""
input_page = InputPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
input_page.create_new_input.select("Example Input One")
self.assert_util(input_page.entity1.single_select_group_test.is_editable, True)
self.assert_util(input_page.entity1.index.is_editable, True)
self.assert_util(
input_page.entity1.single_select_group_test.allow_new_values, True
)
self.assert_util(input_page.entity1.index.allow_new_values, True)
self.assert_util(input_page.entity1.example_account.allow_new_values, False)

@pytest.mark.execute_enterprise_cloud_true
@pytest.mark.forwarder
@pytest.mark.input
def test_single_select_is_editable(
self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper, add_input_one
):
"""
Verifies that SingleSelect value is editable or not
"""
input_page = InputPage(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)
input_page.table.edit_row("dummy_input_one")
self.assert_util(input_page.entity1.example_account.is_editable, False)
self.assert_util(input_page.entity1.index.is_editable, True)
1 change: 1 addition & 0 deletions tests/ui/test_splunk_ta_example_addon_input_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ def test_inputs_create_new_input_list_nested_values(
"Example Input Four",
]
input_page.create_new_input.select("Group One")
input_page.create_new_input.wait_to_be_stale()
self.assert_util(input_page.create_new_input.get_inputs_list, value_to_test)

@pytest.mark.execute_enterprise_cloud_true
Expand Down