Skip to content

Commit

Permalink
Add gui tests for suspend, lock and unlock
Browse files Browse the repository at this point in the history
Marked power menu gui test cases with GUI preposition
and removed GUI from the resource keyword names.

Combined GUI Log in and GUI Log out into a single test
case.

Signed-off-by: Samuli Leivo <[email protected]>
  • Loading branch information
leivos-unikie committed Jan 3, 2025
1 parent a5869fe commit f16d930
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 25 deletions.
8 changes: 4 additions & 4 deletions Robot-Framework/resources/gui_keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ${LOGGED_IN_STATUS} ${True}

*** Keywords ***

GUI Log in
Log in via GUI
[Documentation] Login and verify that task bar is available
Verify logout
IF ${LOGGED_IN_STATUS}
Expand All @@ -27,7 +27,7 @@ GUI Log in
Type string and press enter ${USER_PASSWORD}
END

GUI Log out
Log out
[Documentation] Log out and optionally verify that desktop is not available
[Arguments] ${log_out_icon}=./logout.png
Start ydotoold
Expand Down Expand Up @@ -122,7 +122,7 @@ Verify logout
END
Sleep 1
END
Connect to VM ${GUI_VM}
[Teardown] Connect to VM ${GUI_VM}

Get icon
[Documentation] Copy icon svg file to test agent machine. Crop and convert the svg file to png.
Expand Down Expand Up @@ -151,7 +151,7 @@ Check if locked
END
RETURN ${False}

GUI Unlock
Unlock
[Documentation] Unlock the screen be typing password
Start ydotoold
Log To Console Typing password to unlock
Expand Down
4 changes: 2 additions & 2 deletions Robot-Framework/test-suites/gui-tests/__init__.robot
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ Common Setup
${lock} Check if locked
IF ${lock}
Log To Console Screen lock detected
GUI Unlock
Unlock
ELSE
Log To Console Screen lock not active. Checking if logged in...
GUI Log in
Log in via GUI
END
Verify login
# Open and close app launcher menu to workaround a bug (icons not visible at first launch of app menu)
Expand Down
2 changes: 1 addition & 1 deletion Robot-Framework/test-suites/gui-tests/gui_apps.robot
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

*** Settings ***
Documentation Testing launching applications via GUI
Force Tags gui
Force Tags gui gui-apps
Resource ../../resources/ssh_keywords.resource
Resource ../../config/variables.robot
Resource ../../resources/common_keywords.resource
Expand Down
91 changes: 73 additions & 18 deletions Robot-Framework/test-suites/gui-tests/gui_power_options.robot
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,73 @@

*** Settings ***
Documentation Testing taskbar power widget options
Force Tags gui
Force Tags gui gui-power-menu
Resource ../../resources/ssh_keywords.resource
Resource ../../config/variables.robot
Resource ../../resources/gui_keywords.resource
Resource ../../resources/common_keywords.resource
Library ../../lib/SwitchbotLibrary.py ${SWITCH_TOKEN} ${SWITCH_SECRET}
Suite Teardown Close All Connections


*** Test Cases ***

GUI Suspend and wake up
[Documentation] Suspend the device via GUI taskbar suspend icon.
... Check that the device is suspended.
... Wake up by pressing the power button for 1 sec.
... Check that the device is awake.
[Tags] lenovo-x1 SP-T208-2
Click power menu item suspend
${device_not_available} Run Keyword And Return Status Wait Until Keyword Succeeds 15s 2s Check If Ping Fails
IF ${device_not_available} == True
Log To Console Device suspended.
ELSE
FAIL Device failed to suspend.
END
Log To Console Waking the device up by pressing the power button for 1 sec
Press Button ${SWITCH_BOT}-ON
Check If Device Is Up
IF ${IS_AVAILABLE} == False
FAIL The device did suspend but failed to wake up
ELSE
Log To Console Device succesfully woke up after suspend
END
Log To Console Checking if the screen is in locked state after wake up
${lock} Check if locked
IF ${lock}
Log To Console Screen lock detected
ELSE
Log To Console Screen lock not active.
FAIL Screen lock not active after wake up
END
Unlock

GUI Lock
[Documentation] Lock the screen via GUI taskbar lock icon.
... Check that the screen is locked.
[Tags] lenovo-x1 SP-T208-4
Click power menu item lock
${lock} Check if locked
IF ${lock}
Log To Console Screen lock detected
ELSE
Log To Console Screen lock not active
FAIL Failed to lock the screen
END

GUI Unlock
[Documentation] Unlock lock screen by typing the password
... Check that desktop is available
[Tags] lenovo-x1 SP-T208-3
Unlock
Verify login

GUI Reboot
[Documentation] Reboot the device via GUI reboot icon.
... Check that it shuts down. Check that it turns on and boots to login screen.
[Tags] lenovo-x1 SP-T208-1
Connect to VM if not already connected gui-vm
Start ydotoold
Log To Console Going to click the power icon
Get icon ghaf-artwork power.svg crop=0 background=black
Locate and click ./icon.png 0.95 5
Log To Console Going to click the reboot icon
Get icon ghaf-artwork restart.svg crop=0 background=black
Locate and click ./icon.png 0.95 5
Click power menu item restart
${device_not_available} Run Keyword And Return Status Wait Until Keyword Succeeds 15s 2s Check If Ping Fails
IF ${device_not_available} == True
Log To Console Device is down
Expand All @@ -47,17 +92,27 @@ GUI Reboot
Log To Console ${LOGGED_IN_STATUS}
Run Keyword If ${LOGGED_IN_STATUS} FAIL Desktop detected. Device failed to boot to login screen.

Log in
GUI Log in and log out
[Documentation] Login and verify logged in state.
[Tags] lenovo-x1 SP-T149 login
... Logout via gui icon and verify that desktop is not available.
[Tags] lenovo-x1 SP-T149 loginlogout
Connect to VM if not already connected gui-vm
GUI Log in
Log in via GUI
Verify login

Log out
[Documentation] Logout via gui icon and verify that desktop is not available
[Tags] lenovo-x1 SP-T149 logout
Connect to VM if not already connected gui-vm
GUI Log out
Log out
Verify logout iterations=5
Run Keyword If ${LOGGED_IN_STATUS} FAIL Logout failed. Desktop still detected after 5 sec.


*** Keywords ***

Click power menu item
[Arguments] ${icon_name}
Connect to VM if not already connected gui-vm
Start ydotoold
Log To Console Going to click the power icon
Get icon ghaf-artwork power.svg crop=0 background=black
Locate and click ./icon.png 0.95 5
Log To Console Going to click the ${icon_name} icon
Get icon ghaf-artwork ${icon_name}.svg crop=0 background=black
Locate and click ./icon.png 0.95 5

0 comments on commit f16d930

Please sign in to comment.