Skip to content

Commit

Permalink
merge Issue #252 into v1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
damies13 committed Nov 5, 2024
2 parents cc66a85 + 181653e commit 7e7d7d1
Show file tree
Hide file tree
Showing 32 changed files with 399 additions and 53 deletions.
27 changes: 20 additions & 7 deletions Tests/Regression/Manager/GUI_Basic.robot
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
*** Settings ***
Test Tags Basic GUI

Resource GUI_Common.robot

Library OperatingSystem
Library Process
Library String
Expand All @@ -10,7 +12,7 @@ Library ImageHorizonLibrary reference_folder=${IMAGE_DIR}
*** Variables ***
${default_image_timeout} ${120}
${cmd_agent} rfswarm-agent
${cmd_manager} rfswarm
${cmd_manager} rfswarm-manager
${IMAGE_DIR} ${CURDIR}/Images/file_method
${pyfile} ${EXECDIR}${/}rfswarm_manager${/}rfswarm.py
${process} None
Expand All @@ -20,15 +22,18 @@ Open GUI
[Tags] macos-latest
# Press Escape and move mouse because on linux the screen save had kicked in
Press Combination Key.esc
Move To 10 10
Move To 20 20
Wiggle Mouse

Set Suite Variable ${platform} macos
Set Confidence 0.9
# ${process}= Start Process python3 ${pyfile} alias=Manager stdout=${OUTPUT DIR}${/}stdout.txt stderr=${OUTPUT DIR}${/}stderr.txt
${process}= Start Process ${cmd_manager} alias=Manager stdout=${OUTPUT DIR}${/}Open_GUI_stdout.txt stderr=${OUTPUT DIR}${/}Open_GUI_stderr.txt
Set Test Variable $process ${process}
# Sleep 10 # not needed now we wait for the agents tab to be visible
Set Screenshot Folder ${OUTPUT DIR}

Handle Donation Reminder

${img}= Set Variable manager_${platform}_tab_agents.png
Wait For ${img} timeout=${default_image_timeout}
Take A Screenshot
Expand All @@ -37,15 +42,18 @@ Open GUI
[Tags] windows-latest
# Press Escape and move mouse because on linux the screen save had kicked in
Press Combination Key.esc
Move To 10 10
Move To 20 20
Wiggle Mouse

Set Suite Variable ${platform} windows
Set Confidence 0.9
# ${process}= Start Process python3 ${pyfile} alias=Manager stdout=${OUTPUT DIR}${/}stdout.txt stderr=${OUTPUT DIR}${/}stderr.txt
${process}= Start Process ${cmd_manager} alias=Manager stdout=${OUTPUT DIR}${/}Open_GUI_stdout.txt stderr=${OUTPUT DIR}${/}Open_GUI_stderr.txt
Set Test Variable $process ${process}
# Sleep 10 # not needed now we wait for the agents tab to be visible
Set Screenshot Folder ${OUTPUT DIR}

Handle Donation Reminder

${img}= Set Variable manager_${platform}_tab_agents.png
Wait For ${img} timeout=${default_image_timeout}
Take A Screenshot
Expand All @@ -54,15 +62,18 @@ Open GUI
[Tags] ubuntu-latest
# Press Escape and move mouse because on linux the screen save had kicked in
Press Combination Key.esc
Move To 10 10
Move To 20 20
Wiggle Mouse

Set Suite Variable ${platform} ubuntu
Set Confidence 0.9
# ${process}= Start Process python3 ${pyfile} alias=Manager stdout=${OUTPUT DIR}${/}stdout.txt stderr=${OUTPUT DIR}${/}stderr.txt
${process}= Start Process ${cmd_manager} alias=Manager stdout=${OUTPUT DIR}${/}Open_GUI_stdout.txt stderr=${OUTPUT DIR}${/}Open_GUI_stderr.txt
Set Test Variable $process ${process}
# Sleep 10 # not needed now we wait for the agents tab to be visible
Set Screenshot Folder ${OUTPUT DIR}

Handle Donation Reminder

${img}= Set Variable manager_${platform}_tab_agents.png
Wait For ${img} timeout=${default_image_timeout}
Take A Screenshot
Expand Down Expand Up @@ -100,6 +111,7 @@ Close GUI
${result} = Terminate Process ${process}
Fail
END
Kill Manager If Still Running

Close GUI
[Tags] macos-latest
Expand All @@ -117,6 +129,7 @@ Close GUI
${result} = Terminate Process ${process}
Fail
END
Kill Manager If Still Running

# Intentional Fail
# [Tags] ubuntu-latest windows-latest macos-latest
Expand Down
47 changes: 40 additions & 7 deletions Tests/Regression/Manager/GUI_Common.robot
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ${global_name} None
@{mngr_options} None
@{agent_options} None
${cmd_agent} rfswarm-agent
${cmd_manager} rfswarm
${cmd_manager} rfswarm-manager
${IMAGE_DIR} ${CURDIR}/Images/file_method
${pyfile_manager} ${EXECDIR}${/}rfswarm_manager${/}rfswarm.py
${pyfile_agent} ${EXECDIR}${/}rfswarm_agent${/}rfswarm_agent.py
Expand Down Expand Up @@ -84,8 +84,8 @@ Open Manager GUI
[Arguments] ${options}=None
# Press Escape and move mouse because on linux the screen save had kicked in
Press Combination Key.esc
Move To 10 10
Move To 20 20
Wiggle Mouse

IF ${options} == None
${options}= Create List
Create Directory ${results_dir}
Expand All @@ -103,7 +103,11 @@ Open Manager GUI

IF '-n' in ${options}
Sleep 10
ELSE IF '-r' in ${options} or '--run' in ${options}
Handle Donation Reminder
ELSE
Handle Donation Reminder

${img}= Set Variable manager_${platform}_button_runschedule.png
${passed}= Run Keyword And Return Status Wait For ${img} timeout=${default_image_timeout / 2}
IF not ${passed}
Expand All @@ -130,13 +134,19 @@ Open Manager GUI
END
END

Wiggle Mouse
Move To 10 10
Move To 20 20

Handle Donation Reminder
${found}= Run Keyword And Return Status Click Button MaybeLater ${default_image_timeout / 2}
VAR ${DonationReminder} ${found} scope=TEST

Close Manager GUI ubuntu
Run Keyword And Ignore Error Click Dialog Button cancel 0.01
Run Keyword And Ignore Error Click Dialog Button no 0.01
Close Manager GUI



Close Manager GUI windows
Run Keyword And Ignore Error Click Dialog Button cancel 0.01
Run Keyword And Ignore Error Click Dialog Button no 0.01
Expand Down Expand Up @@ -174,6 +184,7 @@ Close Manager GUI
Fail
END
END
Kill Manager If Still Running
# stdout=${OUTPUT DIR}${/}stdout_manager.txt stderr=${OUTPUT DIR}${/}stderr_manager.txt
Show Log ${OUTPUT DIR}${/}stdout_manager.txt
Show Log ${OUTPUT DIR}${/}stderr_manager.txt
Expand Down Expand Up @@ -214,9 +225,13 @@ Close Manager GUI macos
Fail
END
END
Kill Manager If Still Running
Show Log ${OUTPUT DIR}${/}stdout_manager.txt
Show Log ${OUTPUT DIR}${/}stderr_manager.txt

Kill Manager If Still Running
Kill If Still Running ${cmd_manager}

Stop Agent
${running}= Is Process Running ${process_agent}
IF ${running}
Expand All @@ -232,10 +247,28 @@ Stop Agent
# Should Be Equal As Integers ${result.rc} 0
END

Kill Agent If Still Running
# stdout=${OUTPUT DIR}${/}stdout_agent.txt stderr=${OUTPUT DIR}${/}stderr_agent.txt
Show Log ${OUTPUT DIR}${/}stdout_agent.txt
Show Log ${OUTPUT DIR}${/}stderr_agent.txt

Kill Agent If Still Running
Kill If Still Running ${cmd_agent}

Kill If Still Running
[Arguments] ${cmdname}
${processes}= Evaluate list(psutil.process_iter()) modules=psutil
# Log ${processes}
FOR ${p} IN @{processes}
# Log ${p}
TRY
IF $cmdname in $p.name()
Evaluate $p.kill()
END
EXCEPT # Match any error.
No Operation
END
END

Show Log
[Arguments] ${filename}
Expand Down Expand Up @@ -348,12 +381,12 @@ Selected Option Should Be


Click Button
[Arguments] ${btnname}
[Arguments] ${btnname} ${timeout}=${default_image_timeout}
${btnnamel}= Convert To Lower Case ${btnname}
${img}= Set Variable manager_${platform}_button_${btnnamel}.png
Log ${CURDIR}
Log ${IMAGE_DIR}
Wait For ${img} timeout=${default_image_timeout}
Wait For ${img} timeout=${timeout}
@{coordinates}= Locate ${img}
Click Image ${img}
Sleep 0.1
Expand Down
46 changes: 37 additions & 9 deletions Tests/Regression/Manager/GUI_Features.robot
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,16 @@ Manager Command Line AGENTS -a
Click Button runplay
${status}= Run Keyword And Return Status
... Wait For ${platform}_warning_label_not_enough_agents.png timeout=${10}
Run Keyword If not ${status} Fail msg=The manager didn't display expected prompt dialogue that says: Not enough Agents available to run Robots!
IF not ${status}
# Try again with alt screenshot
${status}= Run Keyword And Return Status
... Wait For ${platform}_warning_label_not_enough_agents2.png timeout=${10}
END

IF not ${status}
Take A Screenshot
Fail msg=The manager didn't display expected prompt dialogue that says: Not enough Agents available to run Robots!
END
Press key.enter 1 Times

[Teardown] Run Keywords
Expand Down Expand Up @@ -1911,8 +1920,17 @@ Verify If Manager Displays Prompt Dialogue When No Agents Available To Run Robot

${status}= Run Keyword And Return Status
... Wait For ${platform}_warning_label_not_enough_agents.png timeout=${10}
Take A Screenshot
Run Keyword If not ${status} Fail msg=The manager didn't display expected prompt dialogue that says: Not enough Agents available to run Robots!
IF not ${status}
# Try again with alt screenshot
${status}= Run Keyword And Return Status
... Wait For ${platform}_warning_label_not_enough_agents2.png timeout=${10}
END

IF not ${status}
Take A Screenshot
Fail msg=The manager didn't display expected prompt dialogue that says: Not enough Agents available to run Robots!
END

Press key.enter 1 Times
${status}= Run Keyword And Return Status
... Wait For manager_${platform}_button_abort timeout=${10}
Expand Down Expand Up @@ -1943,8 +1961,18 @@ Verify If Manager Displays Prompt Dialogue When No Agents Available To Run Robot
Click Button runplay
${status}= Run Keyword And Return Status
... Wait For ${platform}_warning_label_not_enough_agents.png timeout=${10}
Run Keyword If ${status} Fail
... msg=The manager have displaed prompt dialogue that says: Not enough Agents available to run Robots! but that was not expected!

IF not ${status}
# Try again with alt screenshot
${status}= Run Keyword And Return Status
... Wait For ${platform}_warning_label_not_enough_agents2.png timeout=${10}
END

IF ${status}
Take A Screenshot
Fail msg=The manager have displaed prompt dialogue that says: Not enough Agents available to run Robots! but that was not expected!
END

Sleep 5
Click Button stoprun
Sleep 2
Expand Down Expand Up @@ -2909,7 +2937,7 @@ Verify That Time Gets Correctly Validated For Schelduled Start
${copied_converted_start_time_value}= Evaluate clipboard.paste() modules=clipboard
Should Be Equal ${updated_start_times}[${i}] ${copied_converted_start_time_value}
... msg=The "Schedule Time" did not convert to the time as expected [ Expected != Converted ]

END

[Teardown] Run Keywords Close Manager GUI ${platform}
Expand Down Expand Up @@ -3042,7 +3070,7 @@ Verify Test Doesn't Start Until Scheduled To Start And Will Start After the Time
... Open Agent

${current_time}= Get Current Date result_format=%H:%M:%S
${new_time}= Add Time To Date ${current_time} 45 date_format=%H:%M:%S result_format=%H:%M:%S
${new_time}= Add Time To Date ${current_time} 105 date_format=%H:%M:%S result_format=%H:%M:%S
${scenariofile}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#89${/}Issue-#89.rfs
VAR @{mngr_options} -s ${scenariofile} -t ${new_time}

Expand Down Expand Up @@ -3072,7 +3100,7 @@ Verify the Start Time Is Displayed On the Plan Screen
VAR ${expected_time_image} 3_00_00
END
VAR @{mngr_options} -t ${scheduled_time}

Open Manager GUI ${mngr_options}
Take A Screenshot
${status}= Run Keyword And Return Status
Expand All @@ -3090,7 +3118,7 @@ Verify the Remaining Time Is Displayed On the Plan Screen

${current_time}= Get Current Date result_format=%H:%M:%S
#adding 10m:20s
${new_time}= Add Time To Date ${current_time} 620 date_format=%H:%M:%S result_format=%H:%M:%S
${new_time}= Add Time To Date ${current_time} 680 date_format=%H:%M:%S result_format=%H:%M:%S
VAR @{mngr_options} -t ${new_time}

Open Manager GUI ${mngr_options}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Tests/Regression/Manager/Images/file_method/macos_finder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Tests/Regression/Manager/Images/file_method/macos_launchpad.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 46 additions & 1 deletion Tests/Regression/Reporter/GUI_Basic.robot
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,52 @@ Select Preview Tab
Click Tab Preview
# Close GUI


# Accessability Settings test was to verify Terminal is set to 'check'
# https://stackoverflow.com/questions/62035751/pyautogui-not-running-on-mac-catalina
# MacOS Accessability Settings
# [Tags] macos-latest
#
# # setting -> security & privacy -> Accessibility -> Terminal 'check'
#
# # Open Settings
# ${img}= Set Variable ${platform}_settings.png
# Wait For ${img} timeout=${default_image_timeout}
# @{coordinates}= Locate ${img}
# Click Image ${img}
#
#
# # Open security & privacy
# ${img}= Set Variable ${platform}_settings_privsec.png
# Wait For ${img} timeout=${default_image_timeout}
# Click Image ${img}
#
# # Open Accessibility
# ${img}= Set Variable ${platform}_settings_accessibility.png
# ${imgsd}= Set Variable ${platform}_settings_scrolldown.png
# ${found}= Run Keyword And Return Status Wait For ${img} timeout=10
# WHILE not ${found}
# Take A Screenshot
# Click Image ${imgsd}
# ${found}= Run Keyword And Return Status Wait For ${img} timeout=10
# END
# Take A Screenshot
# Click Image ${img}
#
# # Open Check Terminal
#
# Sleep 10.5
# Take A Screenshot
# Fatal Error Intentional Fail
#
# Click Image reporter_${platform}_button_closewindow.png
# Run Keyword And Ignore Error Click Image reporter_${platform}_button_closewindow.png
# Take A Screenshot
# Sleep 0.5
#
#
# Fatal Error Intentional Fail
#
# [Teardown] Fatal Error Intentional Fail

# Intentional Fail
# [Tags] ubuntu-latest windows-latest macos-latest
Expand Down
8 changes: 4 additions & 4 deletions Tests/Regression/Reporter/GUI_Bugs.robot
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ Verify If Reporter Runs With Existing INI File From Current Version
File Should Not Be Empty ${location}${/}RFSwarmReporter.ini
Log To Console Running Reporter with existing ini file.
Open GUI
Wait For Status PreviewLoaded
TRY
Sleep 10
Click Section test_result_summary
Click #double click needed. Maybe delete after eel module implemetation
Wait For reporter_${platform}_option_datatable.png timeout=${30}
Wait For reporter_${platform}_option_datatable.png timeout=${60}
EXCEPT
Fail msg=Reporter is not responding!
END
Expand All @@ -35,8 +35,8 @@ Verify If Reporter Runs With No Existing INI File From Current Version
File Should Not Exist ${location}${/}RFSwarmReporter.ini
Log To Console Running Reporter with no existing ini file.
Open GUI
Wait For Status SelectResultFile
TRY
Sleep 10
Click Section test_result_summary
Click #double click needed. Maybe delete after eel module implemetation
Wait For reporter_${platform}_option_datatable.png timeout=${30}
Expand All @@ -56,8 +56,8 @@ Verify If Reporter Runs With Existing INI File From Previous Version
File Should Not Be Empty ${location}${/}RFSwarmReporter.ini
Log To Console Running Reporter with existing ini file.
Open GUI
Wait For Status SelectResultFile
TRY
Sleep 10
Click Section test_result_summary
Click #double click needed. Maybe delete after eel module implemetation
Wait For reporter_${platform}_option_datatable.png timeout=${30}
Expand Down
Loading

0 comments on commit 7e7d7d1

Please sign in to comment.