Skip to content
Draft
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
4 changes: 2 additions & 2 deletions .github/workflows/build-test-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ concurrency:
cancel-in-progress: true

env:
PYTHON_VERSION: "3.7"
POETRY_VERSION: "1.5.1"
PYTHON_VERSION: "3.9"
POETRY_VERSION: "2.1.4"

jobs:
meta:
Expand Down
532 changes: 347 additions & 185 deletions poetry.lock

Large diffs are not rendered by default.

13 changes: 5 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ classifiers = [
"Intended Audience :: Developers",
"Topic :: Software Development :: Testing",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -39,22 +37,21 @@ packages = [
version = "5.3.4"

[tool.poetry.dependencies]
python = "^3.7"
python = ">=3.9,<3.14"
pytest-html = "*"
urllib3 = "^1.21.1"
selenium = "*"
urllib3 = "2.5.0"
selenium = "4.9.1"
webdriver-manager = "*"
msedge-selenium-tools = "*"
cssselect = "*"
lxml = "^5.1.0"
pytest-splunk-addon = "^6.0.0"
pytest-splunk-addon = "7.0.0b1"

[tool.poetry.plugins]
pytest11 = { "ucc-smartx" = "pytest_splunk_addon_ui_smartx.plugin" }

[tool.poetry.group.dev.dependencies]
pytest = ">=5.4, <7.3"
splunk-add-on-ucc-framework = "5.48.0"
splunk-add-on-ucc-framework = "5.66.0"
pytest-rerunfailures = "^12.0"

[build-system]
Expand Down
40 changes: 1 addition & 39 deletions pytest_splunk_addon_ui_smartx/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import sys

import requests
from msedge.selenium_tools import Edge
from selenium import webdriver
from selenium.common.exceptions import ElementNotInteractableException, TimeoutException
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
Expand Down Expand Up @@ -94,19 +93,6 @@ def __init__(
raise Exception(
f"Chrome tests have to be run either with --local or in CI environment with selenium host!"
)
elif browser == "edge":
if debug:
self.browser = Edge(
executable_path="msedgedriver",
desired_capabilities=SeleniumHelper.get_local_edge_opts(
headless
),
service_args=["--verbose"],
)
else:
raise Exception(
f"Edge tests are available only with --local option"
)
elif browser == "IE":
if debug:
self.browser = webdriver.Ie(
Expand All @@ -123,7 +109,7 @@ def __init__(
)
else:
raise Exception(
f"No valid browser found.! expected=[firefox, chrome, edge, IE, safari], got={browser}"
f"No valid browser found.! expected=[firefox, chrome, IE, safari], got={browser}"
)
except Exception as e:
raise e
Expand Down Expand Up @@ -173,30 +159,6 @@ def get_local_firefox_opts(headless_run):
firefox_opts.add_argument("--window-size=1280,768")
return firefox_opts

@staticmethod
def get_local_edge_opts(headless_run):
if sys.platform.startswith("darwin"):
platform = "MAC"
elif sys.platform.startswith("win") or sys.platform.startswith("cygwin"):
platform = "WINDOWS"
else:
platform = "LINUX"
DesiredCapabilities = {
"platform": platform,
"browserName": "MicrosoftEdge",
"ms:edgeOptions": {
"extensions": [],
"args": ["--ignore-ssl-errors=yes", "--ignore-certificate-errors"],
},
"ms:edgeChromium": True,
}
if headless_run:
DesiredCapabilities["ms:edgeOptions"]["args"].append("--headless")
DesiredCapabilities["ms:edgeOptions"]["args"].append(
"--window-size=1280,768"
)
return DesiredCapabilities

def login_to_splunk(self, *cred):
try:
login_page = LoginPage(self)
Expand Down
6 changes: 3 additions & 3 deletions pytest_splunk_addon_ui_smartx/components/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ def get_table(self):
table[row_name][each_col] += " | Delete"
continue
if each_col == "status":
table[row_name][each_col] = each_row.find_element_by_css_selector(
'[data-test="status"]'
table[row_name][each_col] = each_row.find_element(
By.CSS_SELECTOR, '[data-test="status"]'
).text
continue
if each_col:
Expand All @@ -290,7 +290,7 @@ def get_cell_value(self, name, column):
"""
_row = self._get_row(name)
if column.lower() == "status":
return _row.find_element_by_css_selector('[data-test="status"]').text
return _row.find_element(By.CSS_SELECTOR, '[data-test="status"]').text
return self._get_column_value(_row, column)

def get_column_values(self, column):
Expand Down
2 changes: 1 addition & 1 deletion pytest_splunk_addon_ui_smartx/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def pytest_addoption(parser):
"--browser",
action="store",
help=(
"The browser on which the test should run. supported_values: (firefox, chrome, edge, IE, safari)."
"The browser on which the test should run. supported_values: (firefox, chrome, IE, safari)."
),
)

Expand Down
24 changes: 12 additions & 12 deletions tests/testdata/Splunk_TA_UCCExample/package/lib/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
certifi==2022.12.7 ; python_version >= "3.7" and python_version < "4"
charset-normalizer==3.0.1 ; python_version >= "3.7" and python_version < "4"
defusedxml==0.7.1 ; python_version >= "3.7" and python_version < "4.0"
idna==3.4 ; python_version >= "3.7" and python_version < "4"
pysocks==1.7.1 ; python_version >= "3.7" and python_version < "4.0"
requests==2.28.2 ; python_version >= "3.7" and python_version < "4"
solnlib==4.9.1 ; python_version >= "3.7" and python_version < "4.0"
sortedcontainers==2.4.0 ; python_version >= "3.7" and python_version < "4.0"
splunk-sdk==1.7.3 ; python_version >= "3.7" and python_version < "4.0"
splunktalib==3.0.3 ; python_version >= "3.7" and python_version < "4.0"
splunktaucclib==6.0.7 ; python_version >= "3.7" and python_version < "4.0"
urllib3==1.26.14 ; python_version >= "3.7" and python_version < "4"
certifi==2022.12.7 ; python_version >= "3.9" and python_version < "4"
charset-normalizer==3.0.1 ; python_version >= "3.9" and python_version < "4"
defusedxml==0.7.1 ; python_version >= "3.9" and python_version < "4.0"
idna==3.4 ; python_version >= "3.9" and python_version < "4"
pysocks==1.7.1 ; python_version >= "3.9" and python_version < "4.0"
requests==2.32.5 ; python_version >= "3.9" and python_version < "4"
solnlib==7.0.0 ; python_version >= "3.9" and python_version < "4.0"
sortedcontainers==2.4.0 ; python_version >= "3.9" and python_version < "4.0"
splunk-sdk==2.1.0 ; python_version >= "3.9" and python_version < "4.0"
splunktalib==3.0.3 ; python_version >= "3.9" and python_version < "4.0"
splunktaucclib @ git+https://github.com/splunk/addonfactory-ucc-library.git@feat/upgrade-project-python39 ; python_version >= "3.9" and python_version < "4.0"
urllib3==2.5.0 ; python_version >= "3.9" and python_version < "4"
33 changes: 0 additions & 33 deletions tests/unit/test_base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def test_selenium_helper_raise_exception_with_given_invalid_browser_version():
("chrome", "selenium.webdriver.Chrome", [True, False]),
("IE", "selenium.webdriver.Ie", True),
("safari", "selenium.webdriver.Safari", True),
("edge", "pytest_splunk_addon_ui_smartx.base_test.Edge", True),
],
)
def test_constructor_selenium_helper(browser, webdriver, debug):
Expand All @@ -55,27 +54,6 @@ def test_constructor_selenium_helper(browser, webdriver, debug):
)


@pytest.mark.parametrize(
"headless_run", [True, False], ids=["headless_run-True", "headless_run-False"]
)
@pytest.mark.parametrize(
"platform,system",
[("darwin", "MAC"), ("win", "WINDOWS"), ("cygwin", "WINDOWS"), ("unknow", "LINUX")],
)
def test_get_local_edge_opts(headless_run, platform, system):
with patch("pytest_splunk_addon_ui_smartx.base_test.Edge"), patch(
"sys.platform", platform
):
assert SeleniumHelper.get_local_edge_opts(headless_run)["platform"] == system
expected = deepcopy(expected_edge_opts)
expected = {**expected, "platform": system}
if headless_run:
expected["ms:edgeOptions"]["args"].append("--headless")
expected["ms:edgeOptions"]["args"].append("--window-size=1280,768")

assert SeleniumHelper.get_local_edge_opts(headless_run) == expected


@pytest.mark.parametrize(
"headless_run", [True, False], ids=["headless_run-True", "headless_run-False"]
)
Expand Down Expand Up @@ -345,17 +323,6 @@ def test_rest_helper_exceptions(mock_request, side_effect):
RestHelper(**defaults_rest_helper)


expected_edge_opts = {
"platform": "MAC",
"browserName": "MicrosoftEdge",
"ms:edgeOptions": {
"extensions": [],
"args": ["--ignore-ssl-errors=yes", "--ignore-certificate-errors"],
},
"ms:edgeChromium": True,
}


def test_login_to_splunk():
with patch("selenium.webdriver.Chrome"), patch(
"pytest_splunk_addon_ui_smartx.base_test.LoginPage",
Expand Down
Loading