aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--catalog-ui/src/app/ng2/components/logic/attributes-table/attributes-table.component.html2
-rw-r--r--catalog-ui/src/app/ng2/components/logic/attributes-table/attributes-table.component.less2
-rw-r--r--catalog-ui/src/app/ng2/components/logic/outputs-table/outputs-table.component.html3
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/AddOutputsUiTest.java312
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiOnboardVnfCnfUiTests.java14
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ImportVfcUiTest.java13
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java161
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/DownloadCsarArtifactFlow.java10
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/DownloadToscaCsarFlow.java79
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/DownloadToscaTemplateFlow.java9
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/AttributesOutputsPage.java133
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/AttributesTabComponent.java103
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ComponentPage.java14
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/OutputsTabComponent.java109
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceCreatePage.java16
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceLeftSideMenu.java11
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionHierarchyComponent.java78
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionPage.java6
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/home/HomePage.java16
-rw-r--r--integration-tests/src/test/resources/Files/VFCs/1-VFC-NetworkFunction.yaml2
-rw-r--r--integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml1
21 files changed, 957 insertions, 137 deletions
diff --git a/catalog-ui/src/app/ng2/components/logic/attributes-table/attributes-table.component.html b/catalog-ui/src/app/ng2/components/logic/attributes-table/attributes-table.component.html
index 1115620594..e9360421a6 100644
--- a/catalog-ui/src/app/ng2/components/logic/attributes-table/attributes-table.component.html
+++ b/catalog-ui/src/app/ng2/components/logic/attributes-table/attributes-table.component.html
@@ -41,7 +41,7 @@
<ng-container *ngFor="let instanceId of feAttributesMap | keys; trackBy:vspId">
<!-- Icon & Instance Name -->
<div class="table-rows-header white-sub-header" *ngIf="feInstanceNamesMap">
- <span [ngClass]="['prop-instance-icon', feInstanceNamesMap[instanceId].iconClass, 'small']"></span>
+ <span [ngClass]="['attrib-instance-icon', feInstanceNamesMap[instanceId].iconClass, 'small']"></span>
{{feInstanceNamesMap[instanceId].name}}
<div class="sprite-new archive-label" *ngIf="feInstanceNamesMap[instanceId].originArchived == true"></div>
</div>
diff --git a/catalog-ui/src/app/ng2/components/logic/attributes-table/attributes-table.component.less b/catalog-ui/src/app/ng2/components/logic/attributes-table/attributes-table.component.less
index 26ae0d4d74..0a20bfa3f9 100644
--- a/catalog-ui/src/app/ng2/components/logic/attributes-table/attributes-table.component.less
+++ b/catalog-ui/src/app/ng2/components/logic/attributes-table/attributes-table.component.less
@@ -235,7 +235,7 @@
}
}
- .prop-instance-icon {
+ .attrib-instance-icon {
vertical-align: middle;
margin-right: 7px;
&.defaulticon.small {
diff --git a/catalog-ui/src/app/ng2/components/logic/outputs-table/outputs-table.component.html b/catalog-ui/src/app/ng2/components/logic/outputs-table/outputs-table.component.html
index fbae0e45e6..e0e7e2ea1a 100644
--- a/catalog-ui/src/app/ng2/components/logic/outputs-table/outputs-table.component.html
+++ b/catalog-ui/src/app/ng2/components/logic/outputs-table/outputs-table.component.html
@@ -87,8 +87,7 @@
[constraints]="getConstraints(output)">
</dynamic-element>
<div class="delete-button-container">
- <span *ngIf="output.instanceUniqueId && !readonly" class="sprite-new delete-btn"
- (click)="openDeleteModal(output)"></span>
+ <span [attr.data-tests-id]="'delete-'+output.name" *ngIf="output.instanceUniqueId && !readonly" class="sprite-new delete-btn" (click)="openDeleteModal(output)"></span>
</div>
</div>
</div>
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/AddOutputsUiTest.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/AddOutputsUiTest.java
new file mode 100644
index 0000000000..c0773139c2
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/AddOutputsUiTest.java
@@ -0,0 +1,312 @@
+/*
+ * ============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.execute.sanity;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.anEmptyMap;
+import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.Matchers.emptyString;
+import static org.hamcrest.Matchers.not;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
+import com.aventstack.extentreports.Status;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Optional;
+import org.onap.sdc.backend.ci.tests.datatypes.enums.ComponentType;
+import org.onap.sdc.backend.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.onap.sdc.backend.ci.tests.utils.general.ElementFactory;
+import org.onap.sdc.frontend.ci.tests.datatypes.ComponentData;
+import org.onap.sdc.frontend.ci.tests.datatypes.ResourceCreateData;
+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.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.exception.UiTestFlowRuntimeException;
+import org.onap.sdc.frontend.ci.tests.pages.AttributesOutputsPage;
+import org.onap.sdc.frontend.ci.tests.pages.ComponentPage;
+import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionPage;
+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;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openqa.selenium.WebDriver;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.yaml.snakeyaml.Yaml;
+
+public class AddOutputsUiTest extends SetupCDTest {
+
+ private String filePath;
+ private WebDriver webDriver;
+ private HomePage homePage;
+ private ResourceCreateData vfcCreateData;
+ private ResourceCreateData vfCreateData;
+
+ @BeforeClass
+ public void beforeClass() throws IOException {
+ filePath = FileHandling.getFilePath("VFCs/");
+ }
+
+ @Test
+ public void addOutputsToVF_test() throws UnzipException, IOException {
+ ComponentPage resourceCreatePage;
+ webDriver = DriverFactory.getDriver();
+ homePage = new HomePage(webDriver);
+ // TC - Import VFC with root namespace
+ String fileName = "org.openecomp.resource.VFC-root.yml";
+ CreateVfcFlow createVfcFlow = createVFC(fileName);
+
+ resourceCreatePage = createVfcFlow.getLandedPage().orElseThrow(() -> new UiTestFlowRuntimeException("Expecting a ResourceCreatePage"));
+ resourceCreatePage.isLoaded();
+ resourceCreatePage.certifyComponent();
+ resourceCreatePage.isLoaded();
+
+ Map<String, Object> yamlObject = downloadToscaArtifact(resourceCreatePage);
+ checkMetadata(yamlObject, vfcCreateData);
+ checkNodeTypes(yamlObject);
+
+ homePage = homePage.getTopNavComponent().clickOnHome();
+ homePage.isLoaded();
+
+ // TC - Import hierarchy of VFCs
+ fileName = "org.openecomp.resource.VFC-child.yml";
+ createVfcFlow = createVFC(fileName);
+ resourceCreatePage = createVfcFlow.getLandedPage().orElseThrow(() -> new UiTestFlowRuntimeException("Expecting a ResourceCreatePage"));
+ resourceCreatePage.isLoaded();
+ resourceCreatePage.certifyComponent();
+ resourceCreatePage.isLoaded();
+
+ yamlObject = downloadToscaArtifact(resourceCreatePage);
+ checkMetadata(yamlObject, vfcCreateData);
+ checkNodeTypes(yamlObject);
+
+ homePage = homePage.getTopNavComponent().clickOnHome();
+ homePage.isLoaded();
+
+ // TC - Import VFC with interface inputs
+ // TC - Import VFC with attributes
+ final CreateVfFlow createVfFlow = createVF();
+
+ final AddNodeToCompositionFlow addNodeToCompositionFlow = addNodeToCompositionFlow(resourceCreatePage);
+ final CompositionPage compositionPage = addNodeToCompositionFlow.getLandedPage()
+ .orElseThrow(() -> new UiTestFlowRuntimeException("Expecting a CompositionPage"));
+ compositionPage.isLoaded();
+ resourceCreatePage = compositionPage.goToGeneral();
+ resourceCreatePage.isLoaded();
+
+ final AttributesOutputsPage attributesOutputsPage = resourceCreatePage.goToAttributesOutputs();
+ attributesOutputsPage.isLoaded();
+
+ final ComponentInstance createdComponentInstance = addNodeToCompositionFlow.getCreatedComponentInstance()
+ .orElseThrow(() -> new UiTestFlowRuntimeException("Expecting a ComponentInstance"));
+
+ attributesOutputsPage.clickOnAttributeNavigation(createdComponentInstance.getName());
+ assertTrue(attributesOutputsPage.isAttributePresent("test_1"));
+ attributesOutputsPage.declareOutput("test_1");
+ attributesOutputsPage.clickOnOutputsTab();
+ assertTrue(attributesOutputsPage.isOutputPresent("test_1"));
+
+ attributesOutputsPage.clickOnAttributesTab();
+ assertTrue(attributesOutputsPage.isAttributePresent("test_2"));
+ attributesOutputsPage.declareOutput("test_2");
+ attributesOutputsPage.clickOnOutputsTab();
+ assertTrue(attributesOutputsPage.isOutputPresent("test_2"));
+
+ attributesOutputsPage.clickOnAttributesTab();
+ assertTrue(attributesOutputsPage.isAttributePresent("test_3"));
+ attributesOutputsPage.declareOutput("test_3");
+ attributesOutputsPage.clickOnOutputsTab();
+ assertTrue(attributesOutputsPage.isOutputPresent("test_3"));
+
+ attributesOutputsPage.deleteOutput(createdComponentInstance.getName() + "_test_2");
+ attributesOutputsPage.clickOnAttributesTab();
+ assertTrue(attributesOutputsPage.isAttributePresent("test_2"));
+ attributesOutputsPage.clickOnOutputsTab();
+ assertTrue(attributesOutputsPage.isOutputDeleted("test_2"));
+
+ attributesOutputsPage.clickOnAttributesTab();
+ ExtentTestActions.addScreenshot(Status.INFO, "AttributesTab", "The Attribute's list : ");
+
+ attributesOutputsPage.clickOnOutputsTab();
+ ExtentTestActions.addScreenshot(Status.INFO, "OutputsTab", "The Output's list : ");
+
+ attributesOutputsPage.certifyComponent();
+ attributesOutputsPage.isLoaded();
+
+ yamlObject = downloadToscaArtifact(attributesOutputsPage);
+ checkMetadata(yamlObject, vfCreateData);
+ checkTopologyTemplate(yamlObject);
+
+ }
+
+ private AddNodeToCompositionFlow addNodeToCompositionFlow(final ComponentPage componentPage) {
+ componentPage.isLoaded();
+ final ComponentData parentComponent = new ComponentData();
+ parentComponent.setName(vfCreateData.getName());
+ parentComponent.setVersion("0.1");
+ parentComponent.setComponentType(ComponentType.RESOURCE);
+ final ComponentData componentToAdd = new ComponentData();
+ componentToAdd.setName(vfcCreateData.getName());
+ componentToAdd.setVersion("1.0");
+ componentToAdd.setComponentType(ComponentType.RESOURCE);
+ final AddNodeToCompositionFlow addNodeToCompositionFlow = new AddNodeToCompositionFlow(webDriver, parentComponent, componentToAdd);
+ addNodeToCompositionFlow.run(componentPage.goToComposition());
+ return addNodeToCompositionFlow;
+ }
+
+ private Map<String, Object> downloadToscaArtifact(final ComponentPage resourceCreatePage) throws UnzipException {
+ final DownloadCsarArtifactFlow downloadCsarArtifactFlow = downloadCsarArtifact(resourceCreatePage);
+ 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);
+ final String downloadFolderPath = getConfig().getDownloadAutomationFolder();
+ final Map<String, byte[]> filesFromZip = FileHandling.getFilesFromZip(downloadFolderPath, downloadedCsarName);
+ final Optional<String> resourceEntryOpt = filesFromZip.keySet().stream()
+ .filter(s -> s.equals("Definitions/" + downloadedCsarName.replace("-csar.csar", "-template.yml")))
+ .findFirst();
+ if (resourceEntryOpt.isEmpty()) {
+ fail("Could not find the resource package in Definitions");
+ }
+ return loadYamlObject(filesFromZip.get(resourceEntryOpt.get()));
+ }
+
+ private Map<String, Object> getMapEntry(final Map<String, Object> yamlObj, final String entryName) {
+ try {
+ return (Map<String, Object>) yamlObj.get(entryName);
+ } catch (final Exception e) {
+ final String errorMsg = String.format("Could not get the '%s' entry.", entryName);
+ fail(errorMsg + "Error message: " + e.getMessage());
+ }
+ return null;
+ }
+
+ private Map<String, Object> loadYamlObject(final byte[] mainDefinitionFileBytes) {
+ return new Yaml().load(new String(mainDefinitionFileBytes));
+ }
+
+ private DownloadCsarArtifactFlow downloadCsarArtifact(final ComponentPage resourceCreatePage) {
+ final DownloadCsarArtifactFlow downloadCsarArtifactFlow = new DownloadCsarArtifactFlow(webDriver);
+ downloadCsarArtifactFlow.setWaitBeforeGetTheFile(5L);
+ downloadCsarArtifactFlow.run(resourceCreatePage);
+ return downloadCsarArtifactFlow;
+ }
+
+ private CreateVfcFlow createVFC(final String fileName) {
+ vfcCreateData = createVfcFormData();
+ final CreateVfcFlow createVfcFlow = new CreateVfcFlow(webDriver, vfcCreateData, filePath + fileName);
+ createVfcFlow.run(homePage);
+ return createVfcFlow;
+ }
+
+ private CreateVfFlow createVF() {
+ vfCreateData = createVfFormData();
+ final CreateVfFlow createVfFlow = new CreateVfFlow(webDriver, vfCreateData);
+ createVfFlow.run(homePage);
+ return createVfFlow;
+ }
+
+ private ResourceCreateData createVfcFormData() {
+ final ResourceCreateData vfcCreateData = new ResourceCreateData();
+ vfcCreateData.setRandomName(ElementFactory.getResourcePrefix() + "-VFC");
+ vfcCreateData.setCategory(ResourceCategoryEnum.NETWORK_L4.getSubCategory());
+ vfcCreateData.setTagList(Arrays.asList(vfcCreateData.getName(), "importVFC"));
+ vfcCreateData.setDescription("aDescription");
+ vfcCreateData.setVendorName("Ericsson");
+ vfcCreateData.setVendorRelease("1.2.3");
+ vfcCreateData.setVendorModelNumber("4.5.6");
+ return vfcCreateData;
+ }
+
+ private ResourceCreateData createVfFormData() {
+ final ResourceCreateData vfCreateData = new ResourceCreateData();
+ vfCreateData.setRandomName(ElementFactory.getResourcePrefix() + "-VF");
+ vfCreateData.setCategory(ResourceCategoryEnum.NETWORK_L4.getSubCategory());
+ vfCreateData.setTagList(Arrays.asList(vfCreateData.getName(), "createVF"));
+ vfCreateData.setDescription("aDescription");
+ vfCreateData.setVendorName("Ericsson");
+ vfCreateData.setVendorRelease("6.5.4");
+ vfCreateData.setVendorModelNumber("3.2.1");
+ return vfCreateData;
+ }
+
+ private void checkMetadata(final Map<String, Object> map, final ResourceCreateData createdData) {
+ final Map<String, Object> metadata = getMapEntry(map, "metadata");
+
+ assertEquals(createdData.getName(), metadata.get("name"));
+ assertEquals(createdData.getDescription(), metadata.get("description"));
+ assertEquals("Network L4+", metadata.get("category"));
+ assertThat((String) metadata.get("type"), not(emptyString()));
+ assertEquals(createdData.getCategory(), metadata.get("subcategory"));
+ assertEquals(createdData.getVendorName(), metadata.get("resourceVendor"));
+ assertEquals(createdData.getVendorRelease(), metadata.get("resourceVendorRelease"));
+ assertEquals(createdData.getVendorModelNumber(), metadata.get("reourceVendorModelNumber"));
+ }
+
+ private void checkNodeTypes(final Map<String, Object> map) {
+ final Map<String, Object> mapEntry = getMapEntry(map, "node_types");
+ final Map<String, Object> nodeTypes = getMapEntry(mapEntry, mapEntry.keySet().iterator().next());
+
+ assertNotNull(nodeTypes);
+ assertEquals("aDescription", nodeTypes.get("description"));
+
+ final Map<String, Object> properties = getMapEntry(nodeTypes, "properties");
+ assertThat(properties, not(anEmptyMap()));
+
+ final Map<String, Object> attributes = getMapEntry(nodeTypes, "attributes");
+ assertThat(attributes, not(anEmptyMap()));
+
+ final Map<String, Object> interfaces = getMapEntry(nodeTypes, "interfaces");
+ assertThat(interfaces, not(anEmptyMap()));
+
+ }
+
+ private void checkTopologyTemplate(final Map<String, Object> map) {
+ final Map<String, Object> mapEntry = getMapEntry(map, "topology_template");
+ assertNotNull(mapEntry);
+
+ final Map<String, Object> inputs = getMapEntry(mapEntry, "inputs");
+ assertThat(inputs, not(anEmptyMap()));
+
+ final Map<String, Object> outputs = getMapEntry(mapEntry, "outputs");
+ assertThat(outputs, not(anEmptyMap()));
+ assertEquals(2, outputs.keySet().stream().filter(s -> (s.contains("_test_1") || s.contains("_test_3")) && !s.contains("_test_2")).count());
+
+ final Map<String, Object> nodeTemplates = getMapEntry(mapEntry, "node_templates");
+ assertThat(nodeTemplates, not(anEmptyMap()));
+
+ final Map<String, Object> substitutionMappings = getMapEntry(mapEntry, "substitution_mappings");
+ assertThat(substitutionMappings, not(anEmptyMap()));
+
+ final Map<String, Object> attributes = getMapEntry(substitutionMappings, "attributes");
+ assertThat(attributes, not(anEmptyMap()));
+ assertEquals(2, attributes.keySet().stream().filter(s -> (s.contains("_test_1") || s.contains("_test_3")) && !s.contains("_test_2")).count());
+
+ }
+}
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 bbef8fbeda..0ab0ae3e0a 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
@@ -43,7 +43,7 @@ import org.onap.sdc.frontend.ci.tests.flow.CreateResourceFromVspFlow;
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.DownloadToscaCsarFlow;
+import org.onap.sdc.frontend.ci.tests.flow.DownloadCsarArtifactFlow;
import org.onap.sdc.frontend.ci.tests.flow.ImportVspFlow;
import org.onap.sdc.frontend.ci.tests.flow.exception.UiTestFlowRuntimeException;
import org.onap.sdc.frontend.ci.tests.pages.ComponentPage;
@@ -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);
@@ -139,7 +139,7 @@ public class EtsiOnboardVnfCnfUiTests extends SetupCDTest {
}
private void downloadAndVerifyOnboardedPackage(final ComponentPage componentPage) {
- final DownloadToscaCsarFlow downloadToscaCsarFlow = downloadToscaCsar(componentPage);
+ final DownloadCsarArtifactFlow downloadToscaCsarFlow = downloadToscaCsar(componentPage);
final ToscaArtifactsPage toscaArtifactsPage = downloadToscaCsarFlow.getLandedPage()
.orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected ToscaArtifactsPage"));
assertThat("No artifact download was found", toscaArtifactsPage.getDownloadedArtifactList(), not(empty()));
@@ -181,7 +181,7 @@ public class EtsiOnboardVnfCnfUiTests extends SetupCDTest {
*/
private ComponentPage loadComponentPage() {
final ComponentPage componentPage = Optional.of(new ComponentPage(webDriver))
- .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected ComponentPage"));
+ .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected ComponentPage"));
componentPage.isLoaded();
return componentPage;
}
@@ -191,8 +191,8 @@ public class EtsiOnboardVnfCnfUiTests extends SetupCDTest {
*
* @return DownloadToscaCsarFlow
*/
- private DownloadToscaCsarFlow downloadToscaCsar(final ComponentPage componentPage) {
- final DownloadToscaCsarFlow downloadToscaCsarFlow = new DownloadToscaCsarFlow(webDriver);
+ private DownloadCsarArtifactFlow downloadToscaCsar(final ComponentPage componentPage) {
+ final DownloadCsarArtifactFlow downloadToscaCsarFlow = new DownloadCsarArtifactFlow(webDriver);
downloadToscaCsarFlow.run(componentPage);
return downloadToscaCsarFlow;
}
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 6823c3eef0..8636101754 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,6 +27,7 @@ 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;
@@ -62,20 +63,20 @@ public class ImportVfcUiTest extends SetupCDTest {
private ResourceCreateData vfCreateData;
@BeforeClass
- public void beforeClass() {
+ public void beforeClass() throws IOException {
filePath = FileHandling.getFilePath("VFCs/");
}
@Test
public void importVFC_createVF_addVFC2VF_test() throws UnzipException {
+ ComponentPage componentPage;
webDriver = DriverFactory.getDriver();
homePage = new HomePage(webDriver);
// TC - Import VFC with root namespace
String fileName = "org.openecomp.resource.VFC-root.yml";
CreateVfcFlow createVfcFlow = createVFC(fileName);
- ComponentPage 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();
@@ -88,7 +89,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();
+ componentPage = createVfcFlow.getLandedPage().orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage"));
+ componentPage.isLoaded();
componentPage.certifyComponent();
componentPage.isLoaded();
@@ -100,8 +102,7 @@ public class ImportVfcUiTest extends SetupCDTest {
// TC - Import VFC with interface inputs
// TC - Import VFC with attributes
final CreateVfFlow createVfFlow = createVF();
- componentPage = createVfFlow.getLandedPage()
- .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage"));
+ componentPage = createVfFlow.getLandedPage().orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage"));
componentPage.isLoaded();
final AddNodeToCompositionFlow addNodeToCompositionFlow = addNodeToCompositionFlow(componentPage);
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 ee453bf221..1acf1e6eca 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
@@ -20,20 +20,28 @@
package org.onap.sdc.frontend.ci.tests.execute.sanity;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.anEmptyMap;
import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.Matchers.emptyString;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import com.aventstack.extentreports.Status;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
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;
@@ -48,9 +56,10 @@ import org.onap.sdc.frontend.ci.tests.execute.setup.SetupCDTest;
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.DownloadToscaCsarFlow;
+import org.onap.sdc.frontend.ci.tests.flow.DownloadCsarArtifactFlow;
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;
import org.onap.sdc.frontend.ci.tests.pages.ComponentPage;
import org.onap.sdc.frontend.ci.tests.pages.ResourceCreatePage;
import org.onap.sdc.frontend.ci.tests.pages.TopNavComponent;
@@ -62,6 +71,7 @@ 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;
@@ -77,6 +87,7 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
private ResourceCreateData vfResourceCreateData;
private ComponentInstance networkFunctionInstance;
private ComponentInstance networkServiceInstance;
+ private AddNodeToCompositionFlow addNodeToCompositionFlow;
@BeforeMethod
public void init() {
@@ -103,7 +114,7 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
@Test(dependsOnMethods = "importAndCertifyVfc")
public void runServiceDesign() throws UnzipException {
final CreateVfFlow createVfFlow = createVF();
- final AddNodeToCompositionFlow addNodeToCompositionFlow = addNodeToCompositionAndCreateRelationship(createVfFlow);
+ addNodeToCompositionFlow = addNodeToCompositionAndCreateRelationship(createVfFlow);
final CompositionPage compositionPage = addNodeToCompositionFlow.getLandedPage()
.orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return CompositionPage"));
compositionPage.isLoaded();
@@ -112,6 +123,111 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
downloadAndVerifyCsarPackage(componentPage);
}
+ @Test(dependsOnMethods = "runServiceDesign")
+ public void addOutputsToVF_test() throws UnzipException, IOException {
+ homePage.isLoaded();
+ final ComponentPage resourceCreatePage = (ComponentPage) homePage.clickOnComponent(vfResourceCreateData.getName());
+ resourceCreatePage.isLoaded();
+
+ final AttributesOutputsPage attributesOutputsPage = resourceCreatePage.goToAttributesOutputs();
+ attributesOutputsPage.isLoaded();
+
+ final ComponentInstance createdComponentInstance = addNodeToCompositionFlow.getCreatedComponentInstance()
+ .orElseThrow(() -> new UiTestFlowRuntimeException("Expecting a ComponentInstance"));
+
+ attributesOutputsPage.clickOnAttributeNavigation(createdComponentInstance.getName());
+ assertTrue(attributesOutputsPage.isAttributePresent("attr_1"));
+ attributesOutputsPage.declareOutput("attr_1");
+ attributesOutputsPage.clickOnOutputsTab();
+ assertTrue(attributesOutputsPage.isOutputPresent("attr_1"));
+
+ attributesOutputsPage.clickOnAttributesTab();
+ assertTrue(attributesOutputsPage.isAttributePresent("attr_2"));
+ attributesOutputsPage.declareOutput("attr_2");
+ attributesOutputsPage.clickOnOutputsTab();
+ assertTrue(attributesOutputsPage.isOutputPresent("attr_2"));
+
+ attributesOutputsPage.clickOnAttributesTab();
+ assertTrue(attributesOutputsPage.isAttributePresent("attr_3"));
+ attributesOutputsPage.declareOutput("attr_3");
+ attributesOutputsPage.clickOnOutputsTab();
+ assertTrue(attributesOutputsPage.isOutputPresent("attr_3"));
+
+ attributesOutputsPage.deleteOutput(createdComponentInstance.getName() + "_attr_2");
+ attributesOutputsPage.clickOnAttributesTab();
+ assertTrue(attributesOutputsPage.isAttributePresent("attr_2"));
+ attributesOutputsPage.clickOnOutputsTab();
+ assertTrue(attributesOutputsPage.isOutputDeleted("attr_2"));
+
+ attributesOutputsPage.clickOnAttributesTab();
+ ExtentTestActions.addScreenshot(Status.INFO, "AttributesTab", "The Attribute's list : ");
+
+ attributesOutputsPage.clickOnOutputsTab();
+ ExtentTestActions.addScreenshot(Status.INFO, "OutputsTab", "The Output's list : ");
+
+ attributesOutputsPage.certifyComponent();
+ attributesOutputsPage.isLoaded();
+
+ Map<String, Object> yamlObject = downloadToscaArtifact(attributesOutputsPage);
+ checkMetadata(yamlObject, vfResourceCreateData);
+ checkTopologyTemplate(yamlObject);
+
+ }
+
+ private void checkMetadata(final Map<String, Object> map, final ResourceCreateData createdData) {
+ final Map<String, Object> metadata = getMapEntry(map, "metadata");
+
+ assertEquals(createdData.getName(), metadata.get("name"));
+ assertEquals(createdData.getDescription(), metadata.get("description"));
+ assertEquals("Generic", metadata.get("category"));
+ assertThat((String) metadata.get("type"), not(emptyString()));
+ assertEquals(createdData.getCategory(), metadata.get("subcategory"));
+ assertEquals(createdData.getVendorName(), metadata.get("resourceVendor"));
+ assertEquals(createdData.getVendorRelease(), metadata.get("resourceVendorRelease"));
+ assertEquals(createdData.getVendorModelNumber(), metadata.get("reourceVendorModelNumber"));
+ }
+
+ private void checkTopologyTemplate(final Map<String, Object> map) {
+ final Map<String, Object> mapEntry = getMapEntry(map, "topology_template");
+ assertNotNull(mapEntry);
+
+ final Map<String, Object> inputs = getMapEntry(mapEntry, "inputs");
+ assertThat(inputs, not(anEmptyMap()));
+
+ final Map<String, Object> outputs = getMapEntry(mapEntry, "outputs");
+ assertThat(outputs, not(anEmptyMap()));
+ assertEquals(2, outputs.keySet().stream().filter(s -> (s.contains("_attr_1") || s.contains("_attr_3")) && !s.contains("_attr_2")).count());
+
+ final Map<String, Object> nodeTemplates = getMapEntry(mapEntry, "node_templates");
+ assertThat(nodeTemplates, not(anEmptyMap()));
+
+ final Map<String, Object> substitutionMappings = getMapEntry(mapEntry, "substitution_mappings");
+ assertThat(substitutionMappings, not(anEmptyMap()));
+
+ final Map<String, Object> attributes = getMapEntry(substitutionMappings, "attributes");
+ assertThat(attributes, not(anEmptyMap()));
+ assertEquals(2, attributes.keySet().stream().filter(s -> (s.contains("_attr_1") || s.contains("_attr_3")) && !s.contains("_attr_2")).count());
+
+ }
+
+ private Map<String, Object> downloadToscaArtifact(final ComponentPage resourceCreatePage) throws UnzipException {
+ final DownloadCsarArtifactFlow downloadCsarArtifactFlow = downloadToscaCsar(resourceCreatePage);
+ 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);
+ final String downloadFolderPath = getConfig().getDownloadAutomationFolder();
+ final Map<String, byte[]> filesFromZip = FileHandling.getFilesFromZip(downloadFolderPath, downloadedCsarName);
+ final Optional<String> resourceEntryOpt = filesFromZip.keySet().stream()
+ .filter(s -> s.equals("Definitions/" + downloadedCsarName.replace("-csar.csar", "-template.yml")))
+ .findFirst();
+ if (resourceEntryOpt.isEmpty()) {
+ fail("Could not find the resource package in Definitions");
+ }
+ return loadYamlObject(filesFromZip.get(resourceEntryOpt.get()));
+ }
+
private CreateVfFlow createVF() {
final ResourceCreateData vfCreateData = createVfFormData();
final CreateVfFlow createVfFlow = new CreateVfFlow(webDriver, vfCreateData);
@@ -204,11 +320,12 @@ 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) {
@@ -222,7 +339,7 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
}
private void downloadAndVerifyCsarPackage(final ComponentPage componentPage) throws UnzipException {
- final DownloadToscaCsarFlow downloadToscaCsarFlow = downloadToscaCsar(componentPage);
+ final DownloadCsarArtifactFlow downloadToscaCsarFlow = downloadToscaCsar(componentPage);
final ToscaArtifactsPage toscaArtifactsPage = downloadToscaCsarFlow.getLandedPage()
.orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected ToscaArtifactsPage"));
assertThat("No artifact download was found", toscaArtifactsPage.getDownloadedArtifactList(), not(empty()));
@@ -233,10 +350,11 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
/**
* Download the generated package
*
- * @return DownloadToscaCsarFlow
+ * @return DownloadCsarArtifactFlow
*/
- private DownloadToscaCsarFlow downloadToscaCsar(final ComponentPage componentPage) {
- final DownloadToscaCsarFlow downloadToscaCsarFlow = new DownloadToscaCsarFlow(webDriver);
+ private DownloadCsarArtifactFlow downloadToscaCsar(final ComponentPage componentPage) {
+ final DownloadCsarArtifactFlow downloadToscaCsarFlow = new DownloadCsarArtifactFlow(webDriver);
+ downloadToscaCsarFlow.setWaitBeforeGetTheFile(5);
downloadToscaCsarFlow.run(componentPage);
return downloadToscaCsarFlow;
}
@@ -246,7 +364,7 @@ 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 vfResourceName VF created
* @param downloadedCsarName download Tosca CSAR filename
* @throws UnzipException
*/
@@ -255,9 +373,10 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
final Map<String, byte[]> filesFromZip = FileHandling.getFilesFromZip(downloadFolderPath, downloadedCsarName);
final String virtualFunctionName = vfResourceName.replace("-", "").toLowerCase();
final List<String> expectedDefinitionFolderFileList = getExpectedDefinitionFolderFileList(virtualFunctionName);
- final Map<String, byte[]> expectedFilesFromZipMap = filesFromZip.entrySet().parallelStream().filter(key -> expectedDefinitionFolderFileList.stream()
- .anyMatch(filename -> filename.equalsIgnoreCase(key.getKey()))).collect(Collectors.toMap(Entry::getKey, Entry::getValue));
- final String vfResourceTemplateFile = "Definitions/resource-"+ virtualFunctionName +"-template.yml";
+ final Map<String, byte[]> expectedFilesFromZipMap = filesFromZip.entrySet().parallelStream()
+ .filter(key -> expectedDefinitionFolderFileList.stream()
+ .anyMatch(filename -> filename.equalsIgnoreCase(key.getKey()))).collect(Collectors.toMap(Entry::getKey, Entry::getValue));
+ final String vfResourceTemplateFile = "Definitions/resource-" + virtualFunctionName + "-template.yml";
final String generatedTemplateFile = expectedFilesFromZipMap.keySet().stream()
.filter(filename -> filename.equalsIgnoreCase(vfResourceTemplateFile)).findFirst()
.orElseThrow(() -> new UiTestFlowRuntimeException(String.format("Resource template file not found %s", vfResourceTemplateFile)));
@@ -270,7 +389,8 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
private void verifyGeneratedTemplate(final byte[] generatedTemplateData, final String generatedTemplateFile) {
final Map<String, Object> templateYamlMap = loadYamlObject(generatedTemplateData);
final boolean hasToscaDefinitionVersionEntry = templateYamlMap.containsKey("tosca_definitions_version");
- assertThat(String.format("'%s' should contain tosca_definitions_version entry", generatedTemplateFile), hasToscaDefinitionVersionEntry, is(true));
+ assertThat(String.format("'%s' should contain tosca_definitions_version entry", generatedTemplateFile), hasToscaDefinitionVersionEntry,
+ is(true));
final String toscaVersion = (String) templateYamlMap.get("tosca_definitions_version");
assertThat(String.format("'%s' tosca_definitions_version entry should have tosca_simple_yaml_1_3 value", generatedTemplateFile),
toscaVersion.equalsIgnoreCase("tosca_simple_yaml_1_3"));
@@ -280,12 +400,13 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
assertThat(String.format("'%s' should contain a node_templates entry", generatedTemplateFile), nodeTemplatesTosca, is(notNullValue()));
final List<String> nodeTemplateFound = nodeTemplatesTosca.keySet().parallelStream().filter(s -> vfcs.stream()
.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()));
+ assertThat(String.format("'%s' should contain the node type definitions for the added VFCs '%s'", nodeTemplatesTosca, vfcs),
+ nodeTemplateFound, hasSize(vfcs.size()));
}
private void verifyNodesRelationship(final Map<String, byte[]> expectedFilesFromZipMap, final String virtualFunctionName,
final Map<String, byte[]> filesFromZip) {
- final String vfResourceTemplateFile = "Definitions/resource-"+ virtualFunctionName +"-template-interface.yml";
+ final String vfResourceTemplateFile = "Definitions/resource-" + virtualFunctionName + "-template-interface.yml";
final String interfaceTemplateFile = expectedFilesFromZipMap.keySet().stream()
.filter(filename -> filename.equalsIgnoreCase(vfResourceTemplateFile)).findFirst()
.orElseThrow(() -> new UiTestFlowRuntimeException(String.format("Resource template file not found %s", vfResourceTemplateFile)));
@@ -304,9 +425,9 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
private List<String> getExpectedDefinitionFolderFileList(final String vfResourceName) {
final List<String> expectedDefinitionFolderFileList = new ArrayList<>();
- vfcs.forEach(vfc -> expectedDefinitionFolderFileList.add("Definitions/resource-"+ vfc.getName() +"-template.yml"));
- expectedDefinitionFolderFileList.add("Definitions/resource-"+ vfResourceName +"-template.yml");
- expectedDefinitionFolderFileList.add("Definitions/resource-"+ vfResourceName +"-template-interface.yml");
+ vfcs.forEach(vfc -> expectedDefinitionFolderFileList.add("Definitions/resource-" + vfc.getName() + "-template.yml"));
+ expectedDefinitionFolderFileList.add("Definitions/resource-" + vfResourceName + "-template.yml");
+ expectedDefinitionFolderFileList.add("Definitions/resource-" + vfResourceName + "-template-interface.yml");
return expectedDefinitionFolderFileList;
}
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 b93266e80e..e4fec34b68 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
@@ -37,6 +37,9 @@ import org.openqa.selenium.WebDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.FluentWait;
+/**
+ * UI Flow for downloading Tosca CSAR from a component
+ */
public class DownloadCsarArtifactFlow extends AbstractUiTestFlow {
private ToscaArtifactsPage toscaArtifactsPage;
@@ -49,15 +52,18 @@ public class DownloadCsarArtifactFlow extends AbstractUiTestFlow {
@Override
public Optional<PageObject> run(final PageObject... pageObjects) {
+ extendTest.log(Status.INFO, "Downloading Tosca CSAR generated");
final ComponentPage componentPage = findParameter(pageObjects, ComponentPage.class);
+ componentPage.isLoaded();
toscaArtifactsPage = componentPage.goToToscaArtifacts();
toscaArtifactsPage.isLoaded();
toscaArtifactsPage.clickOnDownload("Tosca Model");
- final File downloadedCsar = waitAndGetDowloadedCsar();
+ 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");
return Optional.of(toscaArtifactsPage);
@@ -68,7 +74,7 @@ public class DownloadCsarArtifactFlow extends AbstractUiTestFlow {
return Optional.ofNullable(toscaArtifactsPage);
}
- private File waitAndGetDowloadedCsar() {
+ private File waitAndGetDownloadedCsar() {
new Actions(webDriver).pause(Duration.ofSeconds(waitBeforeGetTheFile)).perform();
final FluentWait<String> fluentWait = new FluentWait<>("").withTimeout(Duration.ofSeconds(5)).pollingEvery(Duration.ofSeconds(1));
fluentWait.until(s -> FileHandling.getLastModifiedFileNameFromDir() != null);
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/DownloadToscaCsarFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/DownloadToscaCsarFlow.java
deleted file mode 100644
index f503d4f509..0000000000
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/DownloadToscaCsarFlow.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * ============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 static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-
-import com.aventstack.extentreports.Status;
-import java.io.File;
-import java.time.Duration;
-import java.util.Optional;
-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.component.workspace.ToscaArtifactsPage;
-import org.onap.sdc.frontend.ci.tests.utilities.FileHandling;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.support.ui.FluentWait;
-
-/**
- * UI Flow for downloading Tosca CSAR from a component
- */
-public class DownloadToscaCsarFlow extends AbstractUiTestFlow {
-
- private ToscaArtifactsPage toscaArtifactsPage;
-
- public DownloadToscaCsarFlow(final WebDriver webDriver) {
- super(webDriver);
- }
-
- @Override
- public Optional<PageObject> run(final PageObject... pageObjects) {
- extendTest.log(Status.INFO, "Downloading Tosca CSAR generated");
- final ComponentPage componentPage = findParameter(pageObjects, ComponentPage.class);
- 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-csar-downloaded", "TOSCA CSAR Downloaded");
- return Optional.of(toscaArtifactsPage);
- }
-
- @Override
- public Optional<ToscaArtifactsPage> getLandedPage() {
- return Optional.ofNullable(toscaArtifactsPage);
- }
-
- private File waitAndGetDownloadedCsar() {
- final FluentWait<String> fluentWait = new FluentWait<>("")
- .withTimeout(Duration.ofSeconds(5)).pollingEvery(Duration.ofSeconds(1));
- fluentWait.until(s -> FileHandling.getLastModifiedFileNameFromDir() != null);
- return FileHandling.getLastModifiedFileNameFromDir();
- }
-
-}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/DownloadToscaTemplateFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/DownloadToscaTemplateFlow.java
index 1ad470600f..6c69974ce7 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/DownloadToscaTemplateFlow.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/DownloadToscaTemplateFlow.java
@@ -23,10 +23,11 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
+import com.aventstack.extentreports.Status;
import java.io.File;
import java.time.Duration;
import java.util.Optional;
-
+import lombok.Setter;
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;
@@ -36,10 +37,6 @@ import org.openqa.selenium.WebDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.FluentWait;
-import com.aventstack.extentreports.Status;
-
-import lombok.Setter;
-
public class DownloadToscaTemplateFlow extends AbstractUiTestFlow {
private ToscaArtifactsPage toscaArtifactsPage;
@@ -53,7 +50,7 @@ public class DownloadToscaTemplateFlow extends AbstractUiTestFlow {
@Override
public Optional<PageObject> run(final PageObject... pageObjects) {
final ComponentPage componentPage = findParameter(pageObjects, ComponentPage.class);
- toscaArtifactsPage = (ToscaArtifactsPage) componentPage.goToToscaArtifacts();
+ toscaArtifactsPage = componentPage.goToToscaArtifacts();
toscaArtifactsPage.isLoaded();
toscaArtifactsPage.clickOnDownload("Tosca Template");
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/AttributesOutputsPage.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/AttributesOutputsPage.java
new file mode 100644
index 0000000000..1c3bac998b
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/AttributesOutputsPage.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;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+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.component.workspace.CompositionHierarchyComponent;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Handles the 'Attributes & Outputs' Page UI actions
+ */
+public class AttributesOutputsPage extends ComponentPage {
+
+ private final AttributesTabComponent attributesTabComponent;
+ private final OutputsTabComponent outputsTabComponent;
+ private final CompositionHierarchyComponent compositionHierarchyComponent;
+
+ public AttributesOutputsPage(final WebDriver webDriver) {
+ super(webDriver);
+ attributesTabComponent = new AttributesTabComponent(webDriver);
+ outputsTabComponent = new OutputsTabComponent(webDriver);
+ compositionHierarchyComponent = new CompositionHierarchyComponent(webDriver);
+ setTimeout(5);
+ }
+
+ @Override
+ public void isLoaded() {
+ super.isLoaded();
+ waitForElementVisibility(By.xpath(XpathSelector.MAIN_DIV.getXpath()));
+ waitForElementVisibility(By.xpath(XpathSelector.TITLE_DIV.getXpath()));
+ attributesTabComponent.isLoaded();
+ compositionHierarchyComponent.isLoaded();
+ }
+
+ public void clickOnAttributeNavigation(final String id) {
+ compositionHierarchyComponent.clickOnAttributeNavigation(id);
+ assertTrue(attributesTabComponent.isInstanceSelected(id));
+ }
+
+ /**
+ * Checks if a attribute exists.
+ *
+ * @return true if exists, false if not
+ */
+ public boolean isAttributePresent(final String attributeName) {
+ ExtentTestActions.log(Status.INFO, "Going to check if Attribute '" + attributeName + "' is present");
+ return attributesTabComponent.isAttributePresent(attributeName);
+ }
+
+ /**
+ * Checks if a output exists.
+ *
+ * @return true if exists, false if not
+ */
+ public boolean isOutputPresent(final String outputName) {
+ ExtentTestActions.log(Status.INFO, "Going to check if Output '" + outputName + "' is present");
+ return outputsTabComponent.isOutputPresent(outputName);
+ }
+
+ /**
+ * Checks if a output deleted.
+ *
+ * @return true if deleted, false if not
+ */
+ public boolean isOutputDeleted(final String outputName) {
+ ExtentTestActions.log(Status.INFO, "Going to check if Output '" + outputName + "' deleted");
+ return outputsTabComponent.isOutputDeleted(outputName);
+ }
+
+ public void declareOutput(final String attributeName) {
+ ExtentTestActions.log(Status.INFO, "Going to declare Attribute '" + attributeName + "' as Output");
+ attributesTabComponent.declareOutput(attributeName);
+ }
+
+ public void deleteOutput(final String outputName) {
+ ExtentTestActions.log(Status.INFO, "Going to delete Output '" + outputName + "'");
+ outputsTabComponent.deleteOutput(outputName);
+ }
+
+ public void clickOnOutputsTab() {
+ waitForElementVisibility(By.xpath(XpathSelector.OUTPUTS_TAB.getXpath())).click();
+ outputsTabComponent.isLoaded();
+ }
+
+ public void clickOnAttributesTab() {
+ waitForElementVisibility(By.xpath(XpathSelector.ATTRIBUTES_TAB.getXpath())).click();
+ attributesTabComponent.isLoaded();
+ }
+
+ /**
+ * Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
+ */
+ @AllArgsConstructor
+ private enum XpathSelector {
+ MAIN_DIV("w-sdc-main-right-container", "//div[@class='%s']"),
+ TITLE_DIV("tab-title", "//div[contains(@class,'%s') and contains(text(), 'Attributes & Outputs')]"),
+ ATTRIBUTES_TAB("Attributes", "//*[@data-tests-id='%s']"),
+ OUTPUTS_TAB("Outputs", "//*[@data-tests-id='%s']");
+
+ @Getter
+ private final String id;
+ private final String xpathFormat;
+
+ public String getXpath() {
+ return String.format(xpathFormat, id);
+ }
+
+ }
+
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/AttributesTabComponent.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/AttributesTabComponent.java
new file mode 100644
index 0000000000..e06d702afe
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/AttributesTabComponent.java
@@ -0,0 +1,103 @@
+/*
+ * ============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 lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+
+/**
+ * Handles the 'Attributes' Tab UI component on 'Attributes & Outputs' Page
+ */
+public class AttributesTabComponent extends AbstractPageObject {
+
+ public AttributesTabComponent(final WebDriver webDriver) {
+ super(webDriver);
+ }
+
+ @Override
+ public void isLoaded() {
+ waitForElementVisibility(By.xpath(XpathSelector.ATTRIBUTES_TABLE.getXpath()));
+ waitForElementInvisibility(By.xpath(XpathSelector.NO_DATA_MESSAGE.getXpath()));
+ }
+
+ public void declareOutput(final String attributeName) {
+ if (attributeName == null) {
+ return;
+ }
+ waitForElementVisibility(By.xpath(XpathSelector.ATTRIBUTES_CHECKBOX.getXpath(attributeName))).click();
+ waitToBeClickable(By.xpath(XpathSelector.DECLARE_OUTPUT_BTN.getXpath())).click();
+ waitForAddedOutputNotification();
+ }
+
+ private void waitForAddedOutputNotification() {
+ waitForElementVisibility(By.xpath(XpathSelector.ADDED_OUTPUT_NOTIFICATION.getXpath()));
+ }
+
+ /**
+ * Checks if a attribute exists.
+ *
+ * @return true if exists, false if not
+ */
+ public boolean isAttributePresent(final String attributeName) {
+ try {
+ waitForElementVisibility(By.xpath(XpathSelector.ATTRIBUTES_CHECKBOX.getXpath(attributeName)));
+ } catch (final Exception ignored) {
+ return false;
+ }
+ return true;
+ }
+
+ public boolean isInstanceSelected(final String id) {
+ final WebElement webElement = waitForElementVisibility(By.xpath(XpathSelector.INSTANCE_SPAN.getXpath()));
+ final String text = webElement.getText();
+ return text.equalsIgnoreCase(id);
+ }
+
+ /**
+ * Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
+ */
+ @AllArgsConstructor
+ private enum XpathSelector {
+ ATTRIBUTES_TABLE("attributes-table", "//div[contains(@class,'%s')]"),
+ NO_DATA_MESSAGE("no-data", "//div[contains(@class,'%s') and text()='No data to display']"),
+ ATTRIBUTES_CHECKBOX("//checkbox[@data-tests-id='%s']"),
+ DECLARE_OUTPUT_BTN("declare-button declare-output", "//button[@data-tests-id='%s']"),
+ INSTANCE_SPAN("//div[contains(@class,'table-rows-header')]"),
+ ADDED_OUTPUT_NOTIFICATION("tab-indication", "//div[@data-tests-id='Outputs']/div[contains(@class, '%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/ComponentPage.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ComponentPage.java
index 3a95a6f0d8..68087f6261 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ComponentPage.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ComponentPage.java
@@ -63,10 +63,9 @@ public class ComponentPage extends AbstractPageObject {
return resourceLeftSideMenu.clickOnCompositionMenuItem();
}
- public ResourcePropertiesAssignmentPage goToPropertiesAssignment() {
- return resourceLeftSideMenu.clickOnPropertiesAssignmentMenuItem();
- }
-
+ /**
+ * Certifies the resource and wait for success notification.
+ */
public void certifyComponent() {
workspaceTopBarComponent.certifyResource();
}
@@ -88,4 +87,11 @@ public class ComponentPage extends AbstractPageObject {
return LifeCycleStateEnum.IN_DESIGN.getValue().equalsIgnoreCase(getLifecycleState());
}
+ public AttributesOutputsPage goToAttributesOutputs() {
+ return resourceLeftSideMenu.clickOnAttributesOutputsMenuItem();
+ }
+
+ public ResourcePropertiesAssignmentPage goToPropertiesAssignment() {
+ return resourceLeftSideMenu.clickOnPropertiesAssignmentMenuItem();
+ }
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/OutputsTabComponent.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/OutputsTabComponent.java
new file mode 100644
index 0000000000..4b2b14db5b
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/OutputsTabComponent.java
@@ -0,0 +1,109 @@
+/*
+ * ============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 lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Handles the 'Outputs' Tab UI component on 'Attributes & Outputs' Page
+ */
+public class OutputsTabComponent extends AbstractPageObject {
+
+ public OutputsTabComponent(final WebDriver webDriver) {
+ super(webDriver);
+ }
+
+ @Override
+ public void isLoaded() {
+ waitForElementVisibility(By.xpath(XpathSelector.OUTPUT_ATTRIBUTES_TABLE.getXpath()));
+ waitForElementInvisibility(By.xpath(XpathSelector.NO_DATA_MESSAGE.getXpath()));
+ }
+
+ public void deleteOutput(final String outputName) {
+ if (outputName == null) {
+ return;
+ }
+ waitForElementVisibility(By.xpath(XpathSelector.DELETE_OUTPUT_BTN.getXpath(normalizeOutputName(outputName)))).click();
+ waitToBeClickable(By.xpath(XpathSelector.DELETE_OUTPUT_CONFIRM_BTN.getXpath())).click();
+ waitForElementInvisibility(By.xpath(XpathSelector.OUTPUT_NAME_SPAN.getXpath(normalizeOutputName(outputName))), 5);
+ }
+
+ /**
+ * Checks if a output exists.
+ *
+ * @return true if exists, false if not
+ */
+ public boolean isOutputPresent(final String outputName) {
+ try {
+ waitForElementVisibility(By.xpath(XpathSelector.OUTPUT_NAME_SPAN.getXpath(outputName)));
+ } catch (final Exception ignored) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Checks if a output deleted.
+ *
+ * @return true if deleted, false if not
+ */
+ public boolean isOutputDeleted(final String outputName) {
+ try {
+ findElement(By.xpath(XpathSelector.OUTPUT_NAME_SPAN.getXpath(outputName)));
+ } catch (final Exception ignored) {
+ return true;
+ }
+ return false;
+ }
+
+ private String normalizeOutputName(final String outputName) {
+ return outputName.replaceAll(" ", "").replaceAll("-", "").toLowerCase();
+ }
+
+ /**
+ * Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
+ */
+ @AllArgsConstructor
+ private enum XpathSelector {
+ DELETE_OUTPUT_BTN("//span[@data-tests-id='delete-%s']"),
+ OUTPUT_ATTRIBUTES_TABLE("output-attributes-table", "//div[contains(@class,'%s')]"),
+ NO_DATA_MESSAGE("no-data", "//div[contains(@class,'%s') and text()='No data to display']"),
+ DELETE_OUTPUT_CONFIRM_BTN("Delete", "//button[@data-tests-id='%s']"),
+ OUTPUT_NAME_SPAN("//span[contains(@class,'attribute-name') and contains(text(), '%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/ResourceCreatePage.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceCreatePage.java
index 83641d4039..d6e023a7d3 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceCreatePage.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceCreatePage.java
@@ -23,19 +23,35 @@ import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.onap.sdc.frontend.ci.tests.datatypes.ResourceCreateData;
+import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionPage;
+import org.onap.sdc.frontend.ci.tests.pages.component.workspace.ToscaArtifactsPage;
+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;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
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 Resource Create Page UI actions
*/
public class ResourceCreatePage extends ComponentPage {
+ private final LoaderHelper loaderHelper;
+ private final NotificationComponent notificationComponent;
+ private final ResourceWorkspaceTopBarComponent topBarComponent;
+ private final ResourceLeftSideMenu resourceLeftSideMenu;
+
public ResourceCreatePage(final WebDriver webDriver) {
super(webDriver);
+ this.loaderHelper = new LoaderHelper(webDriver);
+ this.notificationComponent = new NotificationComponent(webDriver);
+ this.resourceLeftSideMenu = new ResourceLeftSideMenu(webDriver);
+ this.topBarComponent = new ResourceWorkspaceTopBarComponent(webDriver);
timeoutInSeconds = 5;
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceLeftSideMenu.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceLeftSideMenu.java
index c6366b398a..9b860d5ab0 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceLeftSideMenu.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceLeftSideMenu.java
@@ -65,6 +65,16 @@ public class ResourceLeftSideMenu extends AbstractPageObject {
}
/**
+ * Clicks on the 'Attributes & Outputs' menu item.
+ *
+ * @return the next page object
+ */
+ public AttributesOutputsPage clickOnAttributesOutputsMenuItem() {
+ wrappingElement.findElement(By.xpath(XpathSelector.ATTRIBUTES_OUTPUTS_MENU.getXpath())).click();
+ return new AttributesOutputsPage(webDriver);
+ }
+
+ /**
* Clicks on the TOSCA artifacts menu item.
*
* @return the next page object
@@ -96,6 +106,7 @@ public class ResourceLeftSideMenu extends AbstractPageObject {
private enum XpathSelector {
MAIN_DIV("w-sdc-left-sidebar", "//div[@class='%s']"),
PROPERTIES_ASSIGNMENT_MENU("Properties AssignmentLeftSideMenu", "//*[@data-tests-id='%s']"),
+ ATTRIBUTES_OUTPUTS_MENU("Attributes & OutputsLeftSideMenu", "//*[@data-tests-id='%s']"),
GENERAL_MENU("GeneralLeftSideMenu", "//*[@data-tests-id='%s']"),
COMPOSITION_MENU("CompositionLeftSideMenu", "//*[@data-tests-id='%s']"),
TOSCA_ARTIFACTS_MENU("TOSCA ArtifactsLeftSideMenu", "//*[@data-tests-id='%s']");
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionHierarchyComponent.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionHierarchyComponent.java
new file mode 100644
index 0000000000..52f395c98c
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionHierarchyComponent.java
@@ -0,0 +1,78 @@
+/*
+ * ============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 static org.junit.jupiter.api.Assertions.assertNotNull;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.onap.sdc.frontend.ci.tests.pages.AbstractPageObject;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+
+public class CompositionHierarchyComponent extends AbstractPageObject {
+
+ private WebElement wrappingElement;
+
+ public CompositionHierarchyComponent(final WebDriver webDriver) {
+ super(webDriver);
+ }
+
+ @Override
+ public void isLoaded() {
+ wrappingElement = waitForElementVisibility(By.xpath(XpathSelector.MAIN_ELEMENT.getXpath()));
+ assertNotNull(wrappingElement);
+ wrappingElement.findElement(By.xpath(XpathSelector.COMPOSITION_TAB.getXpath()));
+ wrappingElement.findElement(By.xpath(XpathSelector.STRUCTURE_TAB.getXpath()));
+ }
+
+ public void clickOnAttributeNavigation(final String id) {
+ wrappingElement.findElement(By.xpath(XpathSelector.INSTANCE_SPAN.getXpath(id))).click();
+ }
+
+ /**
+ * Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
+ */
+ @AllArgsConstructor
+ private enum XpathSelector {
+ MAIN_ELEMENT("right-column", "//div[@class='%s']"),
+ COMPOSITION_TAB("Composition", "//div[contains(@class,'tab') and contains(text(), '%s')]"),
+ STRUCTURE_TAB(" Structure", "//div[contains(@class,'tab') and contains(text(), '%s')]"),
+ SELF_SPAN("SELF", "//span[@data-tests-id='%s']"),
+ INSTANCE_SPAN("//span[@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/component/workspace/CompositionPage.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionPage.java
index 8dfc6e88ce..e7f37fd72e 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionPage.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionPage.java
@@ -28,7 +28,7 @@ import org.openecomp.sdc.be.model.ComponentInstance;
import org.openqa.selenium.WebDriver;
/**
- * Represents the Component (Service, VF, VFC, etc.) Composition Page
+ * Represents the Component (Service, VF, CR, PNF, etc.) Composition Page
*/
public class CompositionPage extends AbstractPageObject {
@@ -57,12 +57,12 @@ public class CompositionPage extends AbstractPageObject {
}
public ComponentInstance addNodeToServiceCompositionUsingApi(final String serviceName, final String serviceVersion, final String resourceName,
- final String resourceVersion) {
+ final String resourceVersion) {
return compositionCanvasComponent.createNodeOnServiceCanvas(serviceName, serviceVersion, resourceName, resourceVersion);
}
public ComponentInstance addNodeToResourceCompositionUsingApi(final String serviceName, final String serviceVersion, final String resourceName,
- final String resourceVersion) {
+ final String resourceVersion) {
return compositionCanvasComponent.createNodeOnResourceCanvas(serviceName, serviceVersion, resourceName, resourceVersion);
}
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 c0d58e0b9b..73c0bb4d89 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
@@ -21,6 +21,7 @@ package org.onap.sdc.frontend.ci.tests.pages.home;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
+import static org.testng.Assert.assertNotNull;
import java.time.Duration;
import lombok.AllArgsConstructor;
@@ -120,15 +121,20 @@ public class HomePage extends AbstractPageObject {
}
public AbstractPageObject clickOnComponent(final String component) {
- WebElement element = waitForElementVisibility(By.xpath(XpathSelector.COMPONENT.getXpath(component)));
+ final WebElement element = waitForElementVisibility(By.xpath(XpathSelector.COMPONENT.getXpath(component)));
final WebElement componentTypeDiv = element.findElement(By.xpath("./../../../div[contains(@class, 'sdc-tile-header')]/div"));
final String text = componentTypeDiv.getText();
element.click();
- if ("S".equals(text)) {
- return new ServiceComponentPage(webDriver);
+ assertNotNull(text);
+ switch (text) {
+ 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("Return not yet implemented for " + text);
}
private void clickOnAdd(final By locator) {
diff --git a/integration-tests/src/test/resources/Files/VFCs/1-VFC-NetworkFunction.yaml b/integration-tests/src/test/resources/Files/VFCs/1-VFC-NetworkFunction.yaml
index 7949abfdc4..125235d88c 100644
--- a/integration-tests/src/test/resources/Files/VFCs/1-VFC-NetworkFunction.yaml
+++ b/integration-tests/src/test/resources/Files/VFCs/1-VFC-NetworkFunction.yaml
@@ -10,7 +10,7 @@ node_types:
type: string
required: false
attributes:
- atttr_1:
+ attr_1:
type: string
default: 'Integration Test'
attr_2:
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 cb1370865b..6098303598 100644
--- a/integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml
+++ b/integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml
@@ -39,6 +39,7 @@
<methods>
<include name="importAndCertifyVfc"/>
<include name="runServiceDesign"/>
+ <include name="addOutputsToVF_test"/>
</methods>
</class>
</classes>