aboutsummaryrefslogtreecommitdiffstats
path: root/integration-tests
diff options
context:
space:
mode:
Diffstat (limited to 'integration-tests')
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiNetworkServiceUiTests.java6
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiOnboardVnfCnfUiTests.java19
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ImportVfcUiTest.java6
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java157
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/AddComponentPropertyFlow.java58
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/DownloadCsarArtifactFlow.java5
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/EditComponentPropertiesFlow.java (renamed from integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/EditServicePropertiesFlow.java)24
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/AddPropertyModal.java167
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentPage.java183
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/home/HomePage.java14
-rw-r--r--integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml3
11 files changed, 557 insertions, 85 deletions
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiNetworkServiceUiTests.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiNetworkServiceUiTests.java
index 22bde40682..b662148d8b 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiNetworkServiceUiTests.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiNetworkServiceUiTests.java
@@ -54,7 +54,7 @@ import org.onap.sdc.frontend.ci.tests.flow.CreateServiceFlow;
import org.onap.sdc.frontend.ci.tests.flow.CreateVlmFlow;
import org.onap.sdc.frontend.ci.tests.flow.CreateVspFlow;
import org.onap.sdc.frontend.ci.tests.flow.DownloadCsarArtifactFlow;
-import org.onap.sdc.frontend.ci.tests.flow.EditServicePropertiesFlow;
+import org.onap.sdc.frontend.ci.tests.flow.EditComponentPropertiesFlow;
import org.onap.sdc.frontend.ci.tests.flow.ImportVspFlow;
import org.onap.sdc.frontend.ci.tests.flow.composition.CreateRelationshipFlow;
import org.onap.sdc.frontend.ci.tests.flow.exception.UiTestFlowRuntimeException;
@@ -245,8 +245,8 @@ public class EtsiNetworkServiceUiTests extends SetupCDTest {
}
private void editProperties(final ServiceComponentPage serviceComponentPage, final Map<String, Object> propertyMap) {
- final EditServicePropertiesFlow editServicePropertiesFlow = new EditServicePropertiesFlow(webDriver, propertyMap);
- editServicePropertiesFlow.run(serviceComponentPage);
+ final EditComponentPropertiesFlow editComponentPropertiesFlow = new EditComponentPropertiesFlow(webDriver, propertyMap);
+ editComponentPropertiesFlow.run(serviceComponentPage);
}
private DownloadCsarArtifactFlow downloadCsarArtifact(final ServiceComponentPage serviceComponentPage) {
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiOnboardVnfCnfUiTests.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiOnboardVnfCnfUiTests.java
index 0ab0ae3e0a..c149b24907 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiOnboardVnfCnfUiTests.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiOnboardVnfCnfUiTests.java
@@ -80,7 +80,7 @@ public class EtsiOnboardVnfCnfUiTests extends SetupCDTest {
createVlmFlow.run();
}
- @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "etsiVnfCnfOnboardPackages")
+ @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "etsiVnfCnfOnboardPackages", dependsOnMethods = "createVlm")
public void onboardEtsiVnfCnfFlow(final String rootFolder, final String vnfFile) {
setLog(vnfFile);
final String resourceName = ElementFactory.addRandomSuffixToName(ElementFactory.getResourcePrefix());
@@ -92,8 +92,8 @@ public class EtsiOnboardVnfCnfUiTests extends SetupCDTest {
* Runs ETSI onboarding VNF/CNF UI flow
*
* @param resourceName VSP name
- * @param rootFolder VNF/CNF package location
- * @param vnfCnfFile file to be onboarded
+ * @param rootFolder VNF/CNF package location
+ * @param vnfCnfFile file to be onboarded
*/
private void runOnboardEtsiVnfCnf(final String resourceName, final String rootFolder, final String vnfCnfFile) {
final CreateVspFlow createVspFlow = new CreateVspFlow(webDriver, resourceName, vnfCnfFile, rootFolder);
@@ -132,6 +132,7 @@ public class EtsiOnboardVnfCnfUiTests extends SetupCDTest {
componentPage = compositionPage.goToGeneral();
componentPage.isLoaded();
componentPage.certifyComponent();
+ componentPage.isLoaded();
ExtentTestActions.takeScreenshot(Status.INFO, "service-certified",
String.format("Service '%s' was certified", serviceCreateData.getName()));
@@ -139,8 +140,8 @@ public class EtsiOnboardVnfCnfUiTests extends SetupCDTest {
}
private void downloadAndVerifyOnboardedPackage(final ComponentPage componentPage) {
- final DownloadCsarArtifactFlow downloadToscaCsarFlow = downloadToscaCsar(componentPage);
- final ToscaArtifactsPage toscaArtifactsPage = downloadToscaCsarFlow.getLandedPage()
+ final DownloadCsarArtifactFlow downloadCsarArtifactFlow = downloadToscaCsar(componentPage);
+ final ToscaArtifactsPage toscaArtifactsPage = downloadCsarArtifactFlow.getLandedPage()
.orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected ToscaArtifactsPage"));
assertThat("No artifact download was found", toscaArtifactsPage.getDownloadedArtifactList(), not(empty()));
final String downloadedCsarName = toscaArtifactsPage.getDownloadedArtifactList().get(0);
@@ -189,12 +190,12 @@ public class EtsiOnboardVnfCnfUiTests extends SetupCDTest {
/**
* Download the generated package
*
- * @return DownloadToscaCsarFlow
+ * @return DownloadCsarArtifactFlow
*/
private DownloadCsarArtifactFlow downloadToscaCsar(final ComponentPage componentPage) {
- final DownloadCsarArtifactFlow downloadToscaCsarFlow = new DownloadCsarArtifactFlow(webDriver);
- downloadToscaCsarFlow.run(componentPage);
- return downloadToscaCsarFlow;
+ final DownloadCsarArtifactFlow downloadCsarArtifactFlow = new DownloadCsarArtifactFlow(webDriver);
+ downloadCsarArtifactFlow.run(componentPage);
+ return downloadCsarArtifactFlow;
}
/**
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ImportVfcUiTest.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ImportVfcUiTest.java
index 8636101754..9c733f6aa5 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ImportVfcUiTest.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ImportVfcUiTest.java
@@ -27,7 +27,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.fail;
-import java.io.IOException;
import java.util.Arrays;
import java.util.Map;
import java.util.Optional;
@@ -63,7 +62,7 @@ public class ImportVfcUiTest extends SetupCDTest {
private ResourceCreateData vfCreateData;
@BeforeClass
- public void beforeClass() throws IOException {
+ public void beforeClass() {
filePath = FileHandling.getFilePath("VFCs/");
}
@@ -89,7 +88,8 @@ public class ImportVfcUiTest extends SetupCDTest {
// TC - Import hierarchy of VFCs
fileName = "org.openecomp.resource.VFC-child.yml";
createVfcFlow = createVFC(fileName);
- componentPage = createVfcFlow.getLandedPage().orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage"));
+ componentPage = createVfcFlow.getLandedPage()
+ .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage"));
componentPage.isLoaded();
componentPage.certifyComponent();
componentPage.isLoaded();
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java
index 1acf1e6eca..967a97b9e9 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java
@@ -36,12 +36,12 @@ import com.aventstack.extentreports.Status;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.stream.Collectors;
-import org.onap.sdc.backend.ci.tests.config.Config;
import org.onap.sdc.backend.ci.tests.data.providers.OnboardingDataProviders;
import org.onap.sdc.backend.ci.tests.datatypes.enums.ComponentType;
import org.onap.sdc.backend.ci.tests.datatypes.enums.ResourceCategoryEnum;
@@ -53,10 +53,12 @@ import org.onap.sdc.frontend.ci.tests.exception.UnzipException;
import org.onap.sdc.frontend.ci.tests.execute.setup.DriverFactory;
import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions;
import org.onap.sdc.frontend.ci.tests.execute.setup.SetupCDTest;
+import org.onap.sdc.frontend.ci.tests.flow.AddComponentPropertyFlow;
import org.onap.sdc.frontend.ci.tests.flow.AddNodeToCompositionFlow;
import org.onap.sdc.frontend.ci.tests.flow.CreateVfFlow;
import org.onap.sdc.frontend.ci.tests.flow.CreateVfcFlow;
import org.onap.sdc.frontend.ci.tests.flow.DownloadCsarArtifactFlow;
+import org.onap.sdc.frontend.ci.tests.flow.EditComponentPropertiesFlow;
import org.onap.sdc.frontend.ci.tests.flow.composition.CreateRelationshipFlow;
import org.onap.sdc.frontend.ci.tests.flow.exception.UiTestFlowRuntimeException;
import org.onap.sdc.frontend.ci.tests.pages.AttributesOutputsPage;
@@ -71,7 +73,6 @@ import org.openecomp.sdc.be.model.ComponentInstance;
import org.openqa.selenium.WebDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.yaml.snakeyaml.Yaml;
@@ -88,6 +89,8 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
private ComponentInstance networkFunctionInstance;
private ComponentInstance networkServiceInstance;
private AddNodeToCompositionFlow addNodeToCompositionFlow;
+ private ComponentPage componentPage;
+ private Map<String, String> propertiesToBeAddedMap;
@BeforeMethod
public void init() {
@@ -112,18 +115,27 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
}
@Test(dependsOnMethods = "importAndCertifyVfc")
- public void runServiceDesign() throws UnzipException {
+ public void createBaseService() throws UnzipException {
final CreateVfFlow createVfFlow = createVF();
addNodeToCompositionFlow = addNodeToCompositionAndCreateRelationship(createVfFlow);
final CompositionPage compositionPage = addNodeToCompositionFlow.getLandedPage()
.orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return CompositionPage"));
compositionPage.isLoaded();
- final ComponentPage componentPage = compositionPage.goToGeneral();
+ componentPage = compositionPage.goToGeneral();
componentPage.isLoaded();
- downloadAndVerifyCsarPackage(componentPage);
+ downloadAndVerifyCsarPackageAfterBaseServiceCreation(componentPage);
}
- @Test(dependsOnMethods = "runServiceDesign")
+ @Test(dependsOnMethods = "createBaseService")
+ public void addComponentProperty() throws UnzipException {
+ propertiesToBeAddedMap = loadPropertiesToAdd();
+ addProperty(propertiesToBeAddedMap);
+ componentPage = addValueToProperty(loadPropertiesToEdit());
+ componentPage.isLoaded();
+ downloadAndVerifyCsarPackageAfterAddProperty(componentPage);
+ }
+
+ @Test(dependsOnMethods = "createBaseService")
public void addOutputsToVF_test() throws UnzipException, IOException {
homePage.isLoaded();
final ComponentPage resourceCreatePage = (ComponentPage) homePage.clickOnComponent(vfResourceCreateData.getName());
@@ -320,12 +332,11 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
/**
* Creates a DependsOn relationship between the imported VFCs
- *
- * @param compositionPage Composition Page
+ * @param compositionPage Composition Page
* @param fromComponentInstanceName VFC - Network Function
- * @param fromCapability Node Capability
- * @param toComponentInstanceName VFC - Network Service
- * @param toRequirement Node Requirement
+ * @param fromCapability Node Capability
+ * @param toComponentInstanceName VFC - Network Service
+ * @param toRequirement Node Requirement
*/
private void createRelationship(final CompositionPage compositionPage, final String fromComponentInstanceName,
final String fromCapability, final String toComponentInstanceName, final String toRequirement) {
@@ -338,25 +349,86 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
fromComponentInstanceName, toComponentInstanceName));
}
- private void downloadAndVerifyCsarPackage(final ComponentPage componentPage) throws UnzipException {
- final DownloadCsarArtifactFlow downloadToscaCsarFlow = downloadToscaCsar(componentPage);
- final ToscaArtifactsPage toscaArtifactsPage = downloadToscaCsarFlow.getLandedPage()
+ /**
+ * Adds a property to the base service
+ * @param propertyMap map of properties to be added
+ */
+ private void addProperty(final Map<String, String> propertyMap) {
+ componentPage = (ComponentPage) homePage.clickOnComponent(vfResourceCreateData.getName());
+ componentPage.isLoaded();
+ final AddComponentPropertyFlow addComponentPropertyFlow = new AddComponentPropertyFlow(webDriver, propertyMap);
+ addComponentPropertyFlow.run(componentPage.goToPropertiesAssignment());
+ }
+
+ /**
+ * Edits a property to add a value
+ * @param propertyMap map of properties to be edited
+ */
+ private ComponentPage addValueToProperty(final Map<String, Object> propertyMap) {
+ final EditComponentPropertiesFlow editComponentPropertiesFlow = new EditComponentPropertiesFlow(webDriver, propertyMap);
+ return editComponentPropertiesFlow.run().orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ComponentPage"));
+ }
+
+ /**
+ * Downloads and verifies the generated tosca templates.
+ * @param componentPage the component page
+ * @throws UnzipException
+ */
+ private void downloadAndVerifyCsarPackageAfterBaseServiceCreation(final ComponentPage componentPage) throws UnzipException {
+ checkCsarPackage(downloadCsarPackage(componentPage));
+ }
+
+ /**
+ * Downloads and verifies if the generated Tosca template contains the expected properties.
+ * @throws UnzipException
+ * @param componentPage
+ */
+ private void downloadAndVerifyCsarPackageAfterAddProperty(final ComponentPage componentPage) throws UnzipException {
+ verifyPropertiesOnGeneratedTemplate(downloadCsarPackage(componentPage));
+ }
+
+ private String downloadCsarPackage(final ComponentPage componentPage) {
+ final DownloadCsarArtifactFlow downloadCsarArtifactFlow = downloadToscaCsar(componentPage);
+ final ToscaArtifactsPage toscaArtifactsPage = downloadCsarArtifactFlow.getLandedPage()
.orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected ToscaArtifactsPage"));
assertThat("No artifact download was found", toscaArtifactsPage.getDownloadedArtifactList(), not(empty()));
- final String downloadedCsarName = toscaArtifactsPage.getDownloadedArtifactList().get(0);
- checkCsarPackage(vfResourceCreateData.getName(), downloadedCsarName);
+ return toscaArtifactsPage.getDownloadedArtifactList().get(0);
}
/**
- * Download the generated package
- *
- * @return DownloadCsarArtifactFlow
+ * Downloads the generated CSAR package.
+ * @param componentPage the component page
+ * @return the Downloaded Tosca CSAR file
*/
private DownloadCsarArtifactFlow downloadToscaCsar(final ComponentPage componentPage) {
- final DownloadCsarArtifactFlow downloadToscaCsarFlow = new DownloadCsarArtifactFlow(webDriver);
- downloadToscaCsarFlow.setWaitBeforeGetTheFile(5);
- downloadToscaCsarFlow.run(componentPage);
- return downloadToscaCsarFlow;
+ final DownloadCsarArtifactFlow downloadCsarArtifactFlow = new DownloadCsarArtifactFlow(webDriver);
+ downloadCsarArtifactFlow.setWaitBeforeGetTheFile(5L);
+ downloadCsarArtifactFlow.run(componentPage);
+ return downloadCsarArtifactFlow;
+ }
+
+ /**
+ * Verifies if the generated Tosca template contains the expected properties.
+ * @param downloadedCsarName the downloaded csar file name
+ * @throws UnzipException
+ */
+ private void verifyPropertiesOnGeneratedTemplate(final String downloadedCsarName) throws UnzipException {
+ final Map<String, byte[]> filesFromZip = extractFilesFromCsar(downloadedCsarName);
+ final String virtualFunctionName = vfResourceCreateData.getName().replace("-", "").toLowerCase();
+ final String vfResourceTemplateFile = "Definitions/resource-" + virtualFunctionName + "-template-interface.yml";
+ final String interfaceTemplateFile = filesFromZip.keySet().stream()
+ .filter(filename -> filename.equalsIgnoreCase(vfResourceTemplateFile)).findFirst()
+ .orElseThrow(() -> new UiTestFlowRuntimeException(String.format("Resource template file not found %s", vfResourceTemplateFile)));
+ final byte[] toscaInterfaceTemplateGenerated = filesFromZip.get(interfaceTemplateFile);
+ assertThat("The Generated Tosca template should not be null", toscaInterfaceTemplateGenerated, is(notNullValue()));
+ final Map<String, Object> interfaceTemplateYamlMap = loadYamlObject(toscaInterfaceTemplateGenerated);
+ final Map<String, Object> nodeTypesYamlMap = getMapEntry(interfaceTemplateYamlMap, "node_types");
+ assertThat(String.format("'%s' should contain a node_types entry", interfaceTemplateYamlMap), nodeTypesYamlMap, is(notNullValue()));
+ final Map<String, Object> properties = (Map) nodeTypesYamlMap.values().stream().filter(stringObjectEntry -> stringObjectEntry != null)
+ .collect(Collectors.toList()).get(0);
+ final Map<String, Object> propertiesFoundMap = (Map<String, Object>) properties.get("properties");
+ assertThat(String.format("The generated template file %s should contain all added properties", vfResourceTemplateFile),
+ propertiesFoundMap.keySet().containsAll(propertiesToBeAddedMap.keySet()), is(true));
}
/**
@@ -364,14 +436,12 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
* the generated service template declared “tosca_simple_yaml_1_3” as its Tosca version,
* the generated csar contains the node type definitions for the added VFCs in the Definitions directory,
* the interface template contains the relationship declaration
- * @param vfResourceName VF created
* @param downloadedCsarName download Tosca CSAR filename
* @throws UnzipException
*/
- private void checkCsarPackage(final String vfResourceName, final String downloadedCsarName) throws UnzipException {
- final String downloadFolderPath = getConfig().getDownloadAutomationFolder();
- final Map<String, byte[]> filesFromZip = FileHandling.getFilesFromZip(downloadFolderPath, downloadedCsarName);
- final String virtualFunctionName = vfResourceName.replace("-", "").toLowerCase();
+ private void checkCsarPackage(final String downloadedCsarName) throws UnzipException {
+ final Map<String, byte[]> filesFromZip = extractFilesFromCsar(downloadedCsarName);
+ final String virtualFunctionName = vfResourceCreateData.getName().replace("-", "").toLowerCase();
final List<String> expectedDefinitionFolderFileList = getExpectedDefinitionFolderFileList(virtualFunctionName);
final Map<String, byte[]> expectedFilesFromZipMap = filesFromZip.entrySet().parallelStream()
.filter(key -> expectedDefinitionFolderFileList.stream()
@@ -386,6 +456,12 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
verifyNodesRelationship(expectedFilesFromZipMap, virtualFunctionName, filesFromZip);
}
+ private Map<String, byte[]> extractFilesFromCsar(final String downloadedCsarName) throws UnzipException {
+ final String downloadFolderPath = getConfig().getDownloadAutomationFolder();
+ final Map<String, byte[]> filesFromCsar = FileHandling.getFilesFromZip(downloadFolderPath, downloadedCsarName);
+ return filesFromCsar;
+ }
+
private void verifyGeneratedTemplate(final byte[] generatedTemplateData, final String generatedTemplateFile) {
final Map<String, Object> templateYamlMap = loadYamlObject(generatedTemplateData);
final boolean hasToscaDefinitionVersionEntry = templateYamlMap.containsKey("tosca_definitions_version");
@@ -446,4 +522,29 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
return new Yaml().load(new String(definitionYamlFile));
}
+ private Map<String, String> loadPropertiesToAdd() {
+ final Map<String, String> propertyMap = new HashMap<>();
+ propertyMap.put("property1", "string");
+ propertyMap.put("property2", "integer");
+ propertyMap.put("property3", "boolean");
+ propertyMap.put("property4", "list");
+ propertyMap.put("property5", "map");
+ propertyMap.put("property6", "scalar-unit.size");
+ return propertyMap;
+ }
+
+ private Map<String, Object> loadPropertiesToEdit() {
+ final Map<String, Object> propertyMap = new HashMap<>();
+ propertyMap.put("property1", "Integration Test");
+ propertyMap.put("property2", 100);
+ propertyMap.put("property3", Boolean.TRUE);
+ propertyMap.put("property4", Arrays.asList("PropListV1", "PropListV2", "PropListV3"));
+ final Map<String, String> stringMap = new HashMap<>();
+ stringMap.put("PropMapKey1", "PropMapValue1");
+ stringMap.put("PropMapKey2", "PropMapValue2");
+ stringMap.put("PropMapKey3", "PropMapValue3");
+ propertyMap.put("property5", stringMap);
+ propertyMap.put("property6", 500);
+ return propertyMap;
+ }
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/AddComponentPropertyFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/AddComponentPropertyFlow.java
new file mode 100644
index 0000000000..60a4c1fabd
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/AddComponentPropertyFlow.java
@@ -0,0 +1,58 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.sdc.frontend.ci.tests.flow;
+
+import com.aventstack.extentreports.Status;
+import java.util.Map;
+import java.util.Optional;
+import org.apache.commons.collections4.MapUtils;
+import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions;
+import org.onap.sdc.frontend.ci.tests.pages.PageObject;
+import org.onap.sdc.frontend.ci.tests.pages.ResourcePropertiesAssignmentPage;
+import org.openqa.selenium.WebDriver;
+
+public class AddComponentPropertyFlow extends AbstractUiTestFlow {
+
+ private final Map<String, String> propertiesMap;
+ private ResourcePropertiesAssignmentPage resourcePropertiesAssignmentPage;
+
+ public AddComponentPropertyFlow(final WebDriver webDriver, final Map<String, String> propertiesMap) {
+ super(webDriver);
+ this.propertiesMap = propertiesMap;
+ }
+
+ @Override
+ public Optional<ResourcePropertiesAssignmentPage> run(final PageObject... pageObjects) {
+ if (MapUtils.isEmpty(propertiesMap)) {
+ return Optional.of(resourcePropertiesAssignmentPage);
+ }
+ resourcePropertiesAssignmentPage = findParameter(pageObjects, ResourcePropertiesAssignmentPage.class);
+ resourcePropertiesAssignmentPage.isLoaded();
+ final String propertyNames = String.join(", ", propertiesMap.keySet());
+ extendTest.log(Status.INFO, "Adding properties " + propertyNames);
+ resourcePropertiesAssignmentPage.addProperties(propertiesMap);
+ ExtentTestActions.takeScreenshot(Status.INFO, "added-properties", String.format("Properties added: %s", propertyNames));
+ return Optional.of(this.resourcePropertiesAssignmentPage);
+ }
+
+ @Override
+ public Optional<? extends PageObject> getLandedPage() {
+ return Optional.empty();
+ }
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/DownloadCsarArtifactFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/DownloadCsarArtifactFlow.java
index e4fec34b68..573c57596c 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/DownloadCsarArtifactFlow.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/DownloadCsarArtifactFlow.java
@@ -57,15 +57,14 @@ public class DownloadCsarArtifactFlow extends AbstractUiTestFlow {
componentPage.isLoaded();
toscaArtifactsPage = componentPage.goToToscaArtifacts();
toscaArtifactsPage.isLoaded();
-
toscaArtifactsPage.clickOnDownload("Tosca Model");
+
final File downloadedCsar = waitAndGetDownloadedCsar();
assertThat("The downloaded CSAR should exist", downloadedCsar, is(notNullValue()));
assertThat("The downloaded CSAR should exist", downloadedCsar.exists(), is(true));
toscaArtifactsPage.addToDownloadedArtifactList(downloadedCsar.getName());
extendTest.log(Status.INFO, "Tosca CSAR was successfully downloaded");
- ExtentTestActions.takeScreenshot(Status.INFO, "tosca-artifact-csar-download", "TOSCA Artifact downloaded");
-
+ ExtentTestActions.takeScreenshot(Status.INFO, "tosca-artifact-csar-downloaded", "TOSCA Artifact Downloaded");
return Optional.of(toscaArtifactsPage);
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/EditServicePropertiesFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/EditComponentPropertiesFlow.java
index f7b255ddb4..28a63d7487 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/EditServicePropertiesFlow.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/EditComponentPropertiesFlow.java
@@ -24,28 +24,28 @@ import java.util.Map;
import java.util.Optional;
import org.apache.commons.collections4.MapUtils;
import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions;
+import org.onap.sdc.frontend.ci.tests.pages.ComponentPage;
import org.onap.sdc.frontend.ci.tests.pages.PageObject;
import org.onap.sdc.frontend.ci.tests.pages.ResourcePropertiesAssignmentPage;
-import org.onap.sdc.frontend.ci.tests.pages.ServiceComponentPage;
import org.openqa.selenium.WebDriver;
-public class EditServicePropertiesFlow extends AbstractUiTestFlow {
+public class EditComponentPropertiesFlow extends AbstractUiTestFlow {
private final Map<String, Object> propertiesMap;
- private ServiceComponentPage serviceComponentPage;
+ private ComponentPage componentPage;
- public EditServicePropertiesFlow(final WebDriver webDriver, final Map<String, Object> propertiesMap) {
+ public EditComponentPropertiesFlow(final WebDriver webDriver, final Map<String, Object> propertiesMap) {
super(webDriver);
this.propertiesMap = propertiesMap;
}
@Override
- public Optional<ServiceComponentPage> run(final PageObject... pageObjects) {
- serviceComponentPage = getParameter(pageObjects, ServiceComponentPage.class).orElseGet(() -> new ServiceComponentPage(webDriver));
- serviceComponentPage.isLoaded();
- final ResourcePropertiesAssignmentPage resourcePropertiesAssignmentPage = serviceComponentPage.goToPropertiesAssignment();
+ public Optional<ComponentPage> run(final PageObject... pageObjects) {
+ componentPage = getParameter(pageObjects, ComponentPage.class).orElseGet(() -> new ComponentPage(webDriver));
+ componentPage.isLoaded();
+ final ResourcePropertiesAssignmentPage resourcePropertiesAssignmentPage = componentPage.goToPropertiesAssignment();
if (MapUtils.isEmpty(propertiesMap)) {
- return Optional.of(serviceComponentPage);
+ return Optional.of(componentPage);
}
final String propertyNames = String.join(", ", propertiesMap.keySet());
ExtentTestActions.takeScreenshot(Status.INFO, "etsi-ns-edited-properties",
@@ -55,11 +55,11 @@ public class EditServicePropertiesFlow extends AbstractUiTestFlow {
resourcePropertiesAssignmentPage.saveProperties();
ExtentTestActions.takeScreenshot(Status.INFO, "etsi-ns-edited-properties",
String.format("Properties edited: %s", propertyNames));
- return Optional.of(serviceComponentPage);
+ return Optional.of(componentPage);
}
@Override
- public Optional<ServiceComponentPage> getLandedPage() {
- return Optional.ofNullable(serviceComponentPage);
+ public Optional<ComponentPage> getLandedPage() {
+ return Optional.ofNullable(componentPage);
}
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/AddPropertyModal.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/AddPropertyModal.java
new file mode 100644
index 0000000000..69680d27e6
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/AddPropertyModal.java
@@ -0,0 +1,167 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.sdc.frontend.ci.tests.pages;
+
+import com.google.common.collect.ImmutableSet;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.Select;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Handles the Property Creation Modal UI actions
+ */
+public class AddPropertyModal extends AbstractPageObject {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(AddPropertyModal.class);
+
+ private WebElement wrappingElement;
+
+ public AddPropertyModal(final WebDriver webDriver) {
+ super(webDriver);
+ timeoutInSeconds = 5;
+ }
+
+ @Override
+ public void isLoaded() {
+ LOGGER.debug("Finding element with xpath '{}'", XpathSelector.MODAL_XPATH.getXpath());
+ wrappingElement = waitForElementVisibility(XpathSelector.MODAL_XPATH.getXpath());
+ }
+
+ /**
+ * Fills the property modal creation.
+ * @param propertyName the property name to be created
+ * @param propertyType the property type to be selected
+ */
+ public void fillPropertyForm(final String propertyName, final String propertyType) {
+ fillName(propertyName);
+ selectType(propertyType);
+ if (isComplexType(propertyType)) {
+ setSchemaType();
+ }
+ fillDescription("Integration Test for adding property to a component");
+ }
+
+ /**
+ * Clicks on the create button.
+ */
+ public void clickOnCreate() {
+ clickElement(XpathSelector.SAVE_BTN);
+ }
+
+ /**
+ * Fills the Property name.
+ *
+ * @param propertyName the property name
+ */
+ private void fillName(final String propertyName) {
+ setInputValue(XpathSelector.NAME_TXT, propertyName);
+ }
+
+ /**
+ * Selects a property type based on the option value
+ *
+ * @param propertyType the option value
+ */
+ private void selectType(final String propertyType) {
+ setSelectValue(propertyType);
+ }
+
+ /**
+ * Fills the property creation description.
+ *
+ * @param description the property description
+ */
+ private void fillDescription(final String description) {
+ setInputValue(XpathSelector.DESCRIPTION_TXT, description);
+ }
+
+ /**
+ * Sets Input value
+ * @param inputTestId Data test id Xpath
+ * @param value Input value
+ */
+ private void setInputValue(final XpathSelector inputTestId, final String value) {
+ findSubElement(wrappingElement, By.xpath(inputTestId.getXpath())).sendKeys(value);
+ }
+
+ /**
+ * Selects the option from the given propertyType value
+ * @param propertyType option value to be selected
+ */
+ private void setSelectValue(final String propertyType) {
+ new Select(findElement(By.xpath(XpathSelector.PROPERTY_TYPE_SELECT.getXpath()))).selectByVisibleText(propertyType);
+ }
+
+ /**
+ * Sets Schema Type for complex types
+ */
+ private void setSchemaType() {
+ new Select(findElement(By.xpath(XpathSelector.PROPERTY_SCHEMA_TYPE_SELECT.getXpath()))).selectByVisibleText("string");
+ }
+
+ private void clickElement(final XpathSelector elementTestId) {
+ wrappingElement.findElement(By.xpath(elementTestId.getXpath())).click();
+ }
+
+ /**
+ * Verifies if the given property type is a complex type
+ * @param propertyType Property type
+ * @return true if property type is found
+ */
+ private boolean isComplexType(final String propertyType) {
+ return ImmutableSet.of("map", "list").contains(propertyType);
+ }
+
+ /**
+ * Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
+ */
+ @AllArgsConstructor
+ private enum XpathSelector {
+ MODAL_XPATH("custom-modal", "//div[contains(@class,'%s')]"),
+ NAME_TXT("property-name", "//input[@data-tests-id='%s']"),
+ PROPERTY_TYPE_SELECT("value-property-type", "//select[@data-tests-id='%s']"),
+ PROPERTY_SCHEMA_TYPE_SELECT("value-property-schema-type", "//select[@data-tests-id='%s']"),
+ PROPERTY_CHECKBOX("//checkbox[@data-tests-id='%s']"),
+ DESCRIPTION_TXT("property-description", "//textarea[@data-tests-id='%s']"),
+ SAVE_BTN("Save", "//*[@data-tests-id='%s']");
+
+ @Getter
+ private String id;
+ private final String xpathFormat;
+
+ XpathSelector(final String xpathFormat) {
+ this.xpathFormat = xpathFormat;
+ }
+
+ public String getXpath() {
+ return String.format(xpathFormat, id);
+ }
+
+ public String getXpath(final String... xpathParams) {
+ return String.format(xpathFormat, xpathParams);
+ }
+ }
+
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentPage.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentPage.java
index 0b38c9d2ad..dcc26121e3 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentPage.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentPage.java
@@ -21,11 +21,15 @@ package org.onap.sdc.frontend.ci.tests.pages;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import com.aventstack.extentreports.Status;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
+import java.util.concurrent.atomic.AtomicInteger;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions;
import org.onap.sdc.frontend.ci.tests.utilities.LoaderHelper;
import org.onap.sdc.frontend.ci.tests.utilities.NotificationComponent;
import org.onap.sdc.frontend.ci.tests.utilities.NotificationComponent.NotificationType;
@@ -33,9 +37,7 @@ import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
+import org.openqa.selenium.support.ui.Select;
/**
* Handles the Resource Properties Assignment Page UI actions
@@ -80,34 +82,114 @@ public class ResourcePropertiesAssignmentPage extends AbstractPageObject {
}
/**
+ * Gets the property row element for the given propertyName
+ * @param propertyName the property name
+ * @return the property row element
+ */
+ private WebElement getPropertyRow(String propertyName) {
+ final By propertyCheckboxLocator = By.xpath(XpathSelector.PROPERTY_CHECKBOX.getXpath(propertyName));
+ final WebElement propertyCheckbox = waitForElementVisibility(propertyCheckboxLocator, 5);
+ return propertyCheckbox.findElement(By.xpath("./../../.."));
+ }
+
+ /**
* Gets the value of a string TOSCA property.
- *
* @return the value of the property
*/
public String getStringPropertyValue(final String propertyName) {
waitPropertiesToLoad();
- final By propertyCheckboxLocator = By.xpath(XpathSelector.PROPERTY_CHECKBOX.getXpath(propertyName));
- final WebElement propertyCheckbox = waitForElementVisibility(propertyCheckboxLocator, 5);
- final WebElement propertyRow = propertyCheckbox.findElement(By.xpath("./../../.."));
- final WebElement propertyInput = propertyRow.findElement(By.xpath(XpathSelector.INPUT_PROPERTY.getXpath(propertyName)));
+ final WebElement propertyInput = getPropertyRow(propertyName).findElement(By.xpath(XpathSelector.INPUT_PROPERTY.getXpath(propertyName)));
return propertyInput.getAttribute("value");
}
/**
- * Set a value to a TOSCA string property.
+ * Sets a String value to a TOSCA property.
+ * @param propertyName the property name
+ * @param value property value to be set
*/
public void setStringPropertyValue(final String propertyName, final String value) {
if (value == null) {
return;
}
waitPropertiesToLoad();
- final By propertyCheckboxLocator = By.xpath(XpathSelector.PROPERTY_CHECKBOX.getXpath(propertyName));
- final WebElement propertyCheckbox = waitForElementVisibility(propertyCheckboxLocator, 5);
- final WebElement propertyRow = propertyCheckbox.findElement(By.xpath("./../../.."));
- final WebElement propertyInput = propertyRow.findElement(By.xpath(XpathSelector.INPUT_PROPERTY.getXpath(propertyName)));
- propertyInput.sendKeys(value);
+ getPropertyRow(propertyName).findElement(By.xpath(XpathSelector.INPUT_PROPERTY.getXpath(propertyName))).sendKeys(value);
}
+ /**
+ * Sets a boolean value to a TOSCA property.
+ * @param propertyName
+ */
+ private void setBooleanPropertyValue(final String propertyName) {
+ waitPropertiesToLoad();
+ new Select(getPropertyRow(propertyName).findElement(By.xpath(XpathSelector.SELECT_INPUT_PROPERTY.getXpath(propertyName)))).
+ selectByVisibleText("TRUE");
+ }
+
+ /**
+ * Sets a complex property type value to a TOSCA property. It handles List and Map
+ * @param propertyName the property name
+ * @param objectValue the property complex type value
+ */
+ public void setComplexPropertyValue(final String propertyName, final Object objectValue) {
+ if (objectValue == null) {
+ return;
+ }
+ waitPropertiesToLoad();
+ final WebElement addToListLink = getPropertyRow(propertyName)
+ .findElement(By.xpath(XpathSelector.PROPERTY_ADD_VALUE_COMPLEX_TYPE.getXpath(propertyName)));
+ if (objectValue instanceof List) {
+ setValueFromList(propertyName, (List<String>) objectValue, addToListLink);
+ }
+ if (objectValue instanceof Map) {
+ setValueFromMap(propertyName, (Map) objectValue, addToListLink);
+ }
+ }
+
+ /**
+ * Sets a value to a complex (List) property type.
+ * @param propertyName the property name
+ * @param values the List of values to be added to the given property name
+ * @param addToListLink the link to add the input value
+ */
+ private void setValueFromList(final String propertyName, final List<String> values, final WebElement addToListLink) {
+ AtomicInteger inputIndex = new AtomicInteger(0);
+ values.forEach(value -> {
+ addToListLink.click();
+ final WebElement propertyInput = addToListLink.findElement(By.xpath(XpathSelector.INPUT_PROPERTY_COMPLEX_TYPE_VALUE.getXpath(
+ String.valueOf(new StringBuilder(propertyName).append(".").append(inputIndex)))));
+ propertyInput.sendKeys(value);
+ inputIndex.getAndIncrement();
+ });
+ }
+
+ /**
+ * Sets a value to a complex (Map) property type.
+ * @param propertyName the property name
+ * @param values the Map of values to be added to the given property name
+ * @param addToListLink the link to add the input value
+ */
+ private void setValueFromMap(final String propertyName, final Map values, final WebElement addToListLink) {
+ AtomicInteger inputIndex = new AtomicInteger(0);
+ values.forEach((key, value) -> {
+ addToListLink.click();
+ WebElement propertyInput;
+ // Add Key
+ propertyInput = addToListLink.findElement(By.xpath(XpathSelector.INPUT_PROPERTY_COMPLEX_TYPE_KEY.getXpath(
+ String.valueOf(new StringBuilder(propertyName).append(".").append(inputIndex)))));
+ propertyInput.sendKeys(key.toString());
+ // Add Value
+ propertyInput = addToListLink.findElement(By.xpath(XpathSelector.INPUT_PROPERTY_COMPLEX_TYPE_VALUE.getXpath(
+ String.valueOf(new StringBuilder(propertyName).append(".").append(inputIndex)))));
+ propertyInput.sendKeys(value.toString());
+ inputIndex.getAndIncrement();
+ });
+ }
+
+ /**
+ * Sets a property value
+ * @param propertyName the property name
+ * @param value the property value
+ */
public void setPropertyValue(final String propertyName, final Object value) {
if (value == null) {
return;
@@ -124,7 +206,17 @@ public class ResourcePropertiesAssignmentPage extends AbstractPageObject {
}
if (value instanceof Boolean) {
- setStringPropertyValue(propertyName, ((Boolean) value).toString());
+ setBooleanPropertyValue(propertyName);
+ return;
+ }
+
+ if (value instanceof Map) {
+ setComplexPropertyValue(propertyName, value);
+ return;
+ }
+
+ if (value instanceof List) {
+ setComplexPropertyValue(propertyName, value);
return;
}
@@ -133,7 +225,7 @@ public class ResourcePropertiesAssignmentPage extends AbstractPageObject {
/**
* Checks if a property exists.
- *
+ * @param propertyName the property name
* @return the value of the property
*/
public boolean isPropertyPresent(final String propertyName) {
@@ -154,20 +246,67 @@ public class ResourcePropertiesAssignmentPage extends AbstractPageObject {
waitForElementInvisibility(By.xpath(XpathSelector.NO_DATA_MESSAGE.getXpath()), 5);
}
+ /**
+ * Saves a property
+ */
public void saveProperties() {
final WebElement saveBtn = waitForElementVisibility(By.xpath(XpathSelector.PROPERTY_SAVE_BTN.getXpath()));
assertTrue(saveBtn.isEnabled(), "Property save button should be enabled.");
saveBtn.click();
- loaderHelper.waitForLoader(20);
+ loaderHelper.waitForLoaderInvisibility(20);
notificationComponent.waitForNotification(NotificationType.SUCCESS, 20);
}
/**
+ * Adds a property
+ * @param propertiesMap the properties map to be added
+ */
+ public void addProperties(final Map<String, String> propertiesMap) {
+ waitPropertiesToLoad();
+ propertiesMap.forEach((propertyName, propertyType) -> {
+ final By addPropertyButtonLocator = By.xpath(XpathSelector.PROPERTY_ADD_BTN.getXpath());
+ waitForElementVisibility(addPropertyButtonLocator, 30);
+ final WebElement addPropertyRightColumn = findElement(By.xpath(XpathSelector.PROPERTY_ADD_RIGHT_COLUMN_DIV.getXpath()));
+ final WebElement propertyAddButton = addPropertyRightColumn.findElement(addPropertyButtonLocator);
+ assertTrue(propertyAddButton.isDisplayed(), "Property add button should be enabled.");
+ propertyAddButton.click();
+ createProperty(propertyName, propertyType);
+ verifyProperty(propertyName);
+ ExtentTestActions.takeScreenshot(Status.INFO, "added-property",
+ String.format("Property '%s' was created on component", propertyName));
+ });
+ }
+
+ /**
+ * Fills the creation property modal.
+ * @param propertyName the property name to be created
+ * @param propertyType the property type to be selected
+ */
+ private void createProperty(final String propertyName, final String propertyType) {
+ final AddPropertyModal addPropertyModal = new AddPropertyModal(webDriver);
+ addPropertyModal.isLoaded();
+ addPropertyModal.fillPropertyForm(propertyName, propertyType);
+ addPropertyModal.clickOnCreate();
+ }
+
+ /**
+ * Verifies if the added property is displayed on the UI.
+ * @param propertyName the property name to be found
+ */
+ private void verifyProperty(final String propertyName) {
+ final By propertyCheckboxLocator = By.xpath(XpathSelector.PROPERTY_CHECKBOX.getXpath(propertyName));
+ final WebElement propertyCheckbox = waitForElementVisibility(propertyCheckboxLocator, 5);
+ assertTrue(propertyCheckbox.isDisplayed(), String.format("%s Property should be displayed", propertyName));
+ assertTrue(this.getPropertyNamesAndTypes().containsKey(propertyName),
+ String.format("%s Property should be listed but found %s", propertyName, this.getPropertyNamesAndTypes().toString()));
+ }
+
+ /**
* Creates a map based on property names and data types
*/
public Map<String, String> getPropertyNamesAndTypes() {
waitPropertiesToLoad();
- final Map<String, String> namesAndTypes = new HashMap<String, String>();
+ final Map<String, String> namesAndTypes = new HashMap<>();
final List<WebElement> names = findElements(By.xpath(XpathSelector.PROPERTY_NAMES.getXpath()));
final List<WebElement> types = findElements(By.xpath(XpathSelector.PROPERTY_TYPES.getXpath()));
@@ -191,7 +330,13 @@ public class ResourcePropertiesAssignmentPage extends AbstractPageObject {
SOFTWARE_VERSION_INPUT("value-prop-software_versions", "//input[starts-with(@data-tests-id,'%s')]"),
PROPERTY_CHECKBOX("//checkbox[@data-tests-id='%s']"),
PROPERTY_SAVE_BTN("properties-save-button", "//button[@data-tests-id='%s']"),
+ PROPERTY_ADD_RIGHT_COLUMN_DIV("right-column", "//div[@class='%s']"),
+ PROPERTY_ADD_BTN("add-btn", "//div[contains(@class,'%s')]"),
+ PROPERTY_ADD_VALUE_COMPLEX_TYPE("//a[contains(@data-tests-id, 'add-to-list-%s')]"),
+ INPUT_PROPERTY_COMPLEX_TYPE_KEY("//input[contains(@data-tests-id, 'value-prop-key-%s')]"),
+ INPUT_PROPERTY_COMPLEX_TYPE_VALUE("//input[contains(@data-tests-id, 'value-prop-%s')]"),
INPUT_PROPERTY("//input[@data-tests-id='value-prop-%s']"),
+ SELECT_INPUT_PROPERTY("//select[@data-tests-id='value-prop-%s']"),
PROPERTY_TYPES("//*[contains(@data-tests-id, 'propertyType')]"),
PROPERTY_NAMES("//*[contains(@data-tests-id, 'propertyName')]");
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/home/HomePage.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/home/HomePage.java
index 73c0bb4d89..8b00341b02 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/home/HomePage.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/home/HomePage.java
@@ -20,8 +20,8 @@
package org.onap.sdc.frontend.ci.tests.pages.home;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.core.Is.is;
-import static org.testng.Assert.assertNotNull;
import java.time.Duration;
import lombok.AllArgsConstructor;
@@ -120,20 +120,20 @@ public class HomePage extends AbstractPageObject {
return new ResourceCreatePage(webDriver);
}
- public AbstractPageObject clickOnComponent(final String component) {
- final WebElement element = waitForElementVisibility(By.xpath(XpathSelector.COMPONENT.getXpath(component)));
+ public AbstractPageObject clickOnComponent(final String componentName) {
+ final WebElement element = waitForElementVisibility(By.xpath(XpathSelector.COMPONENT.getXpath(componentName)));
final WebElement componentTypeDiv = element.findElement(By.xpath("./../../../div[contains(@class, 'sdc-tile-header')]/div"));
- final String text = componentTypeDiv.getText();
+ final String componentType = componentTypeDiv.getText();
+ assertThat("The given component type should not be null", componentType, is(notNullValue()));
element.click();
- assertNotNull(text);
- switch (text) {
+ switch (componentType) {
case "S":
return new ServiceComponentPage(webDriver);
case "VF":
case "VFC":
return new ResourceCreatePage(webDriver);
default:
- throw new UnsupportedOperationException("Not yet implemented for " + text);
+ throw new UnsupportedOperationException("Not yet implemented for " + componentType);
}
}
diff --git a/integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml b/integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml
index 6098303598..97ec85b31a 100644
--- a/integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml
+++ b/integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml
@@ -38,7 +38,8 @@
<class name="org.onap.sdc.frontend.ci.tests.execute.sanity.ServiceTemplateDesignUiTests">
<methods>
<include name="importAndCertifyVfc"/>
- <include name="runServiceDesign"/>
+ <include name="createBaseService"/>
+ <include name="addComponentProperty"/>
<include name="addOutputsToVF_test"/>
</methods>
</class>