mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[gui-test] fix a couple of tests
We should use JBTerminalPanel instead of EditorComponentImpl when waiting for the text in the run tool window
This commit is contained in:
+11
-3
@@ -25,18 +25,19 @@ import org.fest.swing.core.Robot
|
||||
import org.fest.swing.exception.ComponentLookupException
|
||||
import org.fest.swing.exception.WaitTimedOutError
|
||||
|
||||
class TerminalFixture(project: Project, robot: Robot): ToolWindowFixture("Terminal", project, robot) {
|
||||
class TerminalFixture(project: Project, robot: Robot, toolWindowId: String) : ToolWindowFixture(toolWindowId, project, robot) {
|
||||
|
||||
private val myJBTerminalPanel: JBTerminalPanel
|
||||
private val terminalTextBuffer: TerminalTextBuffer
|
||||
|
||||
init {
|
||||
val content = this.getContent("") ?: throw Exception("Unable to get content of terminal tool window")
|
||||
val content: Content = this.getContent(getActiveTabName()) ?: throw Exception("Unable to get content of terminal tool window")
|
||||
try {
|
||||
myJBTerminalPanel = GuiTestUtilKt.withPauseWhenNull {
|
||||
getJBTerminalPanel(content)
|
||||
}
|
||||
} catch (e: WaitTimedOutError) {
|
||||
}
|
||||
catch (e: WaitTimedOutError) {
|
||||
throw ComponentLookupException("Unable to find JBTerminalPanel")
|
||||
}
|
||||
terminalTextBuffer = myJBTerminalPanel.terminalTextBuffer
|
||||
@@ -63,6 +64,13 @@ class TerminalFixture(project: Project, robot: Robot): ToolWindowFixture("Termin
|
||||
}
|
||||
}
|
||||
|
||||
private fun getActiveTabName(): String {
|
||||
for (c in this.contents) {
|
||||
if (c.isSelected) return c.tabName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
private fun getJBTerminalPanel(content: Content): JBTerminalPanel? {
|
||||
return try {
|
||||
myRobot.finder().find(content.component) { component -> component is JBTerminalPanel } as JBTerminalPanel
|
||||
|
||||
+1
-1
@@ -164,7 +164,7 @@ public abstract class ToolWindowFixture {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Content[] getContents() {
|
||||
public Content[] getContents() {
|
||||
return myToolWindow.getContentManager().getContents();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user