summaryrefslogtreecommitdiffstats
path: root/integration-tests/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'integration-tests/src/test/java')
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java68
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/composition/CreateRelationshipFlow.java29
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/RelationshipWizardComponent.java7
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/RelationshipWizardInterfaceOperation.java133
4 files changed, 220 insertions, 17 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 d3ab9d49a1..10176b2a50 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
@@ -74,6 +74,7 @@ import org.onap.sdc.frontend.ci.tests.pages.ResourceCreatePage;
import org.onap.sdc.frontend.ci.tests.pages.ResourcePropertiesAssignmentPage;
import org.onap.sdc.frontend.ci.tests.pages.ResourcePropertiesPage;
import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionPage;
+import org.onap.sdc.frontend.ci.tests.pages.component.workspace.RelationshipWizardInterfaceOperation.InterfaceOperationsData;
import org.onap.sdc.frontend.ci.tests.pages.component.workspace.ToscaArtifactsPage;
import org.onap.sdc.frontend.ci.tests.pages.home.HomePage;
import org.onap.sdc.frontend.ci.tests.utilities.FileHandling;
@@ -100,7 +101,13 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
private AddNodeToCompositionFlow addNodeToCompositionFlow;
private ComponentPage componentPage;
private Map<String, String> propertiesToBeAddedMap;
+ private ResourceCreatePage resourceCreatePage;
private final List<ServiceDependencyProperty> substitutionFilterProperties = new ArrayList<>();
+ private final String interfaceName = "Standard";
+ private final String interfaceOperationName = "create";
+ private final String implementationName = "IntegrationTest";
+ private final String inputName = "InputName1";
+ private final String inputValue = "InputValue1";
@BeforeMethod
public void init() {
@@ -124,15 +131,11 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
}
@Test(dependsOnMethods = "importAndCertifyVfc")
- public void createBaseService() throws UnzipException {
+ public void createBaseService() {
final CreateVfFlow createVfFlow = createVF();
- addNodeToCompositionFlow = addNodeToCompositionAndCreateRelationship(createVfFlow);
- final CompositionPage compositionPage = addNodeToCompositionFlow.getLandedPage()
- .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return CompositionPage"));
- compositionPage.isLoaded();
- componentPage = compositionPage.goToGeneral();
- componentPage.isLoaded();
- downloadAndVerifyCsarPackageAfterBaseServiceCreation(componentPage);
+ resourceCreatePage = createVfFlow.getLandedPage()
+ .orElseThrow(() -> new UiTestFlowRuntimeException("Expecting a ResourceCreatePage"));
+ resourceCreatePage.isLoaded();
}
@Test(dependsOnMethods = "createBaseService")
@@ -145,6 +148,20 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
}
@Test(dependsOnMethods = "createBaseService")
+ public void addRelationshipTemplate() throws UnzipException {
+ homePage.isLoaded();
+ resourceCreatePage = (ResourceCreatePage) homePage.clickOnComponent(vfResourceCreateData.getName());
+ resourceCreatePage.isLoaded();
+ addNodeToCompositionFlow = addNodeToCompositionAndCreateRelationship();
+ final CompositionPage compositionPage = addNodeToCompositionFlow.getLandedPage()
+ .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return CompositionPage"));
+ compositionPage.isLoaded();
+ componentPage = compositionPage.goToGeneral();
+ componentPage.isLoaded();
+ downloadAndVerifyCsarPackage(componentPage);
+ }
+
+ @Test(dependsOnMethods = "addRelationshipTemplate")
public void addOutputsToVF_test() throws UnzipException, IOException {
homePage.isLoaded();
final ComponentPage resourceCreatePage = (ComponentPage) homePage.clickOnComponent(vfResourceCreateData.getName());
@@ -191,7 +208,6 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
checkTopologyTemplate(yamlObject);
}
-
@Test(dependsOnMethods = "addComponentProperty")
public void createSubstitutionFilter() throws Exception {
componentPage = (ComponentPage) homePage.clickOnComponent(vfResourceCreateData.getName());
@@ -340,10 +356,7 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
return vfcCreateData;
}
- private AddNodeToCompositionFlow addNodeToCompositionAndCreateRelationship(final CreateVfFlow createVfFlow) {
- final ResourceCreatePage resourceCreatePage = createVfFlow.getLandedPage()
- .orElseThrow(() -> new UiTestFlowRuntimeException("Expecting a ResourceCreatePage"));
- resourceCreatePage.isLoaded();
+ private AddNodeToCompositionFlow addNodeToCompositionAndCreateRelationship() {
assertThat(vfcs, hasSize(2));
final ComponentData parentComponent = new ComponentData();
parentComponent.setName(vfResourceCreateData.getName());
@@ -355,7 +368,7 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
networkFunction.setName(vfcs.get(0).getName());
networkFunction.setVersion("1.0");
networkFunction.setComponentType(ComponentType.RESOURCE);
- CompositionPage compositionPage = resourceCreatePage.goToComposition();
+ final CompositionPage compositionPage = resourceCreatePage.goToComposition();
compositionPage.isLoaded();
AddNodeToCompositionFlow addNodeToCompositionFlow = addNodeToComposition(parentComponent, networkFunction, compositionPage);
networkFunctionInstance = addNodeToCompositionFlow.getCreatedComponentInstance()
@@ -401,7 +414,8 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
final String fromCapability, final String toComponentInstanceName, final String toRequirement) {
final RelationshipInformation relationshipInformation =
new RelationshipInformation(fromComponentInstanceName, fromCapability, toComponentInstanceName, toRequirement);
- CreateRelationshipFlow createRelationshipFlow = new CreateRelationshipFlow(webDriver, relationshipInformation);
+ final CreateRelationshipFlow createRelationshipFlow = new CreateRelationshipFlow(webDriver, relationshipInformation,
+ new InterfaceOperationsData(interfaceName, interfaceOperationName, implementationName, inputName, inputValue));
createRelationshipFlow.run(compositionPage).orElseThrow(() -> new UiTestFlowRuntimeException("Expecting a CompositionPage instance"));
ExtentTestActions.takeScreenshot(Status.INFO, "relationship",
String.format("Relationship from networkFunctionInstance '%s' to networkServiceInstanceResource '%s' was created",
@@ -433,7 +447,7 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
* @param componentPage the component page
* @throws UnzipException
*/
- private void downloadAndVerifyCsarPackageAfterBaseServiceCreation(final ComponentPage componentPage) throws UnzipException {
+ private void downloadAndVerifyCsarPackage(final ComponentPage componentPage) throws UnzipException {
checkCsarPackage(downloadCsarPackage(componentPage));
}
@@ -537,6 +551,28 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
.anyMatch(vfc -> s.startsWith(vfc.getName()))).collect(Collectors.toList());
assertThat(String.format("'%s' should contain the node type definitions for the added VFCs '%s'", nodeTemplatesTosca, vfcs),
nodeTemplateFound, hasSize(vfcs.size()));
+ verifyRelationshipTemplate(topologyTemplateTosca, generatedTemplateFile);
+ }
+
+ private void verifyRelationshipTemplate(final Map<String, Object> topologyTemplateToscaMap, final String generatedTemplateFile) {
+ final Map<String, Object> relationshipTemplateMap = getMapEntry(topologyTemplateToscaMap, "relationship_templates");
+ assertThat(String.format("'%s' should contain a topology_template entry", generatedTemplateFile), relationshipTemplateMap,
+ is(notNullValue()));
+ final String result = Arrays.asList(relationshipTemplateMap.values()).toString();
+ assertThat(String.format("'%s' should contain a DependsOn relationship", relationshipTemplateMap),
+ result.contains("tosca.relationships.DependsOn"), is(true));
+ assertThat(String.format("'%s' should contain interfaces entry", relationshipTemplateMap), result.contains("interfaces"), is(true));
+ assertThat(String.format("'%s' should contain a Interface Name entry '%s'", relationshipTemplateMap, interfaceName),
+ result.contains(interfaceName), is(true));
+ assertThat(String.format("'%s' should contain a Interface Operation Name '%s'", relationshipTemplateMap, interfaceOperationName),
+ result.contains(interfaceOperationName), is(true));
+ assertThat(String.format("'%s' should contain Implementation Name '%s'", relationshipTemplateMap, implementationName),
+ result.contains(interfaceOperationName), is(true));
+ assertThat(String.format("'%s' should contain inputs entry", relationshipTemplateMap), result.contains("inputs"), is(true));
+ assertThat(String.format("'%s' should contain Input Name '%s'", relationshipTemplateMap, inputName), result.contains(inputName),
+ is(true));
+ assertThat(String.format("'%s' should contain Input Value '%s'", relationshipTemplateMap, inputValue), result.contains(inputValue),
+ is(true));
}
private void verifyNodesRelationship(final Map<String, byte[]> expectedFilesFromZipMap, final String virtualFunctionName,
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/composition/CreateRelationshipFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/composition/CreateRelationshipFlow.java
index 99fbc46ea2..a3fdc9884b 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/composition/CreateRelationshipFlow.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/composition/CreateRelationshipFlow.java
@@ -20,6 +20,7 @@
package org.onap.sdc.frontend.ci.tests.flow.composition;
import com.aventstack.extentreports.Status;
+import java.util.Objects;
import java.util.Optional;
import org.onap.sdc.frontend.ci.tests.datatypes.composition.RelationshipInformation;
import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions;
@@ -27,6 +28,8 @@ import org.onap.sdc.frontend.ci.tests.flow.AbstractUiTestFlow;
import org.onap.sdc.frontend.ci.tests.pages.PageObject;
import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionPage;
import org.onap.sdc.frontend.ci.tests.pages.component.workspace.RelationshipWizardComponent;
+import org.onap.sdc.frontend.ci.tests.pages.component.workspace.RelationshipWizardInterfaceOperation;
+import org.onap.sdc.frontend.ci.tests.pages.component.workspace.RelationshipWizardInterfaceOperation.InterfaceOperationsData;
import org.onap.sdc.frontend.ci.tests.pages.component.workspace.RelationshipWizardRequirementCapabilityComponent;
import org.openqa.selenium.WebDriver;
@@ -37,12 +40,20 @@ public class CreateRelationshipFlow extends AbstractUiTestFlow {
private final RelationshipInformation relationshipInformation;
private CompositionPage compositionPage;
+ private InterfaceOperationsData interfaceOperationsData;
public CreateRelationshipFlow(final WebDriver webDriver, final RelationshipInformation relationshipInformation) {
super(webDriver);
this.relationshipInformation = relationshipInformation;
}
+ public CreateRelationshipFlow(final WebDriver webDriver, final RelationshipInformation relationshipInformation,
+ final InterfaceOperationsData interfaceOperationsData) {
+ super(webDriver);
+ this.relationshipInformation = relationshipInformation;
+ this.interfaceOperationsData = interfaceOperationsData;
+ }
+
@Override
public Optional<? extends PageObject> run(final PageObject... pageObjects) {
compositionPage = findParameter(pageObjects, CompositionPage.class);
@@ -62,6 +73,10 @@ public class CreateRelationshipFlow extends AbstractUiTestFlow {
String.format("Selected requirement '%s'", relationshipInformation.getToRequirement()));
relationshipWizardComponent.clickOnNext();
relationshipWizardComponent.clickOnNext();
+ relationshipWizardComponent.clickOnAddOperation();
+ if (Objects.nonNull(interfaceOperationsData)) {
+ addInterfaceOperationAndInput(interfaceOperationsData);
+ }
relationshipWizardComponent.clickOnFinish();
compositionPage.isLoaded();
ExtentTestActions.takeScreenshot(Status.INFO, "relationship-created",
@@ -69,6 +84,20 @@ public class CreateRelationshipFlow extends AbstractUiTestFlow {
return Optional.of(compositionPage);
}
+ /**
+ * Adds an Interface Operation and Input to the relationship template
+ * @param interfaceOperationsData the Interface Operation data
+ */
+ private void addInterfaceOperationAndInput(final InterfaceOperationsData interfaceOperationsData) {
+ ExtentTestActions.takeScreenshot(Status.INFO, "add-interface-operation",
+ String.format("Adding Interface Operation on node '%s'", relationshipInformation.getFromNode()));
+ final RelationshipWizardInterfaceOperation relationshipWizardInterfaceOperation = new RelationshipWizardInterfaceOperation(webDriver);
+ relationshipWizardInterfaceOperation.isLoaded();
+ relationshipWizardInterfaceOperation.addInterfaceOperation(interfaceOperationsData);
+ ExtentTestActions.takeScreenshot(Status.INFO, "added-interface-operation",
+ String.format("Interface Operation added on node '%s'", relationshipInformation.getFromNode()));
+ }
+
@Override
public Optional<CompositionPage> getLandedPage() {
return Optional.of(compositionPage);
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/RelationshipWizardComponent.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/RelationshipWizardComponent.java
index 51ade3a2ec..47364ac2e3 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/RelationshipWizardComponent.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/RelationshipWizardComponent.java
@@ -56,6 +56,10 @@ public class RelationshipWizardComponent extends AbstractPageObject {
waitToBeClickable(XpathSelector.FINISH_BUTTON.getXpath()).click();
}
+ public void clickOnAddOperation() {
+ waitToBeClickable(XpathSelector.ADD_OPERATION_BUTTON.getXpath()).click();
+ }
+
/**
* Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
*/
@@ -66,7 +70,8 @@ public class RelationshipWizardComponent extends AbstractPageObject {
CANCEL_BUTTON(WIZARD_FOOTER.getXpath() + "//button[text()='Cancel']"),
NEXT_BUTTON(WIZARD_FOOTER.getXpath() + "//div[contains(@class, 'white-arrow-next')]/.."),
BACK_BUTTON(WIZARD_FOOTER.getXpath() + "//div[contains(@class, 'blue-arrow-back')]/.."),
- FINISH_BUTTON(WIZARD_FOOTER.getXpath() + "//button[contains(text(), 'Finish')]");
+ FINISH_BUTTON(WIZARD_FOOTER.getXpath() + "//button[contains(text(), 'Finish')]"),
+ ADD_OPERATION_BUTTON("//a[contains(@class,'add-param-link add-btn') and contains(text(), 'Add Operation')]");
@Getter
private final String xpath;
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/RelationshipWizardInterfaceOperation.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/RelationshipWizardInterfaceOperation.java
new file mode 100644
index 0000000000..076426fd5d
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/RelationshipWizardInterfaceOperation.java
@@ -0,0 +1,133 @@
+/*
+ * ============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.component.workspace;
+
+import com.aventstack.extentreports.Status;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions;
+import org.onap.sdc.frontend.ci.tests.pages.AbstractPageObject;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+
+/**
+ * Represents the relationship wizard dialog that is used to add interface operations to a node.
+ */
+public class RelationshipWizardInterfaceOperation extends AbstractPageObject {
+
+ public RelationshipWizardInterfaceOperation(final WebDriver webDriver) {
+ super(webDriver);
+ }
+
+ @Override
+ public void isLoaded() {
+ waitToBeClickable(By.xpath(XpathSelector.ADD_INPUT_BTN.getXPath()));
+ }
+
+ public void addInterfaceOperation(final InterfaceOperationsData interfaceOperationsData) {
+ selectInterfaceName(interfaceOperationsData.getInterfaceName());
+ selectOperationName(interfaceOperationsData.getOperationName());
+ fillImplementationName(interfaceOperationsData.getImplementation());
+ addInput();
+ fillInputName(interfaceOperationsData.getInputName());
+ fillInputValue(interfaceOperationsData.getInputValue());
+ saveInterfaceOperationAndInput();
+ }
+
+ private void selectInterfaceName(final String interfaceName) {
+ waitToBeClickable(By.xpath(XpathSelector.INTERFACE_AND_OPERATION_SVG_ICON.getXPath("interface-name-icon"))).click();
+ findElement(By.xpath(XpathSelector.INTERFACE_AND_OPERATION_DROPDOWN.getXPath(interfaceName))).click();
+ }
+
+ private void selectOperationName(final String interfaceOperationName) {
+ waitToBeClickable(By.xpath(XpathSelector.INTERFACE_AND_OPERATION_SVG_ICON.getXPath("operation-name-icon"))).click();
+ findElement(By.xpath(XpathSelector.INTERFACE_AND_OPERATION_DROPDOWN.getXPath(interfaceOperationName))).click();
+ }
+
+ private void fillImplementationName(final String implementationName) {
+ setInputField(By.xpath(XpathSelector.INTERFACE_OPERATION_IMPLEMENTATION_NAME_INPUT.getXPath()), implementationName);
+ }
+
+ private void fillInputName(final String inputName) {
+ setInputField(By.xpath(XpathSelector.FIELD_INPUT_NAME.getXPath()), inputName);
+ }
+
+ private void fillInputValue(final String inputValue) {
+ setInputField(By.xpath(XpathSelector.FIELD_INPUT_VALUE.getXPath()), inputValue);
+ }
+
+ private void setInputField(final By locator, final String value) {
+ if (value == null) {
+ return;
+ }
+ final WebElement webElement = findElement(locator);
+ webElement.clear();
+ webElement.sendKeys(value);
+ ExtentTestActions.takeScreenshot(Status.INFO, value, value);
+ }
+
+ private void addInput() {
+ waitToBeClickable(By.xpath(XpathSelector.ADD_INPUT_BTN.getXPath())).click();
+ }
+
+ private void saveInterfaceOperationAndInput() {
+ waitToBeClickable(By.xpath(XpathSelector.ADD_BTN.getXPath())).click();
+ }
+
+ @Getter
+ @AllArgsConstructor
+ public static class InterfaceOperationsData {
+
+ private final String interfaceName;
+ private final String operationName;
+ private final String implementation;
+ private final String inputName;
+ private final String inputValue;
+ }
+
+ @AllArgsConstructor
+ private enum XpathSelector {
+ INTERFACE_AND_OPERATION_SVG_ICON("//div[@data-tests-id='%s']"),
+ INTERFACE_AND_OPERATION_DROPDOWN("//li[@class='sdc-dropdown__option ng-star-inserted' and contains(text(), '%s')]"),
+ INTERFACE_OPERATION_DESCRIPTION_INPUT("//input[@data-tests-id='interface-operation-description']"),
+ INTERFACE_OPERATION_IMPLEMENTATION_NAME_INPUT("//input[@id='implementationInput']"),
+ ADD_INPUT_BTN("//a[contains(@class,'add-param-link add-btn') and contains(text(), 'Add Input')]"),
+ FIELD_INPUT_NAME("//input[@id='propertyAssignmentNameInput']"),
+ FIELD_INPUT_VALUE("//input[@id='propertyAssignmentValueInput']"),
+ ADD_BTN("//button[@data-tests-id='addBtn']");
+
+ @Getter
+ private String xPath;
+ private final String xpathFormat;
+
+ XpathSelector(final String xpathFormat) {
+ this.xpathFormat = xpathFormat;
+ }
+
+ public String getXPath() {
+ return String.format(xpathFormat, xPath);
+ }
+
+ public String getXPath(final String... xpathParams) {
+ return String.format(xpathFormat, xpathParams);
+ }
+ }
+}