aboutsummaryrefslogtreecommitdiffstats
path: root/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow
diff options
context:
space:
mode:
Diffstat (limited to 'integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow')
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/AbstractUiTestFlow.java39
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CheckEtsiNsPropertiesFlow.java100
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CheckSoftwareVersionPropertyFlow.java10
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateResourceFlow.java12
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateServiceFlow.java67
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateVspFlow.java23
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/DownloadCsarArtifactFlow.java73
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/EditServicePropertiesFlow.java76
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/ImportVspFlow.java18
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/UiTestFlow.java12
10 files changed, 402 insertions, 28 deletions
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/AbstractUiTestFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/AbstractUiTestFlow.java
index 30cfd2e0bd..85c6444a51 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/AbstractUiTestFlow.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/AbstractUiTestFlow.java
@@ -20,11 +20,15 @@
package org.onap.sdc.frontend.ci.tests.flow;
import com.aventstack.extentreports.ExtentTest;
-import org.onap.sdc.frontend.ci.tests.flow.exception.MissingParameterRuntimeException;
+import java.util.Optional;
import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestManager;
+import org.onap.sdc.frontend.ci.tests.flow.exception.MissingParameterRuntimeException;
import org.onap.sdc.frontend.ci.tests.pages.PageObject;
import org.openqa.selenium.WebDriver;
+/**
+ * The base class for a UI test flow.
+ */
public abstract class AbstractUiTestFlow implements UiTestFlow {
protected final WebDriver webDriver;
@@ -34,15 +38,40 @@ public abstract class AbstractUiTestFlow implements UiTestFlow {
this.webDriver = webDriver;
}
+ /**
+ * Find a page object within the the page objects array, based on the given class. If the page object is not found, throws an error.
+ *
+ * @param pageObjects the page object array
+ * @param expectedParameterType the class of the page object to find
+ * @param <T> a child class of the page object
+ * @return the found page object
+ * @throws MissingParameterRuntimeException when the page object is not found
+ */
public <T extends PageObject> T findParameter(final PageObject[] pageObjects,
final Class<T> expectedParameterType) {
+ final Optional<T> parameter = getParameter(pageObjects, expectedParameterType);
+ if (parameter.isEmpty()) {
+ throw new MissingParameterRuntimeException(expectedParameterType.getName());
+ }
+ return parameter.get();
+ }
+
+ /**
+ * Find a page object within the the page objects array, based on the given class.
+ *
+ * @param pageObjects the page object array
+ * @param expectedParameterType the class of the page object to find
+ * @param <T> a child class of the page object
+ * @return an optional page object
+ */
+ public <T extends PageObject> Optional<T> getParameter(final PageObject[] pageObjects,
+ final Class<T> expectedParameterType) {
for (final PageObject uiTestFlow : pageObjects) {
- if(expectedParameterType.isInstance(uiTestFlow)) {
- return (T) uiTestFlow;
+ if (expectedParameterType.isInstance(uiTestFlow)) {
+ return Optional.of((T) uiTestFlow);
}
}
- throw new MissingParameterRuntimeException(expectedParameterType.getName());
+ return Optional.empty();
}
-
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CheckEtsiNsPropertiesFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CheckEtsiNsPropertiesFlow.java
new file mode 100644
index 0000000000..e767dcee5f
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CheckEtsiNsPropertiesFlow.java
@@ -0,0 +1,100 @@
+/*
+ * ============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 com.aventstack.extentreports.Status;
+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.ResourceLeftSideMenu;
+import org.onap.sdc.frontend.ci.tests.pages.ResourcePropertiesAssignmentPage;
+import org.onap.sdc.frontend.ci.tests.pages.ResourceWorkspaceTopBarComponent;
+import org.onap.sdc.frontend.ci.tests.pages.ServiceComponentPage;
+import org.onap.sdc.frontend.ci.tests.pages.TopNavComponent;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Check the required properties in a Service of category ETSI NFV Network Service.
+ */
+public class CheckEtsiNsPropertiesFlow extends AbstractUiTestFlow {
+
+ private ServiceComponentPage serviceComponentPage;
+
+ public CheckEtsiNsPropertiesFlow(final WebDriver webDriver) {
+ super(webDriver);
+ }
+
+ /**
+ * Starts the flow in the {@link ServiceComponentPage}. From there go to the {@link ResourcePropertiesAssignmentPage} and check for the
+ * properties. It does not require any page object, but can receive:
+ * <ul>
+ * <li>{@link ServiceComponentPage} or its children:</li>
+ * <ul>
+ * <li>{@link TopNavComponent}</li>
+ * <li>{@link ResourceLeftSideMenu}</li>
+ * <li>{@link ResourceWorkspaceTopBarComponent}</li>
+ * </ul>
+ * </ul>
+ *
+ * @param pageObjects any required page object for the flow
+ * @return the {@link ServiceComponentPage}
+ */
+ @Override
+ public Optional<ServiceComponentPage> run(final PageObject... pageObjects) {
+ extendTest.log(Status.INFO, "Checking ETSI NFV Network Service properties");
+ serviceComponentPage = getParameter(pageObjects, ServiceComponentPage.class)
+ .orElseGet(() -> {
+ final TopNavComponent topNavComponent = getParameter(pageObjects, TopNavComponent.class).orElse(new TopNavComponent(webDriver));
+ final ResourceLeftSideMenu resourceLeftSideMenu =
+ getParameter(pageObjects, ResourceLeftSideMenu.class).orElse(new ResourceLeftSideMenu(webDriver));
+ final ResourceWorkspaceTopBarComponent workspaceTopBarComponent =
+ getParameter(pageObjects, ResourceWorkspaceTopBarComponent.class).orElse(new ResourceWorkspaceTopBarComponent(webDriver));
+ return new ServiceComponentPage(webDriver, topNavComponent, resourceLeftSideMenu, workspaceTopBarComponent);
+ });
+ serviceComponentPage.isLoaded();
+ final ResourcePropertiesAssignmentPage resourcePropertiesAssignmentPage = serviceComponentPage.goToPropertiesAssignment();
+ checkProperty(resourcePropertiesAssignmentPage, "descriptor_id");
+ checkProperty(resourcePropertiesAssignmentPage, "designer");
+ checkProperty(resourcePropertiesAssignmentPage, "flavour_id");
+ checkProperty(resourcePropertiesAssignmentPage, "invariant_id");
+ checkProperty(resourcePropertiesAssignmentPage, "name");
+ checkProperty(resourcePropertiesAssignmentPage, "ns_profile");
+ checkProperty(resourcePropertiesAssignmentPage, "version");
+ checkProperty(resourcePropertiesAssignmentPage, "ns_profile");
+ checkProperty(resourcePropertiesAssignmentPage, "service_availability_level");
+ ExtentTestActions.takeScreenshot(Status.INFO, "etsi-ns-properties-present", "ETSI NS properties are present");
+ extendTest.log(Status.INFO, "Finished checking ETSI NFV Network Service properties");
+ return Optional.of(serviceComponentPage);
+ }
+
+ @Override
+ public Optional<ServiceComponentPage> getLandedPage() {
+ return Optional.ofNullable(serviceComponentPage);
+ }
+
+ private void checkProperty(final ResourcePropertiesAssignmentPage resourcePropertiesAssignmentPage, final String propertyName) {
+ extendTest.log(Status.INFO, String.format("Checking property '%s'", propertyName));
+ assertThat(String.format("'%s' property should be present", propertyName),
+ resourcePropertiesAssignmentPage.isPropertyPresent(propertyName), is(true));
+ }
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CheckSoftwareVersionPropertyFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CheckSoftwareVersionPropertyFlow.java
index 3b161546c9..1ec1e031fb 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CheckSoftwareVersionPropertyFlow.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CheckSoftwareVersionPropertyFlow.java
@@ -28,9 +28,9 @@ import org.openqa.selenium.WebDriver;
import java.util.List;
import java.util.Optional;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.hasSize;
-import static org.junit.Assert.assertThat;
/**
* UI Flow for checking the software version property in a resource
@@ -38,6 +38,7 @@ import static org.junit.Assert.assertThat;
public class CheckSoftwareVersionPropertyFlow extends AbstractUiTestFlow {
private final List<String> expectedSoftwareVersionList;
+ private ResourcePropertiesAssignmentPage resourcePropertiesAssignmentPage;
public CheckSoftwareVersionPropertyFlow(final WebDriver webDriver, final List<String> expectedSoftwareVersionList) {
super(webDriver);
@@ -49,12 +50,17 @@ public class CheckSoftwareVersionPropertyFlow extends AbstractUiTestFlow {
final ResourceLeftSideMenu resourceLeftSideMenu = new ResourceLeftSideMenu(webDriver);
resourceLeftSideMenu.isLoaded();
- final ResourcePropertiesAssignmentPage resourcePropertiesAssignmentPage = accessPropertiesAssignmentPage();
+ resourcePropertiesAssignmentPage = accessPropertiesAssignmentPage();
checkSoftwareVersionProperty(resourcePropertiesAssignmentPage);
return Optional.empty();
}
+ @Override
+ public Optional<ResourcePropertiesAssignmentPage> getLandedPage() {
+ return Optional.ofNullable(resourcePropertiesAssignmentPage);
+ }
+
/**
* Checks if the software_version property values are as expected by the {@link #expectedSoftwareVersionList}.
*
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateResourceFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateResourceFlow.java
index 4b6f3542d2..09650570e7 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateResourceFlow.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateResourceFlow.java
@@ -33,6 +33,7 @@ import java.util.Optional;
public class CreateResourceFlow extends AbstractUiTestFlow {
private final String resourceName;
+ private ResourceCreatePage resourceCreatePage;
public CreateResourceFlow(final WebDriver webDriver, final String resourceName) {
super(webDriver);
@@ -40,13 +41,18 @@ public class CreateResourceFlow extends AbstractUiTestFlow {
}
@Override
- public Optional<PageObject> run(final PageObject... pageObjects) {
- final ResourceCreatePage resourceCreatePage = findParameter(pageObjects, ResourceCreatePage.class);
+ public Optional<ResourceCreatePage> run(final PageObject... pageObjects) {
+ resourceCreatePage = findParameter(pageObjects, ResourceCreatePage.class);
extendTest.log(Status.INFO, String.format("Creating the Resource '%s'", resourceName));
resourceCreatePage.createResource();
ExtentTestActions.takeScreenshot(Status.INFO, "resource-created",
String.format("Resource '%s' was created", resourceName));
- return Optional.empty();
+ return Optional.ofNullable(resourceCreatePage);
+ }
+
+ @Override
+ public Optional<ResourceCreatePage> getLandedPage() {
+ return Optional.ofNullable(resourceCreatePage);
}
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateServiceFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateServiceFlow.java
new file mode 100644
index 0000000000..bb986c195e
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateServiceFlow.java
@@ -0,0 +1,67 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.sdc.frontend.ci.tests.flow;
+
+import com.aventstack.extentreports.Status;
+import java.util.Objects;
+import java.util.Optional;
+import lombok.Getter;
+import org.onap.sdc.frontend.ci.tests.datatypes.ServiceCreateData;
+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.ServiceCreatePage;
+import org.onap.sdc.frontend.ci.tests.pages.home.HomePage;
+import org.openqa.selenium.WebDriver;
+
+public class CreateServiceFlow extends AbstractUiTestFlow {
+
+ @Getter
+ private final ServiceCreateData serviceCreateData;
+ @Getter
+ private HomePage homePage;
+ private ServiceCreatePage serviceCreatePage;
+
+ public CreateServiceFlow(final WebDriver webDriver, final ServiceCreateData serviceCreateData) {
+ super(webDriver);
+ this.serviceCreateData = serviceCreateData;
+ }
+
+ @Override
+ public Optional<ServiceCreatePage> run(final PageObject... pageObjects) {
+ Objects.requireNonNull(serviceCreateData);
+ extendTest.log(Status.INFO, String.format("Creating Service '%s'", serviceCreateData.getName()));
+ homePage = findParameter(pageObjects, HomePage.class);
+ homePage.isLoaded();
+ serviceCreatePage = homePage.clickOnAddService();
+ serviceCreatePage.isLoaded();
+ serviceCreatePage.fillForm(serviceCreateData);
+ ExtentTestActions.takeScreenshot(Status.INFO, "service-form-filled",
+ String.format("Service '%s' form is filled", serviceCreateData.getName()));
+ serviceCreatePage.clickOnCreate();
+ ExtentTestActions.takeScreenshot(Status.INFO, "service-created",
+ String.format("Service '%s' was created", serviceCreateData.getName()));
+ return Optional.of(serviceCreatePage);
+ }
+
+ @Override
+ public Optional<ServiceCreatePage> getLandedPage() {
+ return Optional.ofNullable(serviceCreatePage);
+ }
+}
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 eb80985eba..3d3d4424ce 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
@@ -19,21 +19,21 @@
package org.onap.sdc.frontend.ci.tests.flow;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
import com.aventstack.extentreports.Status;
+import java.util.Optional;
+import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions;
import org.onap.sdc.frontend.ci.tests.pages.OnboardHomePage;
+import org.onap.sdc.frontend.ci.tests.pages.PageObject;
import org.onap.sdc.frontend.ci.tests.pages.SoftwareProductOnboarding;
import org.onap.sdc.frontend.ci.tests.pages.TopNavComponent;
import org.onap.sdc.frontend.ci.tests.pages.VspCreationModal;
-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.home.HomePage;
import org.onap.sdc.frontend.ci.tests.utilities.GeneralUIUtils;
import org.openqa.selenium.WebDriver;
-import java.util.Optional;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
/**
* UI Flow for VSP creation
*/
@@ -42,6 +42,7 @@ public class CreateVspFlow extends AbstractUiTestFlow {
private final String resourceName;
private final String packageFile;
private final String rootFolder;
+ private HomePage homePage;
public CreateVspFlow(final WebDriver webDriver, final String resourceName, final String packageFile,
final String rootFolder) {
@@ -64,6 +65,11 @@ public class CreateVspFlow extends AbstractUiTestFlow {
return Optional.empty();
}
+ @Override
+ public Optional<HomePage> getLandedPage() {
+ return Optional.ofNullable(homePage);
+ }
+
/**
* Goes to the onboard home page by clicking in the onboard tab in the top nav component.
*
@@ -136,7 +142,8 @@ public class CreateVspFlow extends AbstractUiTestFlow {
topNavComponent.isLoaded();
topNavComponent.clickOnHome();
GeneralUIUtils.ultimateWait();
- topNavComponent.isLoaded();
+ homePage = new HomePage(webDriver, topNavComponent);
+ homePage.isLoaded();
ExtentTestActions.takeScreenshot(Status.INFO, "home-is-loaded", "The Home page is loaded.");
}
}
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
new file mode 100644
index 0000000000..a325f2b749
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/DownloadCsarArtifactFlow.java
@@ -0,0 +1,73 @@
+/*
+ * ============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.PageObject;
+import org.onap.sdc.frontend.ci.tests.pages.ServiceComponentPage;
+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;
+
+public class DownloadCsarArtifactFlow extends AbstractUiTestFlow {
+
+ private ToscaArtifactsPage toscaArtifactsPage;
+
+ public DownloadCsarArtifactFlow(final WebDriver webDriver) {
+ super(webDriver);
+ }
+
+ @Override
+ public Optional<PageObject> run(final PageObject... pageObjects) {
+ final ServiceComponentPage serviceComponentPage = findParameter(pageObjects, ServiceComponentPage.class);
+ toscaArtifactsPage = serviceComponentPage.goToToscaArtifacts();
+ toscaArtifactsPage.isLoaded();
+ toscaArtifactsPage.clickOnDownload("Tosca Model");
+
+ final File downloadedCsar = waitAndGetDowloadedCsar();
+ assertThat("The downloaded CSAR should exist", downloadedCsar, is(notNullValue()));
+ assertThat("The downloaded CSAR should exist", downloadedCsar.exists(), is(true));
+ toscaArtifactsPage.addToDownloadedArtifactList(downloadedCsar.getName());
+ ExtentTestActions.takeScreenshot(Status.INFO, "etsi-ns-csar-downloaded", "ETSI NS CSAR downloaded");
+
+ return Optional.of(toscaArtifactsPage);
+ }
+
+ @Override
+ public Optional<ToscaArtifactsPage> getLandedPage() {
+ return Optional.ofNullable(toscaArtifactsPage);
+ }
+
+ private File waitAndGetDowloadedCsar() {
+ 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/EditServicePropertiesFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/EditServicePropertiesFlow.java
new file mode 100644
index 0000000000..716d386a3e
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/EditServicePropertiesFlow.java
@@ -0,0 +1,76 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.sdc.frontend.ci.tests.flow;
+
+import com.aventstack.extentreports.Status;
+import java.util.Map;
+import java.util.Optional;
+import org.apache.commons.collections4.MapUtils;
+import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions;
+import org.onap.sdc.frontend.ci.tests.pages.PageObject;
+import org.onap.sdc.frontend.ci.tests.pages.ResourceLeftSideMenu;
+import org.onap.sdc.frontend.ci.tests.pages.ResourcePropertiesAssignmentPage;
+import org.onap.sdc.frontend.ci.tests.pages.ResourceWorkspaceTopBarComponent;
+import org.onap.sdc.frontend.ci.tests.pages.ServiceComponentPage;
+import org.onap.sdc.frontend.ci.tests.pages.TopNavComponent;
+import org.openqa.selenium.WebDriver;
+
+public class EditServicePropertiesFlow extends AbstractUiTestFlow {
+
+ private final Map<String, Object> propertiesMap;
+ private ServiceComponentPage serviceComponentPage;
+
+ public EditServicePropertiesFlow(final WebDriver webDriver, final Map<String, Object> propertiesMap) {
+ super(webDriver);
+ this.propertiesMap = propertiesMap;
+ }
+
+ @Override
+ public Optional<ServiceComponentPage> run(final PageObject... pageObjects) {
+ serviceComponentPage = getParameter(pageObjects, ServiceComponentPage.class)
+ .orElseGet(() -> {
+ final TopNavComponent topNavComponent = getParameter(pageObjects, TopNavComponent.class).orElse(new TopNavComponent(webDriver));
+ final ResourceLeftSideMenu resourceLeftSideMenu =
+ getParameter(pageObjects, ResourceLeftSideMenu.class).orElse(new ResourceLeftSideMenu(webDriver));
+ final ResourceWorkspaceTopBarComponent workspaceTopBarComponent =
+ getParameter(pageObjects, ResourceWorkspaceTopBarComponent.class).orElse(new ResourceWorkspaceTopBarComponent(webDriver));
+ return new ServiceComponentPage(webDriver, topNavComponent, resourceLeftSideMenu, workspaceTopBarComponent);
+ });
+ serviceComponentPage.isLoaded();
+ final ResourcePropertiesAssignmentPage resourcePropertiesAssignmentPage = serviceComponentPage.goToPropertiesAssignment();
+ if (MapUtils.isEmpty(propertiesMap)) {
+ return Optional.of(serviceComponentPage);
+ }
+ final String propertyNames = String.join(", ", propertiesMap.keySet());
+ ExtentTestActions.takeScreenshot(Status.INFO, "etsi-ns-edited-properties",
+ String.format("Before editing properties: %s", propertyNames));
+ extendTest.log(Status.INFO, "Editing properties " + propertyNames);
+ propertiesMap.forEach(resourcePropertiesAssignmentPage::setPropertyValue);
+ resourcePropertiesAssignmentPage.saveProperties();
+ ExtentTestActions.takeScreenshot(Status.INFO, "etsi-ns-edited-properties",
+ String.format("Properties edited: %s", propertyNames));
+ return Optional.of(serviceComponentPage);
+ }
+
+ @Override
+ public Optional<ServiceComponentPage> getLandedPage() {
+ return Optional.ofNullable(serviceComponentPage);
+ }
+}
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 bb9098817e..0f1330f82a 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
@@ -20,21 +20,21 @@
package org.onap.sdc.frontend.ci.tests.flow;
import com.aventstack.extentreports.Status;
+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.onap.sdc.frontend.ci.tests.pages.TopNavComponent;
import org.onap.sdc.frontend.ci.tests.pages.VspRepositoryModalComponent;
-import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions;
-import org.onap.sdc.frontend.ci.tests.pages.PageObject;
import org.openqa.selenium.WebDriver;
-import java.util.Optional;
-
/**
* UI Flow for importing a VSP
*/
public class ImportVspFlow extends AbstractUiTestFlow {
private final String resourceName;
+ private ResourceCreatePage resourceCreatePage;
public ImportVspFlow(final WebDriver webDriver, final String resourceName) {
super(webDriver);
@@ -42,10 +42,16 @@ public class ImportVspFlow extends AbstractUiTestFlow {
}
@Override
- public Optional<PageObject> run(final PageObject... pageObjects) {
+ public Optional<ResourceCreatePage> run(final PageObject... pageObjects) {
final VspRepositoryModalComponent vspRepositoryModalComponent = openVspRepository();
searchForVsp(vspRepositoryModalComponent);
- return Optional.of(importVsp(vspRepositoryModalComponent));
+ resourceCreatePage = importVsp(vspRepositoryModalComponent);
+ return Optional.of(resourceCreatePage);
+ }
+
+ @Override
+ public Optional<ResourceCreatePage> getLandedPage() {
+ return Optional.ofNullable(resourceCreatePage);
}
/**
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/UiTestFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/UiTestFlow.java
index 513a62664c..098f25c93a 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/UiTestFlow.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/UiTestFlow.java
@@ -19,14 +19,12 @@
package org.onap.sdc.frontend.ci.tests.flow;
-import org.onap.sdc.frontend.ci.tests.pages.PageObject;
-
import java.util.Optional;
+import org.onap.sdc.frontend.ci.tests.pages.PageObject;
/**
* Represents a UI test flow
*/
-@FunctionalInterface
public interface UiTestFlow {
/**
@@ -34,6 +32,12 @@ public interface UiTestFlow {
* @param pageObjects any required page object for the flow
* @return an optional page object representing the page that the flow has ended
*/
- Optional<PageObject> run(final PageObject... pageObjects);
+ Optional<? extends PageObject> run(final PageObject... pageObjects);
+
+ /**
+ * Gets the page where the flow finished.
+ * @return the page where the flow finished
+ */
+ Optional<? extends PageObject> getLandedPage();
}