summaryrefslogtreecommitdiffstats
path: root/integration-tests/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'integration-tests/src/test')
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/data/providers/OnboardingDataProviders.java2
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/ComponentData.java35
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiOnboardVnfCnfUiTests.java118
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ImportVfcUiTest.java25
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/AddNodeToCompositionFlow.java61
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateResourceFromVspFlow.java6
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateVlmFlow.java1
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateVspFlow.java2
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/DownloadToscaCsarFlow.java4
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/ImportVspFlow.java1
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ComponentCertificationModal.java83
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ComponentPage.java5
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceCreatePage.java25
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceWorkspaceTopBarComponent.java14
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ServiceCreatePage.java2
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/TopNavComponent.java5
16 files changed, 302 insertions, 87 deletions
diff --git a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/data/providers/OnboardingDataProviders.java b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/data/providers/OnboardingDataProviders.java
index 7f8c018c8f..5e2a8e9066 100644
--- a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/data/providers/OnboardingDataProviders.java
+++ b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/data/providers/OnboardingDataProviders.java
@@ -115,7 +115,7 @@ public final class OnboardingDataProviders {
return parametersArray;
}
- @DataProvider(name = "etsiVnfCnfOnboardPackages", parallel = true)
+ @DataProvider(name = "etsiVnfCnfOnboardPackages")
private static Object[][] etsiVnf() {
final List<String> vnfPackageFileNameList = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.ETSI);
if (CollectionUtils.isEmpty(vnfPackageFileNameList)) {
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/ComponentData.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/ComponentData.java
new file mode 100644
index 0000000000..6ab85183c1
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/ComponentData.java
@@ -0,0 +1,35 @@
+/*
+ * ============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.datatypes;
+
+import lombok.Data;
+import org.onap.sdc.backend.ci.tests.datatypes.enums.ComponentType;
+
+/**
+ * Holds information about a SDC component (Service, VF, VFC, etc.).
+ */
+@Data
+public class ComponentData {
+
+ private String name;
+ private String version;
+ private ComponentType componentType;
+
+}
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 dfe6679102..40716bf717 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
@@ -24,18 +24,23 @@ import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.fail;
-import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import java.util.Map;
import java.util.Optional;
import org.junit.jupiter.api.Assertions;
import org.onap.sdc.backend.ci.tests.data.providers.OnboardingDataProviders;
-import org.onap.sdc.backend.ci.tests.datatypes.enums.UserRoleEnum;
+import org.onap.sdc.backend.ci.tests.datatypes.enums.ComponentType;
+import org.onap.sdc.backend.ci.tests.datatypes.enums.ServiceCategoriesEnum;
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.ServiceCreateData;
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.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;
@@ -43,10 +48,11 @@ 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;
import org.onap.sdc.frontend.ci.tests.pages.ResourceCreatePage;
-import org.onap.sdc.frontend.ci.tests.pages.ResourceLeftSideMenu;
-import org.onap.sdc.frontend.ci.tests.pages.ResourceWorkspaceTopBarComponent;
+import org.onap.sdc.frontend.ci.tests.pages.ServiceCreatePage;
import org.onap.sdc.frontend.ci.tests.pages.TopNavComponent;
+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.openqa.selenium.WebDriver;
import org.slf4j.Logger;
@@ -60,6 +66,7 @@ public class EtsiOnboardVnfCnfUiTests extends SetupCDTest {
private WebDriver webDriver;
private TopNavComponent topNavComponent;
+ private HomePage homePage;
@BeforeMethod
public void init() {
@@ -69,8 +76,6 @@ public class EtsiOnboardVnfCnfUiTests extends SetupCDTest {
@Test
public void createVlm() {
- final ExtentTest extendTest = getExtendTest();
- extendTest.log(Status.INFO, String.format("Starting flow to create a VLM"));
final CreateVlmFlow createVlmFlow = new CreateVlmFlow(webDriver);
createVlmFlow.run();
}
@@ -80,6 +85,7 @@ public class EtsiOnboardVnfCnfUiTests extends SetupCDTest {
setLog(vnfFile);
final String resourceName = ElementFactory.addRandomSuffixToName(ElementFactory.getResourcePrefix());
runOnboardEtsiVnfCnf(resourceName, rootFolder, vnfFile);
+ runDistribution(resourceName);
}
/**
@@ -89,54 +95,93 @@ public class EtsiOnboardVnfCnfUiTests extends SetupCDTest {
* @param rootFolder VNF/CNF package location
* @param vnfCnfFile file to be onboarded
*/
- public void runOnboardEtsiVnfCnf(final String resourceName, final String rootFolder, final String vnfCnfFile) {
- final ExtentTest extendTest = getExtendTest();
- extendTest.log(Status.INFO,
- String.format("Creating VSP '%s' by onboarding ETSI VNF/CNF package '%s'", resourceName, vnfCnfFile));
+ private void runOnboardEtsiVnfCnf(final String resourceName, final String rootFolder, final String vnfCnfFile) {
final CreateVspFlow createVspFlow = new CreateVspFlow(webDriver, resourceName, vnfCnfFile, rootFolder);
createVspFlow.run(topNavComponent);
-
- extendTest.log(Status.INFO, String.format("Importing VSP '%s'", resourceName));
final ImportVspFlow importVspFlow = new ImportVspFlow(webDriver, resourceName);
-
- extendTest.log(Status.INFO, "Creating ResourceCreatePage");
- final ResourceCreatePage resourceCreatePage = importVspFlow.run()
+ ResourceCreatePage resourceCreatePage = importVspFlow.run()
.orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage"));
-
- extendTest.log(Status.INFO, String.format("Onboarding '%s' package", vnfCnfFile));
final CreateResourceFromVspFlow createResourceFlow = new CreateResourceFromVspFlow(webDriver, resourceName);
- createResourceFlow.run(resourceCreatePage);
- extendTest.log(Status.INFO, String.format("Successfully onboarded the package '%s'", vnfCnfFile));
+ resourceCreatePage = createResourceFlow.run(resourceCreatePage)
+ .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage"));
+ resourceCreatePage.isLoaded();
+ resourceCreatePage.certifyComponent();
+ ExtentTestActions.takeScreenshot(Status.INFO, "resource-certified",
+ String.format("Resource '%s' was certified", resourceName));
+ downloadAndVerifyOnboardedPackage(loadComponentPage());
+ }
- extendTest.log(Status.INFO, "Loading Component Page");
- final ComponentPage componentPage = loadComponentPage();
- extendTest.log(Status.INFO, "Downloading Tosca CSAR generated");
+ private void runDistribution(final String resourceName) {
+ final ServiceCreateData serviceCreateData = createServiceFormData();
+ final ServiceCreatePage serviceCreatePage = createService(goToHomePage(topNavComponent), serviceCreateData);
+ final ComponentData parentComponent = new ComponentData();
+ parentComponent.setName(serviceCreateData.getName());
+ parentComponent.setVersion("0.1");
+ parentComponent.setComponentType(ComponentType.SERVICE);
+ final ComponentData componentToAdd = new ComponentData();
+ componentToAdd.setName(resourceName);
+ componentToAdd.setVersion("1.0");
+ componentToAdd.setComponentType(ComponentType.RESOURCE);
+ final AddNodeToCompositionFlow addNodeToCompositionFlow = new AddNodeToCompositionFlow(webDriver, parentComponent, componentToAdd);
+ ComponentPage componentPage = loadComponentPage();
+ final CompositionPage compositionPage = (CompositionPage) addNodeToCompositionFlow.run(componentPage.goToComposition())
+ .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return CompositionPage"));
+ compositionPage.isLoaded();
+ ExtentTestActions.takeScreenshot(Status.INFO, "node-added-to-composition",
+ String.format("Resource '%s' was added to composition", serviceCreateData.getName()));
+ componentPage = compositionPage.goToGeneral();
+ componentPage.isLoaded();
+ componentPage.certifyComponent();
+ ExtentTestActions.takeScreenshot(Status.INFO, "service-certified",
+ String.format("Service '%s' was certified", serviceCreateData.getName()));
+
+ downloadAndVerifyOnboardedPackage(componentPage);
+ }
+
+ private void downloadAndVerifyOnboardedPackage(final ComponentPage componentPage) {
final DownloadToscaCsarFlow downloadToscaCsarFlow = downloadToscaCsar(componentPage);
final ToscaArtifactsPage toscaArtifactsPage = downloadToscaCsarFlow.getLandedPage()
.orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected ToscaArtifactsPage"));
assertThat("No artifact download was found", toscaArtifactsPage.getDownloadedArtifactList(), not(empty()));
- extendTest.log(Status.INFO, "Tosca CSAR was successfully downloaded");
-
final String downloadedCsarName = toscaArtifactsPage.getDownloadedArtifactList().get(0);
- extendTest.log(Status.INFO, String
- .format("Verifying if the onboarded package is included in the downloaded csar '%s'", downloadedCsarName));
verifyOnboardedPackage(downloadedCsarName);
}
+ private ServiceCreatePage createService(final HomePage homePage, final ServiceCreateData serviceCreateData) {
+ final CreateServiceFlow createServiceFlow = new CreateServiceFlow(webDriver, serviceCreateData);
+ return createServiceFlow.run(homePage)
+ .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage"));
+ }
+
+ private ServiceCreateData createServiceFormData() {
+ final ServiceCreateData serviceCreateData = new ServiceCreateData();
+ serviceCreateData.setRandomName(ElementFactory.addRandomSuffixToName(ElementFactory.getServicePrefix()));
+ serviceCreateData.setCategory(ServiceCategoriesEnum.E2E_SERVICE.getValue());
+ serviceCreateData.setDescription("aDescription");
+ return serviceCreateData;
+ }
+
+ /**
+ * Go to the system home page through the top nav menu.
+ *
+ * @param topNavComponent the top nav component
+ */
+ private HomePage goToHomePage(final TopNavComponent topNavComponent) {
+ topNavComponent.isLoaded();
+ homePage = topNavComponent.clickOnHome();
+ homePage.isLoaded();
+ ExtentTestActions.takeScreenshot(Status.INFO, "home-is-loaded", "The Home page is loaded.");
+ return homePage;
+ }
+
/**
* Loads Component Page
*
* @return ComponentPage
*/
private ComponentPage loadComponentPage() {
- final ResourceLeftSideMenu resourceLeftSideMenu = new ResourceLeftSideMenu(webDriver);
- resourceLeftSideMenu.isLoaded();
- final ResourceWorkspaceTopBarComponent workspaceTopBarComponent = new ResourceWorkspaceTopBarComponent(
- webDriver);
- workspaceTopBarComponent.isLoaded();
- final ComponentPage componentPage = Optional
- .of(new ComponentPage(webDriver))
- .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected ComponentPage"));
+ final ComponentPage componentPage = Optional.of(new ComponentPage(webDriver))
+ .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected ComponentPage"));
componentPage.isLoaded();
return componentPage;
}
@@ -174,9 +219,4 @@ public class EtsiOnboardVnfCnfUiTests extends SetupCDTest {
fail(String.format("%s Error: %s", errorMsg, e.getMessage()));
}
}
-
- @Override
- protected UserRoleEnum getRole() {
- return UserRoleEnum.DESIGNER;
- }
}
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 3cf81aae73..af2c9594a5 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
@@ -30,8 +30,10 @@ import static org.junit.jupiter.api.Assertions.fail;
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;
@@ -42,6 +44,7 @@ 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.ResourceCreatePage;
+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;
@@ -93,8 +96,12 @@ public class ImportVfcUiTest extends SetupCDTest {
final CreateVfFlow createVfFlow = createVF();
final AddNodeToCompositionFlow addNodeToCompositionFlow = addNodeToCompositionFlow(createVfFlow);
-
- createVfFlow.getLandedPage().get().clickOnCertify();
+ final CompositionPage compositionPage = addNodeToCompositionFlow.getLandedPage()
+ .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return CompositionPage"));
+ compositionPage.isLoaded();
+ final ResourceCreatePage resourceCreatePage = compositionPage.goToGeneral();
+ resourceCreatePage.isLoaded();
+ resourceCreatePage.clickOnCertify();
yamlObject = downloadToscaArtifact(createVfFlow.getLandedPage().get());
checkMetadata(yamlObject, vfCreateData);
checkTopologyTemplate(yamlObject);
@@ -102,8 +109,18 @@ public class ImportVfcUiTest extends SetupCDTest {
}
private AddNodeToCompositionFlow addNodeToCompositionFlow(final CreateVfFlow createVfFlow) {
- final AddNodeToCompositionFlow addNodeToCompositionFlow = new AddNodeToCompositionFlow(webDriver, vfCreateData, vfcCreateData);
- addNodeToCompositionFlow.run(createVfFlow.getLandedPage().get());
+ 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);
+ final ResourceCreatePage resourceCreatePage = createVfFlow.getLandedPage()
+ .orElseThrow(() -> new UiTestFlowRuntimeException("Expecting a ResourceCreatePage"));
+ addNodeToCompositionFlow.run(resourceCreatePage.goToComposition());
return addNodeToCompositionFlow;
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/AddNodeToCompositionFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/AddNodeToCompositionFlow.java
index 4ecbbc1f8c..07d54299a5 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/AddNodeToCompositionFlow.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/AddNodeToCompositionFlow.java
@@ -3,43 +3,66 @@ package org.onap.sdc.frontend.ci.tests.flow;
import com.aventstack.extentreports.Status;
import java.util.Objects;
import java.util.Optional;
-import org.onap.sdc.frontend.ci.tests.datatypes.ResourceCreateData;
+import org.onap.sdc.frontend.ci.tests.datatypes.ComponentData;
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.CompositionPage;
+import org.openecomp.sdc.be.model.ComponentInstance;
import org.openqa.selenium.WebDriver;
public class AddNodeToCompositionFlow extends AbstractUiTestFlow {
- private final ResourceCreateData destination;
- private final ResourceCreateData resource;
+ private final ComponentData parentComponent;
+ private final ComponentData componentToAdd;
private CompositionPage compositionPage;
- private ComponentPage componentPage;
+ private ComponentInstance createdComponentInstance;
- public AddNodeToCompositionFlow(final WebDriver webDriver, final ResourceCreateData destination, final ResourceCreateData resource) {
+ public AddNodeToCompositionFlow(final WebDriver webDriver, final ComponentData parentComponent, final ComponentData componentToAdd) {
super(webDriver);
- this.destination = destination;
- this.resource = resource;
+ this.parentComponent = parentComponent;
+ this.componentToAdd = componentToAdd;
}
@Override
public Optional<? extends PageObject> run(final PageObject... pageObjects) {
- Objects.requireNonNull(destination);
- Objects.requireNonNull(resource);
- extendTest.log(Status.INFO, String.format("Adding Resource '%s' to VF/Service '%s'", resource.getName(), destination.getName()));
+ Objects.requireNonNull(parentComponent);
+ Objects.requireNonNull(parentComponent.getComponentType());
+ Objects.requireNonNull(componentToAdd);
+ extendTest.log(Status.INFO, String.format("Adding Resource '%s' to VF/Service '%s'", componentToAdd.getName(), parentComponent.getName()));
- componentPage = findParameter(pageObjects, ComponentPage.class);
+ compositionPage = findParameter(pageObjects, CompositionPage.class);
+ compositionPage.isLoaded();
+ addNodeToComposition();
+ final ComponentPage componentPage = compositionPage.goToGeneral();
componentPage.isLoaded();
-
compositionPage = componentPage.goToComposition();
- compositionPage.isLoaded();
- compositionPage.addNodeToResourceCompositionUsingApi(destination.getName(), "0.1", resource.getName(), "1.0");
- compositionPage.goToGeneral();
- return Optional.of(compositionPage);
+ return Optional.of(this.compositionPage);
+ }
+
+ private void addNodeToComposition() {
+ switch (parentComponent.getComponentType()) {
+ case SERVICE:
+ createdComponentInstance = compositionPage
+ .addNodeToServiceCompositionUsingApi(parentComponent.getName(), parentComponent.getVersion(), componentToAdd.getName(),
+ componentToAdd.getVersion());
+ break;
+ case RESOURCE:
+ createdComponentInstance = compositionPage
+ .addNodeToResourceCompositionUsingApi(parentComponent.getName(), parentComponent.getVersion(), componentToAdd.getName(),
+ componentToAdd.getVersion());
+ break;
+ default:
+ throw new UnsupportedOperationException(
+ String.format("Add node in a %s not yet supported", parentComponent.getComponentType().getValue()));
+ }
}
@Override
- public Optional<? extends PageObject> getLandedPage() {
- return Optional.ofNullable(componentPage);
+ public Optional<CompositionPage> getLandedPage() {
+ return Optional.ofNullable(compositionPage);
+ }
+
+ public Optional<ComponentInstance> getCreatedComponentInstance() {
+ return Optional.ofNullable(createdComponentInstance);
}
-}
+} \ No newline at end of file
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateResourceFromVspFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateResourceFromVspFlow.java
index b4e83817a4..367fb896ec 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateResourceFromVspFlow.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateResourceFromVspFlow.java
@@ -20,14 +20,12 @@
package org.onap.sdc.frontend.ci.tests.flow;
import com.aventstack.extentreports.Status;
-import org.onap.sdc.frontend.ci.tests.datatypes.ResourceCreateData;
-import org.onap.sdc.frontend.ci.tests.pages.ResourceCreatePage;
+import java.util.Optional;
import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions;
import org.onap.sdc.frontend.ci.tests.pages.PageObject;
+import org.onap.sdc.frontend.ci.tests.pages.ResourceCreatePage;
import org.openqa.selenium.WebDriver;
-import java.util.Optional;
-
/**
* UI Flow for Resource creation
*/
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateVlmFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateVlmFlow.java
index c40205c331..8b6a391178 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateVlmFlow.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateVlmFlow.java
@@ -44,6 +44,7 @@ public class CreateVlmFlow extends AbstractUiTestFlow {
@Override
public Optional<? extends PageObject> run(PageObject... pageObjects) {
+ extendTest.log(Status.INFO, String.format("Starting flow to create a VLM"));
final TopNavComponent topNavComponent = getParameter(pageObjects, TopNavComponent.class)
.orElse(new TopNavComponent(webDriver));
extendTest.log(Status.INFO, "Accessing the Onboard Home Page to create a VLM");
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateVspFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateVspFlow.java
index 614dc1a2af..aa0d1c649e 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateVspFlow.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateVspFlow.java
@@ -53,6 +53,8 @@ public class CreateVspFlow extends AbstractUiTestFlow {
@Override
public Optional<PageObject> run(final PageObject... pageObjects) {
+ extendTest.log(Status.INFO,
+ String.format("Creating VSP '%s' by onboarding ETSI VNF/CNF package '%s'", resourceName, packageFile));
final TopNavComponent topNavComponent = findParameter(pageObjects, TopNavComponent.class);
extendTest.log(Status.INFO, "Accessing the Onboard Home Page");
topNavComponent.isLoaded();
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
index d785c1f3c5..f503d4f509 100644
--- 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
@@ -48,7 +48,9 @@ public class DownloadToscaCsarFlow 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");
@@ -57,8 +59,8 @@ public class DownloadToscaCsarFlow extends AbstractUiTestFlow {
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);
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/ImportVspFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/ImportVspFlow.java
index 0f1330f82a..58a284aaef 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/ImportVspFlow.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/ImportVspFlow.java
@@ -45,6 +45,7 @@ public class ImportVspFlow extends AbstractUiTestFlow {
public Optional<ResourceCreatePage> run(final PageObject... pageObjects) {
final VspRepositoryModalComponent vspRepositoryModalComponent = openVspRepository();
searchForVsp(vspRepositoryModalComponent);
+ extendTest.log(Status.INFO, String.format("Importing VSP '%s'", resourceName));
resourceCreatePage = importVsp(vspRepositoryModalComponent);
return Optional.of(resourceCreatePage);
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ComponentCertificationModal.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ComponentCertificationModal.java
new file mode 100644
index 0000000000..9232307968
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ComponentCertificationModal.java
@@ -0,0 +1,83 @@
+/*
+ * ============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;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Handles the Commit Modal UI action when certifying a component
+ */
+public class ComponentCertificationModal extends AbstractPageObject {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ComponentCertificationModal.class);
+
+ private WebElement wrappingElement;
+
+ public ComponentCertificationModal(final WebDriver webDriver) {
+ super(webDriver);
+ }
+
+ public void isLoaded() {
+ LOGGER.debug("Finding element with xpath '{}'", XpathSelector.MODAL_DIV.getXpath());
+ wrappingElement = waitForElementVisibility(XpathSelector.MODAL_DIV.getXpath());
+ }
+
+ /**
+ * Fills commit text area with a default message.
+ */
+ public void fillCommentWithDefaultMessage() {
+ final WebElement commentTxt = wrappingElement.findElement(By.xpath(XpathSelector.COMMIT_COMMENT_TXT.getXpath()));
+ commentTxt.sendKeys("UI Integration Test");
+ }
+
+ /**
+ * Clicks on the modal submit and confirms success.
+ */
+ public void submit() {
+ final WebElement commitAndSubmitBtn = wrappingElement.findElement(By.xpath(XpathSelector.MODAL_OK_BTN.getXpath()));
+ commitAndSubmitBtn.click();
+ }
+
+ /**
+ * Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
+ */
+ @AllArgsConstructor
+ private enum XpathSelector {
+ MODAL_DIV("sdc-modal-type-custom", "//div[contains(@class, '%s')]"),
+ COMMIT_COMMENT_TXT("checkindialog", "//textarea[@data-tests-id='%s']"),
+ MODAL_OK_BTN("confirm-modal-button-ok", "//button[@data-tests-id='%s']"),
+ MODAL_CANCEL_BTN("confirm-modal-button-cancel", "//button[@data-tests-id='%s']");
+
+ @Getter
+ private final String id;
+ private final String xpath;
+
+ public String getXpath() {
+ return String.format(xpath, id);
+ }
+ }
+
+}
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 5b283f3e35..bb30af167e 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
@@ -49,4 +49,9 @@ public class ComponentPage extends AbstractPageObject {
public CompositionPage goToComposition() {
return resourceLeftSideMenu.clickOnCompositionMenuItem();
}
+
+ public void certifyComponent() {
+ workspaceTopBarComponent.certifyComponent();
+ }
+
}
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 3737577c6f..6dc98c48e6 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
@@ -19,20 +19,12 @@
package org.onap.sdc.frontend.ci.tests.pages;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.equalToIgnoringCase;
-import static org.hamcrest.Matchers.startsWithIgnoringCase;
-import static org.hamcrest.core.Is.is;
-
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Getter;
-import org.onap.sdc.frontend.ci.tests.datatypes.DataTestIdEnum;
-import org.onap.sdc.frontend.ci.tests.datatypes.LifeCycleStateEnum;
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.GeneralUIUtils;
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;
@@ -66,10 +58,10 @@ public class ResourceCreatePage extends ComponentPage {
@Override
public void isLoaded() {
- topBarComponent.isLoaded();
- final String lifeCycleState = topBarComponent.getLifecycleState();
- assertThat("Life cycle state should be as expected",
- lifeCycleState, is(startsWithIgnoringCase(LifeCycleStateEnum.IN_DESIGN.getValue())));
+ super.isLoaded();
+ waitForElementVisibility(By.xpath(XpathSelector.NAME_INPUT.getXpath()));
+ waitForElementVisibility(By.xpath(XpathSelector.CATEGORY_SELECT.getXpath()));
+ waitForElementVisibility(By.xpath(XpathSelector.DESCRIPTION_TEXT_AREA.getXpath()));
}
/**
@@ -82,12 +74,15 @@ public class ResourceCreatePage extends ComponentPage {
}
/**
- * Certify the resource and wait for success notification.
+ * Certifies the resource and wait for success notification.
*/
public void clickOnCertify() {
topBarComponent.clickOnCertify();
- findElement(By.xpath(XpathSelector.APPROVE_MESSAGE.getXpath())).sendKeys("Resource certified successfully");
- GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.OK.getValue()).click();
+ final ComponentCertificationModal componentCertificationModal = new ComponentCertificationModal(webDriver);
+ componentCertificationModal.isLoaded();
+ componentCertificationModal.fillCommentWithDefaultMessage();
+ componentCertificationModal.submit();
+ loaderHelper.waitForLoader(20);
notificationComponent.waitForNotification(NotificationType.SUCCESS, 20);
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceWorkspaceTopBarComponent.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceWorkspaceTopBarComponent.java
index 942c32a5db..9af7e73fc8 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceWorkspaceTopBarComponent.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceWorkspaceTopBarComponent.java
@@ -20,6 +20,8 @@ package org.onap.sdc.frontend.ci.tests.pages;
import lombok.AllArgsConstructor;
import lombok.Getter;
+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.WebDriver;
import org.openqa.selenium.WebElement;
@@ -33,6 +35,8 @@ public class ResourceWorkspaceTopBarComponent extends AbstractPageObject {
private static final Logger LOGGER = LoggerFactory.getLogger(ResourceWorkspaceTopBarComponent.class);
+ private final NotificationComponent notificationComponent;
+
private WebElement wrappingElement;
private WebElement lifecycleStateDiv;
private WebElement versionContainerDiv;
@@ -40,6 +44,7 @@ public class ResourceWorkspaceTopBarComponent extends AbstractPageObject {
public ResourceWorkspaceTopBarComponent(final WebDriver webDriver) {
super(webDriver);
+ notificationComponent = new NotificationComponent(webDriver);
}
@Override
@@ -59,6 +64,15 @@ public class ResourceWorkspaceTopBarComponent extends AbstractPageObject {
waitToBeClickable(XpathSelector.CERTIFY_BTN.getXpath()).click();
}
+ public void certifyComponent() {
+ clickOnCertify();
+ final ComponentCertificationModal componentCertificationModal = new ComponentCertificationModal(webDriver);
+ componentCertificationModal.isLoaded();
+ componentCertificationModal.fillCommentWithDefaultMessage();
+ componentCertificationModal.submit();
+ notificationComponent.waitForNotification(NotificationType.SUCCESS, 20);
+ }
+
public String getLifecycleState() {
return lifecycleStateDiv.findElement(By.xpath(XpathSelector.FORM_LIFE_CYCLE_STATE.getXpath())).getText();
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ServiceCreatePage.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ServiceCreatePage.java
index e9fc3876d2..4635d2ae01 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ServiceCreatePage.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ServiceCreatePage.java
@@ -37,7 +37,7 @@ import org.openqa.selenium.support.ui.Select;
/**
* Represents the Service Create Page
*/
-public class ServiceCreatePage extends AbstractPageObject {
+public class ServiceCreatePage extends ComponentPage {
private final LoaderHelper loaderHelper;
private final NotificationComponent notificationComponent;
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/TopNavComponent.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/TopNavComponent.java
index 7eb15bbded..88b682bdd8 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/TopNavComponent.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/TopNavComponent.java
@@ -24,7 +24,6 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
import org.onap.sdc.frontend.ci.tests.execute.setup.DriverFactory;
import org.onap.sdc.frontend.ci.tests.pages.home.HomePage;
-import org.onap.sdc.frontend.ci.tests.utilities.GeneralUIUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
@@ -129,12 +128,12 @@ public class TopNavComponent extends AbstractPageObject {
* @return the hovered breadcrumb arrow element
*/
public WebElement hoverToBreadcrumbArrow(final int arrowPosition) {
- final Actions actions = new Actions(GeneralUIUtils.getDriver());
+ final Actions actions = new Actions(webDriver);
final List<WebElement> arrowElementList = getWait()
.until(
ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath(XpathSelector.ARROW_DROPDOWN.getXpath())));
final WebElement selectedArrowElement = arrowElementList.get(arrowPosition);
- actions.moveToElement(selectedArrowElement).perform();
+ actions.moveByOffset(20, 20).moveToElement(selectedArrowElement).perform();
return selectedArrowElement;
}