Skip to content

Commit

Permalink
Fix bat init and disable suspend after login
Browse files Browse the repository at this point in the history
In addition, remove cursor movements and reduced
the accumulation of unused connections by
adding Close All Connections keywords.

Remove unnecessary Suite Teardown.

Fix incorrect use of Set Test Variable.

Add lenovo-x1 tag to timesync test.

Signed-off-by: Samuli Leivo <[email protected]>
  • Loading branch information
leivos-unikie committed Jan 13, 2025
1 parent 40f98d2 commit 8449177
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 14 deletions.
4 changes: 3 additions & 1 deletion Robot-Framework/resources/gui_keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Log in via GUI
Type string and press enter ${USER_PASSWORD}
END
Verify login
Log To Console Disabling automated lock and suspend
Execute Command systemctl --user stop swayidle

Log out
[Documentation] Log out and optionally verify that desktop is not available
Expand Down Expand Up @@ -69,7 +71,6 @@ Locate image on screen
IF $pass_status=='PASS' BREAK
Sleep 0.5
END
Connect to VM ${GUI_VM}
IF $pass_status=='FAIL' FAIL Image recognition failure: ${image_to_be_searched}
Log To Console Coordinates: ${coordinates}
${mouse_x} Get From Dictionary ${coordinates} x
Expand All @@ -79,6 +80,7 @@ Locate image on screen
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}
Connect to VM ${GUI_VM}
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}

Expand Down
6 changes: 4 additions & 2 deletions Robot-Framework/test-suites/bat-tests/__init__.robot
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Resource ../../resources/ssh_keywords.resource
Resource ../../resources/serial_keywords.resource
Resource ../../resources/common_keywords.resource
Resource ../../resources/connection_keywords.resource
Resource ../../resources/gui_keywords.resource
Suite Setup BAT tests setup
Suite Teardown BAT tests teardown

Expand All @@ -21,14 +22,15 @@ BAT tests setup
Connect to VM ${GUI_VM}
Save most common icons and paths to icons
Create test user
GUI Log in
Log in via GUI
END
Switch Connection ${CONNECTION}

BAT tests teardown
Connect to ghaf host
Log journctl
IF "Lenovo" in "${DEVICE}"
Connect to netvm
GUI Log out
Log out
END
Close All Connections
2 changes: 1 addition & 1 deletion Robot-Framework/test-suites/bat-tests/apps.robot
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Force Tags apps
Resource ../../resources/ssh_keywords.resource
Resource ../../config/variables.robot
Resource ../../resources/common_keywords.resource
Test Setup Run Keywords Move cursor AND Switch Connection ${CONNECTION}


*** Variables ***
Expand Down Expand Up @@ -103,3 +102,4 @@ Kill Process And Log journalctl
${output} Execute Command journalctl
Log ${output}
Kill process @{APP_PIDS}
Close All Connections
10 changes: 8 additions & 2 deletions Robot-Framework/test-suites/bat-tests/business_vm.robot
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ Resource ../../resources/ssh_keywords.resource
Resource ../../resources/virtualization_keywords.resource
Resource ../../config/variables.robot
Resource ../../resources/common_keywords.resource
Test Setup Move cursor
Test Teardown Kill process @{APP_PIDS}
Test Teardown Business Apps Test Teardown


*** Test Cases ***
Expand Down Expand Up @@ -76,3 +75,10 @@ Start Xarchiver on LenovoX1
Start XDG application "Xarchiver"
Connect to VM ${BUSINESS_VM}
Check that the application was started xarchiver


*** Keywords ***

Business Apps Test Teardown
Kill process @{APP_PIDS}
Close All Connections
2 changes: 1 addition & 1 deletion Robot-Framework/test-suites/bat-tests/gui-vm.robot
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ Gui-vm apps teardown
Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD}
${app_log} Execute command cat output.log
Log ${app_log}
Move cursor
Close All Connections
14 changes: 7 additions & 7 deletions Robot-Framework/test-suites/bat-tests/timesync.robot
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ${change_time} ${EMPTY}
Time synchronization
[Documentation] Stop timesyncd, change time on ghaf host and check that time was changed
... Start timesyncd and check that time was synchronized
[Tags] bat SP-T97 nuc orin-agx orin-nx riscv
[Tags] bat SP-T97 nuc orin-agx orin-nx riscv lenovo-x1
${host} Connect
Check that time is correct timezone=UTC
Expand Down Expand Up @@ -68,12 +68,12 @@ Check that time is correct

Set time
[Arguments] ${time}=${wrong_time}
${change_time} Get Time epoch
${change_time} Set Test Variable ${change_time}
Log To Console Setting time ${time}
Execute Command hwclock --set --date="${time}" sudo=True sudo_password=${PASSWORD}
Execute Command hwclock -s sudo=True sudo_password=${PASSWORD}
${output} Execute Command timedatectl -a
${change_time} Get Time epoch
Set Test Variable ${change_time} ${change_time}
Log To Console Setting time ${time}
Execute Command hwclock --set --date="${time}" sudo=True sudo_password=${PASSWORD}
Execute Command hwclock -s sudo=True sudo_password=${PASSWORD}
${output} Execute Command timedatectl -a

Check time was changed
[Documentation] Check that current system time is equal to given (time tolerance = 10 sec)
Expand Down

0 comments on commit 8449177

Please sign in to comment.