aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVodafone <onap@vodafone.com>2019-04-11 16:07:52 +0530
committerOren Kleks <orenkle@amdocs.com>2019-04-11 11:28:18 +0000
commit962b8610448d6cec8f12045e09b4adac3aefbf4c (patch)
tree2d7cfe1759ce9c3f20e7be928325722058e13948
parent55e8600f2f70f051f7bd897cd4926e258980ba07 (diff)
Functional Test Automation: VSP
Change-Id: I2090a0646c1f1c7077830dbf49294f9a711774e4 Issue-ID: SDC-2047 Co-authored-by: rahul.ghugikar@vodafone.com, soumyarup.paul@vodafone.com Signed-off-by: Vodafone <onap@vodafone.com>
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java2
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java31
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java38
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsUI.java151
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationPage.java100
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationResultsPage.java50
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java42
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUiUtils.java17
-rw-r--r--ui-ci/src/main/resources/ci/testSuites/onapUiSanity.xml1
-rw-r--r--ui-ci/src/main/resources/ci/testSuites/vspValidationAllFlows.xml21
10 files changed, 435 insertions, 18 deletions
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java
index f85f326f03..a4338fb272 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java
@@ -422,4 +422,6 @@ public interface Urls {
String DELETE_CAPABILITY = SDC_HTTP_METHOD + "://%s:%s/sdc2/rest/v1/catalog/%s/%s/capabilities/%s";
String GET_CAPABILITY = SDC_HTTP_METHOD + "://%s:%s/sdc2/rest/v1/catalog/%s/%s/capabilities/%s";
+ //VSP Validation Operation
+ final String VSP_VALIDATION_CONFIGURATION = SDC_HTTP_METHOD + "://%s:%s/onboarding-api/v1.0/externaltesting/config";
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java
index 4f03767a85..8b5f91b53d 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java
@@ -27,6 +27,7 @@ import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
import java.util.*;
@@ -138,6 +139,36 @@ public class OnboardingUtils {
return response;
}
+ public static String getVspValidationConfiguration() throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format(Urls.VSP_VALIDATION_CONFIGURATION, config.getOnboardingBeHost(), config.getOnboardingBePort());
+ Map<String, String> headersMap = prepareHeadersMap("cs0008");
+
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendGet(url, headersMap);
+ if(response.getErrorCode().intValue() == 200){
+ return ResponseParser.getValueFromJsonResponse(response.getResponse(), "enabled");
+ }
+ throw new Exception("Cannot get configuration file");
+ //return response;
+ }
+
+ public static String putVspValidationConfiguration(boolean value) throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format(Urls.VSP_VALIDATION_CONFIGURATION, config.getOnboardingBeHost(), config.getOnboardingBePort());
+ Map<String, String> headersMap = prepareHeadersMap("cs0008");
+
+ String body = String.format("{\"enabled\": \"%s\"}", value);
+
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendPut(url, body, headersMap);
+ if(response.getErrorCode().intValue() == 200){
+ return ResponseParser.getValueFromJsonResponse(response.getResponse(), "enabled");
+ }
+ throw new Exception("Cannot set configuration file");
+ //return response;
+ }
+
protected static Map<String, String> prepareHeadersMap(String userId) {
Map<String, String> headersMap = new HashMap<String, String>();
headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json");
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java
index 662b239044..3823611662 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java
@@ -1033,4 +1033,42 @@ public final class DataTestIdEnum {
}
}
+ public enum VspValidationPage {
+
+ VSP_VALIDATION_PAGE_NAVBAR("navbar-group-item-SOFTWARE_PRODUCT_VALIDATION"),
+ VSP_VALIDATION_PAGE_BREADCRUMBS("sub-menu-button-validation"),
+ VSP_VALIDATION_PAGE_PROCEED_TO_INPUTS_BUTTON("go-to-vsp-validation-inputs"),
+ VSP_VALIDATION_PAGE_PROCEED_TO_SETUP_BUTTON("go-to-vsp-validation-setup"),
+ VSP_VALIDATION_PAGE_INPUT("%s_%s_input"),
+ VSP_VALIDATION_PAGE_PROCEED_TO_RESULTS_BUTTON("proceed-to-validation-results-btn"),
+ VSP_VALIDATION_PAGE_COMPLIANCE_CHECKBOX_TREE("vsp-validation-compliance-checks-checkbox-tree"),
+ VSP_VALIDATION_PAGE_CERTIFICATION_CHECKBOX_TREE("vsp-validation-certifications-query-checkbox-tree");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private VspValidationPage(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum VspValidationResultsPage {
+
+ VSP_VALIDATION_RESULTS_PAGE_NAVBAR("navbar-group-item-SOFTWARE_PRODUCT_VALIDATION_RESULTS"),
+ VSP_VALIDATION_RESULTS_PAGE_BREADCRUMBS("sub-menu-button-validation results");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private VspValidationResultsPage(String value) {
+ this.value = value;
+ }
+ }
+
}
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 77b2a0a80a..419ca6e7ae 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
@@ -107,7 +107,158 @@ public class OnboardingFlowsUI extends SetupCDTest {
runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
}
+ @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders.class, dataProvider = "Single_VNF")
+ public void onapOnboardVSPValidationsSanityFlow(String filePath, String vnfFile) throws Exception, Throwable {
+ setLog(vnfFile);
+ String vspName = createNewVSP(filePath, vnfFile);
+ if(OnboardingUiUtils.getVspValidationCongiguration()){
+ goToVspScreen(true, vspName);
+
+ //check links are available
+ checkVspValidationLinksVisibility();
+
+ VspValidationPage.navigateToVspValidationPageUsingNavbar();
+ assertTrue("Next Button is enabled, it should have been disabled", VspValidationPage.checkNextButtonDisabled());
+ VspValidationResultsPage.navigateToVspValidationResultsPageUsingNavbar();
+ GeneralUIUtils.ultimateWait();
+ assertNotNull(GeneralUIUtils.findByText("No Validation Checks Performed"));
+ }
+ else {
+ goToVspScreen(true, vspName);
+
+ //check links are not available
+ checkVspValidationLinksInvisibility();
+ }
+ }
+
+
+ @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders.class, dataProvider = "Single_VNF")
+ public void onapOnboardVSPValidationsConfigurationChangeCheck(String filePath, String vnfFile) throws Exception, Throwable {
+ setLog(vnfFile);
+ String vspName = createNewVSP(filePath, vnfFile);
+ if(OnboardingUiUtils.getVspValidationCongiguration()){
+ goToVspScreen(true, vspName);
+ //check links are available
+ checkVspValidationLinksVisibility();
+
+ //change config
+ changeVspValidationConfig(false, vspName, OnboardingUiUtils.getVspValidationCongiguration());
+
+ //check links are not available
+ checkVspValidationLinksInvisibility();
+ }
+ else {
+ goToVspScreen(true, vspName);
+ //check links are not available
+ checkVspValidationLinksInvisibility();
+ changeVspValidationConfig(false, vspName, OnboardingUiUtils.getVspValidationCongiguration());
+
+ //check links are available
+ checkVspValidationLinksVisibility();
+ }
+ }
+
+ @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders.class, dataProvider = "Single_VNF")
+ public void onapOnboardVSPCertificationQueryFlow(String filePath, String vnfFile) throws Exception, Throwable {
+ 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 disabled", VspValidationPage.checkNextButtonDisabled());
+
+ if(VspValidationPage.checkCertificationQueryExists()){
+ VspValidationPage.clickCertificationQueryAll();
+ GeneralUIUtils.ultimateWait();
+ 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());
+ }
+ else {
+ assertNotNull(GeneralUIUtils.findByText("No Certifications Query are Available"));
+ }
+
+ }
+
+ @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders.class, dataProvider = "Single_VNF")
+ public void onapOnboardVSPComplianceCheckFlow(String filePath, String vnfFile) throws Exception, Throwable {
+ 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()){
+ VspValidationPage.clickComplianceChecksAll();
+ GeneralUIUtils.ultimateWait();
+ 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());
+ }
+ else {
+ assertNotNull(GeneralUIUtils.findByText("No Compliance Checks are Available"));
+ }
+
+ }
+
+ private void checkVspValidationLinksVisibility(){
+ //check links are available
+ assertTrue("Validation Link is not available", GeneralUIUtils.isElementVisibleByTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_NAVBAR.getValue()));
+ assertTrue("Validation Results Link is not available", GeneralUIUtils.isElementVisibleByTestId(DataTestIdEnum.VspValidationResultsPage.VSP_VALIDATION_RESULTS_PAGE_NAVBAR.getValue()));
+ }
+
+ private void checkVspValidationLinksInvisibility(){
+ //check links not available
+ assertTrue("Validation Link is still available", GeneralUIUtils.isElementInvisibleByTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_NAVBAR.getValue()));
+ assertTrue("Validation Results Link is still available", GeneralUIUtils.isElementInvisibleByTestId(DataTestIdEnum.VspValidationResultsPage.VSP_VALIDATION_RESULTS_PAGE_NAVBAR.getValue()));
+ }
+
+ private void changeVspValidationConfig(boolean isCurrentScreenCatalogPage, String vspName, boolean vspConfig) throws Exception{
+ //change config
+ OnboardingUiUtils.putVspValidationCongiguration(!vspConfig);
+ assertTrue(String.format("Failed to set Congiguration to %s", !vspConfig), OnboardingUiUtils.getVspValidationCongiguration() != vspConfig);
+
+ if(!isCurrentScreenCatalogPage){
+ GeneralUIUtils.refreshWebpage();
+ GeneralUIUtils.ultimateWait();
+ }
+
+ goToVspScreen(isCurrentScreenCatalogPage, vspName);
+
+ //revert the config
+ OnboardingUiUtils.putVspValidationCongiguration(vspConfig);
+ assertTrue(String.format("Failed to revert Congiguration to %s", vspConfig), OnboardingUiUtils.getVspValidationCongiguration() == vspConfig);
+ }
+
+ private void goToVspScreen(boolean isCurrentScreenCatalogPage, String vspName) throws Exception{
+ if(isCurrentScreenCatalogPage)
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.MainMenuButtons.ONBOARD_BUTTON.getValue());
+ GeneralUIUtils.clickOnElementByText(vspName);
+ GeneralUIUtils.waitForLoader();
+ }
+
+ private String createNewVSP(String filePath, String vnfFile) throws Exception {
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
+ return OnboardingUiUtils.createVSP(resourceReqDetails, vnfFile, filePath, getUser()).getName();
+ }
public void runOnboardToDistributionFlow(ResourceReqDetails resourceReqDetails, ServiceReqDetails serviceMetadata, String filePath, String vnfFile) throws Exception {
getExtendTest().log(Status.INFO, "Going to create resource with category: " + resourceReqDetails.getCategories().get(0).getName()
+ " subCategory: " + resourceReqDetails.getCategories().get(0).getSubcategories().get(0).getName()
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
new file mode 100644
index 0000000000..286ee46482
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationPage.java
@@ -0,0 +1,100 @@
+/**
+ * Copyright (c) 2019 Vodafone Group
+ *
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openecomp.sdc.ci.tests.pages;
+
+import com.aventstack.extentreports.Status;
+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.WebElement;
+import org.openqa.selenium.*;
+import static org.testng.AssertJUnit.assertTrue;
+
+
+import java.util.List;
+
+public class VspValidationPage extends GeneralPageElements {
+
+ public VspValidationPage() { super(); }
+
+ public static void navigateToVspValidationPageUsingNavbar() throws Exception {
+ clickOnElementUsingTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_NAVBAR);
+ }
+
+ public static void navigateToVspValidationPageUsingBreadcrumbs() throws Exception {
+ clickOnElementUsingTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_BREADCRUMBS);
+ }
+
+ public static void clickOnNextButton() throws Exception {
+ clickOnElementUsingTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_PROCEED_TO_INPUTS_BUTTON);
+ }
+
+ public static void clickOnBackButton() throws Exception {
+ clickOnElementUsingTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_PROCEED_TO_SETUP_BUTTON);
+ }
+
+ public static void clickOnSubmitButton() throws Exception {
+ clickOnElementUsingTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_PROCEED_TO_RESULTS_BUTTON);
+ }
+
+ 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){
+ checkboxes.get(0).click();
+ }
+ else
+ assertTrue("Checkbox Not Found", checkboxes.size() > 0);
+ }
+
+ 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)
+ checkboxes.get(checkboxes.size() - 1).click();
+ else
+ assertTrue("Checkbox Not Found", checkboxes.size() > 0);
+ }
+
+ public static boolean checkCertificationQueryExists() throws Exception {
+ 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);
+ }
+
+ 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);
+ }
+
+ 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<WebElement> getChildElements(WebElement webElement) throws Exception {
+ return webElement.findElements(By.xpath(".//*"));
+ }
+
+
+} \ No newline at end of file
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationResultsPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationResultsPage.java
new file mode 100644
index 0000000000..e71afd9d7b
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationResultsPage.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2019 Vodafone Group
+ *
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openecomp.sdc.ci.tests.pages;
+
+import com.aventstack.extentreports.Status;
+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.WebElement;
+import org.testng.AssertJUnit;
+
+import java.util.List;
+
+public class VspValidationResultsPage extends GeneralPageElements {
+
+ public VspValidationResultsPage() { super(); }
+
+ public static void navigateToVspValidationResultsPageUsingNavbar() throws Exception {
+ clickOnElementUsingTestId(DataTestIdEnum.VspValidationResultsPage.VSP_VALIDATION_RESULTS_PAGE_NAVBAR);
+ }
+
+ public static void navigateToVspValidationResultsPageUsingBreadcrumbs() throws Exception {
+ clickOnElementUsingTestId(DataTestIdEnum.VspValidationResultsPage.VSP_VALIDATION_RESULTS_PAGE_BREADCRUMBS);
+ }
+
+ public static boolean checkResultsExist() throws Exception {
+ List<WebElement> results = GeneralUIUtils.findElementsByXpath("//h4[contains(text(),'No Validation Checks Performed')]");
+ return results.size() == 0;
+ }
+
+ public static void clickOnElementUsingTestId(DataTestIdEnum.VspValidationResultsPage elementTestId) throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s", elementTestId.name()));
+ GeneralUIUtils.getWebElementByTestID(elementTestId.getValue()).click();
+ GeneralUIUtils.ultimateWait();
+ }
+} \ No newline at end of file
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java
index 30e68234ba..eed25908dd 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java
@@ -49,7 +49,7 @@ import static org.testng.AssertJUnit.assertTrue;
public final class GeneralUIUtils {
- private static final String DATA_TESTS_ID = "//*[@data-tests-id='";
+ private static final String DATA_TESTS_ID = "//*[@data-tests-id='%1$s' or @data-test-id='%1$s']";
private static final String COLOR_YELLOW_BORDER_4PX_SOLID_YELLOW = "color: yellow; border: 4px solid yellow;";
private static int timeOut = (int) (60 * 1.5);
@@ -105,11 +105,11 @@ public final class GeneralUIUtils {
public static WebElement getWebElementByTestID(String dataTestId, int timeout) {
WebDriverWait wait = new WebDriverWait(getDriver(), timeout);
- return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(DATA_TESTS_ID + dataTestId + "']")));
+ return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(String.format(DATA_TESTS_ID,dataTestId))));
}
public static boolean isWebElementExistByTestId(String dataTestId) {
- return getDriver().findElements(By.xpath(DATA_TESTS_ID + dataTestId + "']")).size() != 0;
+ return getDriver().findElements(By.xpath(String.format(DATA_TESTS_ID,dataTestId))).size() != 0;
}
public static boolean isWebElementExistByClass(String className) {
@@ -119,7 +119,7 @@ public final class GeneralUIUtils {
public static WebElement getInputElement(String dataTestId) {
try {
ultimateWait();
- return getDriver().findElement(By.xpath(DATA_TESTS_ID + dataTestId + "']"));
+ return getDriver().findElement(By.xpath(String.format(DATA_TESTS_ID,dataTestId)));
} catch (Exception e) {
return null;
}
@@ -127,7 +127,7 @@ public final class GeneralUIUtils {
public static List<WebElement> getInputElements(String dataTestId) {
ultimateWait();
- return getDriver().findElements(By.xpath(DATA_TESTS_ID + dataTestId + "']"));
+ return getDriver().findElements(By.xpath(String.format(DATA_TESTS_ID,dataTestId)));
}
@@ -165,7 +165,7 @@ public final class GeneralUIUtils {
public static List<WebElement> getWebElementsListByContainTestID(String dataTestId) {
try {
WebDriverWait wait = new WebDriverWait(getDriver(), 10);
- return wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath("//*[contains(@data-tests-id, '" + dataTestId + "')]")));
+ return wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath(String.format("//*[contains(@data-tests-id, '%1$s') or contains(@data-test-id, '%1$s')]",dataTestId))));
} catch (Exception e) {
return new ArrayList<WebElement>();
}
@@ -187,7 +187,7 @@ public final class GeneralUIUtils {
public static List<WebElement> getWebElementsListByTestID(String dataTestId) {
WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
- return wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath(DATA_TESTS_ID + dataTestId + "']")));
+ return wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath(String.format(DATA_TESTS_ID,dataTestId))));
}
public static List<WebElement> getWebElementsListByClassName(String className) {
@@ -199,13 +199,13 @@ public final class GeneralUIUtils {
public static Boolean isElementInvisibleByTestId(String dataTestId) {
WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
return wait.until(
- ExpectedConditions.invisibilityOfElementLocated(By.xpath(DATA_TESTS_ID + dataTestId + "']")));
+ ExpectedConditions.invisibilityOfElementLocated(By.xpath(String.format(DATA_TESTS_ID,dataTestId))));
}
public static Boolean isElementVisibleByTestId(String dataTestId) {
try {
WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
- return wait.until(ExpectedConditions.visibilityOfElementLocated((By.xpath(DATA_TESTS_ID + dataTestId + "']")))).isDisplayed();
+ return wait.until(ExpectedConditions.visibilityOfElementLocated((By.xpath(String.format(DATA_TESTS_ID,dataTestId))))).isDisplayed();
} catch (Exception e) {
return false;
}
@@ -218,22 +218,22 @@ public final class GeneralUIUtils {
public static void clickOnElementByTestIdWithoutWait(String dataTestId) {
WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
- wait.until(ExpectedConditions.elementToBeClickable(By.xpath(DATA_TESTS_ID + dataTestId + "']"))).click();
+ wait.until(ExpectedConditions.elementToBeClickable(By.xpath(String.format(DATA_TESTS_ID,dataTestId)))).click();
}
public static void clickOnElementByInputTestIdWithoutWait(String dataTestId) {
WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
- wait.until(ExpectedConditions.elementToBeClickable(By.xpath(DATA_TESTS_ID + dataTestId + "']//*"))).click();
+ wait.until(ExpectedConditions.elementToBeClickable(By.xpath(String.format(DATA_TESTS_ID, dataTestId) + "//*"))).click();
}
public static void clickOnElementByTestId(String dataTestId, int customTimeout) {
WebDriverWait wait = new WebDriverWait(getDriver(), customTimeout);
- wait.until(ExpectedConditions.elementToBeClickable(By.xpath(DATA_TESTS_ID + dataTestId + "']"))).click();
+ wait.until(ExpectedConditions.elementToBeClickable(By.xpath(String.format(DATA_TESTS_ID,dataTestId)))).click();
}
public static WebElement waitForElementVisibilityByTestId(String dataTestId) {
WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
- return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(DATA_TESTS_ID + dataTestId + "']")));
+ return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(String.format(DATA_TESTS_ID,dataTestId))));
}
public static Boolean waitForElementInVisibilityByTestId(String dataTestId) {
@@ -242,9 +242,9 @@ public final class GeneralUIUtils {
public static Boolean waitForElementInVisibilityByTestId(String dataTestId, int timeOut) {
WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
- boolean displayed = getDriver().findElements(By.xpath(DATA_TESTS_ID + dataTestId + "']")).isEmpty();
+ boolean displayed = getDriver().findElements(By.xpath(String.format(DATA_TESTS_ID,dataTestId))).isEmpty();
if (!displayed) {
- Boolean until = wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath(DATA_TESTS_ID + dataTestId + "'])")));
+ Boolean until = wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath(String.format(DATA_TESTS_ID,dataTestId))));
ultimateWait();
return until;
}
@@ -385,7 +385,7 @@ public final class GeneralUIUtils {
public static WebElement getSelectedElementFromDropDown(String dataTestId) {
GeneralUIUtils.ultimateWait();
- return new Select(getDriver().findElement(By.xpath(DATA_TESTS_ID + dataTestId + "']"))).getFirstSelectedOption();
+ return new Select(getDriver().findElement(By.xpath(String.format(DATA_TESTS_ID,dataTestId)))).getFirstSelectedOption();
}
public static boolean checkElementsCountInTable(int expectedElementsCount, Supplier<List<WebElement>> func) {
@@ -492,7 +492,7 @@ public final class GeneralUIUtils {
public static boolean isElementDisabled(WebElement element) {
return HighlightMyElement(element).getAttribute("class").contains("view-mode") ||
- element.getAttribute("class").contains("disabled");
+ element.getAttribute("class").contains("disabled") || element.getAttribute("disabled") != null;
}
public static boolean isElementDisabled(String dataTestId) {
@@ -613,7 +613,7 @@ public final class GeneralUIUtils {
public static void selectByValueTextContained(String dataTestsId, String value) {
- List<WebElement> options = GeneralUIUtils.getWebElementsListBy(By.xpath(String.format("//select[@data-tests-id='%s']//option[contains(@value,'%s')]", dataTestsId, value)));
+ List<WebElement> options = GeneralUIUtils.getWebElementsListBy(By.xpath(String.format("//select[@data-tests-id='%1$s' or @data-test-id='%1$s']//option[contains(@value,'%2$s')]", dataTestsId, value)));
boolean matched = false;
for (WebElement option : options) {
@@ -668,6 +668,12 @@ public final class GeneralUIUtils {
getDriver().navigate().to(url);
}
+ public static void refreshWebpage() throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Refreshing Webpage");
+ getDriver().navigate().refresh();
+ ultimateWait();
+ }
+
public static Object getElementPositionOnCanvas(String elementName) {
String scriptJS = "var cy = window.jQuery('.sdc-composition-graph-wrapper').cytoscape('get');\n" +
"var n = cy.nodes('[name=\"" + elementName + "\"]');\n" +
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUiUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUiUtils.java
index 9ef9515db3..6a91ed7c77 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUiUtils.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUiUtils.java
@@ -35,6 +35,7 @@ import org.openecomp.sdc.ci.tests.utils.general.VendorSoftwareProductRestUtils;
import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
+import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
import java.io.File;
import java.util.LinkedList;
@@ -80,6 +81,14 @@ public class OnboardingUiUtils {
}
}
+ public static boolean getVspValidationCongiguration() throws Exception{
+ return Boolean.parseBoolean(OnboardingUtils.getVspValidationConfiguration());
+ }
+
+ public static boolean putVspValidationCongiguration(boolean value) throws Exception{
+ return Boolean.parseBoolean(OnboardingUtils.putVspValidationConfiguration(value));
+ }
+
public static void doCheckOut() {
String lifeCycleState = ResourceGeneralPage.getLifeCycleState();
boolean needCheckout = lifeCycleState.equals(LifeCycleStateEnum.CHECKIN.getValue()) || lifeCycleState.equals(LifeCycleStateEnum.CERTIFIED.getValue());
@@ -130,6 +139,14 @@ public class OnboardingUiUtils {
DeploymentArtifactPage.verifyArtifactsExistInTable(filePath, updatedVnfFile);
}
+ public static VendorSoftwareProductObject createVSP(ResourceReqDetails resourceReqDetails, String vnfFile, String filepath, User user) throws Exception {
+ ExtentTestActions.log(Status.INFO, String.format("Going to onboard the VNF %s", vnfFile));
+ System.out.println(String.format("Going to onboard the VNF %s", vnfFile));
+
+ AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(user);
+ return VendorSoftwareProductRestUtils.createVSP(resourceReqDetails, vnfFile, filepath, user, amdocsLicenseMembers);
+ }
+
public static VendorSoftwareProductObject onboardAndValidate(ResourceReqDetails resourceReqDetails, String filepath, String vnfFile, User user) throws Exception {
ExtentTestActions.log(Status.INFO, String.format("Going to onboard the VNF %s", vnfFile));
diff --git a/ui-ci/src/main/resources/ci/testSuites/onapUiSanity.xml b/ui-ci/src/main/resources/ci/testSuites/onapUiSanity.xml
index de03d3d07e..3945088218 100644
--- a/ui-ci/src/main/resources/ci/testSuites/onapUiSanity.xml
+++ b/ui-ci/src/main/resources/ci/testSuites/onapUiSanity.xml
@@ -23,6 +23,7 @@
<class name="org.openecomp.sdc.ci.tests.execute.sanity.OnboardingFlowsUI">
<methods>
<include name="onapOnboardVNFflow"/>
+ <include name="onapOnboardVSPValidationsSanityFlow"/>
</methods>
</class>
diff --git a/ui-ci/src/main/resources/ci/testSuites/vspValidationAllFlows.xml b/ui-ci/src/main/resources/ci/testSuites/vspValidationAllFlows.xml
new file mode 100644
index 0000000000..fcbd41e9ae
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/testSuites/vspValidationAllFlows.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="1" data-provider-thread-count="1">
+
+ <parameter name="makeDistribution" value="false"/>
+
+ <test name="vspValidationAllFlows">
+ <classes>
+
+ <class name="org.openecomp.sdc.ci.tests.execute.sanity.OnboardingFlowsUI">
+ <methods>
+ <include name="onapOnboardVSPValidationsSanityFlow"/>
+ <include name="onapOnboardVSPValidationsConfigurationChangeCheck" />
+ <include name="onapOnboardVSPCertificationQueryFlow"/>
+ <include name="onapOnboardVSPComplianceCheckFlow"/>
+ </methods>
+ </class>
+
+ </classes>
+ </test> <!-- uitests -->
+</suite> <!-- uisuite --> \ No newline at end of file