From a3a08e6dee9d6dc78d13c98e01fa0af3d272e934 Mon Sep 17 00:00:00 2001 From: "Viktoria.Shirunova" Date: Fri, 25 Jan 2019 13:38:20 +0300 Subject: [PATCH] [gui-test] added debug screenshots before and after test --- ...reateGradleKotlinDslProjectWithKotlinGuiTest.kt | 14 ++++++++++++++ .../CreateGradleProjectWithKotlinGuiTest.kt | 14 ++++++++++++++ .../fixtures/WelcomeFrameFixture.kt | 2 ++ 3 files changed, 30 insertions(+) diff --git a/community-guitests/testSrc/com/intellij/ide/projectWizard/kotlin/createProject/CreateGradleKotlinDslProjectWithKotlinGuiTest.kt b/community-guitests/testSrc/com/intellij/ide/projectWizard/kotlin/createProject/CreateGradleKotlinDslProjectWithKotlinGuiTest.kt index 91c928a8b09e..3cd02e95d1d1 100644 --- a/community-guitests/testSrc/com/intellij/ide/projectWizard/kotlin/createProject/CreateGradleKotlinDslProjectWithKotlinGuiTest.kt +++ b/community-guitests/testSrc/com/intellij/ide/projectWizard/kotlin/createProject/CreateGradleKotlinDslProjectWithKotlinGuiTest.kt @@ -3,7 +3,11 @@ package com.intellij.ide.projectWizard.kotlin.createProject import com.intellij.ide.projectWizard.kotlin.model.* import com.intellij.testGuiFramework.framework.param.GuiTestSuiteParam +import com.intellij.testGuiFramework.impl.ScreenshotOnFailure +import com.intellij.testGuiFramework.util.currentTimeInHumanString import com.intellij.testGuiFramework.util.scenarios.NewProjectDialogModel +import org.junit.After +import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.Parameterized @@ -20,6 +24,16 @@ class CreateGradleKotlinDslProjectWithKotlinGuiTest(private val testParameters: override fun toString() = projectName } + @Before + fun beforeTest(){ + ScreenshotOnFailure.takeScreenshot("${currentTimeInHumanString}_before_${testMethod.methodName}") + } + + @After + fun afterTest(){ + ScreenshotOnFailure.takeScreenshot("${currentTimeInHumanString}_after_${testMethod.methodName}") + } + @Test fun createKotlinDslGradleWithKotlin() { testGradleProjectWithKotlin( diff --git a/community-guitests/testSrc/com/intellij/ide/projectWizard/kotlin/createProject/CreateGradleProjectWithKotlinGuiTest.kt b/community-guitests/testSrc/com/intellij/ide/projectWizard/kotlin/createProject/CreateGradleProjectWithKotlinGuiTest.kt index 374849dc8a96..6e13b98230d3 100644 --- a/community-guitests/testSrc/com/intellij/ide/projectWizard/kotlin/createProject/CreateGradleProjectWithKotlinGuiTest.kt +++ b/community-guitests/testSrc/com/intellij/ide/projectWizard/kotlin/createProject/CreateGradleProjectWithKotlinGuiTest.kt @@ -3,7 +3,11 @@ package com.intellij.ide.projectWizard.kotlin.createProject import com.intellij.ide.projectWizard.kotlin.model.* import com.intellij.testGuiFramework.framework.param.GuiTestSuiteParam +import com.intellij.testGuiFramework.impl.ScreenshotOnFailure +import com.intellij.testGuiFramework.util.currentTimeInHumanString import com.intellij.testGuiFramework.util.scenarios.NewProjectDialogModel +import org.junit.After +import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.Parameterized @@ -20,6 +24,16 @@ class CreateGradleProjectWithKotlinGuiTest(private val testParameters: TestParam override fun toString() = projectName } + @Before + fun beforeTest(){ + ScreenshotOnFailure.takeScreenshot("${currentTimeInHumanString}_before_${testMethod.methodName}") + } + + @After + fun afterTest(){ + ScreenshotOnFailure.takeScreenshot("${currentTimeInHumanString}_after_${testMethod.methodName}") + } + @Test fun createGradleWithKotlin() { testGradleProjectWithKotlin( diff --git a/platform/testGuiFramework/src/com/intellij/testGuiFramework/fixtures/WelcomeFrameFixture.kt b/platform/testGuiFramework/src/com/intellij/testGuiFramework/fixtures/WelcomeFrameFixture.kt index 74c31cb391b8..c9996f6078cc 100644 --- a/platform/testGuiFramework/src/com/intellij/testGuiFramework/fixtures/WelcomeFrameFixture.kt +++ b/platform/testGuiFramework/src/com/intellij/testGuiFramework/fixtures/WelcomeFrameFixture.kt @@ -4,6 +4,7 @@ package com.intellij.testGuiFramework.fixtures import com.intellij.openapi.wm.impl.welcomeScreen.FlatWelcomeFrame import com.intellij.testGuiFramework.framework.Timeouts import com.intellij.testGuiFramework.impl.* +import com.intellij.testGuiFramework.util.currentTimeInHumanString import com.intellij.testGuiFramework.util.step import org.fest.swing.core.Robot import org.fest.swing.exception.ComponentLookupException @@ -17,6 +18,7 @@ class WelcomeFrameFixture private constructor(robot: Robot, WelcomeFrameFixture::class.java, robot, target), ContainerFixture { fun createNewProject(): WelcomeFrameFixture { + ScreenshotOnFailure.takeScreenshot("${currentTimeInHumanString}_before click Create New Project") findActionLinkByActionId("WelcomeScreen.CreateNewProject").click() return this }