From 70d730eab9bb2fa9c04f252414fef3b9d3e640c6 Mon Sep 17 00:00:00 2001 From: "vladislav.shishov" Date: Sun, 22 Feb 2026 20:37:55 +0200 Subject: [PATCH] AT-4096 [remote-driver]: fix JComboBoxTextFixture (cherry picked from commit 7ca5e5d98a7de3291de277d909d4a25affed1e59) IJ-CR-193921 GitOrigin-RevId: 2fb20c05e990d5fc9d7feab513de22f7384fd1c6 --- .../fixtures/JComboBoxTextFixture.kt | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) 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