diff --git a/platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/ui/components/UiComponent.kt b/platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/ui/components/UiComponent.kt index f0dd155a1dc4..5cf55a0d7f51 100644 --- a/platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/ui/components/UiComponent.kt +++ b/platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/ui/components/UiComponent.kt @@ -492,6 +492,16 @@ open class UiComponent(private val data: ComponentData) : Finder, WithKeyboard { } } + fun press(point: Point? = null) { + LOG.info("Press at $this${point?.let { ": $it" } ?: ""}") + withComponent { robot.moveMouseAndPress(it, point) } + } + + fun mouseRelease() { + LOG.info("Release at $this") + withComponent { robot.releaseMouse(RemoteMouseButton.LEFT) } + } + fun getBackgroundColor(): Color { return withComponent { Color(it.getBackground().getRGB()) } } diff --git a/platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/ui/components/notebooks/NotebookEditorComponent.kt b/platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/ui/components/notebooks/NotebookEditorComponent.kt index 6843743a233b..b6cb90ba0849 100644 --- a/platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/ui/components/notebooks/NotebookEditorComponent.kt +++ b/platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/ui/components/notebooks/NotebookEditorComponent.kt @@ -98,6 +98,8 @@ class NotebookEditorUiComponent(private val data: ComponentData) : JEditorUiComp get() = xx("//div[@class='MyScrollPane']//div[@class='JBViewport']").list().first() val selectedCellActions: UiComponent get() = xx("//div[@class='JupyterCellActionsToolbar']").list().first() + val firstFoldingBar: UiComponent + get() = xx("//div[@class='EditorCellFoldingBarComponent']").list().first() override val editorComponent: EditorComponentImpl get() = when { @@ -221,6 +223,12 @@ class NotebookEditorUiComponent(private val data: ComponentData) : JEditorUiComp cell.strictClick() } + fun moveMouseOnCell(cellSelector: CellSelector) { + val cellEditors = notebookCellEditors + val cell = cellSelector(cellEditors) + cell.moveMouse() + } + fun typeInCell( cellSelector: CellSelector, text: String, diff --git a/platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/ui/remote/Robot.kt b/platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/ui/remote/Robot.kt index 209a97c7a12a..438a41e59c00 100644 --- a/platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/ui/remote/Robot.kt +++ b/platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/ui/remote/Robot.kt @@ -39,6 +39,7 @@ interface Robot { */ fun strictClick(component: Component, point: Point?) + fun moveMouseAndPress(component: Component, where: Point?) fun pressMouse(mouseButton: RemoteMouseButton) fun pressMouse(component: Component, point: Point) diff --git a/plugins/performanceTesting/remote-driver/src/com/jetbrains/performancePlugin/remotedriver/robot/SmoothRobot.kt b/plugins/performanceTesting/remote-driver/src/com/jetbrains/performancePlugin/remotedriver/robot/SmoothRobot.kt index 8f7a3aaa9768..f5aa273deb71 100644 --- a/plugins/performanceTesting/remote-driver/src/com/jetbrains/performancePlugin/remotedriver/robot/SmoothRobot.kt +++ b/plugins/performanceTesting/remote-driver/src/com/jetbrains/performancePlugin/remotedriver/robot/SmoothRobot.kt @@ -375,6 +375,17 @@ internal class SmoothRobot @JvmOverloads constructor( } } + fun moveMouseAndPress(component: Component, where: Point?) { + if (where != null) { + moveMouse(component, where) + } + else { + moveMouse(component) + } + ApplicationManager.getApplication().invokeAndWait({}, ModalityState.any()) + basicRobot.pressMouse(MouseButton.LEFT_BUTTON) + } + private fun moveMouseWithAttempts(c: Component, x: Int, y: Int, attempts: Int = 3) { waitFor(Duration.ofSeconds(5), Duration.ofSeconds(1)) { performOnEdt { c.isShowing }!! }