Skip to content

Commit

Permalink
Handle potential lock screen in gui setup
Browse files Browse the repository at this point in the history
Add keywords for detecting lock screen and unloking.
Fix GUI Log in keyword.

Signed-off-by: Samuli Leivo <[email protected]>
  • Loading branch information
leivos-unikie committed Nov 7, 2024
1 parent 8f50e83 commit d3d82e0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
29 changes: 24 additions & 5 deletions Robot-Framework/resources/gui_keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ GUI Log in
Log To Console Already logged in. Skipping login.
ELSE
Log To Console Logging in
Start ydotoold
Log To Console Typing username and password to login
Type string and press enter ${LOGIN}
Type string and press enter ${PASSWORD}
END
Start ydotoold
Log To Console Typing username and password to login
Type string and press enter ${LOGIN}
Type string and press enter ${PASSWORD}

GUI Log out
[Documentation] Log out and optionally verify that desktop is not available
Expand Down Expand Up @@ -117,7 +117,7 @@ Verify logout

Get icon
[Documentation] Copy icon svg file to test agent machine. Crop and convert the svg file to png.
[Arguments] ${path} ${icon_name} ${crop} ${background}=none ${output_filename}=icon.png
[Arguments] ${path} ${icon_name} ${crop}=0 ${background}=none ${output_filename}=icon.png
IF $path == "app"
SSHLibrary.Get File ${APP_ICON_PATH}/${icon_name} icon.svg
ELSE IF $path == "ghaf-artwork"
Expand All @@ -126,3 +126,22 @@ Get icon
SSHLibrary.Get File ${path}/${icon_name} icon.svg
END
Convert app icon ${crop} ${background} input_file=icon.svg output_file=${output_filename}

Check if locked
[Documentation] Check if the screen lock has been activated
Log To Console Searching for view-reveal-symbolic.svg
Get icon ${ADWAITA}/symbolic/actions view-reveal-symbolic.svg background=black
Verify logout 2
IF ${LOGGED_IN_STATUS}
${status} ${output} Run Keyword And Ignore Error Locate image on screen ./icon.png 0.95 3
IF '${status}' == 'PASS'
RETURN ${True}
END
END
RETURN ${False}

GUI Unlock
[Documentation] Unlock the screen be typing password
Start ydotoold
Log To Console Typing password to unlock
Type string and press enter ${PASSWORD}
14 changes: 11 additions & 3 deletions Robot-Framework/test-suites/gui-tests/__init__.robot
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ Common Setup
END
Run journalctl recording
Save most common icons and paths to icons
GUI Log in
Log To Console Check if the screen is in locked state
${lock} Check if locked
IF ${lock}
Log To Console Screen lock detected
Unlock
ELSE
Log To Console Screen lock not active
GUI Log in
END
Verify login

Common Teardown
Expand All @@ -44,7 +52,7 @@ Common Teardown
Save most common icons and paths to icons
[Documentation] Save those icons by name which will be used in multiple test cases
... Śave paths to icon packs in gui-vm nix store
${adwaita} Set Variable /run/current-system/sw/share/icons/Adwaita
Set Global Variable ${ADWAITA} /run/current-system/sw/share/icons/Adwaita
Log To Console Saving path to icon-pack
${app_icon_pack_path} Execute Command echo /nix/store/$(ls /nix/store | grep icon-pack | grep -v .drv)
Set Global Variable ${APP_ICON_PATH} ${app_icon_pack_path}
Expand All @@ -55,5 +63,5 @@ Save most common icons and paths to icons
Log To Console ${ARTWORK_PATH}
Log To Console Saving gui icons
Get icon ghaf-artwork launcher.svg crop=0 background=black output_filename=launcher.png
Get icon ${adwaita}/symbolic/ui window-close-symbolic.svg crop=0 output_filename=window-close.png background=white
Get icon ${ADWAITA}/symbolic/ui window-close-symbolic.svg crop=0 output_filename=window-close.png background=white
Negate app icon window-close.png window-close-neg.png

0 comments on commit d3d82e0

Please sign in to comment.