mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[driver][ui-tests] AT-3237 Added tests for new terminal
GitOrigin-RevId: 586fd8c49f47dece15a587f9d8ce070196e38fc5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
de0dae2e04
commit
7742011fcd
@@ -38,5 +38,6 @@
|
||||
<orderEntry type="module" module-name="intellij.driver.model" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ui.jcef" />
|
||||
<orderEntry type="module" module-name="intellij.terminal" />
|
||||
</component>
|
||||
</module>
|
||||
+2
@@ -66,6 +66,8 @@ open class JEditorUiComponent(data: ComponentData) : UiComponent(data) {
|
||||
|
||||
fun getLineNumber(text: String): Int = document.getLineNumber(this.text.indexOf(text)) + 1
|
||||
|
||||
fun getLastLineNumber(text: String): Int = document.getLineNumber(this.text.lastIndexOf(text)) + 1
|
||||
|
||||
fun expandAllFoldings() {
|
||||
driver.invokeAction("ExpandAllRegions", component = component)
|
||||
}
|
||||
|
||||
+38
-2
@@ -1,6 +1,7 @@
|
||||
package com.intellij.driver.sdk.ui.components.common.dialogs
|
||||
|
||||
import com.intellij.driver.client.Driver
|
||||
import com.intellij.driver.client.Remote
|
||||
import com.intellij.driver.sdk.ui.Finder
|
||||
import com.intellij.driver.sdk.ui.components.ComponentData
|
||||
import com.intellij.driver.sdk.ui.components.UiComponent
|
||||
@@ -9,11 +10,12 @@ import com.intellij.driver.sdk.ui.ui
|
||||
import com.intellij.driver.sdk.waitFor
|
||||
import org.intellij.lang.annotations.Language
|
||||
|
||||
fun Finder.terminal(@Language("xpath") xpath: String = "//div[contains(@class, 'TerminalToolWindow') or contains(@class, 'ConsoleTerminalWidget')]") =
|
||||
|
||||
fun Finder.terminal(@Language("xpath") xpath: String = "//div[contains(@class, 'TerminalPanel') or contains(@class, 'ConsoleTerminalWidget')]") =
|
||||
x(xpath, TerminalDialogUI::class.java)
|
||||
|
||||
fun Finder.terminal(action: TerminalDialogUI.() -> Unit) {
|
||||
x("//div[contains(@class, 'TerminalToolWindow') or contains(@class, 'ConsoleTerminalWidget')]", TerminalDialogUI::class.java).action()
|
||||
x("//div[contains(@class, 'TerminalPanel') or contains(@class, 'ConsoleTerminalWidget')]", TerminalDialogUI::class.java).action()
|
||||
}
|
||||
|
||||
fun Driver.terminal(action: TerminalDialogUI.() -> Unit) {
|
||||
@@ -28,6 +30,14 @@ class TerminalDialogUI(data: ComponentData) : UiComponent(data) {
|
||||
waitFound()
|
||||
}
|
||||
|
||||
val terminalView: TerminalView
|
||||
get() = driver.cast(component, TerminalView::class)
|
||||
val terminalOutputModel: TerminalOutputModel get() = terminalView.outputModels.active.value
|
||||
val cursorOffset: Long get() = terminalOutputModel.cursorOffset.toAbsolute()
|
||||
|
||||
|
||||
|
||||
|
||||
val rdPortForwardingPanelWidget: RdPortForwardingPanelWidget
|
||||
get() = x(RdPortForwardingPanelWidget::class.java) { byJavaClass("com.jetbrains.thinclient.portForwarding.ThinClientPortForwardingPanelWidget") }
|
||||
|
||||
@@ -47,3 +57,29 @@ class RdPortForwardingPanelWidget(data: ComponentData) : UiComponent(data) {
|
||||
val forwardedPortDropDown: UiComponent
|
||||
get() = x { byJavaClass("com.jetbrains.thinclient.portForwarding.ui.ForwardedPortDropDownLink") }
|
||||
}
|
||||
|
||||
@Remote("com.intellij.terminal.frontend.view.TerminalView", plugin = "org.jetbrains.plugins.terminal/intellij.terminal.frontend")
|
||||
interface TerminalView {
|
||||
fun getActiveOutputModel(): TerminalOutputModel
|
||||
val outputModels: TerminalOutputModelsSet
|
||||
}
|
||||
|
||||
@Remote("org.jetbrains.plugins.terminal.view.TerminalOutputModelsSet", plugin = "org.jetbrains.plugins.terminal")
|
||||
interface TerminalOutputModelsSet {
|
||||
val active: StateFlow<TerminalOutputModel>
|
||||
}
|
||||
|
||||
@Remote("kotlinx.coroutines.flow.StateFlow")
|
||||
interface StateFlow<out T> {
|
||||
val value: T
|
||||
}
|
||||
|
||||
@Remote("org.jetbrains.plugins.terminal.block.reworked.TerminalOutputModel")
|
||||
interface TerminalOutputModel {
|
||||
val cursorOffset: TerminalOffset
|
||||
}
|
||||
|
||||
@Remote("org.jetbrains.plugins.terminal.block.reworked.TerminalOffset", plugin = "org.jetbrains.plugins.terminal")
|
||||
interface TerminalOffset {
|
||||
fun toAbsolute(): Long
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Deferred
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.plugins.terminal.block.reworked.TerminalOutputModel
|
||||
import org.jetbrains.plugins.terminal.session.TerminalGridSize
|
||||
import org.jetbrains.plugins.terminal.session.TerminalStartupOptions
|
||||
import org.jetbrains.plugins.terminal.view.TerminalOutputModel
|
||||
@@ -124,6 +125,10 @@ interface TerminalView {
|
||||
*/
|
||||
fun createSendTextBuilder(): TerminalSendTextBuilder
|
||||
|
||||
// todo
|
||||
|
||||
fun getActiveOutputModel(): TerminalOutputModel
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* The data context key for accessing the Terminal View from actions.
|
||||
|
||||
+4
@@ -123,6 +123,10 @@ class TerminalViewImpl(
|
||||
get() = getCurEditor().calculateTerminalSize()
|
||||
override val title: TerminalTitle = TerminalTitle()
|
||||
|
||||
//@VisibleForTesting
|
||||
override fun getActiveOutputModel(): TerminalOutputModel{
|
||||
return outputModels.active.value
|
||||
}
|
||||
private val mutableOutputModels: TerminalOutputModelsSetImpl
|
||||
override val outputModels: TerminalOutputModelsSet
|
||||
|
||||
|
||||
Reference in New Issue
Block a user