[split mode] IJAI-895 IJ-MR-218645 Stabilize structure view test, attempt 3

It turned out that the test became flaky after bunding
1) AIR plugin due to the following sequence:
AIR adds custom editor empty state
2) If it initializes within 5 seconds, the empty state takes focus (platform behaviour)
3) Depending on the focused component a toolwindow opened afterwards takes either 25% or 33% of the screen width (platform behaviour)
4) Depending on the opened toolwindow width either 1 or 2 action buttons get rendered in its header
5) A ui test assumes both buttons are always visible and clicks on 2nd by looking up its icon in the header component

now we support opening the second tab no matter what the toolwindow width is

GitOrigin-RevId: 3d2edc1940acbcd8d66aa3c7453a13de07bff5cd
This commit is contained in:
Nikita Katkov
2026-08-18 14:27:36 +00:00
committed by intellij-monorepo-bot
parent 2a4d4855a5
commit 3cbb0e8f45
@@ -3,10 +3,15 @@ package com.intellij.driver.sdk.ui.components.common.toolwindows
import com.intellij.driver.sdk.step
import com.intellij.driver.sdk.ui.Finder
import com.intellij.driver.sdk.ui.UiText
import com.intellij.driver.sdk.ui.ui
import com.intellij.driver.sdk.ui.components.ComponentData
import com.intellij.driver.sdk.ui.components.UiComponent
import com.intellij.driver.sdk.ui.components.elements.ActionButtonUi
import com.intellij.driver.sdk.ui.components.elements.JTreeUiComponent
import com.intellij.driver.sdk.ui.components.elements.actionButton
import com.intellij.driver.sdk.ui.components.elements.contentTabLabel
import com.intellij.driver.sdk.ui.components.elements.list
import com.intellij.driver.sdk.ui.components.elements.popup
import com.intellij.driver.sdk.ui.components.elements.tree
import org.intellij.lang.annotations.Language
import java.awt.Point
@@ -53,6 +58,26 @@ class StructureToolWindowUi(data: ComponentData) : ToolWindowUiComponent(data) {
return xx("//div[@class='ContentTabLabel']").list()
}
fun hasMultipleTabs(): Boolean = tabs.size >= 2 || hiddenTabsButton.present()
fun selectTab(tabName: String) {
val visibleTab = contentTabLabel(tabName)
if (visibleTab.present()) {
step("Select visible Structure tab '$tabName'") {
visibleTab.click()
}
return
}
step("Select hidden Structure tab '$tabName'") {
hiddenTabsButton.click()
driver.ui.popup().list().clickItem(tabName)
}
}
private val hiddenTabsButton: ActionButtonUi
get() = toolWindowHeader.actionButton { byAccessibleName("Show Hidden Tabs") }
fun expandViewOptions() {
viewOptionsButton.click()
}
@@ -84,4 +109,4 @@ class StructureToolWindowUi(data: ComponentData) : ToolWindowUiComponent(data) {
val headerComponent = header.component
moveMouse(Point(headerComponent.x, headerComponent.y))
}
}
}