[gui-test] tests for plugins. add regexp for path

This commit is contained in:
Artem Gainanov
2017-12-21 20:04:16 +07:00
parent 3dbeaae3f7
commit 8e6aaba2c3
2 changed files with 21 additions and 9 deletions
@@ -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)
@@ -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")