[driver-tests]: add ProjectViewToolWindowUi

GitOrigin-RevId: 6a282ef7d396bf545a89504c9537e98f15d7ffc0
This commit is contained in:
Anastasia Katsman
2024-06-28 16:22:57 +02:00
committed by intellij-monorepo-bot
parent 58be39ad5d
commit 74bda450d0

View File

@@ -0,0 +1,26 @@
package com.intellij.driver.sdk.ui.components
import com.intellij.driver.sdk.ui.Finder
import com.intellij.driver.sdk.ui.components.UiComponent.Companion.waitFound
import kotlin.time.Duration.Companion.seconds
fun Finder.projectViewToolWindow(): ProjectViewToolWindowUi =
x(ProjectViewToolWindowUi::class.java) {
byAccessibleName("Project Tool Window")
}
fun Finder.showProjectViewButton() = x { and (byAccessibleName("Project"), byClass("SquareStripeButton")) }
fun Finder.openProjectViewToolWindow(): ProjectViewToolWindowUi {
return runCatching { projectViewToolWindow().waitFound(3.seconds) }.getOrElse {
showProjectViewButton().click()
projectViewToolWindow().waitFound(3.seconds)
}
}
class ProjectViewToolWindowUi(data: ComponentData) : JTreeUiComponent(data) {
fun expandAll() = x("//div[@myicon='expandAll.svg']").click()
}