Skip to content

Commit

Permalink
Apply power measurement to suspend test
Browse files Browse the repository at this point in the history
Signed-off-by: Samuli Leivo <[email protected]>
  • Loading branch information
leivos-unikie committed Jan 17, 2025
1 parent b959b76 commit 99a6f8f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
12 changes: 5 additions & 7 deletions Robot-Framework/config/variables.robot
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ Set Variables

Set Log Level NONE

Run Keyword And Ignore Error Set Global Variable ${RPI_IP_ADDRESS} ${config['addresses']['measurement_agent']['device_ip_address']}
${result} Run Process sh -c cat /run/secrets/pi-login shell=true
Set Global Variable ${LOGIN_PI} ${result.stdout}
${result} Run Process sh -c cat /run/secrets/pi-pass shell=true
Set Global Variable ${PASSWORD_PI} ${result.stdout}
${result} Run Process sh -c cat /run/secrets/dut-pass shell=true
Set Global Variable ${PASSWORD} ${result.stdout}
${result} Run Process sh -c cat /run/secrets/plug-login shell=true
Expand All @@ -61,16 +66,9 @@ Set Variables
Set Global Variable ${TEST_WIFI_SSID} ${result.stdout}
${result} Run Process sh -c cat /run/secrets/wifi-password shell=true
Set Global Variable ${TEST_WIFI_PSWD} ${result.stdout}

Set Global Variable ${USER_LOGIN} testuser
Set Global Variable ${USER_PASSWORD} testpw

Run Keyword And Ignore Error Set Global Variable ${RPI_IP_ADDRESS} ${config['addresses']['measurement_agent']['device_ip_address']}
${result} Run Process sh -c cat /run/secrets/pi-login shell=true
Set Global Variable ${LOGIN_PI} ${result.stdout}
${result} Run Process sh -c cat /run/secrets/pi-pass shell=true
Set Global Variable ${PASSWORD_PI} ${result.stdout}

Set Log Level INFO

IF $BUILD_ID != '${EMPTY}'
Expand Down
19 changes: 16 additions & 3 deletions Robot-Framework/test-suites/gui-tests/gui_power_options.robot
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ Resource ../../resources/ssh_keywords.resource
Resource ../../config/variables.robot
Resource ../../resources/gui_keywords.resource
Resource ../../resources/common_keywords.resource
Resource ../../resources/power_meas_keywords.resource
Library ../../lib/SwitchbotLibrary.py ${SWITCH_TOKEN} ${SWITCH_SECRET}
Suite Teardown Close All Connections
Test Teardown Close All Connections


*** Test Cases ***
Expand All @@ -19,16 +20,24 @@ GUI Suspend and wake up
... Check that the device is suspended.
... Wake up by pressing the power button for 1 sec.
... Check that the device is awake.
... Logs device power consumption during the test
... if power measurement tooling is set.
[Tags] lenovo-x1 SP-T208-2
Start power measurement ${BUILD_ID} timeout=180
Set start timestamp
Connect to netvm
Connect to VM ${GUI_VM}
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
Log To Console Letting the device stay suspended for 30 sec
BuiltIn.Sleep 30
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
Expand All @@ -44,11 +53,15 @@ GUI Suspend and wake up
FAIL Screen lock not active after wake up
END
Unlock
Generate power plot ${BUILD_ID} ${TEST NAME}
Stop recording power

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
Connect to netvm
Connect to VM ${GUI_VM}
Click power menu item lock
${lock} Check if locked
IF ${lock}
Expand Down

0 comments on commit 99a6f8f

Please sign in to comment.