Skip to content

Commit

Permalink
Adapt to changes introduced by ghaf PR827
Browse files Browse the repository at this point in the history
Signed-off-by: Samuli Leivo <[email protected]>
  • Loading branch information
leivos-unikie committed Dec 16, 2024
1 parent cdad17a commit 72ffc48
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 25 deletions.
3 changes: 3 additions & 0 deletions Robot-Framework/config/variables.robot
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ Set Variables
${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

Set Log Level INFO

IF $BUILD_ID != '${EMPTY}'
Expand Down
1 change: 0 additions & 1 deletion Robot-Framework/resources/gui_keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,3 @@ GUI Unlock
Start ydotoold
Log To Console Typing password to unlock
Type string and press enter ${PASSWORD}

24 changes: 20 additions & 4 deletions Robot-Framework/resources/ssh_keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ Connect to netvm
RETURN ${netvm_ssh}

Connect to VM
[Arguments] ${vm_name}
[Arguments] ${vm_name} ${user}=${LOGIN} ${pw}=${PASSWORD}
Log To Console Connecting to ${vm_name}
Check if ssh is ready on vm ${vm_name}
${failed_connection} Set variable True
FOR ${i} IN RANGE 3
TRY
${connection}= Open Connection ${vm_name} port=22 prompt=\$ timeout=30
${output}= Login username=${LOGIN} password=${PASSWORD} jumphost_index_or_alias=${netvm_ssh}
${output}= Login username=${user} password=${pw} jumphost_index_or_alias=${netvm_ssh}
EXCEPT ChannelException: ChannelException(2, 'Connect failed') type=LITERAL
Sleep 1
CONTINUE
Expand Down Expand Up @@ -184,12 +184,12 @@ Find pid by name
RETURN @{pids}

Kill process
[Arguments] @{pids} ${sig}=15
[Arguments] @{pids} ${sig}=9
FOR ${pid} IN @{pids}
IF '${PID}' == '${EMPTY}'
BREAK
END
Execute Command kill -${sig} ${pid}
Execute Command kill -${sig} ${pid} sudo=True sudo_password=${password} timeout=15
FOR ${i} IN RANGE 5
${ps_exists}= Is Process Started ${pid}
IF ${ps_exists}
Expand Down Expand Up @@ -489,3 +489,19 @@ Connect to VM if not already connected
Connect to netvm
Connect to VM ${vm_name}
END

Detect first boot
[Documentation] Determine desktop state after boot by attempting login to gui-vm as testuser
Log To Console Detecting if this is first boot by trying test user credentials
Verify service status range=15 [email protected] expected_status=active expected_state=running
Connect to netvm
${status} ${output} Run Keyword And Ignore Error Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD}
IF $status=='PASS'
Log To Console Test user exists
RETURN ${False}
END
RETURN ${True}

Create test user
Log To Console Creating test user
Execute Command systemctl start setup-test-user.service sudo=True sudo_password=${password}
13 changes: 13 additions & 0 deletions Robot-Framework/test-suites/bat-tests/__init__.robot
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ Common Setup
Log versions
Run journalctl recording

IF "Lenovo" in "${DEVICE}"
${first_boot} Detect first boot
IF ${first_boot}
Close All Connections
${connection} Connect
Connect to netvm
Connect to VM ${GUI_VM}
Create test user
END
Close All Connections
${connection} Connect
END

Common Teardown
IF ${connection}
Connect
Expand Down
12 changes: 6 additions & 6 deletions Robot-Framework/test-suites/bat-tests/apps.robot
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Start Chrome on LenovoX1
[Tags] bat pre-merge SP-T92 lenovo-x1
Verify service status range=15 [email protected] expected_status=active expected_state=running
Connect to netvm
Connect to VM ${GUI_VM}
Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD}
Check if ssh is ready on vm ${CHROME_VM}
Start XDG application 'Google Chrome'
Connect to VM ${CHROME_VM}
Expand All @@ -42,7 +42,7 @@ Start Zathura on LenovoX1
[Documentation] Start Zathura in dedicated VM and verify process started
[Tags] bat pre-merge SP-T105 lenovo-x1
[Setup] Connect to netvm
Connect to VM ${GUI_VM}
Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD}
Check if ssh is ready on vm ${ZATHURA_VM}
Start XDG application 'PDF Viewer'
Connect to VM ${ZATHURA_VM}
Expand All @@ -55,7 +55,7 @@ Start Gala on LenovoX1
[Documentation] Start Gala in dedicated VM and verify process started
[Tags] bat pre-merge SP-T104 lenovo-x1
[Setup] Connect to netvm
Connect to VM ${GUI_VM}
Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD}
Check if ssh is ready on vm ${GALA_VM}
Start XDG application GALA
Connect to VM ${GALA_VM}
Expand All @@ -66,7 +66,7 @@ Start Element on LenovoX1
[Documentation] Start Element in dedicated VM and verify process started
[Tags] bat pre-merge SP-T52 lenovo-x1
[Setup] Connect to netvm
Connect to VM ${GUI_VM}
Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD}
Check if ssh is ready on vm ${COMMS_VM}
Start XDG application Element
Connect to VM ${COMMS_VM}
Expand All @@ -77,7 +77,7 @@ Start Slack on LenovoX1
[Documentation] Start Slack in dedicated VM and verify process started
[Tags] bat pre-merge SP-T181 lenovo-x1
[Setup] Connect to netvm
Connect to VM ${GUI_VM}
Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD}
Check if ssh is ready on vm ${COMMS_VM}
Start XDG application Slack
Connect to VM ${COMMS_VM}
Expand All @@ -88,7 +88,7 @@ Start Appflowy on LenovoX1
[Documentation] Start Appflowy in dedicated VM and verify process started
[Tags] appflowy # Removed bat tag & lenovo-x1 tag until final decision of this app is made
[Setup] Connect to netvm
Connect to VM ${GUI_VM}
Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD}
Check if ssh is ready on vm appflowy-vm
Start XDG application AppFlowy
Connect to VM ${APPFLOWY_VM}
Expand Down
14 changes: 7 additions & 7 deletions Robot-Framework/test-suites/bat-tests/business_vm.robot
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ 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}
Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD}
Start XDG application "Microsoft Outlook"
Connect to VM ${BUSINESS_VM}
Check that the application was started outlook
Expand All @@ -28,7 +28,7 @@ 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}
Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD}
Start XDG application "Microsoft 365"
Connect to VM ${BUSINESS_VM}
Check that the application was started microsoft365
Expand All @@ -38,7 +38,7 @@ 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}
Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD}
Start XDG application Teams
Connect to VM ${BUSINESS_VM}
Check that the application was started teams
Expand All @@ -48,7 +48,7 @@ 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}
Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD}
Start XDG application "Trusted Browser"
Connect to VM ${BUSINESS_VM}
Check that the application was started chrome
Expand All @@ -58,7 +58,7 @@ 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}
Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD}
Start XDG application "Video Editor"
Connect to VM ${BUSINESS_VM}
Check that the application was started lossless
Expand All @@ -68,7 +68,7 @@ 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}
Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD}
Start XDG application "Text Editor"
Connect to VM ${BUSINESS_VM}
Check that the application was started text-editor
Expand All @@ -78,7 +78,7 @@ 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}
Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD}
Start XDG application "Xarchiver"
Connect to VM ${BUSINESS_VM}
Check that the application was started xarchiver
Expand Down
22 changes: 15 additions & 7 deletions Robot-Framework/test-suites/bat-tests/gui-vm.robot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Resource ../../resources/ssh_keywords.resource
Resource ../../config/variables.robot
Resource ../../resources/common_keywords.resource
Suite Teardown Close All Connections
Test Setup Run Keywords Connect to netvm AND Connect to VM ${GUI_VM}
Test Setup Run Keywords Connect to netvm AND Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD}


*** Variables ***
Expand All @@ -21,39 +21,47 @@ Start Calculator on LenovoX1
[Tags] calculator SP-T202
Start XDG application Calculator
Check that the application was started calculator
[Teardown] Kill process @{app_pids}
[Teardown] Gui-vm apps teardown

Start Sticky Notes on LenovoX1
[Documentation] Start Sticky Notes and verify process started
[Tags] sticky_notes SP-T201
Start XDG application 'Sticky Notes'
Check that the application was started sticky-wrapped
[Teardown] Kill process @{app_pids}
[Teardown] Gui-vm apps teardown

Start Control Panel on LenovoX1
[Documentation] Start Control Panel and verify process started
[Tags] control_panel SP-T205
Start XDG application 'Control Panel'
Check that the application was started ctrl-panel
[Teardown] Kill process @{app_pids}
[Teardown] Gui-vm apps teardown

Start Bluetooth Settings on LenovoX1
[Documentation] Start Bluetooth Settings and verify process started
[Tags] bluetooth_settings SP-T204
Start XDG application 'Bluetooth Settings'
Check that the application was started blueman
[Teardown] Kill process @{app_pids}
[Teardown] Gui-vm apps teardown

Start Audio Control on LenovoX1
[Documentation] Start Audio Control and verify process started
[Tags] audio_control SP-T203
Start XDG application 'Audio Control'
Check that the application was started audio-control
[Teardown] Kill process @{app_pids}
[Teardown] Gui-vm apps teardown

Start File Manager on LenovoX1
[Documentation] Start File Manager and verify process started
[Tags] file_manager SP-T206
Start XDG application 'File Manager'
Check that the application was started pcmanfm
[Teardown] Kill process @{app_pids}
[Teardown] Gui-vm apps teardown


*** Keywords ***

Gui-vm apps teardown
Connect to VM ${GUI_VM}
Kill process @{app_pids}
Connect to VM ${GUI_VM} ${USER_LOGIN} ${USER_PASSWORD}

0 comments on commit 72ffc48

Please sign in to comment.