diff --git a/community-tests/community-tests.iml b/community-tests/community-tests.iml index 2eeafe8057bd..2cc9c7b7c46e 100644 --- a/community-tests/community-tests.iml +++ b/community-tests/community-tests.iml @@ -47,5 +47,7 @@ + + \ No newline at end of file diff --git a/community-tests/src/META-INF/community-tests.xml b/community-tests/src/META-INF/community-tests.xml index 4ceadd7837e2..dab52d2bcced 100644 --- a/community-tests/src/META-INF/community-tests.xml +++ b/community-tests/src/META-INF/community-tests.xml @@ -2,5 +2,11 @@ + + + + diff --git a/community-tests/src/com/intellij/tests/gui/fixtures/FrameworksTreeFixture.java b/community-tests/src/com/intellij/tests/gui/fixtures/FrameworksTreeFixture.java index 83bf863d2dc3..725a725c50b3 100644 --- a/community-tests/src/com/intellij/tests/gui/fixtures/FrameworksTreeFixture.java +++ b/community-tests/src/com/intellij/tests/gui/fixtures/FrameworksTreeFixture.java @@ -22,6 +22,8 @@ import com.intellij.ide.util.newProjectWizard.FrameworksTree; import com.intellij.ui.CheckboxTreeBase; import com.intellij.ui.treeStructure.Tree; import org.fest.swing.core.Robot; +import org.fest.swing.edt.GuiActionRunner; +import org.fest.swing.edt.GuiTask; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.junit.Assert; @@ -66,7 +68,12 @@ public class FrameworksTreeFixture { if (frameworkSupportElement.getText().equals(frameworkName)) { //scroll tree to path final TreePath treePath = myFrameworksTree.getPathForRow(i); - myFrameworksTree.scrollPathToVisible(treePath); + GuiActionRunner.execute(new GuiTask() { + @Override + protected void executeInEDT() throws Throwable { + myFrameworksTree.scrollPathToVisible(treePath); + } + }); final JCheckBox checkbox = frameworkSupportElement.getCheckbox(); myRobot.click(checkbox); diff --git a/community-tests/src/com/intellij/tests/gui/fixtures/IdeFrameFixture.java b/community-tests/src/com/intellij/tests/gui/fixtures/IdeFrameFixture.java index 0e4551c65500..dbb8cb22f301 100644 --- a/community-tests/src/com/intellij/tests/gui/fixtures/IdeFrameFixture.java +++ b/community-tests/src/com/intellij/tests/gui/fixtures/IdeFrameFixture.java @@ -22,13 +22,12 @@ import com.intellij.ide.RecentProjectsManager; import com.intellij.ide.actions.ShowSettingsUtilImpl; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.application.PathManager; import com.intellij.openapi.externalSystem.model.ExternalSystemException; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleManager; import com.intellij.openapi.options.ShowSettingsUtil; import com.intellij.openapi.progress.ProgressManager; -import com.intellij.openapi.project.DumbService; -import com.intellij.openapi.project.FileContentQueue; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ContentEntry; import com.intellij.openapi.roots.ModifiableRootModel; @@ -65,7 +64,8 @@ import java.util.List; import java.util.Set; import static com.intellij.ide.impl.ProjectUtil.closeAndDispose; -import static com.intellij.openapi.util.io.FileUtil.*; +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; import static com.intellij.openapi.vfs.VfsUtilCore.urlToPath; import static com.intellij.tests.gui.framework.GuiTests.*; @@ -75,7 +75,8 @@ import static org.fest.assertions.Assertions.assertThat; import static org.fest.swing.edt.GuiActionRunner.execute; import static org.fest.swing.timing.Pause.pause; import static org.fest.util.Strings.quote; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; /** * Created by karashevich on 30/05/16. @@ -92,7 +93,7 @@ public class IdeFrameFixture extends ComponentFixture + if (!aborted) { + print("Compilation done") + ScriptAction("CurrentTest").actionPerformed(AnActionEvent.createFromDataContext("nothing", null, DataContext.EMPTY_CONTEXT)) + } + }) + } + +} \ No newline at end of file diff --git a/community-tests/src/com/intellij/tests/gui/script/ScriptRunnerAction.kt b/community-tests/src/com/intellij/tests/gui/script/ScriptRunnerAction.kt new file mode 100644 index 000000000000..62bc62e830d4 --- /dev/null +++ b/community-tests/src/com/intellij/tests/gui/script/ScriptRunnerAction.kt @@ -0,0 +1,45 @@ +/* + * Copyright 2000-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.tests.gui.script + +import com.intellij.openapi.actionSystem.ActionManager +import com.intellij.openapi.actionSystem.AnAction +import com.intellij.openapi.actionSystem.AnActionEvent +import java.io.File + +/** + * Created by jetbrains on 12/09/16. + */ +class ScriptRunnerAction() : AnAction(){ + + override fun actionPerformed(e: AnActionEvent?) { + val myPackage = "com.intellij.tests.gui.test" + val packagePath = myPackage.replace(".", "/") + val testFolder = this.javaClass.classLoader.getResource(packagePath) + val testFiles = File(testFolder.file).listFiles().filter { !it.name.contains("$") } //remove inlined classes + val actionManager = ActionManager.getInstance() + + testFiles.forEach { + val testName = it.name.substring(0, it.name.indexOf('.')) + val genId = "guiTest." + testName + val script = ScriptAction(testName) + if (actionManager.getAction(genId) != null) + actionManager.unregisterAction(genId) + actionManager.registerAction(genId, script) + } + } + +} \ No newline at end of file diff --git a/community-tests/src/com/intellij/tests/gui/test/CurrentTest.kt b/community-tests/src/com/intellij/tests/gui/test/CurrentTest.kt new file mode 100644 index 000000000000..83dfd3d656eb --- /dev/null +++ b/community-tests/src/com/intellij/tests/gui/test/CurrentTest.kt @@ -0,0 +1,34 @@ +/* + * Copyright 2000-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.tests.gui.test + +import com.intellij.tests.gui.framework.GuiTestCase +import org.junit.Test + +/** + * Created by jetbrains on 12/09/16. + */ + +class CurrentTest: GuiTestCase(){ + + @Test + fun testMe() { + val ideFrame = findIdeFrame() + ideFrame.waitForBackgroundTasksToFinish() + + ideFrame.editor.enterText("Hello!") + } +} diff --git a/platform/util/src/com/intellij/openapi/application/PathManager.java b/platform/util/src/com/intellij/openapi/application/PathManager.java index ea69e529f687..7eb3598d37cf 100644 --- a/platform/util/src/com/intellij/openapi/application/PathManager.java +++ b/platform/util/src/com/intellij/openapi/application/PathManager.java @@ -493,7 +493,7 @@ public class PathManager { System.err.println(x); } - private static String getAbsolutePath(String path) { + public static String getAbsolutePath(String path) { path = FileUtil.expandUserHome(path); return FileUtil.toCanonicalPath(new File(path).getAbsolutePath()); }