From 8e6aaba2c36af4993bf3845d2a7e31c9f6376f7b Mon Sep 17 00:00:00 2001 From: Artem Gainanov Date: Thu, 21 Dec 2017 20:01:56 +0700 Subject: [PATCH] [gui-test] tests for plugins. add regexp for path --- .../testGuiFramework/impl/GuiTestCase.kt | 3 ++- .../testCases/PluginTestCase.kt | 27 +++++++++++++------ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/platform/testGuiFramework/src/com/intellij/testGuiFramework/impl/GuiTestCase.kt b/platform/testGuiFramework/src/com/intellij/testGuiFramework/impl/GuiTestCase.kt index 5677d2724d24..2c7f77a9da9b 100644 --- a/platform/testGuiFramework/src/com/intellij/testGuiFramework/impl/GuiTestCase.kt +++ b/platform/testGuiFramework/src/com/intellij/testGuiFramework/impl/GuiTestCase.kt @@ -149,7 +149,7 @@ open class GuiTestCase { */ fun chooseFileInFileChooser(path: String, timeout: Long = defaultTimeout) { val macNativeFileChooser = SystemInfo.isMac() && (System.getProperty("ide.mac.file.chooser.native", "true").toLowerCase() == "true") - if (macNativeFileChooser) { + if (!macNativeFileChooser) { MacFileChooserDialogFixture(robot()).selectByPath(path) } else { @@ -170,6 +170,7 @@ open class GuiTestCase { } val dialogFixture = JDialogFixture(robot(), fileChooserDialog) with(dialogFixture) { + asyncProcessIcon().waitUntilStop(20) textfield("") invokeAction("\$SelectAll") typeText(path) diff --git a/platform/testGuiFramework/src/com/intellij/testGuiFramework/testCases/PluginTestCase.kt b/platform/testGuiFramework/src/com/intellij/testGuiFramework/testCases/PluginTestCase.kt index 107f17ee59c9..5354b530b5f5 100644 --- a/platform/testGuiFramework/src/com/intellij/testGuiFramework/testCases/PluginTestCase.kt +++ b/platform/testGuiFramework/src/com/intellij/testGuiFramework/testCases/PluginTestCase.kt @@ -25,6 +25,7 @@ import com.intellij.testGuiFramework.launcher.system.SystemInfo import com.intellij.testGuiFramework.remote.transport.MessageType import com.intellij.testGuiFramework.remote.transport.TransportMessage import org.fest.swing.exception.WaitTimedOutError +import java.io.File import javax.swing.JDialog open class PluginTestCase : GuiTestCase() { @@ -34,6 +35,23 @@ open class PluginTestCase : GuiTestCase() { private val WIN_PLUGIN_HOME = "/Users/jetbrains/Documents/plugins/" private val LINUX_PLUGIN_HOME = "/Users/jetbrains/Documents/plugins/" + private fun getPluginHomePath(): String { + return when { + SystemInfo.isMac() -> MAC_PLUGIN_HOME + SystemInfo.isWin() -> WIN_PLUGIN_HOME + else -> { + LINUX_PLUGIN_HOME + } + } + } + + fun findPlugin(pluginName: String): String { + val f = File(getPluginHomePath()) + return f.listFiles { _, name -> + name.startsWith(pluginName) + }[0].toString() + } + fun installPluginAndRestart(installPluginsFunction: () -> Unit) { val PLUGINS_INSTALLED = "PLUGINS_INSTALLED" if (guiTestRule.getTestName() == GuiTestOptions.getResumeTestName() && @@ -69,14 +87,7 @@ open class PluginTestCase : GuiTestCase() { } } - fun installPluginFromDisk(pluginDir: String, pluginName: String) { - var pluginPath: String = when { - SystemInfo.isMac() -> MAC_PLUGIN_HOME - SystemInfo.isWin() -> WIN_PLUGIN_HOME - else -> { - LINUX_PLUGIN_HOME - } - } + pluginDir + fun installPluginFromDisk(pluginPath: String, pluginName: String) { welcomeFrame { actionLink("Configure").click() popupClick("Plugins")