diff options
Diffstat (limited to 'ui-ci')
5 files changed, 24 insertions, 16 deletions
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java index 0541ab97d3..012895fc86 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java @@ -271,7 +271,7 @@ public final class CanvasManager { return null; } - public CanvasElement createElementOnCanvas(String elementName) throws Exception { + public CanvasElement createElementOnCanvas(String elementName) { String actionDuration = GeneralUIUtils.getActionDuration(() -> { try { canvasElement = createElementOnCanvasWithoutDuration(elementName); @@ -310,7 +310,7 @@ public final class CanvasManager { return null; } - public CanvasElement createElementOnCanvas(LeftPanelCanvasItems canvasItem) throws Exception { + public CanvasElement createElementOnCanvas(LeftPanelCanvasItems canvasItem) { return createElementOnCanvas(canvasItem.getValue()); } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java index 1a5cace690..6a1ec57837 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java @@ -428,19 +428,12 @@ public class Vf extends SetupCDTest { @Test public void changeInstanceNameInVfTest() { final ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + ResourceUIUtils.createVF(vfMetaData, getUser()); + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + final CanvasManager vfCanvasManager = CanvasManager.getCanvasManager(); + final CanvasElement computeElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE); final String updatedInstanceName = "updatedName"; - try { - ResourceUIUtils.createVF(vfMetaData, getUser()); - ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); - final CanvasManager vfCanvasManager = CanvasManager.getCanvasManager(); - final CanvasElement computeElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE); - vfCanvasManager.updateElementNameInCanvas(computeElement, updatedInstanceName); - } catch (final Exception e) { - final String errorMsg = "An unexpected error has occurred during the changeInstanceNameInVfTest"; - takeScreenshot("ChangeInstanceNameInVf" + vfMetaData.getToscaResourceName(), errorMsg); - LOGGER.error(errorMsg, e); - fail(errorMsg); - } + vfCanvasManager.updateElementNameInCanvas(computeElement, updatedInstanceName); assertEquals(CompositionPage.getSelectedInstanceName(), updatedInstanceName); } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java index c5cd347e88..3454c202a6 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java @@ -25,10 +25,14 @@ import static org.openecomp.sdc.ci.tests.pages.HomePage.PageElement.REPOSITORY_I import com.aventstack.extentreports.Status; import java.io.File; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Calendar; import java.util.List; import java.util.UUID; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.exception.HomePageRuntimeException; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; import org.openecomp.sdc.ci.tests.utilities.DownloadManager; import org.openecomp.sdc.ci.tests.utilities.FileHandling; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; @@ -174,6 +178,17 @@ public class HomePage { getExtendTest().log(Status.ERROR, e.getMessage()); throw new HomePageRuntimeException(errorMsg, e); } + final String datetimeString = + new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss.SSS").format(Calendar.getInstance().getTime()); + try { + ExtentTestActions + .addScreenshot(Status.INFO, + String.format("after-click-resource-%s-%s", resourceName, datetimeString), + String.format("Clicked on resource '%s'", resourceName) + ); + } catch (final IOException e) { + LOGGER.warn("Could take screenshot after resource {} click", resourceName, e); + } try { GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()); } catch (final Exception e) { diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java index a41632473f..ef91c1cbb3 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java @@ -414,7 +414,7 @@ public final class GeneralUIUtils { return true; } - public static String getActionDuration(Runnable func) throws Exception { + public static String getActionDuration(Runnable func) { long startTime = System.nanoTime(); func.run(); long estimateTime = System.nanoTime(); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java index 1937785326..76c1a4c572 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java @@ -153,7 +153,7 @@ public final class ResourceUIUtils { createVF(resource, user); } - public static void createVF(ResourceReqDetails resource, User user) throws Exception { + public static void createVF(ResourceReqDetails resource, User user) { ExtentTestActions.log(Status.INFO, "Going to create a new VF."); createResource(resource, user, DataTestIdEnum.Dashboard.BUTTON_ADD_VF); } |