From 258be775ccab92fea8639fb14cea71cf299e3ab1 Mon Sep 17 00:00:00 2001 From: Samuli Leivo Date: Thu, 9 Jan 2025 14:51:24 +0200 Subject: [PATCH] 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 ***