From 3cbb0e8f4547c2b3afcd5fc5992d64d631ad094d Mon Sep 17 00:00:00 2001 From: Nikita Katkov Date: Fri, 14 Aug 2026 18:20:32 +0200 Subject: [PATCH] [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 --- .../toolwindows/StructureToolWindowUi.kt | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/ui/components/common/toolwindows/StructureToolWindowUi.kt b/platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/ui/components/common/toolwindows/StructureToolWindowUi.kt index 95525d9dfa7f..af33d2bbeb26 100644 --- a/platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/ui/components/common/toolwindows/StructureToolWindowUi.kt +++ b/platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/ui/components/common/toolwindows/StructureToolWindowUi.kt @@ -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)) } -} \ No newline at end of file +}