From e67f0a842fbc4839ac2e336cbe4d146f53216ffb Mon Sep 17 00:00:00 2001 From: Sergey Karashevich Date: Fri, 26 Jan 2018 17:49:53 +0300 Subject: [PATCH] [gui-test] fix TypeAheadTest: close popup if action is disabled --- .../tests/community/TypeAheadTest.kt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/community-guitests/testSrc/com/intellij/testGuiFramework/tests/community/TypeAheadTest.kt b/community-guitests/testSrc/com/intellij/testGuiFramework/tests/community/TypeAheadTest.kt index 8e3b00217970..1fedb6d31b13 100644 --- a/community-guitests/testSrc/com/intellij/testGuiFramework/tests/community/TypeAheadTest.kt +++ b/community-guitests/testSrc/com/intellij/testGuiFramework/tests/community/TypeAheadTest.kt @@ -10,8 +10,9 @@ import com.intellij.testGuiFramework.framework.RunWithIde import com.intellij.testGuiFramework.impl.GuiTestCase import com.intellij.testGuiFramework.impl.GuiTestUtilKt import com.intellij.testGuiFramework.launcher.ide.CommunityIde +import com.intellij.testGuiFramework.util.Key import com.intellij.ui.popup.PopupFactoryImpl -import org.fest.swing.timing.Pause +import org.fest.swing.timing.Pause.pause import org.fest.swing.timing.Timeout import org.junit.Test import java.util.concurrent.TimeUnit @@ -24,22 +25,22 @@ class TypeAheadTest : GuiTestCase() { createProject() ideFrame { //a pause to wait when an (Edit Configurations...) action will be enabled - Pause.pause(5000) + pause(5000) waitForBackgroundTasksToFinish() openRunDebugConfiguration() dialog("Run/Debug Configurations") { addJUnitConfiguration() for (i in 0..20) { combobox("Test kind:").selectItem("Category") - Pause.pause(2000) + pause(2000) combobox("Test kind:").selectItem("Class") - Pause.pause(2000) + pause(2000) combobox("Test kind:").selectItem("Method") - Pause.pause(2000) + pause(2000) } button("OK").click() } - Pause.pause(30000) + pause(30000) } } @@ -74,9 +75,10 @@ class TypeAheadTest : GuiTestCase() { actionButton("Run").waitUntilEnabledAndShowing() for (i in 0..attempts) { button("Main").click() - if (ensureEditConfigurationsIsEnabled()) break; + if (ensureEditConfigurationsIsEnabled()) break else if (i == attempts - 1) throw Exception("Action 'Edit Configurations' is still disabled") - Pause.pause(timeoutInterval, TimeUnit.SECONDS) + pause(timeoutInterval, TimeUnit.SECONDS) + shortcut(Key.ESCAPE) } popupClick("Edit Configurations...") }