Skip to content

Commit

Permalink
Merge pull request #327 from NiceProjectPoland/Test-#202-for-Issue-#56
Browse files Browse the repository at this point in the history
Test cases for Issue #56 - Verify the result name returned from keywords works correctly
  • Loading branch information
damies13 authored Jan 1, 2025
2 parents b269b77 + e6e50cf commit 79500f7
Show file tree
Hide file tree
Showing 11 changed files with 111 additions and 80 deletions.
2 changes: 0 additions & 2 deletions Tests/Regression/Agent/CommandLine_Features.robot
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
Resource CommandLine_Common.robot
Suite Setup Set Platform

Suite Setup Set Platform

*** Test Cases ***
Install Application Icon or Desktop Shortcut
[Tags] ubuntu-latest windows-latest macos-latest Issue #145
Expand Down
128 changes: 58 additions & 70 deletions Tests/Regression/Manager/CommandLine_Features.robot
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Environment Variable Substitution in Robot/Resource files
... Stop Manager

Default Result Name Method
[Tags] ubuntu-latest windows-latest macos-latest Issue #154
[Tags] ubuntu-latest windows-latest macos-latest Issue #154 Issue #56
Run Agent
${scenariofile}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#154${/}default.rfs
Log to console ${scenariofile}
Expand All @@ -69,11 +69,9 @@ Default Result Name Method
Length Should Be ${lst_summary} 1
${result}= CSV to List ${lst_summary}[0]

# ${dbfile}= Find Result DB
# # ${result}= Query Result DB ${dbfile} Select Name from ResultSummary;
# ${result}= Query Result DB ${dbfile} SELECT result_name FROM Results GROUP BY result_name ORDER BY result_name;
Sort List ${result}
Log ${result}
Log Found result names from keywords in CSV summary file after scenario run: ${\n}${result} console=${True}
Length Should Be ${result} 4 msg=Unique Result Names number from keywords is incorrect. Check the Logs.
Should Be Equal ${result[0][0]} Default Keyword Documentation
Should Be Equal ${result[1][0]} Doc Keyword Message
Should Be Equal ${result[2][0]} Doc only keyword From Info Library
Expand All @@ -84,7 +82,7 @@ Default Result Name Method
... Stop Manager

Documentation Result Name Method - Tests Defaults
[Tags] ubuntu-latest windows-latest macos-latest Issue #154
[Tags] ubuntu-latest windows-latest macos-latest Issue #154 Issue #56
Run Agent
${scenariofile}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#154${/}documentation_td.rfs
Log to console ${scenariofile}
Expand All @@ -102,11 +100,9 @@ Documentation Result Name Method - Tests Defaults
Length Should Be ${lst_summary} 1
${result}= CSV to List ${lst_summary}[0]

# ${dbfile}= Find Result DB
# # ${result}= Query Result DB ${dbfile} Select Name from ResultSummary;
# ${result}= Query Result DB ${dbfile} SELECT result_name FROM Results GROUP BY result_name ORDER BY result_name;
Sort List ${result}
Log ${result}
Log Found result names from keywords in CSV summary file after scenario run: ${\n}${result} console=${True}
Length Should Be ${result} 3 msg=Unique Result Names number from keywords is incorrect. Check the Logs.
Should Be Equal ${result[0][0]} Default Keyword Documentation
Should Be Equal ${result[1][0]} Doc keyword From Info Library
Should Be Equal ${result[2][0]} Doc only keyword From Info Library
Expand All @@ -116,7 +112,7 @@ Documentation Result Name Method - Tests Defaults
... Stop Manager

Info Result Name Method - Tests Defaults
[Tags] ubuntu-latest windows-latest macos-latest Issue #154
[Tags] ubuntu-latest windows-latest macos-latest Issue #154 Issue #56
Run Agent
${scenariofile}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#154${/}info_td.rfs
Log to console ${scenariofile}
Expand All @@ -134,11 +130,9 @@ Info Result Name Method - Tests Defaults
Length Should Be ${lst_summary} 1
${result}= CSV to List ${lst_summary}[0]

# ${dbfile}= Find Result DB
# # ${result}= Query Result DB ${dbfile} Select Name from ResultSummary;
# ${result}= Query Result DB ${dbfile} SELECT result_name FROM Results GROUP BY result_name ORDER BY result_name;
Sort List ${result}
Log ${result}
Log Found result names from keywords in CSV summary file after scenario run: ${\n}${result} console=${True}
Length Should Be ${result} 2 msg=Unique Result Names number from keywords is incorrect. Check the Logs.
Should Be Equal ${result[0][0]} Doc Keyword Message
Should Be Equal ${result[1][0]} Message for Info Keyword

Expand All @@ -147,7 +141,7 @@ Info Result Name Method - Tests Defaults
... Stop Manager

Keyword Only Result Name Method - Tests Defaults
[Tags] ubuntu-latest windows-latest macos-latest Issue #154
[Tags] ubuntu-latest windows-latest macos-latest Issue #154 Issue #56
Run Agent
${scenariofile}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#154${/}keyword_td.rfs
Log to console ${scenariofile}
Expand All @@ -165,23 +159,23 @@ Keyword Only Result Name Method - Tests Defaults
Length Should Be ${lst_summary} 1
${result}= CSV to List ${lst_summary}[0]

# ${dbfile}= Find Result DB
# # ${result}= Query Result DB ${dbfile} Select Name from ResultSummary;
# ${result}= Query Result DB ${dbfile} SELECT result_name FROM Results GROUP BY result_name ORDER BY result_name;
Sort List ${result}
Log ${result}
Should Be Equal ${result[0][0]} Default Keyword Name
Should Be Equal ${result[1][0]} Doc Keyword
Should Be Equal ${result[2][0]} Doc Only Keyword
Should Be Equal ${result[3][0]} Info Keyword
Should Be Equal ${result[4][0]} Quiet Keyword Name
Log Found result names from keywords in CSV summary file after scenario run: ${\n}${result} console=${True}
Length Should Be ${result} 7 msg=Unique Result Names number from keywords is incorrect. Check the Logs.
Should Be Equal ${result[0][0]} Argument Keyword
Should Be Equal ${result[1][0]} Default Keyword Name
Should Be Equal ${result[2][0]} Doc Keyword
Should Be Equal ${result[3][0]} Doc Only Keyword
Should Be Equal ${result[4][0]} Info Keyword
Should Be Equal ${result[5][0]} Quiet Keyword Name
Should Be Equal ${result[6][0]} Return Only Keyword

[Teardown] Run Keywords
... Stop Agent AND
... Stop Manager

Keyword and Args Result Name Method - Tests Defaults
[Tags] ubuntu-latest windows-latest macos-latest Issue #154
[Tags] ubuntu-latest windows-latest macos-latest Issue #154 Issue #56
Run Agent
${scenariofile}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#154${/}keywordargs_td.rfs
Log to console ${scenariofile}
Expand All @@ -199,23 +193,23 @@ Keyword and Args Result Name Method - Tests Defaults
Length Should Be ${lst_summary} 1
${result}= CSV to List ${lst_summary}[0]

# ${dbfile}= Find Result DB
# # ${result}= Query Result DB ${dbfile} Select Name from ResultSummary;
# ${result}= Query Result DB ${dbfile} SELECT result_name FROM Results GROUP BY result_name ORDER BY result_name;
Sort List ${result}
Log ${result}
Should Be Equal ${result[0][0]} Default Keyword Name
Should Be Equal ${result[1][0]} Doc Keyword Doc Keyword Message
Should Be Equal ${result[2][0]} Doc Only Keyword Doc Keyword Message
Should Be Equal ${result[3][0]} Info Keyword Message for Info Keyword
Should Be Equal ${result[4][0]} Quiet Keyword Name
Log Found result names from keywords in CSV summary file after scenario run: ${\n}${result} console=${True}
Length Should Be ${result} 7 msg=Unique Result Names number from keywords is incorrect. Check the Logs.
Should Be Equal ${result[0][0]} Argument Keyword Arg1
Should Be Equal ${result[1][0]} Default Keyword Name
Should Be Equal ${result[2][0]} Doc Keyword Doc Keyword Message
Should Be Equal ${result[3][0]} Doc Only Keyword Doc Keyword Message
Should Be Equal ${result[4][0]} Info Keyword Message for Info Keyword
Should Be Equal ${result[5][0]} Quiet Keyword Name
Should Be Equal ${result[6][0]} Return Only Keyword Hello

[Teardown] Run Keywords
... Stop Agent AND
... Stop Manager

Default Result Name Method - Tests Row
[Tags] ubuntu-latest windows-latest macos-latest Issue #154
[Tags] ubuntu-latest windows-latest macos-latest Issue #154 Issue #56
Run Agent
${scenariofile}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#154${/}default_tr.rfs
Log to console ${scenariofile}
Expand All @@ -233,11 +227,9 @@ Default Result Name Method - Tests Row
Length Should Be ${lst_summary} 1
${result}= CSV to List ${lst_summary}[0]

# ${dbfile}= Find Result DB
# # ${result}= Query Result DB ${dbfile} Select Name from ResultSummary;
# ${result}= Query Result DB ${dbfile} SELECT result_name FROM Results GROUP BY result_name ORDER BY result_name;
Sort List ${result}
Log ${result}
Log Found result names from keywords in CSV summary file after scenario run: ${\n}${result} console=${True}
Length Should Be ${result} 4 msg=Unique Result Names number from keywords is incorrect. Check the Logs.
Should Be Equal ${result[0][0]} Default Keyword Documentation
Should Be Equal ${result[1][0]} Doc Keyword Message
Should Be Equal ${result[2][0]} Doc only keyword From Info Library
Expand All @@ -248,7 +240,7 @@ Default Result Name Method - Tests Row
... Stop Manager

Documentation Result Name Method - Tests Row
[Tags] ubuntu-latest windows-latest macos-latest Issue #154
[Tags] ubuntu-latest windows-latest macos-latest Issue #154 Issue #56
Run Agent
${scenariofile}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#154${/}documentation_tr.rfs
Log to console ${scenariofile}
Expand All @@ -266,11 +258,9 @@ Documentation Result Name Method - Tests Row
Length Should Be ${lst_summary} 1
${result}= CSV to List ${lst_summary}[0]

# ${dbfile}= Find Result DB
# # ${result}= Query Result DB ${dbfile} Select Name from ResultSummary;
# ${result}= Query Result DB ${dbfile} SELECT result_name FROM Results GROUP BY result_name ORDER BY result_name;
Sort List ${result}
Log ${result}
Log Found result names from keywords in CSV summary file after scenario run: ${\n}${result} console=${True}
Length Should Be ${result} 3 msg=Unique Result Names number from keywords is incorrect. Check the Logs.
Should Be Equal ${result[0][0]} Default Keyword Documentation
Should Be Equal ${result[1][0]} Doc keyword From Info Library
Should Be Equal ${result[2][0]} Doc only keyword From Info Library
Expand All @@ -280,7 +270,7 @@ Documentation Result Name Method - Tests Row
... Stop Manager

Info Result Name Method - Tests Row
[Tags] ubuntu-latest windows-latest macos-latest Issue #154
[Tags] ubuntu-latest windows-latest macos-latest Issue #154 Issue #56
Run Agent
${scenariofile}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#154${/}info_tr.rfs
Log to console ${scenariofile}
Expand All @@ -298,11 +288,9 @@ Info Result Name Method - Tests Row
Length Should Be ${lst_summary} 1
${result}= CSV to List ${lst_summary}[0]

# ${dbfile}= Find Result DB
# # ${result}= Query Result DB ${dbfile} Select Name from ResultSummary;
# ${result}= Query Result DB ${dbfile} SELECT result_name FROM Results GROUP BY result_name ORDER BY result_name;
Sort List ${result}
Log ${result}
Log Found result names from keywords in CSV summary file after scenario run: ${\n}${result} console=${True}
Length Should Be ${result} 2 msg=Unique Result Names number from keywords is incorrect. Check the Logs.
Should Be Equal ${result[0][0]} Doc Keyword Message
Should Be Equal ${result[1][0]} Message for Info Keyword

Expand All @@ -311,7 +299,7 @@ Info Result Name Method - Tests Row
... Stop Manager

Keyword Only Result Name Method - Tests Row
[Tags] ubuntu-latest windows-latest macos-latest Issue #154
[Tags] ubuntu-latest windows-latest macos-latest Issue #154 Issue #56
Run Agent
${scenariofile}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#154${/}keyword_tr.rfs
Log to console ${scenariofile}
Expand All @@ -329,23 +317,23 @@ Keyword Only Result Name Method - Tests Row
Length Should Be ${lst_summary} 1
${result}= CSV to List ${lst_summary}[0]

# ${dbfile}= Find Result DB
# # ${result}= Query Result DB ${dbfile} Select Name from ResultSummary;
# ${result}= Query Result DB ${dbfile} SELECT result_name FROM Results GROUP BY result_name ORDER BY result_name;
Sort List ${result}
Log ${result}
Should Be Equal ${result[0][0]} Default Keyword Name
Should Be Equal ${result[1][0]} Doc Keyword
Should Be Equal ${result[2][0]} Doc Only Keyword
Should Be Equal ${result[3][0]} Info Keyword
Should Be Equal ${result[4][0]} Quiet Keyword Name
Log Found result names from keywords in CSV summary file after scenario run: ${\n}${result} console=${True}
Length Should Be ${result} 7 msg=Unique Result Names number from keywords is incorrect. Check the Logs.
Should Be Equal ${result[0][0]} Argument Keyword
Should Be Equal ${result[1][0]} Default Keyword Name
Should Be Equal ${result[2][0]} Doc Keyword
Should Be Equal ${result[3][0]} Doc Only Keyword
Should Be Equal ${result[4][0]} Info Keyword
Should Be Equal ${result[5][0]} Quiet Keyword Name
Should Be Equal ${result[6][0]} Return Only Keyword

[Teardown] Run Keywords
... Stop Agent AND
... Stop Manager

Keyword and Args Result Name Method - Tests Row
[Tags] ubuntu-latest windows-latest macos-latest Issue #154
[Tags] ubuntu-latest windows-latest macos-latest Issue #154 Issue #56
Run Agent
${scenariofile}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#154${/}keywordargs_tr.rfs
Log to console ${scenariofile}
Expand All @@ -363,16 +351,16 @@ Keyword and Args Result Name Method - Tests Row
Length Should Be ${lst_summary} 1
${result}= CSV to List ${lst_summary}[0]

# ${dbfile}= Find Result DB
# # ${result}= Query Result DB ${dbfile} Select Name from ResultSummary;
# ${result}= Query Result DB ${dbfile} SELECT result_name FROM Results GROUP BY result_name ORDER BY result_name;
Sort List ${result}
Log ${result}
Should Be Equal ${result[0][0]} Default Keyword Name
Should Be Equal ${result[1][0]} Doc Keyword Doc Keyword Message
Should Be Equal ${result[2][0]} Doc Only Keyword Doc Keyword Message
Should Be Equal ${result[3][0]} Info Keyword Message for Info Keyword
Should Be Equal ${result[4][0]} Quiet Keyword Name
Log Found result names from keywords in CSV summary file after scenario run: ${\n}${result} console=${True}
Length Should Be ${result} 7 msg=Unique Result Names number from keywords is incorrect. Check the Logs.
Should Be Equal ${result[0][0]} Argument Keyword Arg1
Should Be Equal ${result[1][0]} Default Keyword Name
Should Be Equal ${result[2][0]} Doc Keyword Doc Keyword Message
Should Be Equal ${result[3][0]} Doc Only Keyword Doc Keyword Message
Should Be Equal ${result[4][0]} Info Keyword Message for Info Keyword
Should Be Equal ${result[5][0]} Quiet Keyword Name
Should Be Equal ${result[6][0]} Return Only Keyword Hello

[Teardown] Run Keywords
... Stop Agent AND
Expand Down
34 changes: 31 additions & 3 deletions Tests/Regression/Manager/GUI_Common.robot
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Open Manager GUI
IF not ${passed}
${running}= Is Process Running ${process_manager}
IF not ${running}
${result} = Get Process Result
${result}= Get Process Result ${process_manager}

Log rc: ${result.rc} console=True
Log stdout: ${result.stdout} console=True
Expand Down Expand Up @@ -452,7 +452,6 @@ Click Label With Vertical Offset
[Arguments] ${labelname} ${offset}=0
[Documentation] Click the image with the offset
... [the point (0.0) is in the top left corner of the screen, so give positive values when you want to move down].
... Give the image a full name, for example: button_runopen.
${labelname}= Convert To Lower Case ${labelname}
${img}= Set Variable manager_${platform}_label_${labelname}.png
Log ${CURDIR}
Expand All @@ -468,7 +467,6 @@ Click Label With Horizontal Offset
[Arguments] ${labelname} ${offset}=0
[Documentation] Click the image with the offset
... [the point (0.0) is in the top left corner of the screen, so give positive values when you want to move right].
... Give the image a full name, for example: button_runopen.
${labelname}= Convert To Lower Case ${labelname}
${img}= Set Variable manager_${platform}_label_${labelname}.png
Log ${CURDIR}
Expand All @@ -480,6 +478,36 @@ Click Label With Horizontal Offset
Sleep 0.1
# Take A Screenshot

Click Button With Vertical Offset
[Arguments] ${btnname} ${offset}=0
[Documentation] Click the image with the offset
... [the point (0.0) is in the top left corner of the screen, so give positive values when you want to move down].
${btnname}= Convert To Lower Case ${btnname}
${img}= Set Variable manager_${platform}_button_${btnname}.png
Log ${CURDIR}
Log ${IMAGE_DIR}
Wait For ${img} timeout=${default_image_timeout}
@{coordinates}= Locate ${img}
Log ${coordinates}
Click To The Below Of ${coordinates} ${offset}
Sleep 0.1
# Take A Screenshot

Click Button With Horizontal Offset
[Arguments] ${btnname} ${offset}=0
[Documentation] Click the image with the offset
... [the point (0.0) is in the top left corner of the screen, so give positive values when you want to move right].
${btnname}= Convert To Lower Case ${btnname}
${img}= Set Variable manager_${platform}_button_${btnname}.png
Log ${CURDIR}
Log ${IMAGE_DIR}
Wait For ${img} timeout=${default_image_timeout}
@{coordinates}= Locate ${img}
Log ${coordinates}
Click To The Right Of ${coordinates} ${offset}
Sleep 0.1
# Take A Screenshot

#TODO: Chceck if it works
Resize Window
[Arguments] ${x}=0 ${y}=0
Expand Down
11 changes: 7 additions & 4 deletions Tests/Regression/Manager/GUI_Features.robot
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,8 @@ Check If the Manager Saves Times and Robots to the Scenario with Example Robot
Press Key.tab 2 Times
Click Button selected_runscriptrow
Select Robot File OS DIALOG ${robot_data}[0]
Click Button selected_select_test_case
# Click Button selected_select_test_case # replaced with horizontal offset because of the image difference in python versions
Click Button With Horizontal Offset selected_runscriptrow 30
Click Button select_example
Press Key.tab 3 Times
END
Expand Down Expand Up @@ -652,7 +653,8 @@ Check If the Manager Saves Settings on the Test Row With Example Robot
Press Key.tab 6 Times
Click Button selected_runscriptrow
Select Robot File OS DIALOG ${robot_data}[0]
Click Button selected_select_test_case
# Click Button selected_select_test_case # replaced with horizontal offset because of the image difference in python versions
Click Button With Horizontal Offset selected_runscriptrow 30
Click Button select_example
Press Key.tab 2 Times
${settings_coordinates}=
Expand Down Expand Up @@ -719,7 +721,8 @@ Check If the Manager Opens Scenario File Correctly With Data From the Test Rows
Press Key.tab 2 Times
Click Button selected_runscriptrow
Select Robot File OS DIALOG ${robot_data}[0]
Click Button selected_select_test_case
# Click Button selected_select_test_case # replaced with horizontal offset because of the image difference in python versions
Click Button With Horizontal Offset selected_runscriptrow 30
Click Button select_example
Press Key.tab 2 Times
${settings_coordinates}=
Expand Down Expand Up @@ -3079,7 +3082,7 @@ Verify Test Doesn't Start Until Scheduled To Start And Will Start After the Time
Run Keyword If ${status} Fail
... msg=The Manager started script before the scheduled start-up!
Log To Console Scenario should start soon.
${status}= Run Keyword And Return Status Wait For manager_${platform}_button_stoprun.png timeout=60
${status}= Run Keyword And Return Status Wait For manager_${platform}_button_stoprun.png timeout=85
Run Keyword If not ${status} Fail
... msg=The Manager did not started script after the scheduled time has elapsed!

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.
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.
3 changes: 3 additions & 0 deletions Tests/Regression/Manager/pip_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This is required because of: https://github.com/langchain-ai/langchain/issues/26026 and https://github.com/numpy/numpy/issues/24318
numpy>2; python_version > '3.12' and platform_system == 'Windows'
PyMuPDF>=1.23.1; python_version > '3.12' and platform_system == 'Windows' # require numpy > 2
robotframework
# pyscreeze 0.1.29 doesn't seem to work with pyautogui 0.9.53
pyscreeze==0.1.28
Expand Down
3 changes: 3 additions & 0 deletions Tests/Regression/Manager/testdata/Issue-#154/InfoLibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ def info_keyword(self, message):
def doc_only_keyword(self, message):
"""Doc only keyword From Info Library"""
return message

def return_only_keyword(self, message):
return message
Loading

0 comments on commit 79500f7

Please sign in to comment.