From d6890fce461c040c2776dfdedd47be282a29f877 Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Mon, 25 Nov 2019 11:51:14 +0000 Subject: Fix welcome screen close timeout The welcome screen close timeout is triggering even if you close the welcome window. After 4 seconds it forces the user to go to the home screen even if it is already in another screen. The timeout was also the cause for one known problem in the sanity ui test "onapOnboardVNFflow". Adds also a print screen to the ui tests, to check if the resource was really clicked. Removes invalids "throws Exception" declarations that were being handled in the main test method "Vf.changeInstanceNameInVfTest", that was catching also assertions errors. Change-Id: Idff26b1ba5b199482e68cc50532fa20f4f834e34 Issue-ID: SDC-2648 Signed-off-by: andre.schmid --- catalog-ui/src/app/view-models/welcome/welcome-view.ts | 9 +++++---- .../openecomp/sdc/ci/tests/datatypes/CanvasManager.java | 4 ++-- .../org/openecomp/sdc/ci/tests/execute/sanity/Vf.java | 17 +++++------------ .../java/org/openecomp/sdc/ci/tests/pages/HomePage.java | 15 +++++++++++++++ .../sdc/ci/tests/utilities/GeneralUIUtils.java | 2 +- .../sdc/ci/tests/utilities/ResourceUIUtils.java | 2 +- 6 files changed, 29 insertions(+), 20 deletions(-) diff --git a/catalog-ui/src/app/view-models/welcome/welcome-view.ts b/catalog-ui/src/app/view-models/welcome/welcome-view.ts index 9e88cb66f7..5ed7159d79 100644 --- a/catalog-ui/src/app/view-models/welcome/welcome-view.ts +++ b/catalog-ui/src/app/view-models/welcome/welcome-view.ts @@ -49,12 +49,13 @@ export class WelcomeViewModel { } private initScope = ():void => { - this.$scope.onCloseButtonClick = ():void => { + let timeout = window.setTimeout(():void => { this.$state.go("dashboard", {}); - }; - window.setTimeout(():void => { + }, 4000); + this.$scope.onCloseButtonClick = ():void => { + window.clearTimeout(timeout); this.$state.go("dashboard", {}); - },4000); + } }; private init = ():void => { 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); } -- cgit 1.2.3-korg