mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[tests] KTNB-1296 fix selectItem() in ComboBoxActionButton
repeate() doesn't help when a UiElement is not found GitOrigin-RevId: c8632e18c5991df1121e4c561de33aba9a67f822
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6097eb7fb1
commit
8e77f9ffe3
+4
-5
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user