mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[gui-test] move setUpDefaultGeneralSettings() from IdeTestApplication to GuiTestCase singleton class GuiSettings (setup once for all guiTests)
This commit is contained in:
+3
-10
@@ -17,7 +17,6 @@ package com.intellij.testGuiFramework.framework;
|
||||
|
||||
import com.intellij.diagnostic.AbstractMessage;
|
||||
import com.intellij.diagnostic.MessagePool;
|
||||
import com.intellij.ide.GeneralSettings;
|
||||
import com.intellij.ide.PrivacyPolicy;
|
||||
import com.intellij.ide.RecentProjectsManager;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
@@ -159,12 +158,8 @@ public final class GuiTestUtil {
|
||||
// Called by IdeTestApplication via reflection.
|
||||
@SuppressWarnings("unused")
|
||||
public static void setUpDefaultGeneralSettings() {
|
||||
//setGuiTestingMode(true);
|
||||
|
||||
GeneralSettings.getInstance().setShowTipsOnStartup(false);
|
||||
setUpDefaultProjectCreationLocationPath();
|
||||
|
||||
setUpSdks();
|
||||
}
|
||||
|
||||
public static String getSystemJdk() {
|
||||
@@ -179,11 +174,6 @@ public final class GuiTestUtil {
|
||||
return jdkHome;
|
||||
}
|
||||
|
||||
public static void setupGitPath() {
|
||||
//GitVcsApplicationSettings settings = GitVcsApplicationSettings.getInstance();
|
||||
//settings.setPathToGit(GitExecutor.PathHolder.GIT_EXECUTABLE);
|
||||
}
|
||||
|
||||
public static void setUpSdks() {
|
||||
|
||||
String jdkHome = getSystemPropertyOrEnvironmentVariable(JDK_HOME_FOR_TESTS);
|
||||
@@ -224,6 +214,9 @@ public final class GuiTestUtil {
|
||||
|
||||
JavaSdk javaSdk = JavaSdk.getInstance();
|
||||
|
||||
//in case of running different from IntelliJ or Android Studio IDE (PyCharm for example)
|
||||
if (javaSdk == null) return;
|
||||
|
||||
String jdk_name = "JDK";
|
||||
final Sdk newJdk = javaSdk.createJdk(jdk_name, path.toString(), false);
|
||||
final Sdk foundJdk = ProjectJdkTable.getInstance().findJdk(newJdk.getName(), newJdk.getSdkType().getName());
|
||||
|
||||
-1
@@ -109,7 +109,6 @@ public class IdeTestApplication {
|
||||
ClassLoader ideClassLoader = ourInstance.getIdeClassLoader();
|
||||
Class<?> clazz = ideClassLoader.loadClass(GuiTestUtil.class.getCanonicalName());
|
||||
method("waitForIdeToStart").in(clazz).invoke();
|
||||
method("setUpDefaultGeneralSettings").in(clazz).invoke();
|
||||
}
|
||||
|
||||
return ourInstance;
|
||||
|
||||
@@ -15,13 +15,14 @@
|
||||
*/
|
||||
package com.intellij.testGuiFramework.impl;
|
||||
|
||||
import com.intellij.ide.GeneralSettings;
|
||||
import com.intellij.testGuiFramework.framework.GuiTestBase;
|
||||
import com.intellij.testGuiFramework.framework.GuiTestUtil;
|
||||
import com.intellij.util.net.HttpConfigurable;
|
||||
import org.fest.swing.core.FastRobot;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import static com.intellij.testGuiFramework.framework.GuiTestUtil.setUpDefaultProjectCreationLocationPath;
|
||||
|
||||
/**
|
||||
* @author Sergey Karashevich
|
||||
@@ -34,30 +35,43 @@ public class GuiTestCase extends GuiTestBase {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
public static class GuiSettings {
|
||||
|
||||
setUpDefaultProjectCreationLocationPath();
|
||||
myRobot = new FastRobot();
|
||||
private static final Object lock = new Object();
|
||||
|
||||
private static GuiSettings SETTINGS;
|
||||
|
||||
public static GuiSettings setUp() {
|
||||
synchronized (lock) {
|
||||
if (SETTINGS == null) SETTINGS = new GuiSettings();
|
||||
return SETTINGS;
|
||||
}
|
||||
}
|
||||
|
||||
GuiSettings(){
|
||||
GeneralSettings.getInstance().setShowTipsOnStartup(false);
|
||||
GuiTestUtil.setUpDefaultProjectCreationLocationPath();
|
||||
GuiTestUtil.setUpSdks();
|
||||
HttpConfigurable ideSettings = HttpConfigurable.getInstance();
|
||||
ideSettings.USE_HTTP_PROXY = false;
|
||||
ideSettings.PROXY_HOST = "";
|
||||
ideSettings.PROXY_PORT = 80;
|
||||
if (IS_UNDER_TEAMCITY) GitSettings.INSTANCE.setup();
|
||||
}
|
||||
|
||||
setIdeSettings();
|
||||
if (IS_UNDER_TEAMCITY) GitSettings.INSTANCE.setup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tearDown() throws InvocationTargetException, InterruptedException {
|
||||
GitSettings.INSTANCE.restore();
|
||||
super.tearDown();
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
myRobot = new FastRobot();
|
||||
GuiSettings.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tearDown() throws InvocationTargetException, InterruptedException {
|
||||
GitSettings.INSTANCE.restore();
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void setIdeSettings() {
|
||||
// Clear HTTP proxy settings, in case a test changed them.
|
||||
HttpConfigurable ideSettings = HttpConfigurable.getInstance();
|
||||
ideSettings.USE_HTTP_PROXY = false;
|
||||
ideSettings.PROXY_HOST = "";
|
||||
ideSettings.PROXY_PORT = 80;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user