mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[gui-test] replace create project with import project
This commit is contained in:
+11
-1
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.testGuiFramework.tests.community
|
||||
|
||||
import com.intellij.ide.IdeBundle
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.testGuiFramework.impl.GuiTestCase
|
||||
import com.intellij.testGuiFramework.impl.GuiTestUtilKt
|
||||
@@ -11,6 +12,7 @@ import com.intellij.testGuiFramework.util.Modifier.META
|
||||
import com.intellij.testGuiFramework.util.plus
|
||||
import com.intellij.testGuiFramework.utils.TestUtilsClass
|
||||
import com.intellij.testGuiFramework.utils.TestUtilsClassCompanion
|
||||
import org.fest.swing.exception.ComponentLookupException
|
||||
import org.fest.swing.exception.WaitTimedOutError
|
||||
import org.junit.Assert
|
||||
import java.io.File
|
||||
@@ -41,6 +43,7 @@ class CommunityProjectCreator(guiTestCase: GuiTestCase) : TestUtilsClass(guiTest
|
||||
jList("Command Line App").clickItem("Command Line App")
|
||||
button("Next").click()
|
||||
typeText(projectName)
|
||||
checkFileAlreadyExistsDialog() //confirm overwriting already created project
|
||||
button("Finish").click()
|
||||
}
|
||||
}
|
||||
@@ -49,6 +52,13 @@ class CommunityProjectCreator(guiTestCase: GuiTestCase) : TestUtilsClass(guiTest
|
||||
}
|
||||
}
|
||||
|
||||
private fun GuiTestCase.checkFileAlreadyExistsDialog() {
|
||||
try {
|
||||
val dialogFixture = dialog(IdeBundle.message("title.file.already.exists"), false, 10L)
|
||||
dialogFixture.button("Yes").click()
|
||||
} catch (cle: ComponentLookupException) { /*do nothing here */ }
|
||||
}
|
||||
|
||||
private fun GuiTestCase.openMainInCommandLineProject() {
|
||||
ideFrame {
|
||||
projectView {
|
||||
@@ -69,7 +79,7 @@ class CommunityProjectCreator(guiTestCase: GuiTestCase) : TestUtilsClass(guiTest
|
||||
|
||||
private fun GuiTestCase.waitForFirstIndexing() {
|
||||
ideFrame {
|
||||
val secondToWaitIndexing = 300
|
||||
val secondToWaitIndexing = 10
|
||||
try {
|
||||
waitForStartingIndexing(secondToWaitIndexing) //let's wait for 2 minutes until indexing bar will appeared
|
||||
}
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import org.junit.runners.Suite
|
||||
@RunWithIde(CommunityIde::class)
|
||||
@FirstStartWith(CommunityIdeFirstStart::class)
|
||||
@Suite.SuiteClasses(CompletionFocusTest::class,
|
||||
TypeAheadTest::class,
|
||||
// TypeAheadTest::class,
|
||||
GoToClassFocusTest::class,
|
||||
GoToClassTwiceFocusTest::class,
|
||||
InlineVariableFocusTest::class,
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ class GoToClassFocusTest : GuiTestCase() {
|
||||
|
||||
@Test
|
||||
fun testGoToClassFocus() {
|
||||
CommunityProjectCreator.createCommandLineProject()
|
||||
CommunityProjectCreator.importCommandLineAppAndOpenMain()
|
||||
Pause.pause(1000)
|
||||
ideFrame {
|
||||
focusOnEditor()
|
||||
|
||||
+9
-7
@@ -1,16 +1,14 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.testGuiFramework.tests.community.focus
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionManager
|
||||
import com.intellij.openapi.actionSystem.ShortcutSet
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.keymap.KeymapUtil
|
||||
import com.intellij.testGuiFramework.fixtures.IdeFrameFixture
|
||||
import com.intellij.testGuiFramework.impl.GuiTestCase
|
||||
import com.intellij.testGuiFramework.impl.GuiTestUtilKt
|
||||
import com.intellij.testGuiFramework.tests.community.CommunityProjectCreator
|
||||
import com.intellij.testGuiFramework.util.Key
|
||||
import com.intellij.testGuiFramework.util.Key.ESCAPE
|
||||
import com.intellij.testGuiFramework.util.Modifier
|
||||
import com.intellij.testGuiFramework.util.plus
|
||||
import org.fest.swing.core.SmartWaitRobot
|
||||
import org.fest.swing.exception.ComponentLookupException
|
||||
import org.fest.swing.timing.Pause
|
||||
@@ -26,11 +24,15 @@ import javax.swing.KeyStroke
|
||||
class GoToClassTwiceFocusTest : GuiTestCase() {
|
||||
|
||||
private val typedString = "hefuihwefwehrf;werfwerfw"
|
||||
private val actionKeyStroke: KeyStroke by lazy { ActionManager.getInstance().getKeyboardShortcut("GotoClass")!!.firstKeyStroke }
|
||||
private val actionKeyStroke: KeyStroke by lazy {
|
||||
val activeKeymapShortcuts: ShortcutSet = KeymapUtil.getActiveKeymapShortcuts("GotoClass")
|
||||
KeymapUtil.getKeyStroke(activeKeymapShortcuts)!!
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
fun testGoToClassFocusTwice() {
|
||||
CommunityProjectCreator.createCommandLineProject()
|
||||
CommunityProjectCreator.importCommandLineAppAndOpenMain()
|
||||
Pause.pause(1000)
|
||||
ideFrame {
|
||||
focusOnEditor()
|
||||
@@ -74,7 +76,7 @@ class GoToClassTwiceFocusTest : GuiTestCase() {
|
||||
private fun openGoToClassSearchAndType(guiTestCase: GuiTestCase) {
|
||||
|
||||
val smartRobot = guiTestCase.robot() as SmartWaitRobot
|
||||
guiTestCase.shortcut(Modifier.CONTROL + Key.N, Modifier.META + Key.N)
|
||||
smartRobot.shortcut(actionKeyStroke)
|
||||
smartRobot.shortcutAndTypeString(actionKeyStroke, typedString, 100)
|
||||
Pause.pause(500)
|
||||
checkSearchWindow(guiTestCase)
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class Test {
|
||||
|
||||
@Test
|
||||
fun testInlineVariableFocus() {
|
||||
CommunityProjectCreator.createCommandLineProject()
|
||||
CommunityProjectCreator.importCommandLineAppAndOpenMain()
|
||||
Pause.pause(1000)
|
||||
CommunityProjectCreator.createJavaClass(pasteCode, "Test")
|
||||
ideFrame {
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ class InputMethodJapaneseFocusTest : GuiTestCase() {
|
||||
*/
|
||||
@Test
|
||||
fun testGoToClassFocus() {
|
||||
CommunityProjectCreator.createCommandLineProject()
|
||||
CommunityProjectCreator.importCommandLineAppAndOpenMain()
|
||||
Pause.pause(1000)
|
||||
ideFrame {
|
||||
focusOnEditor()
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ class KeyMapSettingsTestFocusTest : GuiTestCase() {
|
||||
|
||||
@Test
|
||||
fun testKeyMapSettingsTestFocus() {
|
||||
CommunityProjectCreator.createCommandLineProject()
|
||||
CommunityProjectCreator.importCommandLineAppAndOpenMain()
|
||||
Pause.pause(1000)
|
||||
ideFrame {
|
||||
waitForBackgroundTasksToFinish()
|
||||
|
||||
+3
-2
@@ -12,6 +12,7 @@ import com.intellij.testGuiFramework.util.plus
|
||||
import org.fest.swing.exception.ComponentLookupException
|
||||
import org.fest.swing.exception.WaitTimedOutError
|
||||
import org.fest.swing.timing.Pause
|
||||
import org.junit.Ignore
|
||||
import org.junit.Test
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
@@ -24,7 +25,7 @@ class ReplaceInPathFocusTest : GuiTestCase() {
|
||||
*/
|
||||
@Test
|
||||
fun testReplaceInPathDumbModeFocus() {
|
||||
CommunityProjectCreator.createCommandLineProject(projectName = "replace-in-path-dumb-mode")
|
||||
CommunityProjectCreator.importCommandLineAppAndOpenMain()
|
||||
Pause.pause(1000)
|
||||
ideFrame {
|
||||
dumbMode {
|
||||
@@ -39,7 +40,7 @@ class ReplaceInPathFocusTest : GuiTestCase() {
|
||||
* IDEA-188229
|
||||
* Fixed by 6bd20c4a483a78713c08e426316d29d3cfd1f6a5
|
||||
*/
|
||||
@Test
|
||||
@Test @Ignore
|
||||
fun testReplaceInPathFocus() {
|
||||
CommunityProjectCreator.importCommandLineAppAndOpenMain()
|
||||
Pause.pause(1000)
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ class SearchEverywhereFocusTest : GuiTestCase() {
|
||||
|
||||
@Test
|
||||
fun testSearchEverywhereFocus() {
|
||||
CommunityProjectCreator.createCommandLineProject()
|
||||
CommunityProjectCreator.importCommandLineAppAndOpenMain()
|
||||
Pause.pause(1000)
|
||||
ideFrame {
|
||||
focusOnEditor()
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ class TypeAheadTest : GuiTestCase() {
|
||||
|
||||
@Test
|
||||
fun testTypeAhead() {
|
||||
CommunityProjectCreator.createCommandLineProject("type-ahead-problem")
|
||||
CommunityProjectCreator.importCommandLineAppAndOpenMain()
|
||||
ideFrame {
|
||||
waitForBackgroundTasksToFinish()
|
||||
configurationList {
|
||||
|
||||
@@ -150,6 +150,10 @@ class SmartWaitRobot : BasicRobot(null, ExistingHierarchy()) {
|
||||
fastReleaseKey(keyCode)
|
||||
}
|
||||
|
||||
fun shortcut(keyStoke: KeyStroke) {
|
||||
fastPressAndReleaseKey(keyStoke.keyCode, keyStoke.modifiers)
|
||||
}
|
||||
|
||||
fun shortcutAndTypeString(keyStoke: KeyStroke, string: String, delayBetweenShortcutAndTypingMs: Int = 0) {
|
||||
fastPressAndReleaseKey(keyStoke.keyCode, keyStoke.modifiers)
|
||||
fastTyping(string, delayBetweenShortcutAndTypingMs)
|
||||
|
||||
Reference in New Issue
Block a user