[plasma/plasma-desktop/Plasma/6.6] appiumtests/kcms: appiumtests/kcms: fix kcm_kded_test
Nate Graham <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit bede7f74f30c2702efad844416597decdcdae21b by Nate Graham. Committed on 09/07/2026 at 14:36. Pushed by ngraham into branch 'Plasma/6.6'. appiumtests/kcms: fix kcm_kded_test Flaky because it might be loaded or not depending on the order of tests, speed that they are run, etc. Make sure let it load before running the test. Also make the test more reliable by using `element_to_be_clickable` instead of `presence_of_element_located` (which isn't guarenteed to be visible or interactable). (cherry picked from commit 5735525a6c7284b741181dee1ae30758823d5c18) Co-authored-by: Kristen McWilliam <[email protected]> M +21 -5 appiumtests/kcms/kcm_kded_test.py https://invent.kde.org/plasma/plasma-desktop/-/commit/bede7f74f30c2702efad844416597decdcdae21b diff --git a/appiumtests/kcms/kcm_kded_test.py b/appiumtests/kcms/kcm_kded_test.py index b9149d39aa..226d5d9894 100755 --- a/appiumtests/kcms/kcm_kded_test.py +++ b/appiumtests/kcms/kcm_kded_test.py @@ -107,17 +107,33 @@ class KCMTest(unittest.TestCase): Start/stop the accent color service """ self.driver.find_element(AppiumBy.NAME, "Background Services") - self.driver.find_element(AppiumBy.NAME, "Start Accent Color").click() wait = WebDriverWait(self.driver, 30) - stop_button: WebElement = wait.until(EC.presence_of_element_located((AppiumBy.NAME, "Stop Accent Color"))) + + START_BUTTON_NAME: Final = "Start Accent Color" + STOP_BUTTON_NAME: Final = "Stop Accent Color" + SERVICE_NAME: Final = "plasma_accentcolor_service" # The id is from plasma-workspace session_bus: Gio.DBusConnection = Gio.bus_get_sync(Gio.BusType.SESSION) - self.assertIn("plasma_accentcolor_service", loadedModules(session_bus)) # The service id is from plasma-workspace + # The service has X-KDE-Kded-autoload: true, so it is always loaded when kded is running. + # Wait for autoloading to complete, then stop it to get into a known stopped state. + wait.until(EC.element_to_be_clickable((AppiumBy.NAME, STOP_BUTTON_NAME))).click() + wait.until(EC.element_to_be_clickable((AppiumBy.NAME, START_BUTTON_NAME))) + wait.until(lambda _: SERVICE_NAME not in loadedModules(session_bus)) + self.assertNotIn(SERVICE_NAME, loadedModules(session_bus)) + + # Start the service again, and verify it is loaded. + wait.until(EC.element_to_be_clickable((AppiumBy.NAME, START_BUTTON_NAME))).click() + stop_button: WebElement = wait.until(EC.element_to_be_clickable((AppiumBy.NAME, STOP_BUTTON_NAME))) + wait.until(lambda _: SERVICE_NAME in loadedModules(session_bus)) + self.assertIn(SERVICE_NAME, loadedModules(session_bus)) + + # Stop the service again to make sure it can be stopped again after being started. stop_button.click() - wait.until(EC.presence_of_element_located((AppiumBy.NAME, "Start Accent Color"))) - self.assertNotIn("plasma_accentcolor_service", loadedModules(session_bus)) + wait.until(EC.element_to_be_clickable((AppiumBy.NAME, START_BUTTON_NAME))) + wait.until(lambda _: SERVICE_NAME not in loadedModules(session_bus)) + self.assertNotIn(SERVICE_NAME, loadedModules(session_bus)) def test_1_toggle_automatically_loading_service(self) -> None: """