diff --git a/pytest_splunk_addon_ui_smartx/components/controls/single_select.py b/pytest_splunk_addon_ui_smartx/components/controls/single_select.py index 196c2a74..7efac521 100644 --- a/pytest_splunk_addon_ui_smartx/components/controls/single_select.py +++ b/pytest_splunk_addon_ui_smartx/components/controls/single_select.py @@ -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 diff --git a/pytest_splunk_addon_ui_smartx/components/dropdown.py b/pytest_splunk_addon_ui_smartx/components/dropdown.py index e978ce25..8b92e258 100644 --- a/pytest_splunk_addon_ui_smartx/components/dropdown.py +++ b/pytest_splunk_addon_ui_smartx/components/dropdown.py @@ -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) diff --git a/tests/testdata/Splunk_TA_UCCExample/globalConfig.json b/tests/testdata/Splunk_TA_UCCExample/globalConfig.json index b1c3ff20..7cd44d3e 100644 --- a/tests/testdata/Splunk_TA_UCCExample/globalConfig.json +++ b/tests/testdata/Splunk_TA_UCCExample/globalConfig.json @@ -626,7 +626,8 @@ "type": "singleSelect", "label": "Example Account", "options": { - "referenceName": "account" + "referenceName": "account", + "disableonEdit": true }, "help": "", "field": "account", @@ -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", diff --git a/tests/ui/test_splunk_ta_example_addon_input_1.py b/tests/ui/test_splunk_ta_example_addon_input_1.py index 43c9ecd3..c02cb8e3 100644 --- a/tests/ui/test_splunk_ta_example_addon_input_1.py +++ b/tests/ui/test_splunk_ta_example_addon_input_1.py @@ -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") @@ -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") @@ -1355,7 +1351,7 @@ 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 ): """ @@ -1363,6 +1359,22 @@ def test_single_select_is_editable( """ 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) diff --git a/tests/ui/test_splunk_ta_example_addon_input_common.py b/tests/ui/test_splunk_ta_example_addon_input_common.py index 4da6cd0d..85df5248 100644 --- a/tests/ui/test_splunk_ta_example_addon_input_common.py +++ b/tests/ui/test_splunk_ta_example_addon_input_common.py @@ -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