From c5acb4c58f9a026e4c4b58dc89abc7b89e170dc5 Mon Sep 17 00:00:00 2001 From: damies13 Date: Mon, 16 Sep 2024 13:58:03 +1000 Subject: [PATCH] Keywords needed by the tests I moved to commoanline_bugs Issue #145 --- .../Manager/CommandLine_Common.robot | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/Tests/Regression/Manager/CommandLine_Common.robot b/Tests/Regression/Manager/CommandLine_Common.robot index 83ecc92f8..3e21a968f 100644 --- a/Tests/Regression/Manager/CommandLine_Common.robot +++ b/Tests/Regression/Manager/CommandLine_Common.robot @@ -144,6 +144,109 @@ Stop Agent Log stderr: ${result.stderr} console=True Show Dir Contents ${agent_dir} +Set Global Filename And Default Save Path + [Documentation] Sets global default save path as Test Variable and file name for robot test. + ... You can also provide optional save path. + [Arguments] ${input_name} ${optional_path}=${None} + + Set Test Variable ${global_name} ${input_name} + ${location}= Get Manager Default Save Path + Set Test Variable ${global_path} ${location} + + Set Test Variable $file_name ${global_name} + IF '${optional_path}' != '${None}' + Set Test Variable ${global_path} ${optional_path} + ${location}= Get Manager INI Location + ${ini_content}= Get Manager INI Data + ${ini_content_list}= Split String ${ini_content} + ${scriptdir}= Get Index From List ${ini_content_list} scriptdir + + ${ini_content}= Replace String ${ini_content} ${ini_content_list}[${scriptdir + 2}] ${optional_path} + ${ini_content}= Replace String ${ini_content} ${ini_content_list}[${scriptdir + 5}] ${optional_path} + + Remove File ${location} + Log ${ini_content} + Append To File ${location} ${ini_content} + END + + Log ${global_name} + Log ${global_path} + +Get Manager Default Save Path + ${pip_data}= Get Manager PIP Data + ${pip_data_list}= Split String ${pip_data} + ${i}= Get Index From List ${pip_data_list} Location: + ${location}= Set Variable ${pip_data_list}[${i + 1}] + RETURN ${location}${/}rfswarm_manager${/} + +Get Manager INI Location + ${location}= Get Manager Default Save Path + RETURN ${location}${/}RFSwarmManager.ini + +Get Manager INI Data + ${location}= Get Manager INI Location + TRY + File Should Exist ${location} + File Should Not Be Empty ${location} + EXCEPT + # --- temp fix: + @{mngr_options}= Create List -g 1 + Open Manager GUI ${mngr_options} + # --- + Run Keyword Close Manager GUI ${platform} + File Should Exist ${location} + File Should Not Be Empty ${location} + END + ${ini_content}= Get File ${location} + Log ${ini_content} + Should Not Be Empty ${ini_content} + RETURN ${ini_content} + +#Read INI Data +# [Arguments] ${inifile} + +Set INI Window Size + [Arguments] ${width}=${None} ${height}=${None} + ${location}= Get Manager INI Location + ${ini_content}= Get Manager INI Data + ${ini_content_list}= Split String ${ini_content} + ${i}= Get Index From List ${ini_content_list} win_width + ${j}= Get Index From List ${ini_content_list} win_height + IF "${width}" != "${None}" + ${ini_content}= Replace String ${ini_content} ${ini_content_list}[${i + 2}] ${width} + END + IF "${height}" != "${None}" + ${ini_content}= Replace String ${ini_content} ${ini_content_list}[${j + 2}] ${height} + END + Remove File ${location} + Log ${ini_content} + Append To File ${location} ${ini_content} + +Change Manager INI File Settings + [Arguments] ${option} ${new_value} + ${location}= Get Manager INI Location + ${ini_content}= Get Manager INI Data + ${ini_content_list}= Split String ${ini_content} + ${option_index}= Get Index From List ${ini_content_list} ${option} + + ${len} Get Length ${ini_content_list} + IF ${len} > ${option_index + 2} + ${ini_content}= Replace String ${ini_content} ${ini_content_list}[${option_index + 2}] ${new_value} + ELSE + ${ini_content}= Replace String ${ini_content} ${ini_content_list}[${option_index}] = ${option} = ${new_value} + END + + Remove File ${location} + Log ${ini_content} + Append To File ${location} ${ini_content} + +Get Manager PIP Data + Run Process pip show rfswarm-manager alias=data + ${pip_data} Get Process Result data + Should Not Be Empty ${pip_data.stdout} msg=Manager must be installed with pip + Log ${pip_data.stdout} + RETURN ${pip_data.stdout} + Find Result DB # ${fols}= List Directory ${results_dir} # Log to console ${fols}