diff --git a/platform/testGuiFramework/src/com/intellij/testGuiFramework/fixtures/IdeFrameFixture.java b/platform/testGuiFramework/src/com/intellij/testGuiFramework/fixtures/IdeFrameFixture.java index 20654fc3465f..9d77b59e999a 100644 --- a/platform/testGuiFramework/src/com/intellij/testGuiFramework/fixtures/IdeFrameFixture.java +++ b/platform/testGuiFramework/src/com/intellij/testGuiFramework/fixtures/IdeFrameFixture.java @@ -65,7 +65,6 @@ import java.io.File; import java.util.*; import java.util.List; -import static com.intellij.ide.impl.ProjectUtil.closeAndDispose; import static com.intellij.openapi.util.io.FileUtil.getRelativePath; import static com.intellij.openapi.util.io.FileUtil.toSystemDependentName; import static com.intellij.openapi.util.text.StringUtil.isNotEmpty; @@ -79,7 +78,7 @@ import static org.fest.util.Strings.quote; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; -public class IdeFrameFixture extends ComponentFixture{ +public class IdeFrameFixture extends ComponentFixture { @NotNull private final File myProjectPath; private EditorFixture myEditor; @@ -91,7 +90,8 @@ public class IdeFrameFixture extends ComponentFixture actionManager.tryToExecute(mainMenuAction, fakeMainMenuMouseEvent, null, ActionPlaces.MAIN_MENU, true)); + MouseEvent fakeMainMenuMouseEvent = + new MouseEvent(jMenuBar, MouseEvent.MOUSE_CLICKED, System.currentTimeMillis(), 0, MouseInfo.getPointerInfo().getLocation().x, + MouseInfo.getPointerInfo().getLocation().y, 1, false); + ApplicationManager.getApplication() + .invokeLater(() -> actionManager.tryToExecute(mainMenuAction, fakeMainMenuMouseEvent, null, ActionPlaces.MAIN_MENU, true)); } /** @@ -651,10 +654,10 @@ public class IdeFrameFixture extends ComponentFixture Unit) { - func.invoke(findWelcomeFrame()) + func(findWelcomeFrame()) } fun ideFrame(func: IdeFrameFixture.() -> Unit) { - func.invoke(findIdeFrame()) + func(findIdeFrame()) } fun dialog(title: String? = null, timeout: Long = defaultTimeout, func: JDialogFixture.() -> Unit) { - func.invoke(dialog(title, timeout)) + func(dialog(title, timeout)) } fun simpleProject(func: IdeFrameFixture.() -> Unit) { - func.invoke(importSimpleProject()) + func(importSimpleProject()) } fun projectWizard(func: NewProjectWizardFixture.() -> Unit) { - func.invoke(findNewProjectWizard()) + func(findNewProjectWizard()) } fun IdeFrameFixture.projectView(func: ProjectViewFixture.() -> Unit) { - func.invoke(this.projectView) + func(this.projectView) } fun IdeFrameFixture.toolwindow(id: String, func: CustomToolWindowFixture.() -> Unit) { - func.invoke(CustomToolWindowFixture(id, this)) + func(CustomToolWindowFixture(id, this)) } //*********FIXTURES METHODS WITHOUT ROBOT and TARGET; KOTLIN ONLY @@ -213,7 +213,7 @@ open class GuiTestCase : GuiTestBase() { //*********FIXTURES METHODS FOR IDEFRAME WITHOUT ROBOT and TARGET; KOTLIN ONLY fun IdeFrameFixture.editor(/*timeout in seconds*/ timeout: Long = defaultTimeout, func: EditorFixture.() -> Unit) { - func.invoke(this.editor) + func(this.editor) } fun IdeFrameFixture.popup(vararg path: String) = this.invokeMenuPath(*path) @@ -222,6 +222,7 @@ open class GuiTestCase : GuiTestBase() { fun typeText(text: String) = GuiTestUtil.typeText(text, myRobot, 10) fun shortcut(keyStroke: String) = GuiTestUtil.invokeActionViaShortcut(myRobot, keyStroke) + fun screenshot(component: Component, screenshotName: String): Unit { val extension = "${getScaleSuffix()}.png" diff --git a/platform/testGuiFramework/src/com/intellij/testGuiFramework/impl/GuiTestUtilKt.kt b/platform/testGuiFramework/src/com/intellij/testGuiFramework/impl/GuiTestUtilKt.kt index e16b4b91245d..9895d83de2ab 100644 --- a/platform/testGuiFramework/src/com/intellij/testGuiFramework/impl/GuiTestUtilKt.kt +++ b/platform/testGuiFramework/src/com/intellij/testGuiFramework/impl/GuiTestUtilKt.kt @@ -80,7 +80,7 @@ object GuiTestUtilKt { private fun String.withoutIndent() = this.substring(this.getIndent()) - private fun String.multiply(n: Int): String { + private operator fun String.times(n: Int): String { val sb = StringBuilder(n) for (i in 1..n) { sb.append(this) @@ -99,7 +99,7 @@ object GuiTestUtilKt { } fun printRecursive(root: ImmutableTreeNode, indent: Int) { - println(" ".multiply(indent) + root.value) + println(" " * indent + root.value) if (!root.isLeaf()) root.children.forEach { printRecursive(it, indent + 2) } } diff --git a/platform/testGuiFramework/src/com/intellij/testGuiFramework/remote/server/JUnitServerImpl.kt b/platform/testGuiFramework/src/com/intellij/testGuiFramework/remote/server/JUnitServerImpl.kt index db55231a6024..99d102098b22 100644 --- a/platform/testGuiFramework/src/com/intellij/testGuiFramework/remote/server/JUnitServerImpl.kt +++ b/platform/testGuiFramework/src/com/intellij/testGuiFramework/remote/server/JUnitServerImpl.kt @@ -158,6 +158,10 @@ class JUnitServerImpl: JUnitServer { catch(e: InterruptedException) { Thread.currentThread().interrupt() } + catch (e: Exception) { + if (e is InvalidClassException) LOG.error("Probably client is down:", e) + failHandler?.invoke(e) + } finally { objectOutputStream.close() } diff --git a/platform/testGuiFramework/testGuiFramework.iml b/platform/testGuiFramework/testGuiFramework.iml index 4c49dfea5bb3..c9d525589302 100644 --- a/platform/testGuiFramework/testGuiFramework.iml +++ b/platform/testGuiFramework/testGuiFramework.iml @@ -9,9 +9,9 @@ - + - +