From 8b346842194edb8a9e8c4cd2764ae8ebbce988f0 Mon Sep 17 00:00:00 2001 From: atulpurohit Date: Tue, 5 Nov 2019 14:31:56 +0530 Subject: Refresh option in validation result page Issue-ID: SDC-2585 Co-authored-by: nikhil.soni@vodafone.com Signed-off-by: atulpurohit Change-Id: I78f1385d219837c300cb33aff82b7459f137babb Signed-off-by: atulpurohit --- .../tests/dataProvider/OnbordingDataProviders.java | 64 +++++++-------------- .../ci/tests/execute/sanity/OnboardingFlowsUi.java | 65 ++++++++++++++-------- .../sdc/ci/tests/pages/VspValidationPage.java | 41 ++++++++++---- 3 files changed, 90 insertions(+), 80 deletions(-) (limited to 'ui-ci') diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java index 6594049fc5..89d90df24d 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java @@ -20,17 +20,19 @@ package org.openecomp.sdc.ci.tests.dataProvider; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; import org.openecomp.sdc.ci.tests.datatypes.enums.XnfTypeEnum; import org.openecomp.sdc.ci.tests.utilities.FileHandling; import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; +import org.testng.Assert; import org.testng.annotations.DataProvider; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - public class OnbordingDataProviders { + private static final String VSP_VGW_CSAR = "vsp-vgw.csar"; private static final int NUMBER_OF_RANDOMLY_ONBOARD_VNF = 3; protected static String filepath = FileHandling.getVnfRepositoryPath(); @@ -60,8 +62,10 @@ public class OnbordingDataProviders { Object[][] filteredArObject = null; - objectArr[0] = new Object[]{"1-2016-20-visbc3vf-(VOIP)_v2.1.zip", "2-2016-20-visbc3vf-(VOIP)_v2.1_RenameResourceToShay.zip"}; - objectArr[1] = new Object[]{"1-2017-404_vUSP_vCCF_AIC3.0-(VOIP)_v6.0.zip", "2-2017-404_vUSP_vCCF_AIC3.0-(VOIP)_v6.0_Added2TestParameters.zip"}; + objectArr[0] = new Object[] {"1-2016-20-visbc3vf-(VOIP)_v2.1.zip", + "2-2016-20-visbc3vf-(VOIP)_v2.1_RenameResourceToShay.zip"}; + objectArr[1] = new Object[] {"1-2017-404_vUSP_vCCF_AIC3.0-(VOIP)_v6.0.zip", + "2-2017-404_vUSP_vCCF_AIC3.0-(VOIP)_v6.0_Added2TestParameters.zip"}; filteredArObject = OnboardingUtils.filterObjectArrWithExcludedVnfs(objectArr); @@ -70,12 +74,15 @@ public class OnbordingDataProviders { } - // -----------------------factories----------------------------------------- -// @Factory(dataProvider = "VNF_List") -// public Object[] OnbordingDataProviders(String filepath, String vnfFile){ -// return new Object[] { new ToscaValidationTest(filepath, vnfFile)}; -// } + @DataProvider(name = "Single_Vsp_Test_Csar", parallel = true) + private static Object[][] singleVspTestCsar() throws Exception { + List fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.VNF); + if (!fileNamesFromFolder.contains(VSP_VGW_CSAR)) { + Assert.fail("Vsp Test file is not exits in the path"); + } + return provideData(Arrays.asList(VSP_VGW_CSAR), filepath); + } // -----------------------methods----------------------------------------- static Object[][] provideData(List fileNamesFromFolder, String filepath) { @@ -83,7 +90,7 @@ public class OnbordingDataProviders { Object[][] arObject = new Object[fileNamesFromFolder.size()][]; int index = 0; for (Object obj : fileNamesFromFolder) { - arObject[index++] = new Object[]{filepath, obj}; + arObject[index++] = new Object[] {filepath, obj}; } return arObject; } @@ -106,37 +113,4 @@ public class OnbordingDataProviders { } } - -// private static String[][] arrangeFilesVersionPairs(List filesArr) { -// String[][] filesArrangeByPairs = null; -// -// List versionOneFiles= null; -// List versionTowFiles= null; -// -// for ( String fileName : filesArr ) -// { -// if(fileName.startsWith("1-")) -// { -// versionOneFiles.add(fileName); -// } -// else if(fileName.startsWith("2-")) -// { -// versionTowFiles.add(fileName); -// } -// } -// -// Collections.sort(versionOneFiles); -// Collections.sort(versionTowFiles); -// -// for (int i=0 ; i checkboxes = + GeneralUIUtils.findElementsByXpath("//div[@class='validation-input-wrapper']//input"); + boolean hasValue = CollectionUtils.isNotEmpty(checkboxes); + if (hasValue) { + WebElement browseWebElement = checkboxes.get(0); + browseWebElement.sendKeys(path + File.separator + filename); + GeneralUIUtils.ultimateWait(); + } else { + Assert.fail("Did not find File input field in the page for loading VSP test file"); + } + + } public static boolean checkNextButtonDisabled() throws Exception { return GeneralUIUtils.isElementDisabled(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_PROCEED_TO_INPUTS_BUTTON.getValue()); } public static void clickCertificationQueryAll() throws Exception { List checkboxes = GeneralUIUtils.findElementsByXpath("//div[@data-test-id='vsp-validation-certifications-query-checkbox-tree']//label//span[@class='rct-checkbox']"); - if (checkboxes.size() > 0) { + if (!checkboxes.isEmpty()) { checkboxes.get(0).click(); } else { - assertTrue("Checkbox Not Found", checkboxes.size() > 0); + Assert.fail("Did not find certification test checkbox in the page"); } } public static void clickComplianceChecksAll() throws Exception { - List checkboxes = GeneralUIUtils.findElementsByXpath("//div[@data-test-id='vsp-validation-compliance-checks-checkbox-tree']//label//span[@class='rct-checkbox']"); - if (checkboxes.size() > 0) { + List vnfComplianceCheckboxes = GeneralUIUtils.findElementsByXpath("//div[@data-test-id='vsp-validation-compliance-checks-checkbox-tree']//span[@class='rct-text' and .//label//text()='vnf-compliance']//button"); + if (!vnfComplianceCheckboxes.isEmpty()) { + vnfComplianceCheckboxes.get(vnfComplianceCheckboxes.size() - 1).click(); + } else { + Assert.fail("Did not find vnf-compliance test checkbox in the page"); + } + List checkboxes = GeneralUIUtils.findElementsByXpath("//div[@data-test-id='vsp-validation-compliance-checks-checkbox-tree']//label//span[@class='rct-title' and text()='csar-validate']"); + if (!checkboxes.isEmpty()) { checkboxes.get(checkboxes.size() - 1).click(); } else { - assertTrue("Checkbox Not Found", checkboxes.size() > 0); + Assert.fail("Did not find csar-validate test Checkbox in the page"); } } @@ -79,14 +98,14 @@ public class VspValidationPage extends GeneralPageElements { WebElement parentDiv = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_CERTIFICATION_CHECKBOX_TREE.getValue()); List checkboxTreeDivs = getChildElements(parentDiv); List orderedList = getChildElements(checkboxTreeDivs.get(0)); - return (orderedList.size() > 0); + return (!orderedList.isEmpty()); } public static boolean checkComplianceCheckExists() throws Exception { WebElement parentDiv = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_COMPLIANCE_CHECKBOX_TREE.getValue()); List checkboxTreeDivs = getChildElements(parentDiv); List orderedList = getChildElements(checkboxTreeDivs.get(0)); - return (orderedList.size() > 0); + return (!orderedList.isEmpty()); } public static boolean checkSelectedComplianceCheckExists() throws Exception { -- cgit 1.2.3-korg