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
2 changes: 2 additions & 0 deletions test/gui/config.sample.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[DEFAULT]
APP_PATH=
; useful when using beta or branded clients. E.g. APP_NAME=OpenCloud Beta
APP_NAME=
BACKEND_HOST=
CLIENT_ROOT_SYNC_PATH=
SYNC_TIMEOUT=
Expand Down
18 changes: 13 additions & 5 deletions test/gui/helpers/ConfigHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
from pathlib import Path

CURRENT_DIR = Path(__file__).resolve().parent
APP_CONFIG_FILE = "opencloud.cfg"
APP_NAME = "OpenCloud"
APP_CONFIG_FILE = f"{APP_NAME.lower()}.cfg"
CUMULATIVE_APP_LOG_FILE = "opencloud.log"
CURRENT_APP_LOG_FILE = "app.log"
DEFAULT_SYNC_CONNECTION_NAME = "Personal"
CRASH_LOG_FILE = "OpenCloud-crash.log"
CRASH_LOG_FILE = f"{APP_NAME}-crash.log"


def is_windows():
Expand Down Expand Up @@ -61,6 +62,7 @@ def get_app_env():
# map environment variables to config keys
CONFIG_ENV_MAP = {
'app_path': 'APP_PATH',
'app_name': 'APP_NAME',
'localBackendUrl': 'BACKEND_HOST',
'sync_timeout': 'SYNC_TIMEOUT',
'clientRootSyncPath': 'CLIENT_ROOT_SYNC_PATH',
Expand All @@ -73,29 +75,30 @@ def get_app_env():
DEFAULT_PATH_CONFIG = {
'custom_lib': os.path.abspath(os.path.join(os.path.dirname(__file__), 'custom_lib')),
'home_dir': get_default_home_dir(),
'clientConfigFile': os.path.join(get_config_home(), "OpenCloud", APP_CONFIG_FILE),
# allow to record first 5 videos
'video_record_limit': 5,
'max_timeout': 60,
'min_timeout': 5,
'lowest_timeout': 1,
'min_sync_timeout': 5,
'files_for_upload': os.path.join(CURRENT_DIR.parent, 'files-for-upload'),
# actual file path where the client stores the crash log.
'crash_log_file': os.path.join(gettempdir(), CRASH_LOG_FILE),
'webdriver_url': 'http://localhost:4723',
}

# mutable configs
CONFIG = {
'app_path': None,
'app_name': APP_NAME,
'localBackendUrl': 'https://localhost:9200/',
'sync_timeout': 60,
'clientRootSyncPath': get_client_root_path(),
'guiTestReportDir': os.path.join(CURRENT_DIR.parent, 'reports'),
'test_temp_dir': os.path.join(get_client_root_path(), 'temp'),
'record_video_on_failure': False,
'syncConnectionName': DEFAULT_SYNC_CONNECTION_NAME,
'clientConfigFile': os.path.join(get_config_home(), APP_NAME, APP_CONFIG_FILE),
# actual file path where the client stores the crash log.
'crash_log_file': os.path.join(gettempdir(), CRASH_LOG_FILE),
###############################
# dynamic configs #
###############################
Expand Down Expand Up @@ -172,6 +175,11 @@ def init_config():
if not os.path.isfile(CONFIG['app_path']):
raise KeyError(f'App path is not a file: {CONFIG["app_path"]}')

if CONFIG['app_name'] != APP_NAME:
app_name = CONFIG['app_name']
app_config_file = f"{app_name.lower().replace(' ', '_')}.cfg"
CONFIG['clientConfigFile'] = os.path.join(get_config_home(), app_name, app_config_file)
CONFIG['crash_log_file'] = os.path.join(gettempdir(), f"{app_name}-crash.log"),
### initialize dynamic config values
# file to store app logs for the current scenario run
CONFIG['currentAppLogFile'] = os.path.join(CONFIG["guiTestReportDir"], CURRENT_APP_LOG_FILE)
Expand Down