Skip to content

Commit

Permalink
Keywords needed by the tests I moved to commoanline_bugs
Browse files Browse the repository at this point in the history
Issue #145
  • Loading branch information
damies13 committed Sep 16, 2024
1 parent 3e7c81a commit c5acb4c
Showing 1 changed file with 103 additions and 0 deletions.
103 changes: 103 additions & 0 deletions Tests/Regression/Manager/CommandLine_Common.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit c5acb4c

Please sign in to comment.