Add test cases for Helm validation 40/121540/13
authorPiotr Marcinkiewicz <piotr.marcinkiewicz@nokia.com>
Wed, 26 May 2021 07:45:45 +0000 (09:45 +0200)
committerVasyl Razinkov <vasyl.razinkov@est.tech>
Tue, 15 Jun 2021 16:30:42 +0000 (16:30 +0000)
Issue-ID: SDC-3185
Signed-off-by: Piotr Marcinkiewicz <piotr.marcinkiewicz@nokia.com>
Signed-off-by: Tomasz Wrobel <tomasz.wrobel@nokia.com>
Signed-off-by: Joanna Jeremicz <joanna.jeremicz@nokia.com>
Change-Id: Ic68907aa385e5a735d0948ca2177e6aac12b2e7b

25 files changed:
integration-tests/environments/integration-test.json
integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/data/providers/OnboardingDataProviders.java
integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/datatypes/enums/XnfTypeEnum.java
integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/sanity/Onboard.java
integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/FileHandling.java
integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/OnboardingUtils.java
integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/VendorSoftwareProductRestUtils.java
integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/dataProvider/OnbordingDataProviders.java
integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/OnboardingFlowsUi.java
integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/VspValidationPage.java
integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/FileHandling.java
integration-tests/src/test/resources/Files/CNFs/helm-package-valid.zip
integration-tests/src/test/resources/Files/CNFs/helm-package-valid_expect [new file with mode: 0644]
integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/one_error_two_files.zip [new file with mode: 0644]
integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/one_error_two_files_expect [new file with mode: 0644]
integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/package_invalid_nil_pointer_render_error.zip [new file with mode: 0644]
integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/package_invalid_nil_pointer_render_error_expect [new file with mode: 0644]
integration-tests/src/test/resources/Files/CNFs/helm_validator/package_valid.zip [new file with mode: 0644]
integration-tests/src/test/resources/Files/CNFs/helm_validator/valid_two_files.zip [new file with mode: 0644]
integration-tests/src/test/resources/Files/CNFs/helm_validator/with_warnings/one_warning_two_files.zip [new file with mode: 0644]
integration-tests/src/test/resources/Files/CNFs/helm_validator/with_warnings/one_warning_two_files_expect [new file with mode: 0644]
integration-tests/src/test/resources/ci/testSuites/backend/helmValidatorTests.xml
integration-tests/src/test/resources/ci/testSuites/backend/onapApiSanity.xml
integration-tests/src/test/resources/ci/testSuites/frontend/helmValidatorTests.xml
openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx

index e71e53b..3402113 100644 (file)
          "vnfRepoHost": "10.0.14.1"
       },
       "HelmValidator": {
-         "validator_enabled": false,
+         "validator_enabled": true,
          "helm_version": "v3",
          "deployable": true,
-         "lintable": false,
-         "strict_lintable": false
+         "lintable": true,
+         "strict_lintable": false,
+         "validator_url": "http://helm-validator:8080/validate"
       }
    },
    "override_attributes": {
index 314e37d..16c9521 100644 (file)
@@ -22,6 +22,7 @@ package org.onap.sdc.backend.ci.tests.data.providers;
 
 import static org.testng.Assert.fail;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -82,7 +83,28 @@ public final class OnboardingDataProviders {
     private static Object[][] invalidCnfList() {
         final List<String> fileNamesFromFolder = OnboardingUtils.getInvalidXnfNamesFileList(XnfTypeEnum.CNF);
         LOGGER.debug(String.format("There are %s package file(s) to test", fileNamesFromFolder.size()));
-        return provideData(fileNamesFromFolder, FileHandling.getXnfRepositoryPath(XnfTypeEnum.CNF));
+        return provideData(fileNamesFromFolder, FileHandling.getXnfRepositoryPath(XnfTypeEnum.CNF) + File.separator + OnboardingUtils.INVALID_XNFS_SUBPATH);
+    }
+
+    @DataProvider(name = "CNF_Helm_Validator_List", parallel = true)
+    private static Object[][] cnfForHelmValidatorList() {
+        final List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.CNF_HELM);
+        LOGGER.debug(String.format("There are %s package file(s) to test", fileNamesFromFolder.size()));
+        return provideData(fileNamesFromFolder, FileHandling.getXnfRepositoryPath(XnfTypeEnum.CNF_HELM));
+    }
+
+    @DataProvider(name = "CNF_With_Warning_Helm_Validator_List", parallel = true)
+    private static Object[][] cnfWithWarningForHelmValidatorList() {
+        final List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesWithWarningsFileList(XnfTypeEnum.CNF_HELM);
+        LOGGER.debug(String.format("There are %s package file(s) to test", fileNamesFromFolder.size()));
+        return provideData(fileNamesFromFolder, FileHandling.getXnfRepositoryPath(XnfTypeEnum.CNF_HELM) + File.separator + OnboardingUtils.WITH_WARNINGS_XNFS_SUBPATH);
+    }
+
+    @DataProvider(name = "Invalid_CNF_Helm_Validator_List", parallel = true)
+    private static Object[][] invalidCnfForHelmValidatorList() {
+        final List<String> fileNamesFromFolder = OnboardingUtils.getInvalidXnfNamesFileList(XnfTypeEnum.CNF_HELM);
+        LOGGER.debug(String.format("There are %s package file(s) to test", fileNamesFromFolder.size()));
+        return provideData(fileNamesFromFolder, FileHandling.getXnfRepositoryPath(XnfTypeEnum.CNF_HELM) + File.separator + OnboardingUtils.INVALID_XNFS_SUBPATH);
     }
 
     @DataProvider(name = "Single_VNF", parallel = true)
index d67390e..a3323b9 100644 (file)
@@ -8,9 +8,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -53,11 +53,11 @@ public class Onboard extends ComponentBaseTest {
        private String makeToscaValidationValue;
        @Rule
        public static final TestName name = new TestName();
-       
+
        @Parameters({ "makeDistribution" })
        @BeforeMethod
        public void beforeTestReadParams(@Optional("true") String makeDistributionReadValue) {
-               makeDistributionValue = makeDistributionReadValue;                             
+               makeDistributionValue = makeDistributionReadValue;
                logger.info("makeDistributionReadValue - > " + makeDistributionValue);
        }
 
@@ -67,7 +67,7 @@ public class Onboard extends ComponentBaseTest {
                makeToscaValidationValue = makeToscaValidationReadValue;
                logger.info("makeToscaValidationReadValue - > " + makeToscaValidationValue);
        }
-       
+
 
        @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "VNF_List")
        public void onboardVNFShotFlow(String filePath, String vnfFile) throws Exception {
@@ -93,6 +93,24 @@ public class Onboard extends ComponentBaseTest {
                assertThrows(() -> runOnboardToDistributionFlow(filePath, cnfFile, ResourceTypeEnum.VF));
        }
 
+       @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "CNF_Helm_Validator_List")
+       public void onboardCNFWithHelmValidatorFlow(String filePath, String cnfFile) throws Exception {
+               setLog(cnfFile);
+               runOnboardToDistributionFlow(filePath, cnfFile, ResourceTypeEnum.VF);
+       }
+
+       @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "CNF_With_Warning_Helm_Validator_List")
+       public void onboardCNFWithHelmValidatorFlowWithWarning(String filePath, String cnfFile) throws Exception {
+               setLog(cnfFile);
+               runOnboardToDistributionFlow(filePath, cnfFile, ResourceTypeEnum.VF);
+       }
+
+       @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Invalid_CNF_Helm_Validator_List")
+       public void onboardCNFWithHelmValidatorShouldFailTest(String filePath, String cnfFile) {
+               setLog(cnfFile);
+               assertThrows(() -> runOnboardToDistributionFlow(filePath, cnfFile, ResourceTypeEnum.VF));
+       }
+
        private void runOnboardToDistributionFlow(String packageFilePath, String packageFileName, ResourceTypeEnum resourceTypeEnum) throws Exception {
                ExtentTestActions.log(Status.INFO, String.format("Going to onboard the %s %s", resourceTypeEnum.getValue(), packageFileName));
                User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
index 766c887..dcb3ecb 100644 (file)
@@ -3,6 +3,7 @@
  * SDC
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2021 Nokia. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -135,6 +136,7 @@ public class FileHandling {
        private static EnumMap<XnfTypeEnum, String> XNF_REPOSITORY_PATHS_MAP = new EnumMap<>(Map.of(
                XnfTypeEnum.PNF, getPnfRepositoryPath(),
                XnfTypeEnum.CNF, getCnfRepositoryPath(),
+               XnfTypeEnum.CNF_HELM, getCnfRepositoryForHelmValidatorPath(),
                XnfTypeEnum.VNF, getVnfRepositoryPath(),
                XnfTypeEnum.ETSI, getEtsiRepositoryPath(),
                XnfTypeEnum.VFC, getVfcRepositoryPath()
@@ -152,6 +154,10 @@ public class FileHandling {
                return getFilePath("CNFs");
        }
 
+       private static String getCnfRepositoryForHelmValidatorPath() {
+               return getFilePath("CNFs/helm_validator");
+       }
+
        private static String getEtsiRepositoryPath() { return getFilePath("ETSI"); }
 
        private static String getVfcRepositoryPath() { return getFilePath("VFCs"); }
index 22c3144..6630345 100644 (file)
@@ -24,6 +24,7 @@ package org.onap.sdc.backend.ci.tests.utils.general;
 import static org.onap.sdc.backend.ci.tests.utils.general.FileHandling.filterFileNamesListFromFolder;
 
 import java.io.File;
+import java.nio.file.Paths;
 import org.onap.sdc.backend.ci.tests.datatypes.enums.XnfTypeEnum;
 import org.onap.sdc.backend.ci.tests.datatypes.http.HttpHeaderEnum;
 import org.onap.sdc.backend.ci.tests.datatypes.http.HttpRequest;
@@ -109,7 +110,8 @@ public class OnboardingUtils {
                "1-2017389vtsbc4vf-(VOIP)_v11.0.zip"
        );
 
-       private static final String INVALID_XNFS_SUBPATH = "invalid";
+       public static final String INVALID_XNFS_SUBPATH = "invalid";
+       public static final String WITH_WARNINGS_XNFS_SUBPATH = "with_warnings";
 
        public static String handleFilename(String heatFileName) {
                final String namePrefix = String.format("%sVF%s", ElementFactory.getResourcePrefix(), "Onboarded-");
@@ -204,6 +206,15 @@ public class OnboardingUtils {
                return FileHandling.getZipFileNamesFromFolder(filepath);
        }
 
+       /**
+        * @return
+        * The method returns names list of XNF packages with warnings from Files directory under sdc repository
+        */
+       public static List<String> getXnfNamesWithWarningsFileList(XnfTypeEnum xnfTypeEnum) {
+               String filepath = FileHandling.getXnfRepositoryPath(xnfTypeEnum) + File.separator + WITH_WARNINGS_XNFS_SUBPATH;
+               return FileHandling.getZipFileNamesFromFolder(filepath);
+       }
+
        /**
         * @param vnfNamesFileList
         * @return divide List according to day of month, if day of month is even as get first half part of the List, else - second
index 96d6416..1eea8f3 100644 (file)
@@ -23,6 +23,8 @@ package org.onap.sdc.backend.ci.tests.utils.general;
 import com.aventstack.extentreports.Status;
 import com.clearspring.analytics.util.Pair;
 import com.google.gson.Gson;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import org.apache.commons.io.IOUtils;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.methods.CloseableHttpResponse;
@@ -58,6 +60,7 @@ import java.util.Iterator;
 import java.util.Map;
 
 import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
 
 public class VendorSoftwareProductRestUtils {
 
@@ -129,6 +132,13 @@ public class VendorSoftwareProductRestUtils {
         RestResponse validateUpload = validateUpload(createNewVspPair.right, user);
         assertEquals("did not succeed to validate upload process, reason: " + validateUpload.getResponse(), 200, validateUpload.getErrorCode().intValue());
 
+        Path expectPath =  FileSystems.getDefault().getPath(filepath + File.separator + heatFileName.substring(0, heatFileName.indexOf('.')) + "_expect");
+
+        if(Files.exists(expectPath)) {
+            String content = Files.readString(expectPath);
+            assertTrue(validateUpload.getResponse().contains(content.trim().replaceAll("[\n\r]", "")));
+        }
+
         return createNewVspPair.right;
     }
 
index 3a9fd4d..41b247c 100644 (file)
@@ -24,6 +24,8 @@ package org.onap.sdc.frontend.ci.tests.dataProvider;
 import org.onap.sdc.backend.ci.tests.datatypes.enums.XnfTypeEnum;
 import org.onap.sdc.backend.ci.tests.utils.general.OnboardingUtils;
 import org.onap.sdc.frontend.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
 
@@ -33,6 +35,7 @@ import java.util.Collections;
 import java.util.List;
 
 public class OnbordingDataProviders {
+    private static final Logger LOGGER = LoggerFactory.getLogger(OnbordingDataProviders.class);
 
     private static final String VSP_VGW_CSAR = "vsp-vgw.csar";
     private static final int NUMBER_OF_RANDOMLY_ONBOARD_VNF = 3;
@@ -44,34 +47,44 @@ public class OnbordingDataProviders {
         int randomElementNumber = NUMBER_OF_RANDOMLY_ONBOARD_VNF; //how many VNFs to onboard randomly
         List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure();
         List<String> newRandomFileNamesFromFolder = getRandomElements(randomElementNumber, fileNamesFromFolder);
-        System.out.println(String.format("There are %s zip file(s) to test", newRandomFileNamesFromFolder.size()));
         return provideData(newRandomFileNamesFromFolder, filepath);
     }
 
     @DataProvider(name = "VNF_List", parallel = true)
     private static Object[][] VnfList() throws Exception {
-
         List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.VNF);
-
-        System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size()));
         return provideData(fileNamesFromFolder, filepath);
     }
 
     @DataProvider(name = "CNF_List", parallel = true)
     private static Object[][] cnfList() {
-
         List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.CNF);
-
-        System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size()));
         return provideData(fileNamesFromFolder, FileHandling.getCnfRepositoryPath());
     }
 
+    @DataProvider(name = "CNF_Helm_Validator_List", parallel = true)
+    private static Object[][] cnfForHelmValidatorList() {
+        List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.CNF_HELM);
+        return provideData(fileNamesFromFolder, FileHandling.getCnfForHelmValidatorRepositoryPath());
+    }
+
+    @DataProvider(name = "CNF_With_Warning_Helm_Validator_List", parallel = true)
+    private static Object[][] cnfWithWarningForHelmValidatorList() {
+        List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesWithWarningsFileList(XnfTypeEnum.CNF_HELM);
+        Object[][] objects = provideData(fileNamesFromFolder,
+            FileHandling.getCnfWithWarningForHelmValidatorRepositoryPath());
+        return objects;
+    }
+
+    @DataProvider(name = "Invalid_CNF_Helm_Validator_List", parallel = true)
+    private static Object[][] invalidCnfForHelmValidatorList() {
+        List<String> fileNamesFromFolder = OnboardingUtils.getInvalidXnfNamesFileList(XnfTypeEnum.CNF_HELM);
+        return provideData(fileNamesFromFolder, FileHandling.getInvalidCnfForHelmValidatorRepositoryPath());
+    }
+
     @DataProvider(name = "Invalid_CNF_List", parallel = true)
     private static Object[][] invalidCnfList() {
-
         List<String> fileNamesFromFolder = OnboardingUtils.getInvalidXnfNamesFileList(XnfTypeEnum.CNF);
-
-        System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size()));
         return provideData(fileNamesFromFolder, FileHandling.getCnfRepositoryPath());
     }
 
@@ -106,7 +119,7 @@ public class OnbordingDataProviders {
 
     // -----------------------methods-----------------------------------------
     static Object[][] provideData(List<String> fileNamesFromFolder, String filepath) {
-
+        LOGGER.info(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size()));
         Object[][] arObject = new Object[fileNamesFromFolder.size()][];
         int index = 0;
         for (Object obj : fileNamesFromFolder) {
index 693302a..5d1b3b3 100644 (file)
@@ -473,6 +473,62 @@ public class OnboardingFlowsUi extends SetupCDTest {
         runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, cnfFile);
     }
 
+    @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "CNF_Helm_Validator_List")
+    public void onapOnboardVSPWithHelmValidationSuccessfulWithoutErrorsAndWarnings(String filePath, String cnfFile) throws Exception {
+
+        setLog(cnfFile);
+        String vspName = createNewVSP(filePath, cnfFile);
+        goToVspScreen(true, vspName);
+
+        boolean isVspAttachmentValidationPage = VspValidationPage.isVspAttachmentsValidationPage();
+        if (!isVspAttachmentValidationPage) {
+            VspValidationPage.navigateToVspAttachmentsValidationPage();
+        }
+
+        assertTrue("Submit button should be enabled for correct helm chart",
+            VspValidationPage.isSubmitButtonEnabled());
+        assertFalse("Attachment should not have any warnings for correct helm chart",
+            VspValidationPage.hasHelmAttachmentsAnyWarnings());
+        assertFalse("Attachment should not have any error for correct helm chart",
+            VspValidationPage.hasHelmAttachmentsAnyError());
+    }
+
+    @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "CNF_With_Warning_Helm_Validator_List")
+    public void onapOnboardVSPWithHelmValidationSuccessfulWithWarnings(String filePath, String cnfFile) throws Exception {
+        setLog(cnfFile);
+        String vspName = createNewVSP(filePath, cnfFile);
+        goToVspScreen(true, vspName);
+
+        boolean isVspAttachmentValidationPage = VspValidationPage.isVspAttachmentsValidationPage();
+        if (!isVspAttachmentValidationPage) {
+            VspValidationPage.navigateToVspAttachmentsValidationPage();
+        }
+
+        assertTrue("Submit button should be enabled for helm chart with warning",
+            VspValidationPage.isSubmitButtonEnabled());
+        assertTrue("Attachment should have warnings for helm chart with warning",
+            VspValidationPage.hasHelmAttachmentsAnyWarnings());
+        assertFalse("Attachment should not have error for helm chart with warning",
+            VspValidationPage.hasHelmAttachmentsAnyError());
+    }
+
+    @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "Invalid_CNF_Helm_Validator_List")
+    public void onapOnboardVSPWithHelmValidationUnsuccessfulWithErrors(String filePath, String cnfFile) throws Exception {
+        setLog(cnfFile);
+        String vspName = createNewVSP(filePath, cnfFile);
+        goToVspScreen(true, vspName);
+
+        boolean isVspAttachmentValidationPage = VspValidationPage.isVspAttachmentsValidationPage();
+        if (!isVspAttachmentValidationPage) {
+            VspValidationPage.navigateToVspAttachmentsValidationPage();
+        }
+
+        assertFalse("Submit button should be disabled for helm chart with error",
+            VspValidationPage.isSubmitButtonEnabled());
+        assertTrue("Attachment should have error for helm chart with error",
+            VspValidationPage.hasHelmAttachmentsAnyError());
+    }
+
     @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "Invalid_CNF_List")
     public void onboardCNFTestShouldFailForInvalidHelmPackage(String filePath, String cnfFile) {
         setLog(cnfFile);
index 6d980ce..4b34e68 100644 (file)
@@ -1,5 +1,6 @@
 /**
  * Copyright (c) 2019 Vodafone Group
+ * Copyright (C) 2021 Nokia. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@ import org.onap.sdc.frontend.ci.tests.datatypes.DataTestIdEnum;
 import org.onap.sdc.frontend.ci.tests.execute.setup.SetupCDTest;
 import org.onap.sdc.frontend.ci.tests.utilities.GeneralUIUtils;
 import org.openqa.selenium.By;
+import org.openqa.selenium.NoSuchElementException;
 import org.openqa.selenium.WebElement;
 import org.testng.Assert;
 
@@ -30,6 +32,17 @@ import java.util.List;
 
 public class VspValidationPage extends GeneralPageElements {
 
+    private static final String ATTACHMENT_NAME_TEST_ID = ".//*[@data-test-id='validation-tree-node-name']";
+    private static final String VALIDATION_ERROR_COUNT = ".//*[@data-test-id='validation-error-count']";
+    private static final String VALIDATION_WARNING_COUNT = ".//*[@data-test-id='validation-warning-count']";
+    private static final String SOFTWARE_PRODUCT_ATTACHMENTS = "navbar-group-item-SOFTWARE_PRODUCT_ATTACHMENTS";
+    private static final String ATTACHMENTS_TAB_VALIDATION = "attachments-tab-validation";
+    private static final String SDC_TAB_ACTIVE_CLASS_NAME = "sdc-tab-active";
+    private static final String ATTACHMENTS_NODE_ID = "validation-tree-node";
+    private static final String HELM_ATTACHMENT_EXTENSION = ".tgz";
+    private static final String SUBMIT_BUTTON_ID = "vc-submit-btn";
+    private static final int TWO_SECONDS_TIMEOUT = 2;
+
     private VspValidationPage() {
         super();
     }
@@ -127,9 +140,63 @@ public class VspValidationPage extends GeneralPageElements {
         GeneralUIUtils.ultimateWait();
     }
 
+    public static boolean isSubmitButtonEnabled() {
+        return !GeneralUIUtils.isElementDisabled(SUBMIT_BUTTON_ID);
+    }
+
+    public static boolean hasHelmAttachmentsAnyWarnings() {
+        return GeneralUIUtils.getWebElementsListByTestID(ATTACHMENTS_NODE_ID)
+            .stream()
+            .filter(webElement -> hasAttachmentFileExtension(webElement, HELM_ATTACHMENT_EXTENSION))
+            .anyMatch(VspValidationPage::elementHasWarningCount);
+    }
+
+    public static boolean hasHelmAttachmentsAnyError() {
+        return GeneralUIUtils.getWebElementsListByTestID(ATTACHMENTS_NODE_ID)
+            .stream()
+            .filter(webElement -> hasAttachmentFileExtension(webElement, HELM_ATTACHMENT_EXTENSION))
+            .anyMatch(VspValidationPage::elementHasErrorCount);
+    }
+
+    public static boolean isVspAttachmentsValidationPage() {
+        WebElement webElementByTestID = GeneralUIUtils.getWebElementByTestID(
+            ATTACHMENTS_TAB_VALIDATION, TWO_SECONDS_TIMEOUT);
+        return webElementByTestID != null && webElementByTestID.getAttribute("class").contains(
+            SDC_TAB_ACTIVE_CLASS_NAME);
+    }
+
+    public static void navigateToVspAttachmentsValidationPage() {
+        GeneralUIUtils.clickOnElementByTestId(SOFTWARE_PRODUCT_ATTACHMENTS);
+        GeneralUIUtils.clickOnElementByTestId(ATTACHMENTS_TAB_VALIDATION);
+    }
+
+    private static boolean elementHasWarningCount(WebElement webElement) {
+        try {
+            webElement.findElement(By.xpath(VALIDATION_WARNING_COUNT));
+            return true;
+        } catch (NoSuchElementException ex) {
+            return false;
+        }
+    }
+
+    private static boolean elementHasErrorCount(WebElement webElement) {
+        try {
+            webElement.findElement(By.xpath(VALIDATION_ERROR_COUNT));
+            return true;
+        } catch (NoSuchElementException ex) {
+            return false;
+        }
+    }
+
+    private static boolean hasAttachmentFileExtension(WebElement webElement, String extension) {
+        return webElement
+            .findElement(By.xpath(ATTACHMENT_NAME_TEST_ID))
+            .getText()
+            .endsWith(extension);
+    }
+
     private static List<WebElement> getChildElements(WebElement webElement) throws Exception {
         return webElement.findElements(By.xpath(".//*"));
     }
 
-
 }
index 04b2037..9ec9911 100644 (file)
@@ -3,6 +3,7 @@
  * SDC
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2021 Nokia. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -150,10 +151,23 @@ public class FileHandling {
     public static String getVnfRepositoryPath() {
         return getFilePath("VNFs");
     }
+
     public static String getCnfRepositoryPath() {
         return getFilePath("CNFs");
     }
 
+    public static String getCnfForHelmValidatorRepositoryPath() {
+        return getFilePath("CNFs/helm_validator");
+    }
+
+    public static String getCnfWithWarningForHelmValidatorRepositoryPath() {
+        return getFilePath("CNFs/helm_validator/with_warnings");
+    }
+
+    public static String getInvalidCnfForHelmValidatorRepositoryPath() {
+        return getFilePath("CNFs/helm_validator/invalid");
+    }
+
     public static String getUpdateVSPVnfRepositoryPath() {
         return getFilePath("UpdateVSP");
     }
index 349a9ee..a28a7c2 100644 (file)
Binary files a/integration-tests/src/test/resources/Files/CNFs/helm-package-valid.zip and b/integration-tests/src/test/resources/Files/CNFs/helm-package-valid.zip differ
diff --git a/integration-tests/src/test/resources/Files/CNFs/helm-package-valid_expect b/integration-tests/src/test/resources/Files/CNFs/helm-package-valid_expect
new file mode 100644 (file)
index 0000000..8923fa7
--- /dev/null
@@ -0,0 +1 @@
+"third.tgz":[{"level":"WARNING","message":"WARNING: [HELM VALIDATOR]: [WARNING] templates/: directory not found"}]
diff --git a/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/one_error_two_files.zip b/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/one_error_two_files.zip
new file mode 100644 (file)
index 0000000..fe7925f
Binary files /dev/null and b/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/one_error_two_files.zip differ
diff --git a/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/one_error_two_files_expect b/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/one_error_two_files_expect
new file mode 100644 (file)
index 0000000..d4b2ef4
--- /dev/null
@@ -0,0 +1 @@
+"one_error.tgz":[{"level":"ERROR","message":"ERROR: [HELM VALIDATOR]: Error: template: mychartname/templates/test.yaml:2:18: executing \"mychartname/templates/test.yaml\" at <.Values.image.repository>: nil pointer evaluating interface {}.repository"},{"level":"WARNING","message":"WARNING: [HELM VALIDATOR]: [ERROR] templates/: template: mychartname/templates/test.yaml:2:18: executing \"mychartname/templates/test.yaml\" at <.Values.image.repository>: nil pointer evaluating interface {}.repository"}]
diff --git a/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/package_invalid_nil_pointer_render_error.zip b/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/package_invalid_nil_pointer_render_error.zip
new file mode 100644 (file)
index 0000000..851ee27
Binary files /dev/null and b/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/package_invalid_nil_pointer_render_error.zip differ
diff --git a/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/package_invalid_nil_pointer_render_error_expect b/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/package_invalid_nil_pointer_render_error_expect
new file mode 100644 (file)
index 0000000..b8d9318
--- /dev/null
@@ -0,0 +1 @@
+"one-lint-one-render-error-apiVersion-v2.tgz":[{"level":"ERROR","message":"ERROR: [HELM VALIDATOR]: Error: template: mychartname/templates/test.yaml:2:18: executing \"mychartname/templates/test.yaml\" at <.Values.image.repository>: nil pointer evaluating interface {}.repository"},{"level":"WARNING","message":"WARNING: [HELM VALIDATOR]: [ERROR] templates/: template: mychartname/templates/test.yaml:2:18: executing \"mychartname/templates/test.yaml\" at <.Values.image.repository>: nil pointer evaluating interface {}.repository"}]
diff --git a/integration-tests/src/test/resources/Files/CNFs/helm_validator/package_valid.zip b/integration-tests/src/test/resources/Files/CNFs/helm_validator/package_valid.zip
new file mode 100644 (file)
index 0000000..abe94e6
Binary files /dev/null and b/integration-tests/src/test/resources/Files/CNFs/helm_validator/package_valid.zip differ
diff --git a/integration-tests/src/test/resources/Files/CNFs/helm_validator/valid_two_files.zip b/integration-tests/src/test/resources/Files/CNFs/helm_validator/valid_two_files.zip
new file mode 100644 (file)
index 0000000..508f3f8
Binary files /dev/null and b/integration-tests/src/test/resources/Files/CNFs/helm_validator/valid_two_files.zip differ
diff --git a/integration-tests/src/test/resources/Files/CNFs/helm_validator/with_warnings/one_warning_two_files.zip b/integration-tests/src/test/resources/Files/CNFs/helm_validator/with_warnings/one_warning_two_files.zip
new file mode 100644 (file)
index 0000000..76530d4
Binary files /dev/null and b/integration-tests/src/test/resources/Files/CNFs/helm_validator/with_warnings/one_warning_two_files.zip differ
diff --git a/integration-tests/src/test/resources/Files/CNFs/helm_validator/with_warnings/one_warning_two_files_expect b/integration-tests/src/test/resources/Files/CNFs/helm_validator/with_warnings/one_warning_two_files_expect
new file mode 100644 (file)
index 0000000..6e895ae
--- /dev/null
@@ -0,0 +1 @@
+"one_warning.tgz":[{"level":"WARNING","message":"WARNING: [HELM VALIDATOR]: [WARNING] templates/: directory not found"}]
index e69785d..01d4095 100644 (file)
@@ -5,6 +5,12 @@
   <parameter name="makeToscaValidation" value="true"/>
   <test name="HelmValidatorTests">
     <classes>
+      <class name="org.onap.sdc.backend.ci.tests.sanity.Onboard">
+        <methods>
+          <include name="onboardCNFWithHelmValidatorTest"/>
+          <include name="onboardCNFWithHelmValidatorShouldFailTest"/>
+        </methods>
+      </class>
     </classes>
   </test>
 </suite>
index 9753798..8ce016d 100644 (file)
@@ -5,7 +5,12 @@
   <parameter name="makeToscaValidation" value="true"/>
   <test name="ExternalApis">
     <classes>
-      <class name="org.onap.sdc.backend.ci.tests.sanity.Onboard"/>
+      <class name="org.onap.sdc.backend.ci.tests.sanity.Onboard">
+        <methods>
+          <exclude name="onboardCNFWithHelmValidatorTest"/>
+          <exclude name="onboardCNFWithHelmValidatorShouldFailTest"/>
+        </methods>
+      </class>
     </classes>
   </test>
 </suite>
index ac44641..2e171e9 100644 (file)
@@ -6,6 +6,13 @@
 
   <test name="helmValidatorTests">
     <classes>
+      <class name="org.onap.sdc.frontend.ci.tests.execute.sanity.OnboardingFlowsUi">
+        <methods>
+          <include name="onapOnboardVSPWithHelmValidationSuccessfulWithoutErrorsAndWarnings"/>
+          <include name="onapOnboardVSPWithHelmValidationSuccessfulWithWarnings"/>
+          <include name="onapOnboardVSPWithHelmValidationUnsuccessfulWithErrors"/>
+        </methods>
+      </class>
     </classes>
   </test>
 </suite>
index 7cb5753..04a6841 100644 (file)
@@ -141,6 +141,7 @@ class HeatScreenView extends Component {
                     <Tab
                         tabId={tabsMapping.SETUP}
                         title="Setup"
+                        data-test-id="attachments-tab-setup"
                         disabled={
                             onboardingOrigin === onboardingOriginTypes.CSAR
                         }>
@@ -162,6 +163,7 @@ class HeatScreenView extends Component {
                     <Tab
                         tabId={tabsMapping.VALIDATION}
                         title="Validation"
+                        data-test-id="attachments-tab-validation"
                         disabled={
                             goToOverview &&
                             (!isValidationAvailable || candidateInProcess)