From d104bafda68ab485f16f85a547a3fd04047c1043 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Fri, 12 Jun 2026 12:22:06 +0545 Subject: [PATCH 1/3] test: rename temp dir config to reduce confusion with system tmp Signed-off-by: Saw-jan --- test/gui/config.sample.ini | 2 +- test/gui/helpers/ConfigHelper.py | 9 ++++----- test/gui/helpers/SetupClientHelper.py | 2 +- test/gui/steps/file_context.py | 15 +++++++-------- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/test/gui/config.sample.ini b/test/gui/config.sample.ini index 504e88001..19cffc698 100644 --- a/test/gui/config.sample.ini +++ b/test/gui/config.sample.ini @@ -3,6 +3,6 @@ APP_PATH= BACKEND_HOST= CLIENT_ROOT_SYNC_PATH= SYNC_TIMEOUT= -TEMP_FOLDER_PATH= +TEST_TEMP_DIR= GUI_TEST_REPORT_DIR= RECORD_VIDEO_ON_FAILURE=false diff --git a/test/gui/helpers/ConfigHelper.py b/test/gui/helpers/ConfigHelper.py index ad5d95a81..7353582da 100644 --- a/test/gui/helpers/ConfigHelper.py +++ b/test/gui/helpers/ConfigHelper.py @@ -1,7 +1,6 @@ import os import platform import builtins -import tempfile from tempfile import gettempdir from configparser import ConfigParser from pathlib import Path @@ -31,7 +30,7 @@ def get_client_root_path(): def get_config_home_linux(): - return os.path.join(tempfile.gettempdir(), 'opencloudtest', '.config') + return os.path.join(gettempdir(), 'opencloudtest', '.config') def get_config_home_win(): @@ -65,7 +64,7 @@ def get_app_env(): 'localBackendUrl': 'BACKEND_HOST', 'sync_timeout': 'SYNC_TIMEOUT', 'clientRootSyncPath': 'CLIENT_ROOT_SYNC_PATH', - 'tempFolderPath': 'TEMP_FOLDER_PATH', + 'test_temp_dir': 'TEST_TEMP_DIR', 'guiTestReportDir': 'GUI_TEST_REPORT_DIR', 'record_video_on_failure': 'RECORD_VIDEO_ON_FAILURE', } @@ -91,8 +90,8 @@ def get_app_env(): 'localBackendUrl': 'https://localhost:9200/', 'sync_timeout': 60, 'clientRootSyncPath': get_client_root_path(), - 'tempFolderPath': os.path.join(get_client_root_path(), 'temp'), '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': 'Personal', ############################### @@ -141,7 +140,7 @@ def normalize_configs(): elif key in ( 'localBackendUrl', 'clientRootSyncPath', - 'tempFolderPath', + 'test_temp_dir', 'guiTestReportDir', ): # make sure there is always one trailing slash diff --git a/test/gui/helpers/SetupClientHelper.py b/test/gui/helpers/SetupClientHelper.py index dc0967d8a..60bf60cdb 100644 --- a/test/gui/helpers/SetupClientHelper.py +++ b/test/gui/helpers/SetupClientHelper.py @@ -90,7 +90,7 @@ def parse_username_from_sync_path(sync_path): def get_temp_resource_path(resource_name): - return join(get_config('tempFolderPath'), resource_name) + return join(get_config('test_temp_dir'), resource_name) def get_current_user_sync_path(): diff --git a/test/gui/steps/file_context.py b/test/gui/steps/file_context.py index 80d70b07b..04aa5c125 100644 --- a/test/gui/steps/file_context.py +++ b/test/gui/steps/file_context.py @@ -42,11 +42,10 @@ def file_exists(file_path, timeout=get_config('min_timeout')): ) -# To create folders in a temporary directory, we set is_temp_folder True -# And if is_temp_folder is True, the create_folder function create folders in tempFolderPath +# To create folders in a temporary directory, set is_temp_folder True def create_folder(foldername, username=None, is_temp_folder=False): if is_temp_folder: - folder_path = join(get_config('tempFolderPath'), foldername) + folder_path = join(get_config('test_temp_dir'), foldername) else: folder_path = get_resource_path(foldername, username) os.makedirs(prefix_path_namespace(convert_path_separators_for_os(folder_path))) @@ -60,7 +59,7 @@ def rename_file_folder(source, destination): def create_file_with_size(filename, filesize, is_temp_folder=False): if is_temp_folder: - file = join(get_config('tempFolderPath'), filename) + file = join(get_config('test_temp_dir'), filename) else: file = get_resource_path(filename) with open(prefix_path_namespace(file), 'wb') as f: @@ -333,7 +332,7 @@ def step(context, username, file): regexp=True, ) def step(context, username, resource_type, resource_name): - source_dir = join(get_config('tempFolderPath'), resource_name) + source_dir = join(get_config('test_temp_dir'), resource_name) move_resource(username, resource_type, source_dir, '/', True) @@ -342,7 +341,7 @@ def step(context, username, resource_type, resource_name): regexp=True, ) def step(context, username, resource_type, resource_name): - destination = join(get_config('tempFolderPath'), resource_name) + destination = join(get_config('test_temp_dir'), resource_name) move_resource(username, resource_type, resource_name, destination) @@ -394,7 +393,7 @@ def step(context, zip_file_name): for row in context.table[1:]: resource_list.append(row[0]) - resource = join(get_config('tempFolderPath'), row[0]) + resource = join(get_config('test_temp_dir'), row[0]) if row[1] == 'folder': os.makedirs(resource) elif row[1] == 'file': @@ -402,7 +401,7 @@ def step(context, zip_file_name): if len(row) > 2 and row[2]: content = row[2] write_file(resource, content) - create_zip(resource_list, zip_file_name, get_config('tempFolderPath')) + create_zip(resource_list, zip_file_name, get_config('test_temp_dir')) @When('user "|any|" unzips the zip file "|any|" inside the sync root') From fe481e49d0a50508c94cade14a12907fd9b06bba Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Fri, 12 Jun 2026 13:09:16 +0545 Subject: [PATCH 2/3] test: save crash logs per scenario Signed-off-by: Saw-jan --- test/gui/environment.py | 4 ++++ test/gui/helpers/ConfigHelper.py | 4 ++++ test/gui/helpers/ReportHelper.py | 13 +++++++++++++ 3 files changed, 21 insertions(+) diff --git a/test/gui/environment.py b/test/gui/environment.py index fca4baa16..25f950ad2 100644 --- a/test/gui/environment.py +++ b/test/gui/environment.py @@ -16,6 +16,7 @@ take_screenshot, save_app_log, cleanup_current_app_log, + save_crash_log, ) from step_types.types import * # register all step types @@ -50,6 +51,9 @@ def after_scenario(context, scenario): ): save_app_log(scenario) + if os.path.exists(get_config('crash_file')): + save_crash_log(scenario) + # clean up sync dir if os.path.exists(get_config("clientRootSyncPath")): for entry in os.scandir(get_config("clientRootSyncPath")): diff --git a/test/gui/helpers/ConfigHelper.py b/test/gui/helpers/ConfigHelper.py index 7353582da..22d635d7a 100644 --- a/test/gui/helpers/ConfigHelper.py +++ b/test/gui/helpers/ConfigHelper.py @@ -9,6 +9,7 @@ APP_CONFIG_FILE = "opencloud.cfg" CUMULATIVE_APP_LOG_FILE = "opencloud.log" CURRENT_APP_LOG_FILE = "app.log" +CRASH_LOG_FILE = "OpenCloud-crash.log" def is_windows(): @@ -82,6 +83,7 @@ def get_app_env(): 'min_timeout': 5, 'lowest_timeout': 1, 'files_for_upload': os.path.join(CURRENT_DIR.parent, 'files-for-upload'), + 'crash_file': os.path.join(gettempdir(), CRASH_LOG_FILE), } # mutable configs @@ -173,6 +175,8 @@ def init_config(): CONFIG['appLogFile'] = os.path.join( CONFIG["guiTestReportDir"], CUMULATIVE_APP_LOG_FILE ) + # file to store cumulative app logs for the entire test run + CONFIG['crash_report_file'] = os.path.join(CONFIG["guiTestReportDir"], 'crash.log') # create report dir if it not exist if not os.path.exists(CONFIG['guiTestReportDir']): os.makedirs(CONFIG['guiTestReportDir']) diff --git a/test/gui/helpers/ReportHelper.py b/test/gui/helpers/ReportHelper.py index 89f0ae7cd..1971ca6b2 100644 --- a/test/gui/helpers/ReportHelper.py +++ b/test/gui/helpers/ReportHelper.py @@ -65,3 +65,16 @@ def save_app_log(scenario): def cleanup_current_app_log(): if os.path.exists(get_config('currentAppLogFile')): os.remove(get_config('currentAppLogFile')) + + +def save_crash_log(scenario): + with open(get_config('crash_report_file'), 'a') as log_file: + logs = ["=" * 80] + logs.append( + f"Scenario: {scenario.name}\nLocation: {scenario.filename}:{scenario.line}" + ) + logs.append("-" * 80) + logs.append("") # extra line break + log_file.write("\n".join(logs)) + with open(get_config('crash_file'), 'r') as current_log: + log_file.write(f"{current_log.read()}\n\n") From 4730d1f38c2050e75088f8c98c947bb847a1fc85 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Fri, 12 Jun 2026 13:12:36 +0545 Subject: [PATCH 3/3] ci: show crash log if available Signed-off-by: Saw-jan --- .woodpecker/ui-tests.yaml | 9 --------- test/gui/woodpecker/gui_test_reports.sh | 5 +++++ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.woodpecker/ui-tests.yaml b/.woodpecker/ui-tests.yaml index cca00e2cb..b8dfecb6a 100644 --- a/.woodpecker/ui-tests.yaml +++ b/.woodpecker/ui-tests.yaml @@ -130,15 +130,6 @@ steps: # Cannot handle this tags format inside a container: --tags='@smoke and not @skip' BEHAVE_PARAMETERS: '--tags=~@skip ${SUITES}' - # - name: crash-log - # image: *alpine_image - # when: - # - status: - # - success - # - failure - # commands: - # - cat test/gui/tmp/OpenCloud-crash.log 2>/dev/null || exit 0 - - name: upload-test-reports image: *minio_image when: diff --git a/test/gui/woodpecker/gui_test_reports.sh b/test/gui/woodpecker/gui_test_reports.sh index 166913bba..bb30bf508 100644 --- a/test/gui/woodpecker/gui_test_reports.sh +++ b/test/gui/woodpecker/gui_test_reports.sh @@ -9,6 +9,11 @@ echo "Test Report: $REPORT_URL/report.html" echo "Client Log: $REPORT_URL/opencloud.log" echo "AT_SPI Driver Log: $REPORT_URL/atspi_webdriver.log" +has_crash_log=$(mc find s3/$REPORT_PATH/crash.log 2>/dev/null || true) +if [[ -n "$has_crash_log" ]]; then + echo "Crash Log: $REPORT_URL/crash.log" +fi + screenshots=$(mc find s3/$REPORT_PATH/screenshots/ 2>/dev/null || true) if [[ -n "$screenshots" ]]; then echo "Screenshots:"