[kde-linux/os-autoinst-distri-kdelinux] /: tests: make it possible to do encrypted install
Bhushan Shah <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 28c115ecb8027c399c5d1fd3f2e9b8dcc15ffb2f by Bhushan Shah.
Committed on 20/07/2026 at 11:55.
Pushed by bshah into branch 'master'.
tests: make it possible to do encrypted install
- If FDE_INSTALL is set to 1, calamares_install will enable the full-disk
encryption and set password to user for disk encryption
- Merge multiple bootup variants in single common bootup test
M +32 -0 extensions/openqa/usr/lib/kde-linux-openqa/tests/calamares_install.py
M +2 -2 main.pm
M +26 -2 tests/common/bootup.py
D +0 -14 tests/kdelinux-live/bootup.py
D +0 -12 tests/kdelinux-live/bootup_setup.py
M +9 -1 tests/kdelinux-live/calamares_install.py
https://invent.kde.org/kde-linux/os-autoinst-distri-kdelinux/-/commit/28c115ecb8027c399c5d1fd3f2e9b8dcc15ffb2f
diff --git a/extensions/openqa/usr/lib/kde-linux-openqa/tests/calamares_install.py b/extensions/openqa/usr/lib/kde-linux-openqa/tests/calamares_install.py
index d5e6439..5b3be51 100755
--- a/extensions/openqa/usr/lib/kde-linux-openqa/tests/calamares_install.py
+++ b/extensions/openqa/usr/lib/kde-linux-openqa/tests/calamares_install.py
@@ -6,10 +6,13 @@ from appium import webdriver
from appium.webdriver.common.appiumby import AppiumBy
from appium.options.common.base import AppiumOptions
import selenium.common.exceptions
+from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
+from lib import user_manager
from lib.sut import openqa_junit_xml
+import subprocess
import sys
# Installs the system through Calamares.
@@ -28,6 +31,19 @@ class CalamaresTests(unittest.TestCase):
# fails because calamares is root? TODO
pass
+ def _set_text(self, text, element=None):
+ # QML text fields seem to not implement AT-SPI EditableText in QT versions older than 6.11
+ # and synthesised keystrokes get garbled, so we fall back to using the clipboard here.
+ # https://qt-project.atlassian.net/browse/QTBUG-142132
+ # With no element (e.g. an external dialog not in our a11y tree) paste blind into
+ # whatever currently has focus.
+ subprocess.run(['wl-copy', text], check=True)
+ if element is not None:
+ element.click()
+ WebDriverWait(self.driver, 10).until(
+ lambda _: element.is_selected(), message='field never gained focus')
+ ActionChains(self.driver).key_down(Keys.CONTROL).pause(0.5).send_keys('v').pause(0.5).key_up(Keys.CONTROL).perform()
+
def test_install(self):
"""Go through Calamares and install through the standard Erase Disk method."""
## Welcome page
@@ -38,7 +54,23 @@ class CalamaresTests(unittest.TestCase):
next_button.click()
## Partitions page
self.driver.find_element(by=AppiumBy.XPATH, value="//*[contains(@name, 'Erase disk')]").click()
+
+ if "--encrypted" in sys.argv[1:]:
+ ## Enable encrypted install
+ self.driver.find_element(by=AppiumBy.XPATH, value="//*[contains(@name, 'Encrypt system')]").click()
+
+ ## Set FDE passphrase
+ password = user_manager.installed().pw
+
+ field = WebDriverWait(self.driver, 10).until(ec.presence_of_element_located((AppiumBy.XPATH, "//*[contains(@description, 'Passphrase')]")))
+ self._set_text(password, field)
+
+ field = WebDriverWait(self.driver, 10).until(ec.presence_of_element_located((AppiumBy.XPATH, "//*[contains(@description, 'Confirm passphrase')]")))
+ self._set_text(password, field)
+
+ # Start install
next_button.click()
+
## Finished page
wait = WebDriverWait(self.driver, 300)
wait.until(
diff --git a/main.pm b/main.pm
index 5458ba1..b47e4fb 100755
--- a/main.pm
+++ b/main.pm
@@ -27,12 +27,12 @@ sub loadtest {
}
sub test_live_image {
- loadtest 'kdelinux-live/bootup.py';
+ loadtest 'common/bootup.py';
loadtest 'common/basic_test.py';
loadtest 'common/network.py';
loadtest 'kdelinux-live/calamares_install.py';
loadtest 'common/reboot.py';
- loadtest 'kdelinux-live/bootup_setup.py';
+ loadtest 'common/bootup.py';
loadtest 'kdelinux/desktop/plasma_setup.py';
loadtest 'kdelinux/sddm/sddm_password_login.py';
loadtest 'kdelinux/desktop/plasma_welcome.py';
diff --git a/tests/common/bootup.py b/tests/common/bootup.py
index 77a4b6f..c526dd2 100644
--- a/tests/common/bootup.py
+++ b/tests/common/bootup.py
@@ -1,16 +1,40 @@
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
# SPDX-FileCopyrightText: 2026 Thomas Duckworth <[email protected]>
+# SPDX-FileCopyrightText: 2026 Bhushan Shah <[email protected]>
from testapi import *
+from lib import user_manager
def test_flags(self):
return {'fatal': 1}
def run(self):
+
+ # Turn on the power, in practice if we did reboot,
+ # this does nothing
power('on')
+
+ # Verify that KDE Linux UEFI screen is visible
assert_screen('uefi_screen', 'timeout', 30)
send_key('ret')
+
+ # FDE_INSTALL=1 indicates full-disk-encryption
+ encrypted = get_var('FDE_INSTALL', '0')
+ do_install = get_var('DO_INSTALL', '0')
+ first_boot = get_var('FIRST_BOOT', '0')
+
+ if encrypted == '1' and (first_boot == '1' or do_install == '0'):
+ # Enter password for the FDE
+ assert_screen('bootup_fde', timeout=30)
+ type_string(user_manager.installed().pw, "max_interval", 250)
+ send_key('ret')
+
# check if we see plymouth
assert_screen('booting_screen', 'timeout', 30)
- # wait for kick-off icon on panel to show up
- assert_screen('kickoff_icon_on_panel', 'timeout', 60)
+
+ if first_boot == '1':
+ # Check if we boot into plasma-welcome
+ assert_screen('plasma_welcome', 'timeout', 60)
+ else:
+ # wait for kick-off icon on panel to show up
+ assert_screen('kickoff_icon_on_panel', 'timeout', 60)
diff --git a/tests/kdelinux-live/bootup.py b/tests/kdelinux-live/bootup.py
deleted file mode 100644
index ed2395d..0000000
--- a/tests/kdelinux-live/bootup.py
+++ /dev/null
@@ -1,14 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
-# SPDX-FileCopyrightText: 2026 Thomas Duckworth <[email protected]>
-
-from testapi import *
-
-def test_flags(self):
- return {'fatal': 1}
-
-def run(self):
- power('on')
- assert_screen('uefi_screen', 'timeout', 30)
- send_key('ret')
- assert_screen('booting_screen', 'timeout', 30)
- assert_screen('welcome_desktop_screen', 'timeout', 60)
diff --git a/tests/kdelinux-live/bootup_setup.py b/tests/kdelinux-live/bootup_setup.py
deleted file mode 100644
index d73c3ff..0000000
--- a/tests/kdelinux-live/bootup_setup.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
-# SPDX-FileCopyrightText: 2026 Thomas Duckworth <[email protected]>
-
-from testapi import *
-
-def test_flags(self):
- return {'fatal': 1}
-
-def run(self):
- power('on')
- assert_screen('booting_screen', 'timeout', 30)
- assert_screen('plasma_welcome', 'timeout', 60)
diff --git a/tests/kdelinux-live/calamares_install.py b/tests/kdelinux-live/calamares_install.py
index 3608520..c9c7144 100644
--- a/tests/kdelinux-live/calamares_install.py
+++ b/tests/kdelinux-live/calamares_install.py
@@ -1,5 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
# SPDX-FileCopyrightText: 2026 Thomas Duckworth <[email protected]>
+# SPDX-FileCopyrightText: 2026 Bhushan Shah <[email protected]>
+
from testapi import *
from lib.openqa import cli_test
from lib import paths
@@ -9,5 +11,11 @@ def test_flags(self):
return {'fatal': 1}
def run(self):
+ encrypted = get_var('FDE_INSTALL', '0')
+ install_mode = '--encrypted' if encrypted == '1' else '--default'
+
test = cli_test.CliTest('calamares_install', timeout=300)
- test.run_selenium(user=user_manager.live())
+ test.run_selenium(user=user_manager.live(), args=install_mode)
+ # After install is run we set FIRST_BOOT so follow up code
+ # knows that this is first boot
+ set_var('FIRST_BOOT', '1')