diff options
author | andre.schmid <andre.schmid@est.tech> | 2019-11-25 11:51:14 +0000 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2019-12-01 15:41:05 +0000 |
commit | d6890fce461c040c2776dfdedd47be282a29f877 (patch) | |
tree | 4c24ed63e1cfab2fcbc0c01da6068de1a2d04d68 /ui-ci/src | |
parent | 4082d3936832a2b6e3ba6c025ed5decf97baacbc (diff) |
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 <andre.schmid@est.tech>
Diffstat (limited to 'ui-ci/src')
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); } |