[gui-test] remove first start skipping

This commit is contained in:
Vladislav Shishov
2019-02-28 20:49:46 +03:00
parent 20ba8e9469
commit 7bb8fd224b
15 changed files with 14 additions and 130 deletions
@@ -3,12 +3,10 @@ package com.intellij.ide.projectWizard.kotlin.createProject
import com.intellij.ide.projectWizard.kotlin.installKotlinPlugin.CreateSdksGuiTest
import com.intellij.ide.projectWizard.kotlin.installKotlinPlugin.InstallPluginGuiTest
import com.intellij.testGuiFramework.framework.FirstStartWith
import com.intellij.testGuiFramework.framework.GuiTestSuite
import com.intellij.testGuiFramework.framework.GuiTestSuiteRunner
import com.intellij.testGuiFramework.framework.RunWithIde
import com.intellij.testGuiFramework.launcher.ide.CommunityIde
import com.intellij.testGuiFramework.launcher.ide.CommunityIdeFirstStart
import com.intellij.testGuiFramework.testCases.CreateJdkGuiTest
import org.junit.runner.RunWith
import org.junit.runners.Suite
@@ -70,7 +68,6 @@ class ConfigureKotlinReleaseGuiTestSuite : GuiTestSuite()
@RunWith(GuiTestSuiteRunner::class)
@RunWithIde(CommunityIde::class)
@FirstStartWith(CommunityIdeFirstStart::class)
@Suite.SuiteClasses(
InstallPluginGuiTest::class
, CreateSdksGuiTest::class
@@ -1,17 +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
import com.intellij.testGuiFramework.framework.FirstStartWith
import com.intellij.testGuiFramework.framework.RunWithIde
import com.intellij.testGuiFramework.framework.dtrace.GuiDTTestSuiteRunner
import com.intellij.testGuiFramework.launcher.ide.CommunityIde
import com.intellij.testGuiFramework.launcher.ide.CommunityIdeFirstStart
import com.intellij.testGuiFramework.tests.community.completionPopup.PopupWindowLeakTest
import org.junit.runner.RunWith
import org.junit.runners.Suite
@RunWith(GuiDTTestSuiteRunner::class)
@RunWithIde(CommunityIde::class)
@FirstStartWith(CommunityIdeFirstStart::class)
@Suite.SuiteClasses(PopupWindowLeakTest::class)
class CommunityDTTestSuite
@@ -16,19 +16,16 @@
package com.intellij.testGuiFramework.tests.community
import com.intellij.ide.projectWizard.CommandLineProjectGuiTest
import com.intellij.testGuiFramework.framework.FirstStartWith
import com.intellij.testGuiFramework.framework.GuiTestSuite
import com.intellij.testGuiFramework.framework.GuiTestSuiteRunner
import com.intellij.testGuiFramework.framework.RunWithIde
import com.intellij.testGuiFramework.launcher.ide.CommunityIde
import com.intellij.testGuiFramework.launcher.ide.CommunityIdeFirstStart
import com.intellij.testGuiFramework.tests.community.toolWindow.DockedModeGuiTest
import org.junit.runner.RunWith
import org.junit.runners.Suite
@RunWith(GuiTestSuiteRunner::class)
@RunWithIde(CommunityIde::class)
@FirstStartWith(CommunityIdeFirstStart::class)
@Suite.SuiteClasses(CommandLineProjectGuiTest::class,
DockedModeGuiTest::class,
SaveFilesOnFrameDeactivationGuiTest::class)
@@ -1,18 +1,15 @@
// 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.testGuiFramework.framework.FirstStartWith
import com.intellij.testGuiFramework.framework.GuiTestSuite
import com.intellij.testGuiFramework.framework.GuiTestSuiteRunner
import com.intellij.testGuiFramework.framework.RunWithIde
import com.intellij.testGuiFramework.launcher.ide.CommunityIde
import com.intellij.testGuiFramework.launcher.ide.CommunityIdeFirstStart
import org.junit.runner.RunWith
import org.junit.runners.Suite
@RunWith(GuiTestSuiteRunner::class)
@RunWithIde(CommunityIde::class)
@FirstStartWith(CommunityIdeFirstStart::class)
@Suite.SuiteClasses(
CompletionFocusTest::class,
//TypeAheadTest::class,
@@ -5,13 +5,11 @@
package com.intellij.testGuiFramework.tests.community.welcomeFrame
import com.intellij.ide.projectWizard.CommandLineProjectGuiTest
import com.intellij.testGuiFramework.framework.FirstStartWith
import com.intellij.testGuiFramework.framework.GuiTestSuite
import com.intellij.testGuiFramework.framework.GuiTestSuiteRunner
import com.intellij.testGuiFramework.framework.RunWithIde
import com.intellij.testGuiFramework.framework.param.GuiTestSuiteParam
import com.intellij.testGuiFramework.launcher.ide.CommunityIde
import com.intellij.testGuiFramework.launcher.ide.CommunityIdeFirstStart
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
import org.junit.runners.Suite
@@ -25,7 +23,6 @@ class WelcomeFrameTestSuite : GuiTestSuite() {
@RunWith(GuiTestSuiteRunner::class)
@RunWithIde(CommunityIde::class)
@FirstStartWith(CommunityIdeFirstStart::class)
@Suite.SuiteClasses(
CommandLineProjectGuiTest::class
)
@@ -1,23 +0,0 @@
/*
* Copyright 2000-2017 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.testGuiFramework.framework
import com.intellij.testGuiFramework.impl.FirstStart
import kotlin.reflect.KClass
@kotlin.annotation.Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FILE)
annotation class FirstStartWith(val value: KClass<out FirstStart>)
@@ -17,19 +17,10 @@ import org.junit.runners.model.RunnerBuilder
open class GuiTestSuiteRunner(private val suiteClass: Class<*>, private val builder: RunnerBuilder) : Suite(suiteClass, builder) {
//IDE type to run suite tests with
var isFirstStart: Boolean = true
@Volatile
var customName: String? = null
protected val myIde: Ide = getIdeFromAnnotation(suiteClass)
protected val UNDEFINED_FIRST_CLASS = "undefined"
protected val myFirstStartClassName: String by lazy {
val annotation = suiteClass.getAnnotation(FirstStartWith::class.java)
val value = annotation?.value
if (value != null) value.java.canonicalName else UNDEFINED_FIRST_CLASS
}
private val LOG: Logger = org.apache.log4j.Logger.getLogger("#com.intellij.testGuiFramework.framework.GuiTestSuiteRunner")!!
private val testsFilter by lazy {
@@ -73,8 +64,6 @@ open class GuiTestSuiteRunner(private val suiteClass: Class<*>, private val buil
else {
try {
LOG.info("DEBUG_TEST_DESCRIPTION: ${runner.description.displayName} ${description.className} ${description.testClass} ${description.methodName}")
//let's start IDE to complete installation, import configs and etc before running tests
if (isFirstStart) firstStart()
val testClass = runner.description.testClass
val guiTestLocalRunner = createGuiTestLocalRunner(testClass, suiteClass, myIde)
super.runChild(guiTestLocalRunner, notifier)
@@ -86,11 +75,4 @@ open class GuiTestSuiteRunner(private val suiteClass: Class<*>, private val buil
}
}
protected open fun firstStart() {
if (myFirstStartClassName == UNDEFINED_FIRST_CLASS) return
LOG.info("IDE is configuring for the first time...")
GuiTestLocalLauncher.firstStartIdeLocally(myIde, myFirstStartClassName)
isFirstStart = false
}
}
@@ -89,7 +89,6 @@ object GuiTestUtil {
const val JDK_HOME_FOR_TESTS = "JDK_HOME_FOR_TESTS"
const val TEST_DATA_DIR = "GUI_TEST_DATA_DIR"
const val FIRST_START = "GUI_FIRST_START"
private val SYSTEM_EVENT_QUEUE = Toolkit.getDefaultToolkit().systemEventQueue
val gradleHomePath: File?
@@ -185,8 +184,6 @@ object GuiTestUtil {
// Called by GuiTestPaths via reflection.
fun waitForIdeToStart() {
val firstStart = getSystemPropertyOrEnvironmentVariable(FIRST_START)
val isFirstStart = firstStart != null && firstStart.toLowerCase() == "true"
GuiActionRunner.executeInEDT(false)
var robot: Robot? = null
try {
@@ -12,13 +12,6 @@ import org.junit.runners.model.RunnerBuilder
class GuiDTTestSuiteRunner(suiteClass: Class<*>, builder: RunnerBuilder) : GuiTestSuiteRunner(suiteClass, builder) {
private val LOG: Logger = org.apache.log4j.Logger.getLogger("#com.intellij.testGuiFramework.framework.dtrace.GuiDTTestSuiteRunner")!!
override fun firstStart() {
if (myFirstStartClassName == UNDEFINED_FIRST_CLASS) return
LOG.info("IDE is configuring for the first time...")
GuiTestLocalLauncher.firstStartIdeLocally(myIde, myFirstStartClassName)
isFirstStart = false
}
override fun createGuiTestLocalRunner(testClass:Class<*>, suiteClass:Class<*>, myIde: Ide): GuiTestLocalRunner {
IdeControl.closeIde()
return GuiDTTestLocalRunner(testClass, suiteClass, myIde)
@@ -1,7 +1,6 @@
// 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.framework.param
import com.intellij.testGuiFramework.framework.FirstStartWith
import com.intellij.testGuiFramework.framework.getIdeFromAnnotation
import com.intellij.testGuiFramework.launcher.GuiTestLocalLauncher
import com.intellij.testGuiFramework.launcher.ide.Ide
@@ -16,23 +15,14 @@ import org.junit.runners.parameterized.TestWithParameters
@RunWith(GuiTestSuiteParamRunner::class)
@Parameterized.UseParametersRunnerFactory(GuiTestsParametersRunnerFactory::class)
open class GuiTestSuiteParam(private val klass: Class<*>) : Parameterized(klass) {
open class GuiTestSuiteParam(klass: Class<*>) : Parameterized(klass) {
//IDE type to run suite tests with
val myIde: Ide = getIdeFromAnnotation(klass)
var isFirstStart: Boolean = true
val UNDEFINED_FIRST_CLASS: String = "undefined"
val myFirstStartClassName: String by lazy {
val annotation = klass.getAnnotation(FirstStartWith::class.java)
val value = annotation?.value
if (value != null) value.java.canonicalName else UNDEFINED_FIRST_CLASS
}
val LOG: Logger = org.apache.log4j.Logger.getLogger("#com.intellij.testGuiFramework.framework.param.GuiTestSuiteParam")!!
override fun runChild(runner: Runner, notifier: RunNotifier?) {
try {
//let's start IDE to complete installation, import configs and etc before running tests
if (isFirstStart) firstStart()
val runnerWithParameters = runner as BlockJUnit4ClassRunnerWithParameters
val testNameField = BlockJUnit4ClassRunnerWithParameters::class.java.getDeclaredField("name")
@@ -53,10 +43,4 @@ open class GuiTestSuiteParam(private val klass: Class<*>) : Parameterized(klass)
}
}
private fun firstStart() {
if (myFirstStartClassName == UNDEFINED_FIRST_CLASS) return
LOG.info("IDE is configuring for the first time...")
GuiTestLocalLauncher.firstStartIdeLocally(myIde, myFirstStartClassName)
isFirstStart = false
}
}
@@ -1,11 +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.framework.param
import com.intellij.testGuiFramework.framework.FirstStartWith
import com.intellij.testGuiFramework.framework.getIdeFromAnnotation
import com.intellij.testGuiFramework.launcher.GuiTestLocalLauncher
import com.intellij.testGuiFramework.launcher.GuiTestOptions
import com.intellij.testGuiFramework.launcher.ide.Ide
import org.apache.log4j.Logger
import org.junit.runner.Description
import org.junit.runner.Runner
@@ -16,18 +12,8 @@ import org.junit.runner.notification.RunNotifier
import org.junit.runners.Parameterized
open class GuiTestSuiteParamRunner(private val suiteClass: Class<*>) : Parameterized(suiteClass) {
open class GuiTestSuiteParamRunner(suiteClass: Class<*>) : Parameterized(suiteClass) {
//IDE type to run suite tests with
var isFirstStart: Boolean = true
protected val myIde: Ide = getIdeFromAnnotation(suiteClass)
protected val UNDEFINED_FIRST_CLASS = "undefined"
protected val myFirstStartClassName: String by lazy {
val annotation = suiteClass.getAnnotation(FirstStartWith::class.java)
val value = annotation?.value
if (value != null) value.java.canonicalName else UNDEFINED_FIRST_CLASS
}
private val LOG: Logger = org.apache.log4j.Logger.getLogger("#com.intellij.testGuiFramework.framework.GuiTestSuiteRunner")!!
private val testsFilter by lazy {
@@ -68,11 +54,4 @@ open class GuiTestSuiteParamRunner(private val suiteClass: Class<*>) : Parameter
}
}
protected open fun firstStart() {
if (myFirstStartClassName == UNDEFINED_FIRST_CLASS) return
LOG.info("IDE is configuring for the first time...")
GuiTestLocalLauncher.firstStartIdeLocally(myIde, myFirstStartClassName)
isFirstStart = false
}
}
@@ -288,6 +288,8 @@ object GuiTestLocalLauncher {
.plus("-Didea.system.path=${GuiTestOptions.systemPath}")
.plus("-Didea.gui.tests.log.file=${GuiTestOptions.guiTestLogFile}")
.plus("-Dfile.encoding=${GuiTestOptions.encoding}")
.plus("-Djb.privacy.policy.text=<!--999.999-->")
.plus("-Djb.consents.confirmation.enabled=false")
.plusIf(System.getProperty("java.io.tmpdir") != null, "-Djava.io.tmpdir=${System.getProperty("java.io.tmpdir")}")
.plusIf(!ide.ideType.platformPrefix.isNullOrEmpty(), "-Didea.platform.prefix=${ide.ideType.platformPrefix}")
.plus(ide.ideType.ideSpecificOptions)
@@ -27,7 +27,13 @@ object GuiTestOptions {
private const val NO_NEED_TO_FILTER_TESTS: String = "NO_NEED_TO_FILTER_TESTS"
val configPath: String by lazy { getSystemProperty("idea.config.path", configDefaultPath) }
val configPath: String by lazy {
val configDir = File(getSystemProperty("idea.config.path", configDefaultPath))
if (!configDir.exists()) {
configDir.mkdir()
}
configDir.absolutePath
}
val systemPath: String by lazy { getSystemProperty("idea.system.path", systemDefaultPath) }
val guiTestLogFile: String by lazy { javaClass.classLoader.getResource("gui-test-log.xml").file }
val guiTestRootDirPath: String? by lazy { System.getProperty("idea.gui.tests.root.dir.path", null) }
@@ -1,20 +0,0 @@
/*
* Copyright 2000-2017 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.testGuiFramework.launcher.ide
import com.intellij.testGuiFramework.impl.FirstStart
class CommunityIdeFirstStart : FirstStart(ideType = CommunityIde())
@@ -4,7 +4,6 @@ package com.intellij.testGuiFramework.util.scenarios
import com.intellij.testGuiFramework.fixtures.JDialogFixture
import com.intellij.testGuiFramework.framework.Timeouts
import com.intellij.testGuiFramework.impl.*
import com.intellij.testGuiFramework.impl.FirstStart.Utils.exists
import com.intellij.testGuiFramework.util.*
import com.intellij.testGuiFramework.util.scenarios.NewProjectDialogModel.Constants.buttonFinish
import com.intellij.testGuiFramework.util.scenarios.NewProjectDialogModel.Constants.buttonNext
@@ -571,13 +570,13 @@ fun NewProjectDialogModel.setLibrariesAndFrameworks(libs: LibrariesSet) {
for((option, value) in lib.options)
step("Set option '$option' to value '$value' ")innerStep@{
when {
exists {checkbox(option, Timeouts.seconds05)} -> {
guiTestCase.exists {checkbox(option, Timeouts.seconds05)} -> {
val component = checkbox(option, Timeouts.noTimeout)
if(component.isSelected != value.toBoolean())
component.click()
}
exists { combobox(option, Timeouts.seconds05) } -> combobox(option, Timeouts.noTimeout).selectItem(value)
exists { radioButton(option, Timeouts.seconds05) } -> radioButton(option, Timeouts.noTimeout).select()
guiTestCase.exists { combobox(option, Timeouts.seconds05) } -> combobox(option, Timeouts.noTimeout).selectItem(value)
guiTestCase.exists { radioButton(option, Timeouts.seconds05) } -> radioButton(option, Timeouts.noTimeout).select()
else -> throw IllegalStateException("Unsupported kind of option '$option' - not checkbox, radiobutton or combobox")
}
return@innerStep