activation_tests.py, nextcloud_tests.py: Omit service parameter to driver if no setting found in env

This commit is contained in:
Tobias Knöppler 2025-10-17 22:57:40 +02:00
parent f3d7adf7b7
commit 2fb43eb0e3
2 changed files with 12 additions and 6 deletions

View File

@ -91,12 +91,15 @@ def signal_handler(sig, frame):
sys.exit(0)
def test_activation(IP, nc_port, admin_port, options, webdriver_exec_path="geckodriver", wait_timeout=120):
def test_activation(IP, nc_port, admin_port, options, webdriver_exec_path=None, wait_timeout=120):
""" Activation process checks"""
driver_kwargs={}
if webdriver_exec_path is not None:
driver_kwargs['service'] = Service(webdriver_exec_path)
# activation page
test = Test()
driver = webdriver.Firefox(options=options, service=Service(webdriver_exec_path))
driver = webdriver.Firefox(options=options, **driver_kwargs)
driver.implicitly_wait(5)
test.new("activation opens")
driver.get(f"https://{IP}:{nc_port}")
@ -138,7 +141,7 @@ def test_activation(IP, nc_port, admin_port, options, webdriver_exec_path="gecko
# ncp-web
test.new("ncp-web")
driver = webdriver.Firefox(options=options, service=Service(webdriver_exec_path))
driver = webdriver.Firefox(options=options, **driver_kwargs)
driver.implicitly_wait(30)
try:
driver.get(f"https://ncp:{urllib.parse.quote_plus(ncp_pass)}@{IP}:{admin_port}")
@ -165,7 +168,7 @@ if __name__ == "__main__":
arg_timeout = 120
options = webdriver.FirefoxOptions()
webdriver_exec_path = "geckodriver"
webdriver_exec_path = None
if 'GECKODRIVER_PATH' in os.environ:
print(f"Setting geckodriver from env ({os.environ['GECKODRIVER_PATH']})")
webdriver_exec_path = os.environ['GECKODRIVER_PATH']

View File

@ -334,7 +334,7 @@ if __name__ == "__main__":
skip_release_check = False
options = webdriver.FirefoxOptions()
webdriver_exec_path = "geckodriver"
webdriver_exec_path = None
if 'GECKODRIVER_PATH' in os.environ:
print(f"Setting geckodriver from env ({os.environ['GECKODRIVER_PATH']})")
webdriver_exec_path = os.environ['GECKODRIVER_PATH']
@ -390,7 +390,10 @@ if __name__ == "__main__":
print("Nextcloud tests " + tc.yellow + IP + tc.normal)
print("---------------------------")
driver = webdriver.Firefox(options=options, service=Service(webdriver_exec_path))
if webdriver_exec_path is None:
driver = webdriver.Firefox(options=options)
else:
driver = webdriver.Firefox(options=options, service=Service(webdriver_exec_path))
failed=False
try:
test_nextcloud(IP, nc_port, driver, skip_release_check, wait_multiplier)