mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[gui-test] collect jvm errors
This commit is contained in:
@@ -15,9 +15,11 @@
|
||||
*/
|
||||
package com.intellij.testGuiFramework.framework
|
||||
|
||||
import com.intellij.testGuiFramework.launcher.GuiTestOptions
|
||||
import com.intellij.testGuiFramework.remote.IdeControl
|
||||
import org.junit.AfterClass
|
||||
import org.junit.BeforeClass
|
||||
import java.io.File
|
||||
|
||||
open class GuiTestSuite {
|
||||
|
||||
@@ -31,6 +33,17 @@ open class GuiTestSuite {
|
||||
@JvmStatic
|
||||
fun tearDown() {
|
||||
IdeControl.closeIde()
|
||||
collectJvmErrors()
|
||||
GuiTestOptions.projectsDir.deleteRecursively()
|
||||
}
|
||||
|
||||
private fun collectJvmErrors() {
|
||||
GuiTestOptions.projectsDir.walk()
|
||||
.maxDepth(3)
|
||||
.filter { it.name.startsWith("hs_err") }
|
||||
.forEach {
|
||||
it.copyTo(File(GuiTestPaths.failedTestScreenshotDir, it.name))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.junit.rules.TestName
|
||||
import org.junit.runner.RunWith
|
||||
import java.awt.Component
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import javax.swing.JDialog
|
||||
@@ -74,7 +75,7 @@ open class GuiTestCase {
|
||||
@JvmField
|
||||
val guiTestRule = GuiTestRule()
|
||||
|
||||
val projectsFolder: TemporaryFolder = guiTestRule.projectsFolder
|
||||
val projectsFolder: File = guiTestRule.projectsFolder
|
||||
|
||||
val settingsTitle: String = if (isMac()) "Preferences" else "Settings"
|
||||
// val defaultSettingsTitle: String = if (isMac()) "Default Preferences" else "Default Settings"
|
||||
@@ -92,7 +93,11 @@ open class GuiTestCase {
|
||||
val logActionsDuringTest = LogActionsDuringTest()
|
||||
|
||||
val projectFolder: String by lazy {
|
||||
projectsFolder.newFolder(testMethod.methodName).canonicalPath
|
||||
val dir = File(projectsFolder, testMethod.methodName)
|
||||
if (!dir.mkdirs()) {
|
||||
throw IOException("project dir creation failed")
|
||||
}
|
||||
dir.canonicalPath
|
||||
}
|
||||
|
||||
fun robot() = guiTestRule.robot()
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.intellij.testGuiFramework.impl.GuiTestUtilKt.computeOnEdt
|
||||
import com.intellij.testGuiFramework.impl.GuiTestUtilKt.ignoreComponentLookupException
|
||||
import com.intellij.testGuiFramework.impl.GuiTestUtilKt.runOnEdt
|
||||
import com.intellij.testGuiFramework.impl.GuiTestUtilKt.waitUntil
|
||||
import com.intellij.testGuiFramework.launcher.GuiTestOptions
|
||||
import com.intellij.testGuiFramework.launcher.GuiTestOptions.screenRecorderJarDirPath
|
||||
import com.intellij.testGuiFramework.launcher.GuiTestOptions.testsToRecord
|
||||
import com.intellij.testGuiFramework.launcher.GuiTestOptions.videoDuration
|
||||
@@ -67,7 +68,7 @@ class GuiTestRule : TestRule {
|
||||
|
||||
var CREATE_NEW_PROJECT_ACTION_NAME: String = "Create New Project"
|
||||
|
||||
val projectsFolder: TemporaryFolder = TemporaryFolder(File(FileUtil.getTempDirectory()))
|
||||
val projectsFolder: File = File(GuiTestOptions.projectsDir, UUID.randomUUID().toString())
|
||||
|
||||
val LOG: Logger = Logger.getInstance(GuiTestRule::class.java.name)
|
||||
|
||||
@@ -77,7 +78,7 @@ class GuiTestRule : TestRule {
|
||||
private var myTestShortName: String = "undefined"
|
||||
private var currentTestDateStart: Date = Date()
|
||||
|
||||
private val myRuleChain = RuleChain.outerRule(projectsFolder)
|
||||
private val myRuleChain = RuleChain.emptyRuleChain()
|
||||
.around(myRobotTestRule)
|
||||
.around(myFatalErrorsFlusher)
|
||||
.around(IdeHandling())
|
||||
@@ -460,7 +461,7 @@ class GuiTestRule : TestRule {
|
||||
}
|
||||
|
||||
private fun getTestProjectDirPath(projectDirName: String): File {
|
||||
return File(projectsFolder.root, projectDirName)
|
||||
return File(projectsFolder, projectDirName)
|
||||
}
|
||||
|
||||
fun cleanUpProjectForImport(projectPath: File) {
|
||||
|
||||
Reference in New Issue
Block a user