From 258be775ccab92fea8639fb14cea71cf299e3ab1 Mon Sep 17 00:00:00 2001 From: Samuli Leivo Date: Thu, 9 Jan 2025 14:51:24 +0200 Subject: [PATCH 1/5] Fix bat init and disable suspend after login Signed-off-by: Samuli Leivo --- Robot-Framework/resources/gui_keywords.resource | 4 +++- Robot-Framework/test-suites/bat-tests/__init__.robot | 6 ++++-- Robot-Framework/test-suites/bat-tests/apps.robot | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Robot-Framework/resources/gui_keywords.resource b/Robot-Framework/resources/gui_keywords.resource index 50eeae7..75f4c3f 100644 --- a/Robot-Framework/resources/gui_keywords.resource +++ b/Robot-Framework/resources/gui_keywords.resource @@ -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 @@ -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 @@ -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} diff --git a/Robot-Framework/test-suites/bat-tests/__init__.robot b/Robot-Framework/test-suites/bat-tests/__init__.robot index 85e4fb2..2ba25a9 100644 --- a/Robot-Framework/test-suites/bat-tests/__init__.robot +++ b/Robot-Framework/test-suites/bat-tests/__init__.robot @@ -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 @@ -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 \ No newline at end of file diff --git a/Robot-Framework/test-suites/bat-tests/apps.robot b/Robot-Framework/test-suites/bat-tests/apps.robot index 74b6d8a..de245a5 100644 --- a/Robot-Framework/test-suites/bat-tests/apps.robot +++ b/Robot-Framework/test-suites/bat-tests/apps.robot @@ -7,7 +7,7 @@ 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} +Suite Teardown Close All Connections *** Variables *** From 5d9392a130abb1c88d8debe6971caea72c6d099d Mon Sep 17 00:00:00 2001 From: Samuli Leivo Date: Wed, 8 Jan 2025 15:08:07 +0200 Subject: [PATCH 2/5] Integrate video and logging tests to bat suite Signed-off-by: Samuli Leivo --- Robot-Framework/test-suites/bat-tests/__init__.robot | 5 +++-- .../{logging-tests => bat-tests}/check_logs.robot | 0 .../test-suites/{video-tests => bat-tests}/video.robot | 0 3 files changed, 3 insertions(+), 2 deletions(-) rename Robot-Framework/test-suites/{logging-tests => bat-tests}/check_logs.robot (100%) rename Robot-Framework/test-suites/{video-tests => bat-tests}/video.robot (100%) diff --git a/Robot-Framework/test-suites/bat-tests/__init__.robot b/Robot-Framework/test-suites/bat-tests/__init__.robot index 2ba25a9..b55feae 100644 --- a/Robot-Framework/test-suites/bat-tests/__init__.robot +++ b/Robot-Framework/test-suites/bat-tests/__init__.robot @@ -27,10 +27,11 @@ BAT tests setup Switch Connection ${CONNECTION} BAT tests teardown - Connect to ghaf host + ${connection} Connect + Set Global Variable ${CONNECTION} ${connection} Log journctl IF "Lenovo" in "${DEVICE}" Connect to netvm Log out END - Close All Connections \ No newline at end of file + Close All Connections diff --git a/Robot-Framework/test-suites/logging-tests/check_logs.robot b/Robot-Framework/test-suites/bat-tests/check_logs.robot similarity index 100% rename from Robot-Framework/test-suites/logging-tests/check_logs.robot rename to Robot-Framework/test-suites/bat-tests/check_logs.robot diff --git a/Robot-Framework/test-suites/video-tests/video.robot b/Robot-Framework/test-suites/bat-tests/video.robot similarity index 100% rename from Robot-Framework/test-suites/video-tests/video.robot rename to Robot-Framework/test-suites/bat-tests/video.robot From 2ecfa747c52fd9e7045002761b753be0e1c1788f Mon Sep 17 00:00:00 2001 From: Samuli Leivo Date: Thu, 9 Jan 2025 10:28:58 +0200 Subject: [PATCH 3/5] Ensure necessary setup for all tests in bat suite Signed-off-by: Samuli Leivo --- .../test-suites/bat-tests/business_vm.robot | 2 ++ .../test-suites/bat-tests/check_logs.robot | 2 +- Robot-Framework/test-suites/bat-tests/gui-vm.robot | 11 ++++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Robot-Framework/test-suites/bat-tests/business_vm.robot b/Robot-Framework/test-suites/bat-tests/business_vm.robot index d802f26..52007a8 100644 --- a/Robot-Framework/test-suites/bat-tests/business_vm.robot +++ b/Robot-Framework/test-suites/bat-tests/business_vm.robot @@ -8,6 +8,8 @@ Resource ../../resources/ssh_keywords.resource Resource ../../resources/virtualization_keywords.resource Resource ../../config/variables.robot Resource ../../resources/common_keywords.resource +Suite Setup Connect +Suite Teardown Close All Connections Test Setup Move cursor Test Teardown Kill process @{APP_PIDS} diff --git a/Robot-Framework/test-suites/bat-tests/check_logs.robot b/Robot-Framework/test-suites/bat-tests/check_logs.robot index 3610dde..3d08021 100644 --- a/Robot-Framework/test-suites/bat-tests/check_logs.robot +++ b/Robot-Framework/test-suites/bat-tests/check_logs.robot @@ -21,7 +21,7 @@ ${GRAFANA_LOGS} https://loki.ghaflogs.vedenemo.dev Check Grafana logs [Documentation] Check that all virtual machines are sending logs to Grafana [Tags] SP-T172 - [Setup] Connect to netvm + [Setup] Connect AND Connect to netvm [Teardown] Remove Wifi configuration ${TEST_WIFI_SSID} Configure wifi ${NETVM_SSH} ${TEST_WIFI_SSID} ${TEST_WIFI_PSWD} Check Internet Connection diff --git a/Robot-Framework/test-suites/bat-tests/gui-vm.robot b/Robot-Framework/test-suites/bat-tests/gui-vm.robot index 696a86e..5c3c85b 100644 --- a/Robot-Framework/test-suites/bat-tests/gui-vm.robot +++ b/Robot-Framework/test-suites/bat-tests/gui-vm.robot @@ -7,8 +7,10 @@ Force Tags gui-vm-apps bat lenovo-x1 Resource ../../resources/ssh_keywords.resource Resource ../../config/variables.robot Resource ../../resources/common_keywords.resource -Test Setup Run Keywords Connect to netvm AND Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD} +Test Setup Run Keywords Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD} Test Teardown Gui-vm apps teardown +Suite Setup Run Keywords Connect AND Connect to netvm +Suite Teardown Close All Connections *** Variables *** @@ -56,9 +58,8 @@ Start File Manager on LenovoX1 *** Keywords *** Gui-vm apps teardown - Connect to VM ${GUI_VM} + Move cursor Kill process @{APP_PIDS} - Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD} - ${app_log} Execute command cat output.log + # Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD} + ${app_log} Execute command cat /tmp/output.log Log ${app_log} - Move cursor From 917a5e596f90239f7ccfa44bc3566bcb9385ee85 Mon Sep 17 00:00:00 2001 From: Samuli Leivo Date: Thu, 9 Jan 2025 12:24:01 +0200 Subject: [PATCH 4/5] Fix problems Signed-off-by: Samuli Leivo --- .../test-suites/bat-tests/business_vm.robot | 16 ++++++++-------- .../test-suites/bat-tests/check_logs.robot | 5 ++--- .../test-suites/bat-tests/gui-vm.robot | 4 ++-- .../test-suites/bat-tests/timesync.robot | 3 ++- .../test-suites/bat-tests/video.robot | 3 ++- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Robot-Framework/test-suites/bat-tests/business_vm.robot b/Robot-Framework/test-suites/bat-tests/business_vm.robot index 52007a8..96c93a4 100644 --- a/Robot-Framework/test-suites/bat-tests/business_vm.robot +++ b/Robot-Framework/test-suites/bat-tests/business_vm.robot @@ -8,7 +8,7 @@ Resource ../../resources/ssh_keywords.resource Resource ../../resources/virtualization_keywords.resource Resource ../../config/variables.robot Resource ../../resources/common_keywords.resource -Suite Setup Connect +Suite Setup Connect to netvm Suite Teardown Close All Connections Test Setup Move cursor Test Teardown Kill process @{APP_PIDS} @@ -19,7 +19,7 @@ Test Teardown Kill process @{APP_PIDS} Start Microsoft Outlook on LenovoX1 [Documentation] Start Microsoft Outlook in Business-vm and verify process started [Tags] outlook SP-T176 - Connect to netvm + # Connect to netvm Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD} Start XDG application "Microsoft Outlook" Connect to VM ${BUSINESS_VM} @@ -28,7 +28,7 @@ Start Microsoft Outlook on LenovoX1 Start Microsoft 365 on LenovoX1 [Documentation] Start Microsoft 365 in Business-vm and verify process started [Tags] microsoft365 SP-T178 - Connect to netvm + # Connect to netvm Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD} Start XDG application "Microsoft 365" Connect to VM ${BUSINESS_VM} @@ -37,7 +37,7 @@ Start Microsoft 365 on LenovoX1 Start Microsoft Teams on LenovoX1 [Documentation] Start Microsoft Teams in Business-vm and verify process started [Tags] teams SP-T177 - Connect to netvm + # Connect to netvm Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD} Start XDG application Teams Connect to VM ${BUSINESS_VM} @@ -46,7 +46,7 @@ Start Microsoft Teams on LenovoX1 Start Trusted Browser on LenovoX1 [Documentation] Start Trusted Browser in Business-vm and verify process started [Tags] trusted_browser SP-T179 - Connect to netvm + # Connect to netvm Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD} Start XDG application "Trusted Browser" Connect to VM ${BUSINESS_VM} @@ -55,7 +55,7 @@ Start Trusted Browser on LenovoX1 Start Video Editor on LenovoX1 [Documentation] Start Video Editor in Business-vm and verify process started [Tags] video_editor SP-T244 - Connect to netvm + # Connect to netvm Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD} Start XDG application "Video Editor" Connect to VM ${BUSINESS_VM} @@ -64,7 +64,7 @@ Start Video Editor on LenovoX1 Start Text Editor on LenovoX1 [Documentation] Start Text Editor in Business-vm and verify process started [Tags] text_editor SP-T243 - Connect to netvm + # Connect to netvm Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD} Start XDG application "Text Editor" Connect to VM ${BUSINESS_VM} @@ -73,7 +73,7 @@ Start Text Editor on LenovoX1 Start Xarchiver on LenovoX1 [Documentation] Start Xarchiver in Business-vm and verify process started [Tags] xarchiver SP-T242 - Connect to netvm + # Connect to netvm Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD} Start XDG application "Xarchiver" Connect to VM ${BUSINESS_VM} diff --git a/Robot-Framework/test-suites/bat-tests/check_logs.robot b/Robot-Framework/test-suites/bat-tests/check_logs.robot index 3d08021..a040880 100644 --- a/Robot-Framework/test-suites/bat-tests/check_logs.robot +++ b/Robot-Framework/test-suites/bat-tests/check_logs.robot @@ -3,12 +3,12 @@ *** Settings *** Documentation Testing logging -Force Tags logging lenovo-x1 +Force Tags bat logging lenovo-x1 Resource ../../config/variables.robot Resource ../../resources/ssh_keywords.resource Resource ../../resources/connection_keywords.resource Library DateTime -Suite Setup Set Variables ${DEVICE} +Suite Setup Connect to netvm Suite Teardown Close All Connections @@ -21,7 +21,6 @@ ${GRAFANA_LOGS} https://loki.ghaflogs.vedenemo.dev Check Grafana logs [Documentation] Check that all virtual machines are sending logs to Grafana [Tags] SP-T172 - [Setup] Connect AND Connect to netvm [Teardown] Remove Wifi configuration ${TEST_WIFI_SSID} Configure wifi ${NETVM_SSH} ${TEST_WIFI_SSID} ${TEST_WIFI_PSWD} Check Internet Connection diff --git a/Robot-Framework/test-suites/bat-tests/gui-vm.robot b/Robot-Framework/test-suites/bat-tests/gui-vm.robot index 5c3c85b..ab59d97 100644 --- a/Robot-Framework/test-suites/bat-tests/gui-vm.robot +++ b/Robot-Framework/test-suites/bat-tests/gui-vm.robot @@ -7,9 +7,9 @@ Force Tags gui-vm-apps bat lenovo-x1 Resource ../../resources/ssh_keywords.resource Resource ../../config/variables.robot Resource ../../resources/common_keywords.resource -Test Setup Run Keywords Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD} +Test Setup Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD} Test Teardown Gui-vm apps teardown -Suite Setup Run Keywords Connect AND Connect to netvm +Suite Setup Connect to netvm Suite Teardown Close All Connections diff --git a/Robot-Framework/test-suites/bat-tests/timesync.robot b/Robot-Framework/test-suites/bat-tests/timesync.robot index 506d27b..e80ff03 100644 --- a/Robot-Framework/test-suites/bat-tests/timesync.robot +++ b/Robot-Framework/test-suites/bat-tests/timesync.robot @@ -3,6 +3,7 @@ *** Settings *** Documentation Testing time synchronization +Force Tags bat timesync Resource ../../resources/ssh_keywords.resource Resource ../../config/variables.robot Library ../../lib/TimeLibrary.py @@ -19,7 +20,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] SP-T97 nuc orin-agx orin-nx riscv lenovo-x1 ${host} Connect Check that time is correct timezone=UTC diff --git a/Robot-Framework/test-suites/bat-tests/video.robot b/Robot-Framework/test-suites/bat-tests/video.robot index e48b711..e4a8d86 100644 --- a/Robot-Framework/test-suites/bat-tests/video.robot +++ b/Robot-Framework/test-suites/bat-tests/video.robot @@ -3,7 +3,7 @@ *** Settings *** Documentation Testing camera application -Force Tags video lenovo-x1 +Force Tags bat video lenovo-x1 Resource ../../__framework__.resource Resource ../../resources/serial_keywords.resource Resource ../../resources/common_keywords.resource @@ -19,6 +19,7 @@ Test Timeout 2 minutes Check Camera Application [Documentation] Check that camera application is available in business-vm and not in other vm [Tags] SP-T235 + Sleep 250 Connect to netvm FOR ${vm} IN @{VMS} Connect to VM ${vm} From 15c56388fcd81614e57d6299189a0c3fb0595bb9 Mon Sep 17 00:00:00 2001 From: Samuli Leivo Date: Thu, 9 Jan 2025 13:31:27 +0200 Subject: [PATCH 5/5] Clean up Signed-off-by: Samuli Leivo --- Robot-Framework/test-suites/bat-tests/business_vm.robot | 7 ------- Robot-Framework/test-suites/bat-tests/video.robot | 1 - 2 files changed, 8 deletions(-) diff --git a/Robot-Framework/test-suites/bat-tests/business_vm.robot b/Robot-Framework/test-suites/bat-tests/business_vm.robot index 96c93a4..f497d74 100644 --- a/Robot-Framework/test-suites/bat-tests/business_vm.robot +++ b/Robot-Framework/test-suites/bat-tests/business_vm.robot @@ -19,7 +19,6 @@ Test Teardown Kill process @{APP_PIDS} Start Microsoft Outlook on LenovoX1 [Documentation] Start Microsoft Outlook in Business-vm and verify process started [Tags] outlook SP-T176 - # Connect to netvm Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD} Start XDG application "Microsoft Outlook" Connect to VM ${BUSINESS_VM} @@ -28,7 +27,6 @@ Start Microsoft Outlook on LenovoX1 Start Microsoft 365 on LenovoX1 [Documentation] Start Microsoft 365 in Business-vm and verify process started [Tags] microsoft365 SP-T178 - # Connect to netvm Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD} Start XDG application "Microsoft 365" Connect to VM ${BUSINESS_VM} @@ -37,7 +35,6 @@ Start Microsoft 365 on LenovoX1 Start Microsoft Teams on LenovoX1 [Documentation] Start Microsoft Teams in Business-vm and verify process started [Tags] teams SP-T177 - # Connect to netvm Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD} Start XDG application Teams Connect to VM ${BUSINESS_VM} @@ -46,7 +43,6 @@ Start Microsoft Teams on LenovoX1 Start Trusted Browser on LenovoX1 [Documentation] Start Trusted Browser in Business-vm and verify process started [Tags] trusted_browser SP-T179 - # Connect to netvm Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD} Start XDG application "Trusted Browser" Connect to VM ${BUSINESS_VM} @@ -55,7 +51,6 @@ Start Trusted Browser on LenovoX1 Start Video Editor on LenovoX1 [Documentation] Start Video Editor in Business-vm and verify process started [Tags] video_editor SP-T244 - # Connect to netvm Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD} Start XDG application "Video Editor" Connect to VM ${BUSINESS_VM} @@ -64,7 +59,6 @@ Start Video Editor on LenovoX1 Start Text Editor on LenovoX1 [Documentation] Start Text Editor in Business-vm and verify process started [Tags] text_editor SP-T243 - # Connect to netvm Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD} Start XDG application "Text Editor" Connect to VM ${BUSINESS_VM} @@ -73,7 +67,6 @@ Start Text Editor on LenovoX1 Start Xarchiver on LenovoX1 [Documentation] Start Xarchiver in Business-vm and verify process started [Tags] xarchiver SP-T242 - # Connect to netvm Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD} Start XDG application "Xarchiver" Connect to VM ${BUSINESS_VM} diff --git a/Robot-Framework/test-suites/bat-tests/video.robot b/Robot-Framework/test-suites/bat-tests/video.robot index e4a8d86..2a8b6cb 100644 --- a/Robot-Framework/test-suites/bat-tests/video.robot +++ b/Robot-Framework/test-suites/bat-tests/video.robot @@ -19,7 +19,6 @@ Test Timeout 2 minutes Check Camera Application [Documentation] Check that camera application is available in business-vm and not in other vm [Tags] SP-T235 - Sleep 250 Connect to netvm FOR ${vm} IN @{VMS} Connect to VM ${vm}