Functional Test Automation: VSP 17/86117/3
authorVodafone <onap@vodafone.com>
Wed, 24 Apr 2019 06:35:09 +0000 (12:05 +0530)
committerOren Kleks <orenkle@amdocs.com>
Sun, 12 May 2019 11:01:37 +0000 (11:01 +0000)
Change-Id: Ifd417c2ecfe1e82a69f64b3908c768fbd3b0af4f
Issue-ID: SDC-2047
Co-authored-by: rahul.ghugikar@vodafone.com, soumyarup.paul@vodafone.com
Signed-off-by: Vodafone <onap@vodafone.com>
ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsUI.java
ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationPage.java
ui-ci/src/main/resources/ci/testSuites/vspValidationAllFlows.xml

index 6a02a91..3461aa8 100644 (file)
@@ -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 {
index 286ee46..739f172 100644 (file)
@@ -86,13 +86,25 @@ public class VspValidationPage extends GeneralPageElements {
         return (orderedList.size() > 0);\r
     }\r
 \r
+    public static boolean checkSelectedComplianceCheckExists() throws Exception {\r
+        WebElement selectedTests = GeneralUIUtils.findElementsByXpath("//div[contains(text(),'Selected Compliance Tests')]/..//select[@class='validation-setup-selected-tests']").get(0);\r
+        List<WebElement> options = getChildElements(selectedTests);\r
+        return (!options.isEmpty());\r
+    }\r
+\r
+    public static boolean checkSelectedCertificationQueryExists() throws Exception {\r
+        WebElement selectedTests = GeneralUIUtils.findElementsByXpath("//div[contains(text(),'Selected Certifications Query')]/..//select[@class='validation-setup-selected-tests']").get(0);\r
+        List<WebElement> options = getChildElements(selectedTests);\r
+        return (!options.isEmpty());\r
+    }\r
+\r
     public static void clickOnElementUsingTestId(DataTestIdEnum.VspValidationPage elementTestId) throws Exception {\r
         SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s", elementTestId.name()));\r
         GeneralUIUtils.getWebElementByTestID(elementTestId.getValue()).click();\r
         GeneralUIUtils.ultimateWait();\r
     }\r
 \r
-    public static List<WebElement> getChildElements(WebElement webElement) throws Exception {\r
+    private static List<WebElement> getChildElements(WebElement webElement) throws Exception {\r
         return webElement.findElements(By.xpath(".//*"));\r
     }\r
 \r
index fcbd41e..f159548 100644 (file)
         <class name="org.openecomp.sdc.ci.tests.execute.sanity.OnboardingFlowsUI">\r
             <methods>\r
                 <include name="onapOnboardVSPValidationsSanityFlow"/>\r
-                <include name="onapOnboardVSPValidationsConfigurationChangeCheck" />\r
+                <include name="onapOnboardVSPValidationsConfigurationChangeCheck"/>\r
                 <include name="onapOnboardVSPCertificationQueryFlow"/>\r
                 <include name="onapOnboardVSPComplianceCheckFlow"/>\r
+                <include name="onapOnboardVSPComplianceCheckOperations"/>\r
+                <include name="onapOnboardVSPCertificationQueryOperations"/>\r
             </methods>\r
         </class>\r
 \r