diff --git a/platform/testGuiFramework/src/com/intellij/testGuiFramework/framework/GuiTestUtil.java b/platform/testGuiFramework/src/com/intellij/testGuiFramework/framework/GuiTestUtil.java index 2f0bff0e9159..d33e096b545e 100644 --- a/platform/testGuiFramework/src/com/intellij/testGuiFramework/framework/GuiTestUtil.java +++ b/platform/testGuiFramework/src/com/intellij/testGuiFramework/framework/GuiTestUtil.java @@ -20,6 +20,8 @@ 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; +import com.intellij.openapi.actionSystem.KeyboardShortcut; import com.intellij.openapi.application.ApplicationBundle; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationNamesInfo; @@ -848,4 +850,14 @@ public final class GuiTestUtil { LOG.info("Invoking action via shortcut " + shortcut); robot.pressAndReleaseKey(keyStroke.getKeyCode(), new int[]{keyStroke.getModifiers()}); } + + public static void invokeAction(@NotNull Robot robot, @NotNull String actionId) { + + KeyboardShortcut keyboardShortcut = ActionManager.getInstance().getKeyboardShortcut(actionId); + + assert keyboardShortcut != null; + KeyStroke keyStroke = keyboardShortcut.getFirstKeyStroke(); + LOG.info("Invoking action \"" + actionId +"\" via shortcut " + keyboardShortcut.toString()); + robot.pressAndReleaseKey(keyStroke.getKeyCode(), new int[]{keyStroke.getModifiers()}); + } } diff --git a/platform/testGuiFramework/testSrc/com/intellij/testGuiFramework/tests/SimpleGitTest.java b/platform/testGuiFramework/testSrc/com/intellij/testGuiFramework/tests/SimpleGitTest.java index 40e8c23e399e..434f4cbf8e79 100644 --- a/platform/testGuiFramework/testSrc/com/intellij/testGuiFramework/tests/SimpleGitTest.java +++ b/platform/testGuiFramework/testSrc/com/intellij/testGuiFramework/tests/SimpleGitTest.java @@ -47,7 +47,7 @@ public class SimpleGitTest extends GuiTestCase { ProjectViewFixture.NodeFixture src = projectPane.selectByPath(projectName, "src"); //invoke "New..." action - GuiTestUtil.invokeActionViaShortcut(myRobot, "control N"); + GuiTestUtil.invokeAction(myRobot, "NewElement"); //select first element (Java class) myRobot.pressAndReleaseKey(KeyEvent.VK_ENTER); @@ -61,9 +61,9 @@ public class SimpleGitTest extends GuiTestCase { fileChooserDialogFixture.select(ideFrameFixture.getProject().getBaseDir()).clickOk(); Pause.pause(GuiTestUtil.THIRTY_SEC_TIMEOUT.duration()); //wait when file will be added to commit - GuiTestUtil.invokeActionViaShortcut(myRobot, "alt meta A"); + GuiTestUtil.invokeAction(myRobot, "ChangesView.AddUnversioned"); waitForIdle(); - GuiTestUtil.invokeActionViaShortcut(myRobot, "meta K"); + GuiTestUtil.invokeAction(myRobot, "CheckinProject"); DialogFixture commitDialogFixture = DialogFixture.find(myRobot, VcsBundle.message("commit.dialog.title")); myRobot.enterText("initial commit");