Skip to content

Commit 4be271a

Browse files
authored
ci: split UI tests for the input page in 3 groups (#393)
* ci: split UI tests for the input page in 3 groups * test: use add_account fixture in alert_actions UI tests * test: use proper path * chore: remove addonfactory_test_matrix_splunk submodule as not needed
1 parent 68c74d6 commit 4be271a

File tree

10 files changed

+1338
-1079
lines changed

10 files changed

+1338
-1079
lines changed

.github/workflows/build-test-release.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ jobs:
136136
"test_splunk_ta_example_addon_logging",
137137
"test_splunk_ta_example_addon_account",
138138
"test_splunk_ta_example_addon_proxy",
139-
"test_splunk_ta_example_addon_input",
139+
"test_splunk_ta_example_addon_input_common",
140+
"test_splunk_ta_example_addon_input_1",
141+
"test_splunk_ta_example_addon_input_2",
140142
"test_splunk_ta_example_addon_custom",
141143
"test_splunk_ta_example_addon_alert_actions"
142144
]
@@ -208,12 +210,12 @@ jobs:
208210
- uses: actions/upload-artifact@v3
209211
if: always()
210212
with:
211-
name: test-results-${{ matrix.splunk }}_${{ matrix.python-version }}_${{ matrix.browser }}_${{ matrix.test_suite }}
213+
name: test-results-${{ matrix.splunk.version }}_${{ matrix.python-version }}_${{ matrix.browser }}_${{ matrix.test_suite }}
212214
path: test-results/*
213215
- uses: dorny/test-reporter@v1
214216
if: always()
215217
with:
216-
name: test-report-${{ matrix.splunk }}_${{ matrix.python-version }}_${{ matrix.browser }}_${{ matrix.test_suite }}
218+
name: test-report-${{ matrix.splunk.version }}_${{ matrix.python-version }}_${{ matrix.browser }}_${{ matrix.test_suite }}
217219
path: "test-results/*.xml"
218220
reporter: java-junit
219221

.gitmodules

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
[submodule "tests/deps/build/addonfactory_test_matrix_splunk"]
2-
path = tests/deps/build/addonfactory_test_matrix_splunk
3-
url = https://github.com/splunk/addonfactory_test_matrix_splunk
4-
branch = master

Dockerfile-splunk

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,4 @@ ARG SPLUNK_APP_ID=TA_UNKNOWN
2020
ARG SPLUNK_APP_PACKAGE=package
2121
RUN echo Splunk VERSION=$SPLUNK_VERSION SPLUNK_APP_PACKAGE=$SPLUNK_APP_PACKAGE
2222

23-
COPY tests/deps/build/addonfactory_test_matrix_splunk/packages/all/common /opt/splunk/etc/apps/
24-
COPY tests/deps/build/addonfactory_test_matrix_splunk/packages/all/sh /opt/splunk/etc/apps/
25-
2623
COPY $SPLUNK_APP_PACKAGE /opt/splunk/etc/apps/$SPLUNK_APP_ID

pytest_splunk_addon_ui_smartx/plugin.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def ucc_smartx_configs(request):
154154

155155
def get_browser_scope(fixture_name, config):
156156
"""
157-
Set the scope of the browser dyncamically.
157+
Set the scope of the browser dynamically.
158158
"""
159159
if config.getoption("--local") and config.getoption("--persist-browser"):
160160
return "session"
@@ -186,7 +186,7 @@ def ucc_smartx_selenium_helper(
186186
break
187187
except Exception as e:
188188
last_exc = e
189-
LOGGER.warn(
189+
LOGGER.warning(
190190
"Failed to configure the browser or login to Splunk instance for - Try={} \nTRACEBACK::{}".format(
191191
try_number, traceback.format_exc()
192192
)
@@ -212,7 +212,7 @@ def ucc_smartx_selenium_helper(
212212
"Could not notify to sauce labs because scope of fixture is not set to function"
213213
)
214214
except:
215-
LOGGER.warn(
215+
LOGGER.warning(
216216
"Could not notify to Saucelabs \nTRACEBACK::{}".format(
217217
traceback.format_exc()
218218
)
@@ -232,7 +232,7 @@ def ucc_smartx_rest_helper(ucc_smartx_configs, splunk, splunk_rest_uri):
232232
break
233233
except Exception as e:
234234
last_exc = e
235-
LOGGER.warn(
235+
LOGGER.warning(
236236
"Failed to configure rest endpint for Splunk instance - Try={} \nTRACEBACK::{}".format(
237237
try_number, traceback.format_exc()
238238
)
@@ -290,13 +290,15 @@ def pytest_runtest_makereport(item, call):
290290

291291
report.extra = [pytest_html.extras.image(screenshot_path)]
292292
except:
293-
LOGGER.warn(
293+
LOGGER.warning(
294294
"Screenshot can not be captured. Scope of the fixture test_helper must be 'function' to capture the screenshot. "
295295
)
296296
else:
297-
LOGGER.warn(
297+
LOGGER.warning(
298298
"pytest-html is not installed. Install by using: pip install pytest-html"
299299
)
300300
except Exception as e:
301-
LOGGER.warn("Got exception while making test report. Exception {}".format(e))
301+
LOGGER.warning(
302+
"Got exception while making test report. Exception {}".format(e)
303+
)
302304
LOGGER.debug("test_report, Exception: {}".format(traceback.format_exc()))
Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/ui/conftest.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import pytest
2+
3+
from .Example_UccLib.account import AccountPage
4+
5+
6+
@pytest.fixture
7+
def add_account(ucc_smartx_rest_helper):
8+
account = AccountPage(
9+
ucc_smartx_rest_helper=ucc_smartx_rest_helper, open_page=False
10+
)
11+
url = account._get_account_endpoint()
12+
kwargs = {
13+
"name": "test_input",
14+
"account_checkbox": 1,
15+
"account_multiple_select": "one",
16+
"account_radio": "yes",
17+
"auth_type": "basic",
18+
"custom_endpoint": "login.example.com",
19+
"username": "TestUser",
20+
"password": "TestPassword",
21+
"token": "TestToken",
22+
"client_id": "",
23+
"client_secret": "",
24+
"redirect_url": "",
25+
"endpoint": "",
26+
"example_help_link": "",
27+
}
28+
yield account.backend_conf.post_stanza(url, kwargs)
29+
account.backend_conf.delete_all_stanzas()

tests/ui/test_splunk_ta_example_addon_alert_actions.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from pytest_splunk_addon_ui_smartx.components.controls.button import Button
55

66
from .Example_UccLib.alert_action import AlertPage
7-
from .test_splunk_ta_example_addon_input import add_account
87

98

109
@pytest.fixture(autouse=True)
@@ -85,7 +84,7 @@ def test_dropdown_list(self, ucc_smartx_selenium_helper):
8584

8685
@pytest.mark.execute_enterprise_cloud_true
8786
@pytest.mark.forwarder
88-
def test_account_functionality(self, ucc_smartx_selenium_helper):
87+
def test_account_functionality(self, ucc_smartx_selenium_helper, add_account):
8988
alert_page = AlertPage(ucc_smartx_selenium_helper, None)
9089
alert_page.alert_entity.open()
9190
alert_page.alert_entity.add_action_dropdown.wait_for_values()
@@ -144,7 +143,9 @@ def test_toggle(self, ucc_smartx_selenium_helper):
144143
@pytest.mark.execute_enterprise_cloud_true
145144
@pytest.mark.forwarder
146145
@pytest.mark.sanity_test
147-
def test_alert_action_save(self, ucc_smartx_selenium_helper, clean_alert):
146+
def test_alert_action_save(
147+
self, ucc_smartx_selenium_helper, add_account, clean_alert
148+
):
148149
alert_page = AlertPage(ucc_smartx_selenium_helper, None)
149150
alert_page.alert_entity.open()
150151
alert_page.alert_entity.add_action_dropdown.wait_for_values()
@@ -168,7 +169,7 @@ def test_alert_action_save(self, ucc_smartx_selenium_helper, clean_alert):
168169

169170
@pytest.mark.execute_enterprise_cloud_true
170171
@pytest.mark.forwarder
171-
def test_alert_help_text_entity(self, ucc_smartx_selenium_helper):
172+
def test_alert_help_text_entity(self, add_account, ucc_smartx_selenium_helper):
172173
alert_page = AlertPage(ucc_smartx_selenium_helper, None)
173174
alert_page.alert_entity.open()
174175
alert_page.alert_entity.add_action_dropdown.wait_for_values()

0 commit comments

Comments
 (0)