aboutsummaryrefslogtreecommitdiffstats
path: root/integration-tests
diff options
context:
space:
mode:
authorKrupaNagabhushan <krupa.nagabhushan@est.tech>2021-04-21 16:18:12 +0100
committerChristophe Closset <christophe.closset@intl.att.com>2021-06-08 06:57:14 +0000
commit75cfc6b2eb67ede9e1d0d69ba1c411b534df9000 (patch)
tree1d1d091d2015853f53073d63a0f7a95c8cd91812 /integration-tests
parentc81c95bf4879c805aa91c60653fc0e781ff2d4e9 (diff)
Integration Tests - Add inputs to a base service
Issue-ID: SDC-3609 Signed-off-by: KrupaNagabhushan <krupa.nagabhushan@est.tech> Change-Id: Iaf281999d29317e5c8caff2f2da765551571dc0f
Diffstat (limited to 'integration-tests')
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java52
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentInputTab.java17
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentPage.java37
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentTab.java25
-rw-r--r--integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml1
5 files changed, 129 insertions, 3 deletions
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 2fcd29fc7e..2a803ea298 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
@@ -64,8 +64,8 @@ import org.onap.sdc.frontend.ci.tests.flow.CreateDirectiveNodeFilterFlow;
import org.onap.sdc.frontend.ci.tests.flow.CreateSubstitutionFilterFlow;
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.DownloadToscaTemplateFlow;
+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;
@@ -308,6 +308,19 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
verifyToscaTemplateHasDirectiveNodeFilter(yaml, serviceDependencyProperty, vfcNameInComposition);
}
+ @Test(dependsOnMethods = "addComponentProperty")
+ public void declareInputFromProperties() throws Exception {
+ componentPage = (ComponentPage) homePage.clickOnComponent(vfResourceCreateData.getName());
+ componentPage.isLoaded();
+
+ ResourcePropertiesAssignmentPage propertiesAssignmentPage = componentPage.goToPropertiesAssignment();
+ propertiesAssignmentPage.isLoaded();
+
+ declareInputToBaseService(propertiesAssignmentPage, "property1");
+ declareInputToInstanceProperties(propertiesAssignmentPage, "resourceSubtype");
+ verifyToscaTemplateHasDeclareInput(downloadToscaTemplate());
+ }
+
private void checkMetadata(final Map<String, Object> map, final ResourceCreateData createdData) {
final Map<String, Object> metadata = getMapEntry(map, "metadata");
@@ -453,6 +466,23 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
return loadYamlObject(filesFromZip.get(resourceEntryOpt.get()));
}
+ private void declareInputToBaseService(ResourcePropertiesAssignmentPage propertiesAssignmentPage, String propertyName){
+ propertiesAssignmentPage.selectProperty(propertyName);
+ propertiesAssignmentPage.clickOnDeclareInput();
+ propertiesAssignmentPage.clickInputTab(propertyName);
+ propertiesAssignmentPage.isInputPresent(vfResourceCreateData.getName() + "_" + propertyName);
+ }
+
+ private void declareInputToInstanceProperties(ResourcePropertiesAssignmentPage propertiesAssignmentPage, String propertyName){
+ propertiesAssignmentPage.selectPropertiesTab();
+ propertiesAssignmentPage.loadCompositionTab();
+ propertiesAssignmentPage.loadComponentInstanceProperties(vfcs.get(0).getName().concat(" 0"));
+ propertiesAssignmentPage.selectProperty(propertyName);
+ propertiesAssignmentPage.clickOnDeclareInput();
+ propertiesAssignmentPage.clickInputTab(propertyName);
+ propertiesAssignmentPage.isInputPresent(vfResourceCreateData.getName() + "_" + vfcs.get(0).getName());
+ }
+
private CreateVfFlow createVF() {
final ResourceCreateData vfCreateData = createVfFormData();
final CreateVfFlow createVfFlow = new CreateVfFlow(webDriver, vfCreateData);
@@ -740,6 +770,26 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
return expectedDefinitionFolderFileList;
}
+ private void verifyToscaTemplateHasDeclareInput(Map<?, ?> yaml) {
+ assertNotNull(yaml, "No contents in TOSCA Template");
+ final Map<String, Object> toscaYaml = (Map<String, Object>) yaml;
+ final Map<String, Object> topologyTemplateTosca = getMapEntry(toscaYaml, "topology_template");
+ assertThat(String.format("'%s' should contain a topology_template entry", toscaYaml), topologyTemplateTosca,
+ notNullValue());
+ final Map<String, Object> inputsTosca = getMapEntry(topologyTemplateTosca, "inputs");
+ assertThat(String.format("'%s' should contain a inputs entry", toscaYaml), inputsTosca, notNullValue());
+ assertEquals(2, inputsTosca.keySet().stream()
+ .filter(s -> (s.contains("resourceSubtype") || s.contains("property1"))).count());
+ final Map<String, Object> substitutionMapping = getMapEntry(topologyTemplateTosca, "substitution_mappings");
+ assertThat(String.format("'%s' should contain a substitution_mappings entry", toscaYaml), substitutionMapping,
+ notNullValue());
+ final Map<String, Object> substitutionMappingProperties = getMapEntry(substitutionMapping, "properties");
+ assertThat(String.format("'%s' should contain a properties entry", toscaYaml), substitutionMappingProperties,
+ notNullValue());
+ assertEquals(2, substitutionMappingProperties.keySet().stream()
+ .filter(s -> (s.contains("resourceSubtype") || s.contains("property1"))).count());
+ }
+
private Map<String, Object> getMapEntry(final Map<?, ?> yamlObj, final String entryName) {
try {
return (Map<String, Object>) yamlObj.get(entryName);
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentInputTab.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentInputTab.java
index dedb084147..d1b07dc32f 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentInputTab.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentInputTab.java
@@ -85,6 +85,21 @@ public class ResourcePropertiesAssignmentInputTab extends AbstractPageObject {
}
/**
+ * Checks if a input exists.
+ * @param inputName the property name
+ * @return the value of the input
+ */
+ public boolean isInputPresent(final String inputName) {
+ isInputPropertiesTableLoaded();
+ try {
+ waitForElementVisibility(By.xpath(XpathSelector.INPUT_CHECKBOX.formatXpath(inputName)), 5);
+ } catch (final Exception ignored) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
* Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
*/
@AllArgsConstructor
@@ -92,6 +107,7 @@ public class ResourcePropertiesAssignmentInputTab extends AbstractPageObject {
private enum XpathSelector {
INPUT_TAB("//*[contains(@data-tests-id, 'Inputs') and contains(@class, 'active')]"),
PROPERTIES_TABLE("//div[contains(@class,'properties-table')]"),
+ INPUT_CHECKBOX("//checkbox[@data-tests-id='%s']"),
NO_DATA_MESSAGE("//div[contains(@class,'no-data') and text()='No data to display']"),
PROPERTY_SAVE_BTN("//button[@data-tests-id='properties-save-button']"),
PROPERTY_SAVE_MESSAGE("//div[contains(text(), 'Successfully saved')]"),
@@ -100,6 +116,7 @@ public class ResourcePropertiesAssignmentInputTab extends AbstractPageObject {
INPUT_PROPERTY_ADD_METADATA_BUTTON(INPUT_PROPERTY_TABLE_ROW.getXpath().concat("//a")),
INPUT_PROPERTY_METADATA_KEY_VALUE_PAIR(INPUT_PROPERTY_TABLE_ROW.getXpath().concat("//input"));
+ @Getter
private final String xpath;
public String formatXpath(Object... params) {
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 e69f1131e5..4db048be09 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
@@ -19,9 +19,11 @@
package org.onap.sdc.frontend.ci.tests.pages;
+import com.aventstack.extentreports.Status;
import java.util.List;
import java.util.Map;
+import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
@@ -77,6 +79,13 @@ public class ResourcePropertiesAssignmentPage extends AbstractPageObject {
return resourcePropertiesAssignmentTab.isPropertyPresent(propertyName);
}
+ public boolean isInputPresent(final String inputName) {
+ return resourcePropertiesAssignmentInputTab.isInputPresent(inputName);
+ }
+
+ /**
+ * Saves a property
+ */
public void saveProperties() {
resourcePropertiesAssignmentTab.saveProperties();
}
@@ -98,6 +107,31 @@ public class ResourcePropertiesAssignmentPage extends AbstractPageObject {
}
/**
+ * select property
+ */
+ public void selectProperty(String propertyName){
+ resourcePropertiesAssignmentTab.selectProperty(propertyName);
+ }
+
+ public void loadComponentInstanceProperties(final String instanceName){
+ resourcePropertiesAssignmentTab.loadComponentInstanceProperties(instanceName);
+ }
+
+ public void clickOnDeclareInput(){
+ resourcePropertiesAssignmentTab.clickOnDeclareInput();
+ }
+
+ public void loadCompositionTab(){
+ resourcePropertiesAssignmentTab.loadCompositionTab();
+ }
+
+ public void clickInputTab(String propertyName){
+ waitForElementVisibility(By.xpath(XpathSelector.DECLARE_NOTIFIFICATION.getXpath()));
+ ExtentTestActions.takeScreenshot(Status.INFO, "Declare-Input", String.format("Added declared input for property %s", propertyName));
+ selectInputTab();
+ }
+
+ /**
* Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
*/
@AllArgsConstructor
@@ -105,7 +139,8 @@ public class ResourcePropertiesAssignmentPage extends AbstractPageObject {
MAIN_DIV("w-sdc-main-right-container", "//div[@class='%s']"),
TITLE_DIV("tab-title", "//div[contains(@class,'%s') and contains(text(), 'Properties Assignment')]"),
PROPERTIES_TAB("//*[contains(@data-tests-id, 'Properties') and contains(@class, 'tab')]"),
- INPUT_TAB("//*[contains(@data-tests-id, 'Inputs') and contains(@class, 'tab')]");
+ INPUT_TAB("//*[contains(@data-tests-id, 'Inputs') and contains(@class, 'tab')]"),
+ DECLARE_NOTIFIFICATION("//div[@data-tests-id='Inputs']/div[contains(@class, 'tab-indication')]");
@Getter
private String id;
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentTab.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentTab.java
index b237b17272..32a20dd138 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentTab.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentTab.java
@@ -309,6 +309,26 @@ public class ResourcePropertiesAssignmentTab extends AbstractPageObject {
}
/**
+ * select property
+ */
+ public void selectProperty(String propertyName){
+ isPropertyPresent(propertyName);
+ waitToBeClickable(By.xpath(ResourcePropertiesAssignmentTab.XpathSelector.PROPERTY_CHECKBOX.getXpath(propertyName))).click();
+ }
+
+ public void loadComponentInstanceProperties(final String instanceName){
+ waitToBeClickable(By.xpath(ResourcePropertiesAssignmentTab.XpathSelector.INSTANCE_SPAN.getXpath(instanceName))).click();
+ }
+
+ public void clickOnDeclareInput(){
+ waitToBeClickable(By.xpath(ResourcePropertiesAssignmentTab.XpathSelector.DECLARE_INPUT_BTN.getXpath())).click();
+ }
+
+ public void loadCompositionTab(){
+ waitToBeClickable(By.xpath(ResourcePropertiesAssignmentTab.XpathSelector.COMPOSITION_TAB.getXpath())).click();
+ }
+
+ /**
* Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
*/
@AllArgsConstructor
@@ -329,7 +349,10 @@ public class ResourcePropertiesAssignmentTab extends AbstractPageObject {
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')]");
+ PROPERTY_NAMES("//*[contains(@data-tests-id, 'propertyName')]"),
+ DECLARE_INPUT_BTN("declare-button declare-input", "//button[@data-tests-id='%s']"),
+ COMPOSITION_TAB("Composition", "//div[contains(@class,'tab') and contains(text(), '%s')]"),
+ INSTANCE_SPAN("//span[@data-tests-id='%s']");
@Getter
private String id;
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 ce2436e796..73e369b6f1 100644
--- a/integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml
+++ b/integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml
@@ -41,6 +41,7 @@
<include name="addRelationshipTemplate"/>
<include name="addComponentProperty"/>
<include name="addOutputsToVF_test"/>
+ <include name="declareInputFromProperties"/>
<include name="createSubstitutionFilter"/>
<include name="createDirectiveNodeFilterTest"/>
<include name="updateInterfaceOperation"/>