From f9bfc46fd122e1fd1e4446ae9be860b208952144 Mon Sep 17 00:00:00 2001 From: "Viktoria.Shirunova" Date: Tue, 15 May 2018 18:27:52 +0300 Subject: [PATCH] [gui-test] ScreenshotsDuringTest: screenshot folder should be removed after executorService is stopped if test is successful --- .../intellij/testGuiFramework/impl/ScreenshotsDuringTest.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/testGuiFramework/src/com/intellij/testGuiFramework/impl/ScreenshotsDuringTest.kt b/platform/testGuiFramework/src/com/intellij/testGuiFramework/impl/ScreenshotsDuringTest.kt index ed5102d2b564..7fce02a12a48 100644 --- a/platform/testGuiFramework/src/com/intellij/testGuiFramework/impl/ScreenshotsDuringTest.kt +++ b/platform/testGuiFramework/src/com/intellij/testGuiFramework/impl/ScreenshotsDuringTest.kt @@ -19,6 +19,7 @@ class ScreenshotsDuringTest @JvmOverloads constructor(private val myPeriod: Int private val myScreenshotTaker = ScreenshotTaker() private val myExecutorService: ScheduledExecutorService = Executors.newScheduledThreadPool(1) private var myFolder: File? = null + private var isTestSuccessful = false override fun starting(description: Description) { val folderName = description.testClass.simpleName + "-" + description.methodName @@ -49,9 +50,11 @@ class ScreenshotsDuringTest @JvmOverloads constructor(private val myPeriod: Int catch (e: InterruptedException) { // Do not report the timeout } + if(isTestSuccessful && myFolder != null) FileUtilRt.delete(myFolder!!) } override fun succeeded(description: Description?) { - if (myFolder != null) FileUtilRt.delete(myFolder!!) + isTestSuccessful = true } + }