Skip to content

Commit

Permalink
Trying to take images
Browse files Browse the repository at this point in the history
  • Loading branch information
ArekKuczynski committed Mar 29, 2024
1 parent a4fb69c commit 2869239
Show file tree
Hide file tree
Showing 5 changed files with 294 additions and 293 deletions.
76 changes: 38 additions & 38 deletions Tests/Regression/Manager/CommandLine_Basic.robot
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
*** Settings ***
Library OperatingSystem
# *** Settings ***
# Library OperatingSystem

Suite Setup Clean Up Old Files
# Suite Setup Clean Up Old Files

*** Variables ***
${cmd_agent} rfswarm-agent
${cmd_manager} rfswarm
# *** Variables ***
# ${cmd_agent} rfswarm-agent
# ${cmd_manager} rfswarm

*** Test Cases ***
Robot Version
[Documentation] Logs the robot framework version used
[Tags] ubuntu-latest macos-latest windows-latest
${Robot_Version} = Evaluate robot.__version__ modules=robot
Log ${\n}Robot Version: ${Robot_Version} console=True
# *** Test Cases ***
# Robot Version
# [Documentation] Logs the robot framework version used
# [Tags] ubuntu-latest macos-latest windows-latest
# ${Robot_Version} = Evaluate robot.__version__ modules=robot
# Log ${\n}Robot Version: ${Robot_Version} console=True

Random Offset
[Documentation] This just prevents all the test runners doing git push at the same time
[Tags] ubuntu-latest macos-latest windows-latest
${random} = Evaluate random.randint(0, 60)
Sleep ${random}
# Random Offset
# [Documentation] This just prevents all the test runners doing git push at the same time
# [Tags] ubuntu-latest macos-latest windows-latest
# ${random} = Evaluate random.randint(0, 60)
# Sleep ${random}

Manager Version
[Tags] ubuntu-latest macos-latest windows-latest
# ${result}= Run python3 ${EXECDIR}${/}rfswarm_manager${/}rfswarm.py -v
${result}= Run ${cmd_manager} -v
Log to console ${\n}${result}
Should Contain ${result} Version
Should Contain ${result} Manager
# Manager Version
# [Tags] ubuntu-latest macos-latest windows-latest
# # ${result}= Run python3 ${EXECDIR}${/}rfswarm_manager${/}rfswarm.py -v
# ${result}= Run ${cmd_manager} -v
# Log to console ${\n}${result}
# Should Contain ${result} Version
# Should Contain ${result} Manager

Manager Help
[Tags] ubuntu-latest macos-latest windows-latest
# ${result}= Run python3 ${EXECDIR}${/}rfswarm_manager${/}rfswarm.py -h
${result}= Run ${cmd_manager} -h
Log to console ${\n}${result}
Should Contain ${result} IPADDRESS
# Manager Help
# [Tags] ubuntu-latest macos-latest windows-latest
# # ${result}= Run python3 ${EXECDIR}${/}rfswarm_manager${/}rfswarm.py -h
# ${result}= Run ${cmd_manager} -h
# Log to console ${\n}${result}
# Should Contain ${result} IPADDRESS

*** Keywords ***
Clean Up Old Files
[Tags] ubuntu-latest macos-latest windows-latest
# cleanup previous output
Log To Console ${OUTPUT DIR}
Remove File ${OUTPUT DIR}${/}*.txt
Remove File ${OUTPUT DIR}${/}*.png
# Remove File ${OUTPUT DIR}${/}sikuli_captured${/}*.*
# *** Keywords ***
# Clean Up Old Files
# [Tags] ubuntu-latest macos-latest windows-latest
# # cleanup previous output
# Log To Console ${OUTPUT DIR}
# Remove File ${OUTPUT DIR}${/}*.txt
# Remove File ${OUTPUT DIR}${/}*.png
# # Remove File ${OUTPUT DIR}${/}sikuli_captured${/}*.*
72 changes: 36 additions & 36 deletions Tests/Regression/Manager/CommandLine_Bugs.robot
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
*** Settings ***
Resource CommandLine_Common.robot
# *** Settings ***
# Resource CommandLine_Common.robot

*** Test Cases ***
Robbot files with same name but different folders
[Tags] ubuntu-latest windows-latest macos-latest Issue #184
Log To Console ${\n}TAGS: ${TEST TAGS}
@{agnt_options}= Create List -g 1 -m http://localhost:8138
Run Agent ${agnt_options}
Sleep 1s
Check Agent Is Running
Log to console ${CURDIR}
${scenariofile}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#184${/}Issue-#184.rfs
Log to console ${scenariofile}
@{mngr_options}= Create List -g 1 -s ${scenariofile} -n
Run Manager CLI ${mngr_options}
Wait For Manager
Stop Agent
Show Log ${OUTPUT DIR}${/}stdout_manager.txt
Show Log ${OUTPUT DIR}${/}stderr_manager.txt
Show Log ${OUTPUT DIR}${/}stdout_agent.txt
Show Log ${OUTPUT DIR}${/}stderr_agent.txt
# *** Test Cases ***
# Robbot files with same name but different folders
# [Tags] ubuntu-latest windows-latest macos-latest Issue #184
# Log To Console ${\n}TAGS: ${TEST TAGS}
# @{agnt_options}= Create List -g 1 -m http://localhost:8138
# Run Agent ${agnt_options}
# Sleep 1s
# Check Agent Is Running
# Log to console ${CURDIR}
# ${scenariofile}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#184${/}Issue-#184.rfs
# Log to console ${scenariofile}
# @{mngr_options}= Create List -g 1 -s ${scenariofile} -n
# Run Manager CLI ${mngr_options}
# Wait For Manager
# Stop Agent
# Show Log ${OUTPUT DIR}${/}stdout_manager.txt
# Show Log ${OUTPUT DIR}${/}stderr_manager.txt
# Show Log ${OUTPUT DIR}${/}stdout_agent.txt
# Show Log ${OUTPUT DIR}${/}stderr_agent.txt

Should Not Contain ${OUTPUT DIR}${/}stdout_agent.txt Robot returned an error
Should Not Contain ${OUTPUT DIR}${/}stdout_agent.txt please check the log file
# Should Not Contain ${OUTPUT DIR}${/}stdout_agent.txt Robot returned an error
# Should Not Contain ${OUTPUT DIR}${/}stdout_agent.txt please check the log file

${dbfile}= Find Result DB
${result}= Query Result DB ${dbfile} Select count(*) from Summary;
Should Be True ${result[0][0]} > 0
Should Be Equal As Numbers ${result[0][0]} 4
${result}= Query Result DB ${dbfile} Select count(*) from Summary where _pass > 0;
Should Be True ${result[0][0]} > 0
Should Be Equal As Numbers ${result[0][0]} 4
${result}= Query Result DB ${dbfile} Select result_name from Summary;
Should Contain ${result} ${{ ('Folder A Log Variables AAA',) }}
Should Contain ${result} ${{ ('Folder B Log Variables BBB',) }}
${result}= Query Result DB ${dbfile} Select result_name from Summary where _pass > 0;
Should Contain ${result} ${{ ('Folder A Log Variables AAA',) }}
Should Contain ${result} ${{ ('Folder B Log Variables BBB',) }}
# ${dbfile}= Find Result DB
# ${result}= Query Result DB ${dbfile} Select count(*) from Summary;
# Should Be True ${result[0][0]} > 0
# Should Be Equal As Numbers ${result[0][0]} 4
# ${result}= Query Result DB ${dbfile} Select count(*) from Summary where _pass > 0;
# Should Be True ${result[0][0]} > 0
# Should Be Equal As Numbers ${result[0][0]} 4
# ${result}= Query Result DB ${dbfile} Select result_name from Summary;
# Should Contain ${result} ${{ ('Folder A Log Variables AAA',) }}
# Should Contain ${result} ${{ ('Folder B Log Variables BBB',) }}
# ${result}= Query Result DB ${dbfile} Select result_name from Summary where _pass > 0;
# Should Contain ${result} ${{ ('Folder A Log Variables AAA',) }}
# Should Contain ${result} ${{ ('Folder B Log Variables BBB',) }}
230 changes: 115 additions & 115 deletions Tests/Regression/Manager/CommandLine_Common.robot
Original file line number Diff line number Diff line change
@@ -1,115 +1,115 @@
*** Settings ***
Library OperatingSystem
Library Process
Library DatabaseLibrary
Library String
Library Collections

*** Variables ***
${cmd_agent} rfswarm-agent
${cmd_manager} rfswarm
${pyfile_agent} ${EXECDIR}${/}rfswarm_agent${/}rfswarm_agent.py
${pyfile_manager} ${EXECDIR}${/}rfswarm_manager${/}rfswarm.py
${process_agent} None
${process_manager} None

# datapath: /home/runner/work/rfswarm/rfswarm/rfswarm_manager/results/PreRun
# datapath: /opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/rfswarm_manager/results/PreRun -- let's control the output path rather than leaving it to chance
# datapath: /opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/rfswarm_manager/PreRun
# ${results_dir} ${EXECDIR}${/}rfswarm_manager${/}results
# ${results_dir} ${TEMPDIR}${/}rfswarm_manager${/}results
${results_dir} ${OUTPUT DIR}${/}results
${agent_dir} ${OUTPUT DIR}${/}rfswarm-agent

*** Keywords ***

Show Log
[Arguments] ${filename}
Log to console ${\n}-----${filename}-----
${filedata}= Get File ${filename}
Log to console ${filedata}
Log to console -----${filename}-----${\n}

Show Dir Contents
[Arguments] ${dir}
${filesnfolders}= Evaluate glob.glob("${dir}${/}*", recursive=True) modules=glob
FOR ${item} IN ${filesnfolders}
Log ${item} console=True
END

Run Agent
[Arguments] ${options}=None
IF ${options} == None
${options}= Create List
END
Append To List ${options} -d ${agent_dir}

Log to console ${\n}\${options}: ${options}
# ${process}= Start Process python3 ${pyfile_agent} @{options} alias=Agent stdout=${OUTPUT DIR}${/}stdout_agent.txt stderr=${OUTPUT DIR}${/}stderr_agent.txt
${process}= Start Process ${cmd_agent} @{options} alias=Agent stdout=${OUTPUT DIR}${/}stdout_agent.txt stderr=${OUTPUT DIR}${/}stderr_agent.txt
Set Test Variable $process_agent ${process}

Run Manager CLI
[Arguments] ${options}=None
IF ${options} == None
${options}= Create List
END
Create Directory ${results_dir}
Append To List ${options} -d ${results_dir}
Log to console ${\n}\${options}: ${options}
# ${process}= Start Process python3 ${pyfile_manager} @{options} alias=Manager stdout=${OUTPUT DIR}${/}stdout_manager.txt stderr=${OUTPUT DIR}${/}stderr_manager.txt
${process}= Start Process ${cmd_manager} @{options} alias=Manager stdout=${OUTPUT DIR}${/}stdout_manager.txt stderr=${OUTPUT DIR}${/}stderr_manager.txt
Set Test Variable $process_manager ${process}

Wait For Manager
[Arguments] ${timeout}=10min
${result}= Wait For Process ${process_manager} timeout=${timeout} on_timeout=kill
# Should Be Equal As Integers ${result.rc} 0
Log to console ${result.rc}

Check Agent Is Running
${result}= Is Process Running ${process_agent}
# Should Be Equal As Integers ${result.rc} 0
Log Is Agent Running: ${result} console=True
Should Be True ${result}

Stop Manager
${result}= Terminate Process ${process_manager}
# Should Be Equal As Integers ${result.rc} 0
Log to console Terminate Process returned: ${result.rc}

Stop Agent
${result}= Terminate Process ${process_agent}
# Should Be Equal As Integers ${result.rc} 0
Log Terminate Process returned: ${result.rc} console=True
Log stdout_path: ${result.stdout_path} console=True
Log stdout: ${result.stdout} console=True
Log stderr_path: ${result.stderr_path} console=True
Log stderr: ${result.stderr} console=True
Show Dir Contents ${agent_dir}

Find Result DB
# ${fols}= List Directory ${results_dir}
# Log to console ${fols}
${fols}= List Directory ${results_dir} *_* absolute=True
Log to console ${fols}
# ${files}= List Directory ${fols[0]}
# Log to console ${files}
${file}= List Directory ${fols[-1]} *.db absolute=True
Log to console Result DB: ${file[-1]}
RETURN ${file[-1]}

Query Result DB
[Arguments] ${dbfile} ${sql}
Log to console dbfile: ${dbfile}
${dbfile}= Replace String ${dbfile} ${/} /
# Log to console \${dbfile}: ${dbfile}
Connect To Database Using Custom Params sqlite3 database="${dbfile}", isolation_level=None
Log to console sql: ${sql}
${result}= Query ${sql}
Log to console sql result: ${result}
Disconnect From Database
RETURN ${result}


#
# *** Settings ***
# Library OperatingSystem
# Library Process
# Library DatabaseLibrary
# Library String
# Library Collections

# *** Variables ***
# ${cmd_agent} rfswarm-agent
# ${cmd_manager} rfswarm
# ${pyfile_agent} ${EXECDIR}${/}rfswarm_agent${/}rfswarm_agent.py
# ${pyfile_manager} ${EXECDIR}${/}rfswarm_manager${/}rfswarm.py
# ${process_agent} None
# ${process_manager} None

# # datapath: /home/runner/work/rfswarm/rfswarm/rfswarm_manager/results/PreRun
# # datapath: /opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/rfswarm_manager/results/PreRun -- let's control the output path rather than leaving it to chance
# # datapath: /opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/rfswarm_manager/PreRun
# # ${results_dir} ${EXECDIR}${/}rfswarm_manager${/}results
# # ${results_dir} ${TEMPDIR}${/}rfswarm_manager${/}results
# ${results_dir} ${OUTPUT DIR}${/}results
# ${agent_dir} ${OUTPUT DIR}${/}rfswarm-agent

# *** Keywords ***

# Show Log
# [Arguments] ${filename}
# Log to console ${\n}-----${filename}-----
# ${filedata}= Get File ${filename}
# Log to console ${filedata}
# Log to console -----${filename}-----${\n}

# Show Dir Contents
# [Arguments] ${dir}
# ${filesnfolders}= Evaluate glob.glob("${dir}${/}*", recursive=True) modules=glob
# FOR ${item} IN ${filesnfolders}
# Log ${item} console=True
# END

# Run Agent
# [Arguments] ${options}=None
# IF ${options} == None
# ${options}= Create List
# END
# Append To List ${options} -d ${agent_dir}

# Log to console ${\n}\${options}: ${options}
# # ${process}= Start Process python3 ${pyfile_agent} @{options} alias=Agent stdout=${OUTPUT DIR}${/}stdout_agent.txt stderr=${OUTPUT DIR}${/}stderr_agent.txt
# ${process}= Start Process ${cmd_agent} @{options} alias=Agent stdout=${OUTPUT DIR}${/}stdout_agent.txt stderr=${OUTPUT DIR}${/}stderr_agent.txt
# Set Test Variable $process_agent ${process}

# Run Manager CLI
# [Arguments] ${options}=None
# IF ${options} == None
# ${options}= Create List
# END
# Create Directory ${results_dir}
# Append To List ${options} -d ${results_dir}
# Log to console ${\n}\${options}: ${options}
# # ${process}= Start Process python3 ${pyfile_manager} @{options} alias=Manager stdout=${OUTPUT DIR}${/}stdout_manager.txt stderr=${OUTPUT DIR}${/}stderr_manager.txt
# ${process}= Start Process ${cmd_manager} @{options} alias=Manager stdout=${OUTPUT DIR}${/}stdout_manager.txt stderr=${OUTPUT DIR}${/}stderr_manager.txt
# Set Test Variable $process_manager ${process}

# Wait For Manager
# [Arguments] ${timeout}=10min
# ${result}= Wait For Process ${process_manager} timeout=${timeout} on_timeout=kill
# # Should Be Equal As Integers ${result.rc} 0
# Log to console ${result.rc}

# Check Agent Is Running
# ${result}= Is Process Running ${process_agent}
# # Should Be Equal As Integers ${result.rc} 0
# Log Is Agent Running: ${result} console=True
# Should Be True ${result}

# Stop Manager
# ${result}= Terminate Process ${process_manager}
# # Should Be Equal As Integers ${result.rc} 0
# Log to console Terminate Process returned: ${result.rc}

# Stop Agent
# ${result}= Terminate Process ${process_agent}
# # Should Be Equal As Integers ${result.rc} 0
# Log Terminate Process returned: ${result.rc} console=True
# Log stdout_path: ${result.stdout_path} console=True
# Log stdout: ${result.stdout} console=True
# Log stderr_path: ${result.stderr_path} console=True
# Log stderr: ${result.stderr} console=True
# Show Dir Contents ${agent_dir}

# Find Result DB
# # ${fols}= List Directory ${results_dir}
# # Log to console ${fols}
# ${fols}= List Directory ${results_dir} *_* absolute=True
# Log to console ${fols}
# # ${files}= List Directory ${fols[0]}
# # Log to console ${files}
# ${file}= List Directory ${fols[-1]} *.db absolute=True
# Log to console Result DB: ${file[-1]}
# RETURN ${file[-1]}

# Query Result DB
# [Arguments] ${dbfile} ${sql}
# Log to console dbfile: ${dbfile}
# ${dbfile}= Replace String ${dbfile} ${/} /
# # Log to console \${dbfile}: ${dbfile}
# Connect To Database Using Custom Params sqlite3 database="${dbfile}", isolation_level=None
# Log to console sql: ${sql}
# ${result}= Query ${sql}
# Log to console sql result: ${result}
# Disconnect From Database
# RETURN ${result}


# #
Loading

0 comments on commit 2869239

Please sign in to comment.