[kde-linux/os-autoinst-distri-kdelinux] /: tests: add test for logging out of system
Bhushan Shah <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 173c65c598992989af8b7b6ca14a82a89d7fb372 by Bhushan Shah. Committed on 10/08/2026 at 12:13. Pushed by bshah into branch 'master'. tests: add test for logging out of system A +65 -0 extensions/openqa/usr/lib/kde-linux-openqa/tests/logout.py M +2 -0 main.pm A +9 -0 tests/kdelinux/system/logout.py https://invent.kde.org/kde-linux/os-autoinst-distri-kdelinux/-/commit/173c65c598992989af8b7b6ca14a82a89d7fb372 diff --git a/extensions/openqa/usr/lib/kde-linux-openqa/tests/logout.py b/extensions/openqa/usr/lib/kde-linux-openqa/tests/logout.py new file mode 100644 index 0000000..4c32acc --- /dev/null +++ b/extensions/openqa/usr/lib/kde-linux-openqa/tests/logout.py @@ -0,0 +1,65 @@ +# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL +# SPDX-FileCopyrightText: 2026 Bhushan Shah <[email protected]> + +import subprocess +import unittest +from appium import webdriver +from appium.webdriver.common.appiumby import AppiumBy +from appium.options.common.base import AppiumOptions +from selenium.webdriver.common.action_chains import ActionChains +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as ec +from lib.sut import openqa_junit_xml +from lib.sut.atspi import find_pid_on_atspi_bus + +# Find the logout button in kickoff and trigger logout action + +class LogoutTests(unittest.TestCase): + @classmethod + def setUpClass(self): + options = AppiumOptions() + options.set_capability('app', str(find_pid_on_atspi_bus('plasmashell'))) + self.driver = webdriver.Remote(command_executor='http://127.0.0.1:4723', options=options) + self.driver.implicitly_wait(0) + + @classmethod + def tearDownClass(self): + pass + + def setUp(self): + pass + + def test_1_logout_entry(self): + """Open the application launcher, search for logout, click on it from results.""" + wait = WebDriverWait(self.driver, 10) + wait.until( + ec.element_to_be_clickable((AppiumBy.NAME, "Application Launcher")), + message='kickoff launcher button not found on the panel').click() + search = wait.until( + ec.element_to_be_clickable((AppiumBy.NAME, "Search")), + message='kickoff search field not found') + search.send_keys('Log Out') + + # Launch the Logout search result. + wait.until( + ec.element_to_be_clickable((AppiumBy.NAME, "Log Out")), + message='Log Out did not appear in the kickoff search results').click() + try: + greeter_pid = find_pid_on_atspi_bus('ksmserver-logout-greeter', timeout=30) + except RuntimeError as error: + self.fail(f'Logout greeter did not show-up: {error}') + + options = AppiumOptions() + options.set_capability('app', str(greeter_pid)) + logout_driver = webdriver.Remote(command_executor='http://127.0.0.1:4723', options=options) + logout_driver.implicitly_wait(0) + + wait = WebDriverWait(logout_driver, 10) + # Logout now + wait.until( + ec.element_to_be_clickable((AppiumBy.NAME, "Log Out Now")), + message='Log Out Now is not available').click() + +if __name__ == "__main__": + openqa_junit_xml.run(LogoutTests, "logout") diff --git a/main.pm b/main.pm index 90b9872..1e27028 100755 --- a/main.pm +++ b/main.pm @@ -63,6 +63,8 @@ sub test_kdelinux { loadtest 'kdelinux/system/system_development.py'; loadtest 'kdelinux/system/collect_logs.py'; loadtest 'kdelinux/system/desktop_session_services.py'; + loadtest 'kdelinux/system/logout.py'; + loadtest 'kdelinux/sddm/sddm_password_login.py'; loadtest 'common/shutdown.py'; } diff --git a/tests/kdelinux/system/logout.py b/tests/kdelinux/system/logout.py new file mode 100644 index 0000000..fda9880 --- /dev/null +++ b/tests/kdelinux/system/logout.py @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL +# SPDX-FileCopyrightText: 2026 Bhushan Shah <[email protected]> +from testapi import * +from lib.test import cli_test +from lib.common import user_manager + +def run(self): + test = cli_test.CliTest('logout') + test.run_selenium(user=user_manager.installed())