From 8364c2d4c986e37cc1ea7e4120f5d13d14b03067 Mon Sep 17 00:00:00 2001 From: Vodafone Date: Wed, 24 Apr 2019 12:05:09 +0530 Subject: Functional Test Automation: VSP Change-Id: Ifd417c2ecfe1e82a69f64b3908c768fbd3b0af4f Issue-ID: SDC-2047 Co-authored-by: rahul.ghugikar@vodafone.com, soumyarup.paul@vodafone.com Signed-off-by: Vodafone --- .../ci/tests/execute/sanity/OnboardingFlowsUI.java | 63 +++++++++++++++++++++- .../sdc/ci/tests/pages/VspValidationPage.java | 14 ++++- 2 files changed, 74 insertions(+), 3 deletions(-) (limited to 'ui-ci/src/main/java/org') 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 6a02a917f8..3461aa8af5 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 @@ -194,6 +194,7 @@ public class OnboardingFlowsUI extends SetupCDTest { public void onapOnboardVSPComplianceCheckFlow(String filePath, String vnfFile) throws Exception, Throwable { 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()); @@ -211,9 +212,67 @@ public class OnboardingFlowsUI extends SetupCDTest { VspValidationPage.clickOnNextButton(); GeneralUIUtils.ultimateWait(); VspValidationPage.clickOnSubmitButton(); - GeneralUIUtils.waitForLoader(); + GeneralUIUtils.ultimateWait(); assertTrue("Results are not available", VspValidationResultsPage.checkResultsExist()); } + else { + assertNotNull(GeneralUIUtils.findByText(complianceNotAvailableLabel)); + } + + } + + @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders.class, dataProvider = "Single_VNF") + public void onapOnboardVSPComplianceCheckOperations(String filePath, String vnfFile) throws Exception { + setLog(vnfFile); + String vspName = createNewVSP(filePath, vnfFile); + if(!OnboardingUiUtils.getVspValidationCongiguration()){ + //change config to true to test the feature + changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration()); + } + else { + goToVspScreen(true, vspName); + } + + VspValidationPage.navigateToVspValidationPageUsingNavbar(); + assertTrue("Next Button is enabled, it should have been enabled", VspValidationPage.checkNextButtonDisabled()); + if(VspValidationPage.checkComplianceCheckExists()){ + assertTrue("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()); + VspValidationPage.clickComplianceChecksAll(); + GeneralUIUtils.ultimateWait(); + assertTrue("The selected tests are not deleted from the list", !VspValidationPage.checkSelectedComplianceCheckExists()); + } + else { + assertNotNull(GeneralUIUtils.findByText("No Compliance Checks are Available")); + } + + } + + @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders.class, dataProvider = "Single_VNF") + public void onapOnboardVSPCertificationQueryOperations(String filePath, String vnfFile) throws Exception { + setLog(vnfFile); + String vspName = createNewVSP(filePath, vnfFile); + if(!OnboardingUiUtils.getVspValidationCongiguration()){ + //change config to true to test the feature + changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration()); + } + else { + goToVspScreen(true, vspName); + } + + VspValidationPage.navigateToVspValidationPageUsingNavbar(); + assertTrue("Next Button is enabled, it should have been enabled", VspValidationPage.checkNextButtonDisabled()); + if(VspValidationPage.checkCertificationQueryExists()){ + assertTrue("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()); + VspValidationPage.clickCertificationQueryAll(); + GeneralUIUtils.ultimateWait(); + assertTrue("The selected tests are not deleted from the list", !VspValidationPage.checkSelectedCertificationQueryExists()); + } else { assertNotNull(GeneralUIUtils.findByText("No Compliance Checks are Available")); } @@ -253,7 +312,7 @@ public class OnboardingFlowsUI extends SetupCDTest { if(isCurrentScreenCatalogPage) GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.MainMenuButtons.ONBOARD_BUTTON.getValue()); GeneralUIUtils.clickOnElementByText(vspName); - GeneralUIUtils.waitForLoader(); + GeneralUIUtils.ultimateWait(); } private String createNewVSP(String filePath, String vnfFile) throws Exception { 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 286ee46482..739f172d37 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 @@ -86,13 +86,25 @@ public class VspValidationPage extends GeneralPageElements { return (orderedList.size() > 0); } + public static boolean checkSelectedComplianceCheckExists() throws Exception { + WebElement selectedTests = GeneralUIUtils.findElementsByXpath("//div[contains(text(),'Selected Compliance Tests')]/..//select[@class='validation-setup-selected-tests']").get(0); + List options = getChildElements(selectedTests); + return (!options.isEmpty()); + } + + public static boolean checkSelectedCertificationQueryExists() throws Exception { + WebElement selectedTests = GeneralUIUtils.findElementsByXpath("//div[contains(text(),'Selected Certifications Query')]/..//select[@class='validation-setup-selected-tests']").get(0); + List options = getChildElements(selectedTests); + return (!options.isEmpty()); + } + public static void clickOnElementUsingTestId(DataTestIdEnum.VspValidationPage elementTestId) throws Exception { SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s", elementTestId.name())); GeneralUIUtils.getWebElementByTestID(elementTestId.getValue()).click(); GeneralUIUtils.ultimateWait(); } - public static List getChildElements(WebElement webElement) throws Exception { + private static List getChildElements(WebElement webElement) throws Exception { return webElement.findElements(By.xpath(".//*")); } -- cgit 1.2.3-korg