diff --git a/plugins/performanceTesting/remote-driver/src/com/jetbrains/performancePlugin/remotedriver/fixtures/JComboBoxTextFixture.kt b/plugins/performanceTesting/remote-driver/src/com/jetbrains/performancePlugin/remotedriver/fixtures/JComboBoxTextFixture.kt index 6e33796a8aa1..fcdab48962fd 100644 --- a/plugins/performanceTesting/remote-driver/src/com/jetbrains/performancePlugin/remotedriver/fixtures/JComboBoxTextFixture.kt +++ b/plugins/performanceTesting/remote-driver/src/com/jetbrains/performancePlugin/remotedriver/fixtures/JComboBoxTextFixture.kt @@ -2,9 +2,11 @@ package com.jetbrains.performancePlugin.remotedriver.fixtures import com.jetbrains.performancePlugin.remotedriver.dataextractor.TextCellRendererReader +import com.jetbrains.performancePlugin.remotedriver.dataextractor.computeOnEdt import org.assertj.swing.core.Robot import org.assertj.swing.driver.BasicJComboBoxCellReader import org.assertj.swing.driver.CellRendererReader +import org.assertj.swing.driver.ComponentPreconditions import org.assertj.swing.fixture.JComboBoxFixture import javax.swing.JComboBox @@ -18,7 +20,10 @@ class JComboBoxTextFixture(robot: Robot, component: JComboBox<*>) : JComboBoxFix } fun select(text: String) { - selectItem(text) + checkEnabledAndShowing() + showDropDownList() + select(findItemIndex(text)) + hideDropDownList() } fun selectedText(): String = selectedItem() ?: "" @@ -26,4 +31,35 @@ class JComboBoxTextFixture(robot: Robot, component: JComboBox<*>) : JComboBoxFix fun listValues(): List { return contents().toList() } + + fun getItemCount(): Int = computeOnEdt { target().itemCount } + + private fun select(index: Int) { + require(index in 0..= 0 }) { "No such item in combobox: $text, contents: $items" } + } } \ No newline at end of file