Skip to content

Commit

Permalink
Refactored locate and click to single keyword
Browse files Browse the repository at this point in the history
Signed-off-by: Samuli Leivo <[email protected]>
  • Loading branch information
leivos-unikie committed Sep 30, 2024
1 parent 33680b6 commit ef52568
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions Robot-Framework/test-suites/bat-tests/gui-tests.robot
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,9 @@ Start app via GUI on LenovoX1
Start ydotoold

Log To Console Going to click the app menu icon
${mouse_x} ${mouse_y} Locate image on screen ${start_menu} 0.95
Execute Command ydotool mousemove --absolute -x ${mouse_x} -y ${mouse_y} sudo=True sudo_password=${PASSWORD}
Execute Command ydotool click 0xC0 sudo=True sudo_password=${PASSWORD}
Locate and click ${start_menu} 0.95 5
Log To Console Going to click the application launch icon
${mouse_x} ${mouse_y} Locate image on screen ${launch_icon} 0.95
Execute Command ydotool mousemove --absolute -x ${mouse_x} -y ${mouse_y} sudo=True sudo_password=${PASSWORD}
Execute Command ydotool click 0xC0 sudo=True sudo_password=${PASSWORD}
Locate and click ${launch_icon} 0.95 5

Connect to VM ${app-vm}
Check that the application was started ${app} 10
Expand All @@ -92,9 +88,7 @@ Close app via GUI on LenovoX1
Start ydotoold

Log To Console Going to click the close button of the application window
${mouse_x} ${mouse_y} Locate image on screen ${close_button} 0.999
Execute Command ydotool mousemove --absolute -x ${mouse_x} -y ${mouse_y} sudo=True sudo_password=${PASSWORD}
Execute Command ydotool click 0xC0 sudo=True sudo_password=${PASSWORD}
Locate and click ${close_button} 0.999 5

Connect to VM ${app-vm}
Check that the application is not running ${app} 5
Expand All @@ -115,13 +109,9 @@ Start app via GUI on Orin AGX
Start ydotoold

Log To Console Going to click the app menu icon
${mouse_x} ${mouse_y} Locate image on screen ../gui-ref-images/start_menu_agx.png 0.95
Execute Command ydotool mousemove --absolute -x ${mouse_x} -y ${mouse_y} sudo=True sudo_password=${PASSWORD}
Execute Command ydotool click 0xC0 sudo=True sudo_password=${PASSWORD}
Locate and click ../gui-ref-images/start_menu_agx.png 0.95 5
Log To Console Going to click the application launch icon
${mouse_x} ${mouse_y} Locate image on screen ${launch_icon} 0.95
Execute Command ydotool mousemove --absolute -x ${mouse_x} -y ${mouse_y} sudo=True sudo_password=${PASSWORD}
Execute Command ydotool click 0xC0 sudo=True sudo_password=${PASSWORD}
Locate and click ${launch_icon} 0.95 5

BuiltIn.Sleep 1
Check that the application was started ${app} 10
Expand All @@ -139,9 +129,7 @@ Close app via GUI on Orin AGX
Start ydotoold

Log To Console Going to click the close button of the application window
${mouse_x} ${mouse_y} Locate image on screen ${close_button} 0.999
Execute Command ydotool mousemove --absolute -x ${mouse_x} -y ${mouse_y} sudo=True sudo_password=${PASSWORD}
Execute Command ydotool click 0xC0 sudo=True sudo_password=${PASSWORD}
Locate and click ${close_button} 0.999 5

Check that the application is not running ${app} 5

Expand Down Expand Up @@ -170,6 +158,12 @@ Locate image on screen
${mouse_y} Get From Dictionary ${coordinates} y
RETURN ${mouse_x} ${mouse_y}

Locate and click
[Arguments] ${image_to_be_searched} ${confidence}=0.99 ${iterations}=5
${mouse_x} ${mouse_y} Locate image on screen ${image_to_be_searched} ${confidence}
Execute Command ydotool mousemove --absolute -x ${mouse_x} -y ${mouse_y} sudo=True sudo_password=${PASSWORD}
Execute Command ydotool click 0xC0 sudo=True sudo_password=${PASSWORD}

Start ydotoold
[Documentation] Start ydotool daemon if it is not already running.
${ydotoold_state}= Execute Command sh -c 'ps aux | grep ydotoold | grep -v grep'
Expand All @@ -189,5 +183,6 @@ Stop ydotoold

Move cursor to corner
[Documentation] Move the cursor to the upper left corner so that it will not block searching further gui screenshots
Log To Console Moving cursor to corner from blocking further image detection
Start ydotoold
Execute Command ydotool mousemove --absolute -x 10 -y 10 sudo=True sudo_password=${PASSWORD}

0 comments on commit ef52568

Please sign in to comment.