diff options
author | atulpurohit <atul.purohit1@vodafone.com> | 2019-11-05 14:31:56 +0530 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-01-13 09:33:40 +0000 |
commit | 8b346842194edb8a9e8c4cd2764ae8ebbce988f0 (patch) | |
tree | 3ea20981d4cdd5858c4a99eb49c0370503c3c6cb /ui-ci/src/main/java | |
parent | 0ef638b2eb44c9f473e5ad8bea119845d968fde7 (diff) |
Refresh option in validation result page
Issue-ID: SDC-2585
Co-authored-by: nikhil.soni@vodafone.com
Signed-off-by: atulpurohit <atul.purohit1@vodafone.com>
Change-Id: I78f1385d219837c300cb33aff82b7459f137babb
Signed-off-by: atulpurohit <atul.purohit1@vodafone.com>
Diffstat (limited to 'ui-ci/src/main/java')
3 files changed, 90 insertions, 80 deletions
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<String> 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<String> 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<String> filesArr) { -// String[][] filesArrangeByPairs = null; -// -// List<String> versionOneFiles= null; -// List<String> 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<versionOneFiles.size() ; i++ ) -// { -// for (int j=0 ; j<versionTowFiles.size() ; j++ ) -// { -// -// } -// } -// -// return filesArrangeByPairs; -// } - } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsUi.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsUi.java index 595c43801c..9a28ee9078 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsUi.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsUi.java @@ -80,6 +80,20 @@ import org.testng.annotations.Test; public class OnboardingFlowsUi extends SetupCDTest { private static final Logger LOGGER = LoggerFactory.getLogger(OnboardingFlowsUi.class); + private static final String NO_TESTS_ARE_AVAILABLE = "No Tests are Available"; + private static final String NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_ENABLED = + "Next Button is enabled, it should have been enabled"; + private static final String NEXT_BUTTON_IS_DISABLED_IT_SHOULD_HAVE_BEEN_ENABLED = + "Next Button is disabled, it should have been enabled"; + private static final String RESULTS_ARE_NOT_AVAILABLE = "Results are not available"; + private static final String THE_TESTS_ARE_ALREADY_SELECTED_THE_LIST_SHOULD_INITIALLY_BE_EMPTY = + "The tests are already selected, the list should initially be empty"; + private static final String THE_SELECTED_TESTS_ARE_NOT_POPULATED_IN_THE_LIST = + "The selected tests are not populated in the list"; + private static final String THE_SELECTED_TESTS_ARE_NOT_DELETED_FROM_THE_LIST = + "The selected tests are not deleted from the list"; + private static final String NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_DISABLED = + "Next Button is enabled, it should have been disabled"; protected static String filePath = FileHandling.getVnfRepositoryPath(); private Boolean makeDistributionValue; @@ -142,10 +156,11 @@ public class OnboardingFlowsUi extends SetupCDTest { checkVspValidationLinksVisibility(); VspValidationPage.navigateToVspValidationPageUsingNavbar(); - assertTrue("Next Button is enabled, it should have been disabled", VspValidationPage.checkNextButtonDisabled()); + assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_DISABLED, + VspValidationPage.checkNextButtonDisabled()); VspValidationResultsPage.navigateToVspValidationResultsPageUsingNavbar(); GeneralUIUtils.ultimateWait(); - assertNotNull(GeneralUIUtils.findByText("No Validation Checks Performed")); + assertNotNull(GeneralUIUtils.findByText("No Test Performed")); } else { goToVspScreen(true, vspName); @@ -191,28 +206,28 @@ public class OnboardingFlowsUi extends SetupCDTest { goToVspScreen(true, vspName); } VspValidationPage.navigateToVspValidationPageUsingNavbar(); - assertTrue("Next Button is enabled, it should have been disabled", VspValidationPage.checkNextButtonDisabled()); + assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_DISABLED, VspValidationPage.checkNextButtonDisabled()); if (VspValidationPage.checkCertificationQueryExists()) { VspValidationPage.clickCertificationQueryAll(); GeneralUIUtils.ultimateWait(); - assertTrue("Next Button is disabled, it should have been enabled", !VspValidationPage.checkNextButtonDisabled()); + assertTrue(NEXT_BUTTON_IS_DISABLED_IT_SHOULD_HAVE_BEEN_ENABLED, + !VspValidationPage.checkNextButtonDisabled()); VspValidationPage.clickOnNextButton(); GeneralUIUtils.ultimateWait(); VspValidationPage.clickOnSubmitButton(); GeneralUIUtils.waitForLoader(); - assertTrue("Results are not available", VspValidationResultsPage.checkResultsExist()); + assertTrue(RESULTS_ARE_NOT_AVAILABLE, VspValidationResultsPage.checkResultsExist()); } else { assertNotNull(GeneralUIUtils.findByText("No Certifications Query are Available")); } } - @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF") + @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "Single_Vsp_Test_Csar") public void onapOnboardVSPComplianceCheckFlow(String filePath, String vnfFile) throws Exception { setLog(vnfFile); String vspName = createNewVSP(filePath, vnfFile); - final String complianceNotAvailableLabel = "No Compliance Checks are Available"; if (!OnboardingUiUtils.getVspValidationCongiguration()) { //change config to true to test the feature changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration()); @@ -221,19 +236,20 @@ public class OnboardingFlowsUi extends SetupCDTest { } VspValidationPage.navigateToVspValidationPageUsingNavbar(); - assertTrue("Next Button is enabled, it should have been enabled", VspValidationPage.checkNextButtonDisabled()); + assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_ENABLED, VspValidationPage.checkNextButtonDisabled()); if (VspValidationPage.checkComplianceCheckExists()) { VspValidationPage.clickComplianceChecksAll(); GeneralUIUtils.ultimateWait(); - assertFalse("Next Button is disabled, it should have been enabled", - VspValidationPage.checkNextButtonDisabled()); + assertFalse(NEXT_BUTTON_IS_DISABLED_IT_SHOULD_HAVE_BEEN_ENABLED, + VspValidationPage.checkNextButtonDisabled()); VspValidationPage.clickOnNextButton(); GeneralUIUtils.ultimateWait(); + VspValidationPage.loadVSPFile(filePath, vnfFile); VspValidationPage.clickOnSubmitButton(); GeneralUIUtils.ultimateWait(); - assertTrue("Results are not available", VspValidationResultsPage.checkResultsExist()); + assertTrue(RESULTS_ARE_NOT_AVAILABLE, VspValidationResultsPage.checkResultsExist()); } else { - assertNotNull(GeneralUIUtils.findByText(complianceNotAvailableLabel)); + assertNotNull(GeneralUIUtils.findByText(NO_TESTS_ARE_AVAILABLE)); } } @@ -250,19 +266,20 @@ public class OnboardingFlowsUi extends SetupCDTest { } VspValidationPage.navigateToVspValidationPageUsingNavbar(); - assertTrue("Next Button is enabled, it should have been enabled", VspValidationPage.checkNextButtonDisabled()); + assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_ENABLED, VspValidationPage.checkNextButtonDisabled()); if (VspValidationPage.checkComplianceCheckExists()) { - assertFalse("The tests are already selected, the list should initially be empty", - VspValidationPage.checkSelectedComplianceCheckExists()); + assertFalse(THE_TESTS_ARE_ALREADY_SELECTED_THE_LIST_SHOULD_INITIALLY_BE_EMPTY, + VspValidationPage.checkSelectedComplianceCheckExists()); VspValidationPage.clickComplianceChecksAll(); GeneralUIUtils.ultimateWait(); - assertTrue("The selected tests are not populated in the list", VspValidationPage.checkSelectedComplianceCheckExists()); + assertTrue(THE_SELECTED_TESTS_ARE_NOT_POPULATED_IN_THE_LIST, + VspValidationPage.checkSelectedComplianceCheckExists()); VspValidationPage.clickComplianceChecksAll(); GeneralUIUtils.ultimateWait(); - assertFalse("The selected tests are not deleted from the list", - VspValidationPage.checkSelectedComplianceCheckExists()); + assertFalse(THE_SELECTED_TESTS_ARE_NOT_DELETED_FROM_THE_LIST, + VspValidationPage.checkSelectedComplianceCheckExists()); } else { - assertNotNull(GeneralUIUtils.findByText("No Compliance Checks are Available")); + assertNotNull(GeneralUIUtils.findByText(NO_TESTS_ARE_AVAILABLE)); } } @@ -279,19 +296,19 @@ public class OnboardingFlowsUi extends SetupCDTest { } VspValidationPage.navigateToVspValidationPageUsingNavbar(); - assertTrue("Next Button is enabled, it should have been enabled", VspValidationPage.checkNextButtonDisabled()); + assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_ENABLED, VspValidationPage.checkNextButtonDisabled()); if (VspValidationPage.checkCertificationQueryExists()) { - assertFalse("The tests are already selected, the list should initially be empty", + assertFalse(THE_TESTS_ARE_ALREADY_SELECTED_THE_LIST_SHOULD_INITIALLY_BE_EMPTY, VspValidationPage.checkSelectedCertificationQueryExists()); VspValidationPage.clickCertificationQueryAll(); GeneralUIUtils.ultimateWait(); - assertTrue("The selected tests are not populated in the list", VspValidationPage.checkSelectedCertificationQueryExists()); + assertTrue(THE_SELECTED_TESTS_ARE_NOT_POPULATED_IN_THE_LIST, VspValidationPage.checkSelectedCertificationQueryExists()); VspValidationPage.clickCertificationQueryAll(); GeneralUIUtils.ultimateWait(); - assertFalse("The selected tests are not deleted from the list", + assertFalse(THE_SELECTED_TESTS_ARE_NOT_DELETED_FROM_THE_LIST, VspValidationPage.checkSelectedCertificationQueryExists()); } else { - assertNotNull(GeneralUIUtils.findByText("No Compliance Checks are Available")); + assertNotNull(GeneralUIUtils.findByText(NO_TESTS_ARE_AVAILABLE)); } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationPage.java index ae01e9c207..12b5251e81 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationPage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationPage.java @@ -17,15 +17,15 @@ package org.openecomp.sdc.ci.tests.pages; import com.aventstack.extentreports.Status; +import java.io.File; +import java.util.List; +import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; - -import java.util.List; - -import static org.testng.AssertJUnit.assertTrue; +import org.testng.Assert; public class VspValidationPage extends GeneralPageElements { @@ -53,25 +53,44 @@ public class VspValidationPage extends GeneralPageElements { clickOnElementUsingTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_PROCEED_TO_RESULTS_BUTTON); } + public static void loadVSPFile(String path, String filename) { + List<WebElement> 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<WebElement> 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<WebElement> checkboxes = GeneralUIUtils.findElementsByXpath("//div[@data-test-id='vsp-validation-compliance-checks-checkbox-tree']//label//span[@class='rct-checkbox']"); - if (checkboxes.size() > 0) { + List<WebElement> 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<WebElement> 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<WebElement> checkboxTreeDivs = getChildElements(parentDiv); List<WebElement> 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<WebElement> checkboxTreeDivs = getChildElements(parentDiv); List<WebElement> orderedList = getChildElements(checkboxTreeDivs.get(0)); - return (orderedList.size() > 0); + return (!orderedList.isEmpty()); } public static boolean checkSelectedComplianceCheckExists() throws Exception { |