Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gui tests for suspend, lock and unlock #185

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions Robot-Framework/resources/gui_keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ${LOGGED_IN_STATUS} ${True}

*** Keywords ***

GUI Log in
Log in via GUI
[Documentation] Login and verify that task bar is available
Switch Connection ${CONNECTION}
Verify logout
Expand All @@ -30,7 +30,7 @@ GUI Log in
END
Verify login

GUI Log out
Log out
[Documentation] Log out and optionally verify that desktop is not available
[Arguments] ${log_out_icon}=./logout.png
Switch Connection ${CONNECTION}
Expand Down Expand Up @@ -120,21 +120,19 @@ Move cursor
Verify logout
[Documentation] Check that dekstop is not available by running 'grim' which should have return code 1 in this case
[Arguments] ${iterations}=5

${status}= Set Variable ${EMPTY}
Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD}
${status}= Set Variable ${EMPTY}
Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD}
FOR ${i} IN RANGE ${iterations}
${rc}= Execute Command grim check.png return_stdout=False return_rc=${true}
IF "${rc}" == "1"
Set Global Variable ${LOGGED_IN_STATUS} ${False}
Connect to VM ${GUI_VM}
BREAK
ELSE
Set Global Variable ${LOGGED_IN_STATUS} ${True}
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 @@ -163,7 +161,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 @@ -27,10 +27,10 @@ GUI Tests 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
86 changes: 68 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,68 @@

*** 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 and Unlock
[Documentation] Lock the screen via GUI taskbar lock icon and check that the screen is locked.
... Unlock lock screen by typing the password and check that desktop is available
[Tags] lenovo-x1 SP-T208-3 SP-T208-4 lock
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
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 +87,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
Loading