tests: Run selenium test in CI

This commit is contained in:
tecnovert
2025-03-01 22:38:54 +02:00
parent 7c482bab5c
commit 5ce607541e
3 changed files with 51 additions and 14 deletions

View File

@@ -7,7 +7,6 @@
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
"""
export RESET_TEST=true
export TEST_PATH=/tmp/test_persistent
mkdir -p ${TEST_PATH}/bin
cp -r ~/tmp/basicswap_bin/* ${TEST_PATH}/bin
@@ -20,6 +19,10 @@ python tests/basicswap/extended/test_xmr_persistent.py
# Copy coin releases to permanent storage for faster subsequent startups
cp -r ${TEST_PATH}/bin/ ~/tmp/basicswap_bin/
# Continue existing chains with
export RESET_TEST=false
"""
import json
@@ -62,7 +65,7 @@ from basicswap.interface.dcr.rpc import callrpc as callrpc_dcr
import basicswap.bin.run as runSystem
test_path = os.path.expanduser(os.getenv("TEST_PATH", "/tmp/test_persistent"))
RESET_TEST = make_boolean(os.getenv("RESET_TEST", "false"))
RESET_TEST = make_boolean(os.getenv("RESET_TEST", "true"))
PORT_OFS = int(os.getenv("PORT_OFS", 1))
UI_PORT = 12700 + PORT_OFS

View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2023 tecnovert
# Copyright (c) 2024 The Basicswap developers
# Copyright (c) 2024-2025 The Basicswap developers
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
@@ -20,19 +20,24 @@ BSX_SELENIUM_DRIVER = os.getenv("BSX_SELENIUM_DRIVER", "firefox")
def get_driver():
if BSX_SELENIUM_DRIVER == "firefox":
from selenium.webdriver import Firefox, FirefoxOptions
driver = Firefox(options=FirefoxOptions())
options = FirefoxOptions()
driver = Firefox(options=options)
elif BSX_SELENIUM_DRIVER == "firefox-ci":
from selenium.webdriver import Firefox, FirefoxOptions
options = FirefoxOptions()
options.headless = True
options.add_argument("start-maximized")
options.add_argument("--headless")
options.add_argument("--no-sandbox")
driver = Firefox(options=options)
elif BSX_SELENIUM_DRIVER == "chrome":
from selenium.webdriver import Chrome, ChromeOptions
driver = Chrome(options=ChromeOptions())
elif BSX_SELENIUM_DRIVER == "safari":
from selenium.webdriver import Safari, SafariOptions
driver = Safari(options=SafariOptions())
else:
raise ValueError("Unknown driver " + BSX_SELENIUM_DRIVER)
return driver