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
40 changes: 10 additions & 30 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pytest = ">=5.4, <7.3"
Sphinx = "*"
sphinx_rtd_theme = "*"
sphinx-panels = "*"
splunk-add-on-ucc-framework = "^5.28.5"
splunk-add-on-ucc-framework = "5.28.5"
pytest-rerunfailures = "^12.0"

[build-system]
Expand Down
32 changes: 31 additions & 1 deletion pytest_splunk_addon_ui_smartx/components/dropdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# limitations under the License.
#

import time
from .base_component import BaseComponent, Selector


Expand Down Expand Up @@ -96,11 +97,40 @@ def select(self, value):
else:
raise ValueError("{} not found in select list".format(value))

def select_nested(self, values):
"""
Selects the values we want from the type list in defined order
:param values: Dropdown values list in order we want to select
:return: Returns True if successful, otherwise raises an error
"""
if not isinstance(values, list):
raise ValueError("{} has to be of type list".format(values))

self.root.click()
popoverid = "#" + self.root.get_attribute("data-test-popover-id")
dropdown_selector = ' [data-test="item"] [data-test="label"]'
for value in values:
found = False
self.elements.update(
{"dropdown_options": Selector(select=popoverid + dropdown_selector)}
)
for each in self.get_elements("dropdown_options"):
if each.text.strip().lower() == value.lower():
found = True
each.click()
time.sleep(
1
) # sleep here prevents broken animation resulting in unclicable button
break
if not found:
raise ValueError("{} not found in select list".format(value))
return True

def select_input_type(self, value, open_dropdown=True):
"""
Selects the input type option that the user specifies in value
:param value: The value in which we want to select
:param open_dropdown: Whether or not the dropdown should be opened
:param open_dropdown: Whether the dropdown should be opened
:return: Returns True if successful, otherwise raises an error
"""
if open_dropdown:
Expand Down
95 changes: 95 additions & 0 deletions tests/testdata/Splunk_TA_UCCExample/globalConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -870,9 +870,104 @@
}
],
"title": "Example Input Two"
},
{
"name": "example_input_three",
"entity": [
{
"type": "text",
"label": "Name",
"validators": [
{
"type": "regex",
"errorMsg": "Input Name must begin with a letter and consist exclusively of alphanumeric characters and underscores.",
"pattern": "^[a-zA-Z]\\w*$"
},
{
"type": "string",
"errorMsg": "Length of input name should be between 1 and 100",
"minLength": 1,
"maxLength": 100
}
],
"field": "name",
"help": "A unique name for the data input.",
"required": true
},
{
"type": "text",
"label": "Interval",
"validators": [
{
"type": "regex",
"errorMsg": "Interval must be an integer.",
"pattern": "^\\-[1-9]\\d*$|^\\d*$"
}
],
"field": "interval",
"help": "Time interval of the data input, in seconds.",
"required": true
}
],
"title": "Example Input Three"
},
{
"name": "example_input_four",
"entity": [
{
"type": "text",
"label": "Name",
"validators": [
{
"type": "regex",
"errorMsg": "Input Name must begin with a letter and consist exclusively of alphanumeric characters and underscores.",
"pattern": "^[a-zA-Z]\\w*$"
},
{
"type": "string",
"errorMsg": "Length of input name should be between 1 and 100",
"minLength": 1,
"maxLength": 100
}
],
"field": "name",
"help": "A unique name for the data input.",
"required": true
},
{
"type": "text",
"label": "Interval",
"validators": [
{
"type": "regex",
"errorMsg": "Interval must be an integer.",
"pattern": "^\\-[1-9]\\d*$|^\\d*$"
}
],
"field": "interval",
"help": "Time interval of the data input, in seconds.",
"required": true
}
],
"title": "Example Input Four"
}
],
"title": "Inputs",
"groupsMenu": [
{
"groupName": "example_input_one",
"groupTitle": "Example Input One"
},
{
"groupName": "example_input_two",
"groupTitle": "Example Input Two"
},
{
"groupName": "group_one",
"groupTitle": "Group One",
"groupServices": ["example_input_three", "example_input_four"]
}
],
"description": "Manage your data inputs",
"table": {
"actions": [
Expand Down
Loading