From 8e77f9ffe3196b81eb827dda36c8f57f37a704e2 Mon Sep 17 00:00:00 2001 From: "Ilya.Komolkin" Date: Wed, 14 Jan 2026 10:43:32 +0200 Subject: [PATCH] [tests] KTNB-1296 fix selectItem() in ComboBoxActionButton repeate() doesn't help when a UiElement is not found GitOrigin-RevId: c8632e18c5991df1121e4c561de33aba9a67f822 --- .../notebooks/KotlinNotebookActionToolBarComponent.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/ui/components/notebooks/KotlinNotebookActionToolBarComponent.kt b/platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/ui/components/notebooks/KotlinNotebookActionToolBarComponent.kt index fd27c5fbad6f..6a529fc32754 100644 --- a/platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/ui/components/notebooks/KotlinNotebookActionToolBarComponent.kt +++ b/platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/ui/components/notebooks/KotlinNotebookActionToolBarComponent.kt @@ -5,6 +5,7 @@ import com.intellij.driver.sdk.ui.components.UiComponent import com.intellij.driver.sdk.ui.components.common.ideFrame import com.intellij.driver.sdk.ui.components.elements.list import com.intellij.driver.sdk.ui.ui +import com.intellij.driver.sdk.withRetries /** * Represents the UI component for Kotlin-specific toolbar actions @@ -31,15 +32,13 @@ class ComboBoxActionButton(data: ComponentData) : UiComponent(data) { // it looks like due to some race condition, // sometimes the combobox is not updated after the mode change, so we need to retry a few times val attemptCount = 5 - repeat(times = attemptCount) { - if (getAllTexts().any { it.text == itemText }) return + withRetries(times = attemptCount) { + if (getAllTexts().any { it.text == itemText }) return@withRetries click() val dropdown = driver.ui.ideFrame().list { byClass("MyList") } dropdown.clickItem(itemText = itemText) } - if (getAllTexts().none { it.text == itemText }) { - error("Failed to select item '$itemText' after $attemptCount attempts") - } + waitOneText(itemText, "Failed to select item '$itemText' after $attemptCount attempts") } }