Initial commit - Selenium automation framework
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
CONFIG_PATH = Path(__file__).resolve().parent.parent / "config.json"
|
||||
|
||||
|
||||
def load_config():
|
||||
|
||||
with CONFIG_PATH.open("r", encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
|
||||
|
||||
def get_step_delay_seconds(default=5):
|
||||
|
||||
config = load_config()
|
||||
return config.get("step_delay_seconds", default)
|
||||
|
||||
|
||||
def get_login_captcha_wait_seconds(default=20):
|
||||
|
||||
config = load_config()
|
||||
return config.get("login_captcha_wait_seconds", default)
|
||||
|
||||
|
||||
def get_login_post_submit_wait_seconds(default=10):
|
||||
|
||||
config = load_config()
|
||||
return config.get("login_post_submit_wait_seconds", default)
|
||||
|
||||
|
||||
def is_setup_session_enabled(default=True):
|
||||
|
||||
config = load_config()
|
||||
return config.get("setup", {}).get("run_session", default)
|
||||
|
||||
|
||||
def is_setup_token_enabled(default=True):
|
||||
|
||||
config = load_config()
|
||||
return config.get("setup", {}).get("run_token", default)
|
||||
|
||||
|
||||
def is_combined_setup_enabled():
|
||||
|
||||
config = load_config()
|
||||
setup = config.get("setup", {})
|
||||
return setup.get("run_session", True) and setup.get("run_token", True)
|
||||
|
||||
|
||||
def parse_product_codes(value):
|
||||
|
||||
if value is None:
|
||||
return []
|
||||
|
||||
if isinstance(value, str):
|
||||
return [code.strip() for code in value.split(",") if code.strip()]
|
||||
|
||||
if isinstance(value, list):
|
||||
return [str(code).strip() for code in value if str(code).strip()]
|
||||
|
||||
return [str(value).strip()]
|
||||
Reference in New Issue
Block a user