From bb3acc128bb1150ce7a91fb8e4145bedd54718be Mon Sep 17 00:00:00 2001 From: Sergey Karashevich Date: Fri, 11 Aug 2017 16:04:43 +0300 Subject: [PATCH] [gui-test] fix for invokeMainMenuAction() on each ActionButton click --- .../com/intellij/testGuiFramework/recorder/EventDispatcher.kt | 2 +- .../com/intellij/testGuiFramework/recorder/ScriptGenerator.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/EventDispatcher.kt b/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/EventDispatcher.kt index 2664e3ab3f42..b17a5e4053f7 100644 --- a/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/EventDispatcher.kt +++ b/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/EventDispatcher.kt @@ -97,7 +97,7 @@ object EventDispatcher { } else { val actionManager = ActionManager.getInstance() val mainActions = (actionManager.getAction(IdeActions.GROUP_MAIN_MENU) as ActionGroup).getFlatIdList() - if (mainActions.contains(actionManager.getId(action))) ScriptGenerator.processMainMenuActionEvent(action) + if (mainActions.contains(actionManager.getId(action))) ScriptGenerator.processMainMenuActionEvent(action, event) } } diff --git a/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/ScriptGenerator.kt b/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/ScriptGenerator.kt index a891ae0094e0..e6ac07bbc761 100644 --- a/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/ScriptGenerator.kt +++ b/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/ScriptGenerator.kt @@ -65,11 +65,12 @@ object ScriptGenerator { addToScript(code) } - fun processMainMenuActionEvent(action: AnAction) { + fun processMainMenuActionEvent(action: AnAction, event: AnActionEvent) { val actionId: String? = ActionManager.getInstance().getId(action) if (actionId == null) { addToScript("//called action (${action.templatePresentation.text}) from main menu with null actionId"); return } + if (event.place != "MainMenu") return addToScript(Templates.invokeMainMenuAction(actionId)) }