summaryrefslogtreecommitdiffstats
path: root/integration-tests/src
diff options
context:
space:
mode:
Diffstat (limited to 'integration-tests/src')
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/config/Config.java16
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/datatypes/enums/ServiceCategoriesEnum.java29
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/ServiceCreateData.java47
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/exception/UnzipException.java27
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiNetworkServiceUiTests.java237
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/OnboardingFlowsUi.java81
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/Service.java2
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/WebDriverThread.java19
-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
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/AbstractPageObject.java30
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceCreatePage.java14
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceLeftSideMenu.java27
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentPage.java131
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceWorkspaceTopBarComponent.java91
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ServiceComponentPage.java55
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ServiceCreatePage.java139
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/SoftwareProductOnboarding.java17
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/TopNavComponent.java11
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/VspRepositoryModalComponent.java25
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/ToscaArtifactsPage.java96
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/home/HomePage.java105
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/FileHandling.java62
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/LoaderHelper.java11
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/NotificationComponent.java (renamed from integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/NotificationHelper.java)46
-rw-r--r--integration-tests/src/test/resources/ci/conf/sdc-conf.yaml2
-rw-r--r--integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml5
35 files changed, 1564 insertions, 191 deletions
diff --git a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/config/Config.java b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/config/Config.java
index fcf79e529f..88d6154f0e 100644
--- a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/config/Config.java
+++ b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/config/Config.java
@@ -31,7 +31,7 @@ import java.util.List;
public class Config {
- private static String SDC_DEFAULT_CONFIG_FILE = "src/test/resources/ci/conf/sdc-conf.yaml";
+ private static final String SDC_DEFAULT_CONFIG_FILE = "src/test/resources/ci/conf/sdc-conf.yaml";
private String downloadAutomationFolder;
private boolean systemUnderDebug;
private boolean rerun;
@@ -104,8 +104,7 @@ public class Config {
private static Config configIt = null;
- private static Yaml yaml = new Yaml();
-
+ private static final Yaml yaml = new Yaml();
private Config() {
super();
@@ -169,18 +168,17 @@ public class Config {
private static Config init() throws IOException {
- Config config = null;
-
String configFile = System.getProperty("config.resource");
if (configFile == null) {
configFile = SDC_DEFAULT_CONFIG_FILE;
}
- File file = new File(configFile);
- if (false == file.exists()) {
+ final File file = new File(configFile);
+ if (!file.exists()) {
throw new RuntimeException("The config file " + configFile + " cannot be found.");
}
+ final Config config;
InputStream in = null;
try {
@@ -200,10 +198,6 @@ public class Config {
}
}
- // JsonReader jsonReader = new JsonReader(new FileReader(configFile));
- // Config configAttOdlIt = new Gson().fromJson(jsonReader,
- // Config.class);
-
return config;
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/datatypes/enums/ServiceCategoriesEnum.java b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/datatypes/enums/ServiceCategoriesEnum.java
index 58918c3e1f..f5200b1ad4 100644
--- a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/datatypes/enums/ServiceCategoriesEnum.java
+++ b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/datatypes/enums/ServiceCategoriesEnum.java
@@ -7,9 +7,9 @@
* 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.
@@ -21,24 +21,25 @@
package org.onap.sdc.backend.ci.tests.datatypes.enums;
import java.util.Random;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+@Getter
+@AllArgsConstructor
public enum ServiceCategoriesEnum {
- VOIP("VoIP Call Control"), MOBILITY("Mobility"), NETWORK_L4("Network L4+"), NETWORK_L3("Network L1-3"),
- PARTNERSERVICE("Partner Domain Service");
- String value;
+ E2E_SERVICE("E2E Service"),
+ ETSI_NFV_NETWORK_SERVICE("ETSI NFV Network Service"),
+ MOBILITY("Mobility"),
+ NETWORK_L3("Network L1-3"),
+ NETWORK_L4("Network L4+"),
+ PARTNER_SERVICE("Partner Domain Service"),
+ VOIP("VoIP Call Control");
- private ServiceCategoriesEnum(String value) {
- this.value = value;
- }
-
- public String getValue() {
-
- return value;
- }
+ private final String value;
public static ServiceCategoriesEnum getRandomElement() {
- Random random = new Random();
+ final Random random = new Random();
return ServiceCategoriesEnum.values()[random.nextInt(ServiceCategoriesEnum.values().length)];
}
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/ServiceCreateData.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/ServiceCreateData.java
new file mode 100644
index 0000000000..834522c6f1
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/ServiceCreateData.java
@@ -0,0 +1,47 @@
+/*
+ * ============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 java.util.List;
+import java.util.UUID;
+import lombok.Data;
+import org.onap.sdc.backend.ci.tests.datatypes.enums.ServiceInstantiationType;
+
+@Data
+public class ServiceCreateData {
+
+ private String name;
+ private String category;
+ private String etsiVersion;
+ private List<String> tagList;
+ private String description;
+ private String contactId;
+ private Boolean hasGeneratedNaming;
+ private String namingPolicy;
+ private String serviceType;
+ private String serviceRole;
+ private String serviceFunction;
+ private ServiceInstantiationType instantiationType;
+
+ public void setRandomName(final String prefix) {
+ final String randomPart = UUID.randomUUID().toString().split("-")[0];
+ this.name = String.format("%s%s", prefix == null ? "" : prefix, randomPart);
+ }
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/exception/UnzipException.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/exception/UnzipException.java
new file mode 100644
index 0000000000..be64e3e7aa
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/exception/UnzipException.java
@@ -0,0 +1,27 @@
+/*
+ * ============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.exception;
+
+public class UnzipException extends Exception {
+
+ public UnzipException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiNetworkServiceUiTests.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiNetworkServiceUiTests.java
new file mode 100644
index 0000000000..a2a41b72d2
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiNetworkServiceUiTests.java
@@ -0,0 +1,237 @@
+/*
+ * ============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.empty;
+import static org.hamcrest.Matchers.hasKey;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.not;
+import static org.hamcrest.Matchers.notNullValue;
+import static org.junit.Assert.fail;
+
+import com.aventstack.extentreports.Status;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Optional;
+import org.apache.commons.io.FilenameUtils;
+import org.junit.jupiter.api.Assertions;
+import org.onap.sdc.backend.ci.tests.datatypes.enums.ServiceCategoriesEnum;
+import org.onap.sdc.backend.ci.tests.datatypes.enums.UserRoleEnum;
+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.SetupCDTest;
+import org.onap.sdc.frontend.ci.tests.flow.CheckEtsiNsPropertiesFlow;
+import org.onap.sdc.frontend.ci.tests.flow.CreateServiceFlow;
+import org.onap.sdc.frontend.ci.tests.flow.DownloadCsarArtifactFlow;
+import org.onap.sdc.frontend.ci.tests.flow.EditServicePropertiesFlow;
+import org.onap.sdc.frontend.ci.tests.flow.exception.UiTestFlowRuntimeException;
+import org.onap.sdc.frontend.ci.tests.pages.ServiceComponentPage;
+import org.onap.sdc.frontend.ci.tests.pages.TopNavComponent;
+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;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.Test;
+import org.yaml.snakeyaml.Yaml;
+
+public class EtsiNetworkServiceUiTests extends SetupCDTest {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(EtsiNetworkServiceUiTests.class);
+
+ private WebDriver webDriver;
+
+ @Test
+ public void createEtsiNetworkService() throws UnzipException {
+ webDriver = DriverFactory.getDriver();
+
+ final CreateServiceFlow createServiceFlow = createService();
+ final CheckEtsiNsPropertiesFlow checkEtsiNsPropertiesFlow = checkServiceProperties();
+ final ServiceComponentPage serviceComponentPage = checkEtsiNsPropertiesFlow.getLandedPage()
+ .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected ServiceComponentPage"));
+
+ final Map<String, Object> propertyMap = createPropertyToEditMap();
+ editProperties(serviceComponentPage, propertyMap);
+
+ final DownloadCsarArtifactFlow downloadCsarArtifactFlow = downloadCsarArtifact(serviceComponentPage);
+ 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);
+ checkEtsiNsPackage(createServiceFlow.getServiceCreateData().getName(), downloadedCsarName, propertyMap);
+ }
+
+ private CreateServiceFlow createService() {
+ final ServiceCreateData serviceCreateData = createServiceFormData();
+ final CreateServiceFlow createServiceFlow = new CreateServiceFlow(webDriver, serviceCreateData);
+ final TopNavComponent topNavComponent = new TopNavComponent(webDriver);
+ createServiceFlow.run(new HomePage(webDriver, topNavComponent));
+ return createServiceFlow;
+ }
+
+ private CheckEtsiNsPropertiesFlow checkServiceProperties() {
+ final CheckEtsiNsPropertiesFlow checkEtsiNsPropertiesFlow = new CheckEtsiNsPropertiesFlow(webDriver);
+ checkEtsiNsPropertiesFlow.run();
+ return checkEtsiNsPropertiesFlow;
+ }
+
+ private void editProperties(final ServiceComponentPage serviceComponentPage, final Map<String, Object> propertyMap) {
+ final EditServicePropertiesFlow editServicePropertiesFlow = new EditServicePropertiesFlow(webDriver, propertyMap);
+ editServicePropertiesFlow.run(serviceComponentPage);
+ }
+
+ private DownloadCsarArtifactFlow downloadCsarArtifact(final ServiceComponentPage serviceComponentPage) {
+ final DownloadCsarArtifactFlow downloadCsarArtifactFlow = new DownloadCsarArtifactFlow(webDriver);
+ downloadCsarArtifactFlow.run(serviceComponentPage);
+ return downloadCsarArtifactFlow;
+ }
+
+ private Map<String, Object> createPropertyToEditMap() {
+ final Map<String, Object> propertyMap = new HashMap<>();
+ propertyMap.put("designer", "designer1");
+ propertyMap.put("descriptor_id", "descriptor_id1");
+ propertyMap.put("flavour_id", "flavour_id1");
+ propertyMap.put("invariant_id", "invariant_id1");
+ propertyMap.put("name", "name1");
+ propertyMap.put("version", "version1");
+ propertyMap.put("service_availability_level", 1);
+ //does not work yet with TOSCA complex types
+ propertyMap.put("ns_profile", null);
+ return propertyMap;
+ }
+
+ private ServiceCreateData createServiceFormData() {
+ final ServiceCreateData serviceCreateData = new ServiceCreateData();
+ serviceCreateData.setRandomName("EtsiNfvNetworkService");
+ serviceCreateData.setCategory(ServiceCategoriesEnum.ETSI_NFV_NETWORK_SERVICE.getValue());
+ serviceCreateData.setEtsiVersion("2.5.1");
+ serviceCreateData.setDescription("aDescription");
+ return serviceCreateData;
+ }
+
+ private void checkEtsiNsPackage(final String serviceName, final String downloadedCsarName,
+ final Map<String, Object> expectedPropertyMap) throws UnzipException {
+ final String downloadFolderPath = getConfig().getDownloadAutomationFolder();
+ final Map<String, byte[]> filesFromZip = FileHandling.getFilesFromZip(downloadFolderPath, downloadedCsarName);
+ final Optional<String> etsiPackageEntryOpt =
+ filesFromZip.keySet().stream().filter(s -> s.startsWith("Artifacts/ETSI_PACKAGE")).findFirst();
+ if (etsiPackageEntryOpt.isEmpty()) {
+ Assertions.fail("Could not find the NSD package in Artifacts/ETSI_PACKAGE");
+ }
+ final String nodeType = String.format("org.openecomp.service.%s",
+ serviceName.substring(0, 1).toUpperCase() + serviceName.substring(1).toLowerCase());
+ final String etsiPackageEntry = etsiPackageEntryOpt.get();
+ final String nsdPackageBaseName = FilenameUtils.getBaseName(etsiPackageEntry);
+ final String nsdCsarFile = nsdPackageBaseName + ".csar";
+ final byte[] etsiPackageBytes = filesFromZip.get(etsiPackageEntry);
+ if (etsiPackageEntry.endsWith(".zip")) {
+ final Map<String, byte[]> nsPackageFileMap = FileHandling.getFilesFromZip(etsiPackageBytes);
+ assertThat("Expecting 3 files inside the NSD CSAR, the CSAR itself and its signature and certificate",
+ nsPackageFileMap.size(), is(3));
+ assertThat("Expecting the NSD CSAR file " + nsdCsarFile, nsPackageFileMap, hasKey(nsdCsarFile));
+ final String nsdCsarSignature = nsdPackageBaseName + ".cms";
+ assertThat("Expecting the NSD CSAR signature " + nsdCsarSignature, nsPackageFileMap, hasKey(nsdCsarSignature));
+ final String nsdCertificate = nsdPackageBaseName + ".cert";
+ assertThat("Expecting the NSD CSAR certificate " + nsdCertificate, nsPackageFileMap, hasKey(nsdCertificate));
+ checkNsCsar(nsdPackageBaseName, nodeType, expectedPropertyMap, nsPackageFileMap.get(nsdCsarFile));
+ return;
+ }
+ if (etsiPackageEntry.endsWith(".csar")) {
+ final Map<String, byte[]> nsPackageFileMap = FileHandling.getFilesFromZip(etsiPackageBytes);
+ checkNsCsar(nsdPackageBaseName, nodeType, expectedPropertyMap, nsPackageFileMap.get(nsdCsarFile));
+ return;
+ }
+ fail(String.format("Unexpected ETSI NS PACKAGE entry '%s'. Expecting a '.csar' or '.zip'", etsiPackageEntry));
+ }
+
+ private void checkNsCsar(final String expectedServiceName, final String expectedServiceNodeType, final Map<String, Object> expectedPropertiesMap,
+ final byte[] nsCsar) {
+ try {
+ final Map<String, byte[]> csarFileMap = FileHandling.getFilesFromZip(nsCsar);
+ final String mainDefinitionFile = String.format("Definitions/%s.yaml", expectedServiceName);
+ final byte[] mainDefinitionFileBytes = csarFileMap.get(mainDefinitionFile);
+ if (mainDefinitionFileBytes == null) {
+ Assertions.fail(String.format("Could not find the Main Definition file in '%s'", mainDefinitionFile));
+ }
+
+ final Map<String, Object> mainDefinitionYamlMap = loadYamlObject(mainDefinitionFileBytes);
+ final Map<String, Object> topologyTemplateTosca = getMapEntry(mainDefinitionYamlMap, "topology_template");
+ assertThat(String.format("'%s' should contain a topology_template entry", mainDefinitionFile), topologyTemplateTosca, notNullValue());
+ final Map<String, Object> substitutionMappingsTosca = getMapEntry(topologyTemplateTosca, "substitution_mappings");
+ assertThat(String.format("'%s' should contain a substitution_mappings entry", mainDefinitionFile), substitutionMappingsTosca, notNullValue());
+ final String nodeType = (String) substitutionMappingsTosca.get("node_type");
+ assertThat("substitution_mappings->node_type should be as expected", nodeType, is(expectedServiceNodeType));
+
+ final Map<String, Object> nodeTemplatesTosca = getMapEntry(topologyTemplateTosca, "node_templates");
+ assertThat(String.format("'%s' should contain a node_templates entry", mainDefinitionFile), nodeTemplatesTosca, notNullValue());
+ final Map<String, Object> serviceNodeTemplate = getMapEntry(nodeTemplatesTosca, expectedServiceNodeType);
+ assertThat(String.format("'%s' should contain a '%s' entry in node_templates", mainDefinitionFile, expectedServiceNodeType),
+ serviceNodeTemplate, notNullValue());
+ final Map<String, Object> properties = getMapEntry(serviceNodeTemplate, "properties");
+ assertThat(String.format("'%s' node template in '%s' should contain a properties entry", expectedServiceNodeType, mainDefinitionFile),
+ properties, notNullValue());
+ assertThat(String.format("'%s' node template should contain '%s' properties", expectedServiceNodeType, expectedPropertiesMap.size()),
+ properties.size(), is(expectedPropertiesMap.size()));
+ for (final Entry<String, Object> expectedPropertyEntry : expectedPropertiesMap.entrySet()) {
+ final String expectedPropertyName = expectedPropertyEntry.getKey();
+ assertThat(String.format("'%s' node template should contain the property '%s'", expectedServiceNodeType, expectedPropertyName),
+ properties, hasKey(expectedPropertyName));
+ final Object expectedPropertyValue = expectedPropertyEntry.getValue();
+ if (expectedPropertyValue != null) {
+ final Object actualPropertyValue = properties.get(expectedPropertyName);
+ final String msg = String.format("The property '%s', in '%s' node template should have the expected value '%s'",
+ expectedPropertyName, expectedServiceNodeType, actualPropertyValue);
+ assertThat(msg, actualPropertyValue, is(expectedPropertyValue));
+ }
+ }
+
+ } catch (final UnzipException e) {
+ final String errorMsg = "Could not unzip Network Service CSAR.";
+ LOGGER.info(errorMsg, e);
+ fail(String.format("%s Error: %s", errorMsg, e.getMessage()));
+ }
+ }
+
+ 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);
+ LOGGER.error(errorMsg, e);
+ fail(errorMsg + "Error message: " + e.getMessage());
+ }
+ return null;
+ }
+
+ private Map<String, Object> loadYamlObject(final byte[] mainDefinitionFileBytes) {
+ return new Yaml().load(new String(mainDefinitionFileBytes));
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/OnboardingFlowsUi.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/OnboardingFlowsUi.java
index 73c6d7cf6d..050e6960f2 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/OnboardingFlowsUi.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/OnboardingFlowsUi.java
@@ -21,39 +21,48 @@
package org.onap.sdc.frontend.ci.tests.execute.sanity;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
+import static org.testng.AssertJUnit.fail;
+
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
+import java.io.File;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
import org.onap.sdc.backend.ci.tests.data.providers.OnboardingDataProviders;
-import org.onap.sdc.frontend.ci.tests.dataProvider.OnbordingDataProviders;
-import org.onap.sdc.backend.ci.tests.datatypes.enums.XnfTypeEnum;
-import org.onap.sdc.frontend.ci.tests.flow.CheckSoftwareVersionPropertyFlow;
-import org.onap.sdc.frontend.ci.tests.flow.CreateResourceFlow;
-import org.onap.sdc.frontend.ci.tests.flow.CreateVspFlow;
-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.*;
-import org.onap.sdc.frontend.ci.tests.utilities.FileHandling;
-import org.onap.sdc.frontend.ci.tests.utilities.GeneralUIUtils;
-import org.onap.sdc.frontend.ci.tests.utilities.OnboardingUiUtils;
-import org.onap.sdc.frontend.ci.tests.utilities.ServiceUIUtils;
-import org.onap.sdc.backend.ci.tests.utils.Utils;
-import org.onap.sdc.frontend.ci.tests.verificator.ServiceVerificator;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.Service;
-import org.onap.sdc.frontend.ci.tests.datatypes.CanvasElement;
-import org.onap.sdc.frontend.ci.tests.datatypes.CanvasManager;
-import org.onap.sdc.frontend.ci.tests.datatypes.DataTestIdEnum;
import org.onap.sdc.backend.ci.tests.datatypes.ResourceReqDetails;
import org.onap.sdc.backend.ci.tests.datatypes.ServiceReqDetails;
import org.onap.sdc.backend.ci.tests.datatypes.VendorLicenseModel;
import org.onap.sdc.backend.ci.tests.datatypes.VendorSoftwareProductObject;
import org.onap.sdc.backend.ci.tests.datatypes.enums.UserRoleEnum;
+import org.onap.sdc.backend.ci.tests.datatypes.enums.XnfTypeEnum;
+import org.onap.sdc.backend.ci.tests.utils.Utils;
+import org.onap.sdc.backend.ci.tests.utils.general.AtomicOperationUtils;
+import org.onap.sdc.backend.ci.tests.utils.general.ElementFactory;
+import org.onap.sdc.backend.ci.tests.utils.general.OnboardingUtils;
+import org.onap.sdc.backend.ci.tests.utils.general.VendorLicenseModelRestUtils;
+import org.onap.sdc.backend.ci.tests.utils.general.VendorSoftwareProductRestUtils;
+import org.onap.sdc.frontend.ci.tests.dataProvider.OnbordingDataProviders;
+import org.onap.sdc.frontend.ci.tests.datatypes.CanvasElement;
+import org.onap.sdc.frontend.ci.tests.datatypes.CanvasManager;
+import org.onap.sdc.frontend.ci.tests.datatypes.DataTestIdEnum;
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.CheckSoftwareVersionPropertyFlow;
+import org.onap.sdc.frontend.ci.tests.flow.CreateResourceFlow;
+import org.onap.sdc.frontend.ci.tests.flow.CreateVspFlow;
+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.CompositionPage;
import org.onap.sdc.frontend.ci.tests.pages.DeploymentArtifactPage;
+import org.onap.sdc.frontend.ci.tests.pages.GeneralPageElements;
import org.onap.sdc.frontend.ci.tests.pages.GovernorOperationPage;
import org.onap.sdc.frontend.ci.tests.pages.HomePage;
import org.onap.sdc.frontend.ci.tests.pages.OpsOperationPage;
@@ -64,11 +73,14 @@ import org.onap.sdc.frontend.ci.tests.pages.TesterOperationPage;
import org.onap.sdc.frontend.ci.tests.pages.TopNavComponent;
import org.onap.sdc.frontend.ci.tests.pages.VspValidationPage;
import org.onap.sdc.frontend.ci.tests.pages.VspValidationResultsPage;
-import org.onap.sdc.backend.ci.tests.utils.general.AtomicOperationUtils;
-import org.onap.sdc.backend.ci.tests.utils.general.ElementFactory;
-import org.onap.sdc.backend.ci.tests.utils.general.OnboardingUtils;
-import org.onap.sdc.backend.ci.tests.utils.general.VendorLicenseModelRestUtils;
-import org.onap.sdc.backend.ci.tests.utils.general.VendorSoftwareProductRestUtils;
+import org.onap.sdc.frontend.ci.tests.utilities.FileHandling;
+import org.onap.sdc.frontend.ci.tests.utilities.GeneralUIUtils;
+import org.onap.sdc.frontend.ci.tests.utilities.OnboardingUiUtils;
+import org.onap.sdc.frontend.ci.tests.utilities.ServiceUIUtils;
+import org.onap.sdc.frontend.ci.tests.verificator.ServiceVerificator;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.slf4j.Logger;
@@ -80,19 +92,6 @@ import org.testng.annotations.Optional;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
-import java.io.File;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
public class OnboardingFlowsUi extends SetupCDTest {
private static final Logger LOGGER = LoggerFactory.getLogger(OnboardingFlowsUi.class);
@@ -395,10 +394,8 @@ public class OnboardingFlowsUi extends SetupCDTest {
createVspFlow.run(new TopNavComponent(webDriver));
final ImportVspFlow importVspFlow = new ImportVspFlow(webDriver, resourceName);
- final ResourceCreatePage resourceCreatePage =
- (ResourceCreatePage) importVspFlow.run()
- .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage"));
-
+ final ResourceCreatePage resourceCreatePage = importVspFlow.run()
+ .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage"));
final CreateResourceFlow createResourceFlow = new CreateResourceFlow(webDriver, resourceName);
createResourceFlow.run(resourceCreatePage);
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/Service.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/Service.java
index 70bf7674fa..6ff0ee9d56 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/Service.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/Service.java
@@ -128,7 +128,7 @@ public class Service extends SetupCDTest {
List<WebElement> ddOptions = ServiceGeneralPage.getCategories();
for (WebElement opt: ddOptions) {
- assertFalse("Hidden Category visible", ServiceCategoriesEnum.PARTNERSERVICE.equals(opt.getText()));
+ assertFalse("Hidden Category visible", ServiceCategoriesEnum.PARTNER_SERVICE.equals(opt.getText()));
}
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/WebDriverThread.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/WebDriverThread.java
index afc8524751..4d08e846e8 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/WebDriverThread.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/WebDriverThread.java
@@ -20,31 +20,21 @@
package org.onap.sdc.frontend.ci.tests.execute.setup;
-import net.lightbody.bmp.BrowserMobProxyServer;
-import net.lightbody.bmp.client.ClientUtil;
-import net.lightbody.bmp.proxy.CaptureType;
+import java.net.MalformedURLException;
+import java.net.URL;
import org.onap.sdc.backend.ci.tests.config.Config;
import org.onap.sdc.frontend.ci.tests.exception.WebDriverThreadRuntimeException;
-import org.onap.sdc.frontend.ci.tests.utilities.FileHandling;
import org.openqa.selenium.Dimension;
-import org.openqa.selenium.Platform;
-import org.openqa.selenium.UnexpectedAlertBehaviour;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.remote.CapabilityType;
-import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.LocalFileDetector;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.UUID;
-
public class WebDriverThread {
private final static Logger LOGGER = LoggerFactory.getLogger(SetupCDTest.class);
@@ -94,7 +84,10 @@ public class WebDriverThread {
LOGGER.info("Opening LOCAL browser");
System.setProperty("webdriver.gecko.driver", "target/gecko/geckodriver");
FirefoxOptions firefoxOptions = new FirefoxOptions();
- firefoxOptions.setProfile(initFirefoxProfile(config));
+ final FirefoxProfile firefoxProfile = initFirefoxProfile(config);
+ firefoxProfile.setPreference("browser.download.dir", config.getDownloadAutomationFolder());
+ firefoxProfile.setPreference("browser.download.folderList", 2);
+ firefoxOptions.setProfile(firefoxProfile);
firefoxOptions.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
firefoxOptions.setHeadless(false);
webdriver = new FirefoxDriver(firefoxOptions);
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();
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/AbstractPageObject.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/AbstractPageObject.java
index 06c32801d6..2564d0dd74 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/AbstractPageObject.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/AbstractPageObject.java
@@ -163,4 +163,34 @@ public abstract class AbstractPageObject implements PageObject {
.until(ExpectedConditions.invisibilityOfElementLocated(locator));
}
+ /**
+ * Waits for element invisibility with the provided timeout.
+ *
+ * @param locator the By locator to search for the element
+ * @param timeoutInSeconds the wait timeout in seconds
+ * @return the WebElement if invisible before timeout, false otherwise
+ */
+ protected Boolean waitForElementInvisibility(final By locator, final int timeoutInSeconds) {
+ return getWait(timeoutInSeconds)
+ .until(ExpectedConditions.invisibilityOfElementLocated(locator));
+ }
+
+ /**
+ * Waits elements to be clickable with the default timeout.
+ * @param xpath the xpath to find the element(s)
+ * @return the WebElement if clickable before timeout, otherwise throws an exception
+ */
+ protected WebElement waitToBeClickable(final String xpath) {
+ return waitToBeClickable(By.xpath(xpath));
+ }
+
+ /**
+ * Waits elements to be clickable with the default timeout.
+ * @param locator the By locator to search for the element(s)
+ * @return the WebElement if clickable before timeout, otherwise throws an exception
+ */
+ protected WebElement waitToBeClickable(final By locator) {
+ return getWait().until(ExpectedConditions.elementToBeClickable(locator));
+ }
+
}
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 08724c9a98..b856a13de0 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
@@ -21,8 +21,8 @@ package org.onap.sdc.frontend.ci.tests.pages;
import org.onap.sdc.frontend.ci.tests.datatypes.LifeCycleStateEnum;
import org.onap.sdc.frontend.ci.tests.utilities.LoaderHelper;
-import org.onap.sdc.frontend.ci.tests.utilities.NotificationHelper;
-import org.onap.sdc.frontend.ci.tests.utilities.NotificationHelper.NotificationType;
+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;
@@ -30,9 +30,9 @@ import org.openqa.selenium.support.ui.ExpectedConditions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalToIgnoringCase;
import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
import static org.onap.sdc.frontend.ci.tests.pages.ResourceCreatePage.XpathSelector.FORM_LIFE_CYCLE_STATE;
/**
@@ -42,14 +42,14 @@ public class ResourceCreatePage extends AbstractPageObject {
private static final Logger LOGGER = LoggerFactory.getLogger(ResourceCreatePage.class);
private final LoaderHelper loaderHelper;
- private final NotificationHelper notificationHelper;
+ private final NotificationComponent notificationComponent;
private WebElement createBtn;
public ResourceCreatePage(final WebDriver webDriver, final LoaderHelper loaderHelper,
- final NotificationHelper notificationHelper) {
+ final NotificationComponent notificationComponent) {
super(webDriver);
this.loaderHelper = loaderHelper;
- this.notificationHelper = notificationHelper;
+ this.notificationComponent = notificationComponent;
timeoutInSeconds = 5;
}
@@ -69,7 +69,7 @@ public class ResourceCreatePage extends AbstractPageObject {
public void createResource() {
createBtn.click();
loaderHelper.waitForLoader(60);
- notificationHelper.waitForNotification(NotificationType.SUCCESS, 60);
+ notificationComponent.waitForNotification(NotificationType.SUCCESS, 60);
}
/**
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 35c8b090e0..03df126f00 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
@@ -19,13 +19,16 @@
package org.onap.sdc.frontend.ci.tests.pages;
+import org.onap.sdc.frontend.ci.tests.pages.component.workspace.ToscaArtifactsPage;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
+import static org.onap.sdc.frontend.ci.tests.pages.ResourceLeftSideMenu.XpathSelector.GENERAL_MENU;
import static org.onap.sdc.frontend.ci.tests.pages.ResourceLeftSideMenu.XpathSelector.MAIN_DIV;
import static org.onap.sdc.frontend.ci.tests.pages.ResourceLeftSideMenu.XpathSelector.PROPERTIES_ASSIGNMENT_MENU;
+import static org.onap.sdc.frontend.ci.tests.pages.ResourceLeftSideMenu.XpathSelector.TOSCA_ARTIFACTS_MENU;
/**
* Handles the Resource Page Left Side Menu UI actions
@@ -65,11 +68,33 @@ public class ResourceLeftSideMenu extends AbstractPageObject {
}
/**
+ * Clicks on the TOSCA artifacts menu item.
+ *
+ * @return the next page object
+ */
+ public ToscaArtifactsPage clickOnToscaArtifactsMenuItem() {
+ wrappingElement.findElement(By.xpath(TOSCA_ARTIFACTS_MENU.getXpath())).click();
+ return new ToscaArtifactsPage(webDriver);
+ }
+
+ /**
+ * Clicks on the TOSCA artifacts menu item.
+ *
+ * @return the next page object
+ */
+ public ServiceCreatePage clickOnGeneralMenuItem() {
+ wrappingElement.findElement(By.xpath(GENERAL_MENU.getXpath())).click();
+ return new ServiceCreatePage(webDriver);
+ }
+
+ /**
* Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
*/
public enum XpathSelector {
MAIN_DIV("w-sdc-left-sidebar", "//div[@class='%s']"),
- PROPERTIES_ASSIGNMENT_MENU("Properties AssignmentLeftSideMenu", "//*[@data-tests-id='%s']");
+ PROPERTIES_ASSIGNMENT_MENU("Properties AssignmentLeftSideMenu", "//*[@data-tests-id='%s']"),
+ GENERAL_MENU("GeneralLeftSideMenu", "//*[@data-tests-id='%s']"),
+ TOSCA_ARTIFACTS_MENU("TOSCA ArtifactsLeftSideMenu", "//*[@data-tests-id='%s']");
private final String id;
private final String xpathFormat;
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentPage.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentPage.java
index 726a73f0cf..bf99e03f9f 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentPage.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentPage.java
@@ -19,30 +19,42 @@
package org.onap.sdc.frontend.ci.tests.pages;
-import org.openqa.selenium.By;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.WebElement;
-import org.openqa.selenium.support.ui.ExpectedConditions;
-
-import java.util.ArrayList;
-import java.util.List;
-
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.onap.sdc.frontend.ci.tests.pages.ResourcePropertiesAssignmentPage.XpathSelector.INPUT_PROPERTY;
import static org.onap.sdc.frontend.ci.tests.pages.ResourcePropertiesAssignmentPage.XpathSelector.MAIN_DIV;
import static org.onap.sdc.frontend.ci.tests.pages.ResourcePropertiesAssignmentPage.XpathSelector.NO_DATA_MESSAGE;
import static org.onap.sdc.frontend.ci.tests.pages.ResourcePropertiesAssignmentPage.XpathSelector.PROPERTIES_TABLE;
+import static org.onap.sdc.frontend.ci.tests.pages.ResourcePropertiesAssignmentPage.XpathSelector.PROPERTY_CHECKBOX;
+import static org.onap.sdc.frontend.ci.tests.pages.ResourcePropertiesAssignmentPage.XpathSelector.PROPERTY_SAVE_BTN;
import static org.onap.sdc.frontend.ci.tests.pages.ResourcePropertiesAssignmentPage.XpathSelector.SOFTWARE_VERSION_INPUT;
import static org.onap.sdc.frontend.ci.tests.pages.ResourcePropertiesAssignmentPage.XpathSelector.SOFTWARE_VERSION_PROPERTY_CHECKBOX;
import static org.onap.sdc.frontend.ci.tests.pages.ResourcePropertiesAssignmentPage.XpathSelector.TITLE_DIV;
+import java.util.ArrayList;
+import java.util.List;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+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.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+
/**
* Handles the Resource Properties Assignment Page UI actions
*/
public class ResourcePropertiesAssignmentPage extends AbstractPageObject {
private WebElement wrappingElement;
+ private LoaderHelper loaderHelper;
+ private NotificationComponent notificationComponent;
public ResourcePropertiesAssignmentPage(final WebDriver webDriver) {
super(webDriver);
+ notificationComponent = new NotificationComponent(webDriver);
+ loaderHelper = new LoaderHelper(webDriver);
}
@Override
@@ -61,7 +73,7 @@ public class ResourcePropertiesAssignmentPage extends AbstractPageObject {
public List<String> getSoftwareVersionProperty() {
waitPropertiesToLoad();
final By swVersionCheckboxLocator = By.xpath(SOFTWARE_VERSION_PROPERTY_CHECKBOX.getXpath());
- getWait(5).until(ExpectedConditions.visibilityOfElementLocated(swVersionCheckboxLocator));
+ waitForElementVisibility(swVersionCheckboxLocator, 5);
final List<String> softwareVersionList = new ArrayList<>();
final List<WebElement> elements = wrappingElement.findElements(By.xpath(SOFTWARE_VERSION_INPUT.getXpath()));
@@ -73,41 +85,118 @@ public class ResourcePropertiesAssignmentPage extends AbstractPageObject {
}
/**
+ * Gets the value of a string TOSCA property.
+ *
+ * @return the value of the property
+ */
+ public String getStringPropertyValue(final String propertyName) {
+ waitPropertiesToLoad();
+ final By propertyCheckboxLocator = By.xpath(PROPERTY_CHECKBOX.getXpath(propertyName));
+ final WebElement propertyCheckbox = waitForElementVisibility(propertyCheckboxLocator, 5);
+ final WebElement propertyRow = propertyCheckbox.findElement(By.xpath("./../../.."));
+ final WebElement propertyInput = propertyRow.findElement(By.xpath(INPUT_PROPERTY.getXpath(propertyName)));
+ return propertyInput.getAttribute("value");
+ }
+
+ /**
+ * Set a value to a TOSCA string property.
+ */
+ public void setStringPropertyValue(final String propertyName, final String value) {
+ if (value == null) {
+ return;
+ }
+ waitPropertiesToLoad();
+ final By propertyCheckboxLocator = By.xpath(PROPERTY_CHECKBOX.getXpath(propertyName));
+ final WebElement propertyCheckbox = waitForElementVisibility(propertyCheckboxLocator, 5);
+ final WebElement propertyRow = propertyCheckbox.findElement(By.xpath("./../../.."));
+ final WebElement propertyInput = propertyRow.findElement(By.xpath(INPUT_PROPERTY.getXpath(propertyName)));
+ propertyInput.sendKeys(value);
+ }
+
+ public void setPropertyValue(final String propertyName, final Object value) {
+ if (value == null) {
+ return;
+ }
+
+ if (value instanceof String) {
+ setStringPropertyValue(propertyName, (String) value);
+ return;
+ }
+
+ if (value instanceof Integer) {
+ setStringPropertyValue(propertyName, ((Integer) value).toString());
+ return;
+ }
+
+ if (value instanceof Boolean) {
+ setStringPropertyValue(propertyName, ((Boolean) value).toString());
+ return;
+ }
+
+ throw new UnsupportedOperationException("Cannot set property value of type: " + value.getClass());
+ }
+
+ /**
+ * Checks if a property exists.
+ *
+ * @return the value of the property
+ */
+ public boolean isPropertyPresent(final String propertyName) {
+ waitPropertiesToLoad();
+ try {
+ waitForElementVisibility(By.xpath(PROPERTY_CHECKBOX.getXpath(propertyName)), 5);
+ } catch (final Exception ignored) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
* Waits for the properties loading.
*/
private void waitPropertiesToLoad() {
- getWait(5)
- .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(PROPERTIES_TABLE.getXpath())));
- getWait(5)
- .until(ExpectedConditions.invisibilityOfElementLocated(By.xpath(NO_DATA_MESSAGE.getXpath())));
+ waitForElementVisibility(By.xpath(PROPERTIES_TABLE.getXpath()), 5);
+ waitForElementInvisibility(By.xpath(NO_DATA_MESSAGE.getXpath()), 5);
+ }
+
+ public void saveProperties() {
+ final WebElement saveBtn = waitForElementVisibility(By.xpath(PROPERTY_SAVE_BTN.getXpath()));
+ assertTrue(saveBtn.isEnabled(), "Property save button should be enabled.");
+ saveBtn.click();
+ loaderHelper.waitForLoader(20);
+ notificationComponent.waitForNotification(NotificationType.SUCCESS, 20);
}
/**
* Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
*/
+ @AllArgsConstructor
public enum XpathSelector {
MAIN_DIV("w-sdc-main-right-container", "//div[@class='%s']"),
TITLE_DIV("tab-title", "//div[contains(@class,'%s') and contains(text(), 'Properties Assignment')]"),
PROPERTIES_TABLE("properties-table", "//div[contains(@class,'%s')]"),
NO_DATA_MESSAGE("no-data", "//div[contains(@class,'%s') and text()='No data to display']"),
SOFTWARE_VERSION_PROPERTY_CHECKBOX("software_versions", "//checkbox[@data-tests-id='%s']"),
- SOFTWARE_VERSION_INPUT("value-prop-software_versions.", "//input[starts-with(@data-tests-id,'%s')]");
+ SOFTWARE_VERSION_INPUT("value-prop-software_versions", "//input[starts-with(@data-tests-id,'%s')]"),
+ PROPERTY_CHECKBOX("//checkbox[@data-tests-id='%s']"),
+ PROPERTY_SAVE_BTN("properties-save-button", "//button[@data-tests-id='%s']"),
+ INPUT_PROPERTY("//input[@data-tests-id='value-prop-%s']");
- private final String id;
+ @Getter
+ private String id;
private final String xpathFormat;
- XpathSelector(final String id, final String xpathFormat) {
- this.id = id;
+ XpathSelector(final String xpathFormat) {
this.xpathFormat = xpathFormat;
}
- public String getId() {
- return id;
- }
-
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/ResourceWorkspaceTopBarComponent.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceWorkspaceTopBarComponent.java
new file mode 100644
index 0000000000..70d068f972
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceWorkspaceTopBarComponent.java
@@ -0,0 +1,91 @@
+/*
+ * ============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.onap.sdc.frontend.ci.tests.pages.ResourceWorkspaceTopBarComponent.XpathSelector.FORM_LIFE_CYCLE_STATE;
+import static org.onap.sdc.frontend.ci.tests.pages.ResourceWorkspaceTopBarComponent.XpathSelector.ACTION_BUTTON_DIV;
+import static org.onap.sdc.frontend.ci.tests.pages.ResourceWorkspaceTopBarComponent.XpathSelector.LIFECYCLE_STATE_DIV;
+import static org.onap.sdc.frontend.ci.tests.pages.ResourceWorkspaceTopBarComponent.XpathSelector.MAIN_DIV;
+import static org.onap.sdc.frontend.ci.tests.pages.ResourceWorkspaceTopBarComponent.XpathSelector.VERSION_CONTAINER_DIV;
+import static org.onap.sdc.frontend.ci.tests.pages.ServiceCreatePage.XpathSelector.CREATE_BTN;
+
+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;
+
+/**
+ * Represents the top bar component of the a resource workspace, which contains the resource version, status, progress bar, and some action buttons.
+ */
+public class ResourceWorkspaceTopBarComponent extends AbstractPageObject {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ResourceWorkspaceTopBarComponent.class);
+
+ private WebElement wrappingElement;
+ private WebElement lifecycleStateDiv;
+ private WebElement versionContainerDiv;
+ private WebElement actionButtonsDiv;
+
+ public ResourceWorkspaceTopBarComponent(final WebDriver webDriver) {
+ super(webDriver);
+ }
+
+ @Override
+ public void isLoaded() {
+ LOGGER.debug("Waiting for element visibility with xpath '{}'", MAIN_DIV.getXpath());
+ wrappingElement = waitForElementVisibility(By.xpath(MAIN_DIV.getXpath()), 5);
+ lifecycleStateDiv = wrappingElement.findElement(By.xpath(LIFECYCLE_STATE_DIV.getXpath()));
+ versionContainerDiv = wrappingElement.findElement(By.xpath(VERSION_CONTAINER_DIV.getXpath()));
+ actionButtonsDiv = wrappingElement.findElement(By.xpath(ACTION_BUTTON_DIV.getXpath()));
+ }
+
+ public void clickOnCreate() {
+ waitToBeClickable(CREATE_BTN.getXpath()).click();
+ }
+
+ public String getLifecycleState() {
+ return lifecycleStateDiv.findElement(By.xpath(FORM_LIFE_CYCLE_STATE.getXpath())).getText();
+ }
+
+ /**
+ * Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
+ */
+ @AllArgsConstructor
+ public enum XpathSelector {
+ MAIN_DIV("sdc-workspace-top-bar", "//div[@class='%s']"),
+ LIFECYCLE_STATE_DIV("lifecycle-state", "//div[@class='%s']"),
+ VERSION_CONTAINER_DIV("version-container", "//div[@class='%s']"),
+ ACTION_BUTTON_DIV("sdc-workspace-top-bar-buttons", "//div[@class='%s']"),
+ CREATE_BTN("create/save", "//button[@data-tests-id='%s']"),
+ FORM_LIFE_CYCLE_STATE("formlifecyclestate", "//span[@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/ServiceComponentPage.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ServiceComponentPage.java
new file mode 100644
index 0000000000..254a0ece50
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ServiceComponentPage.java
@@ -0,0 +1,55 @@
+/*
+ * ============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 org.onap.sdc.frontend.ci.tests.pages.component.workspace.ToscaArtifactsPage;
+import org.openqa.selenium.WebDriver;
+
+public class ServiceComponentPage extends AbstractPageObject {
+
+ private final TopNavComponent topNavComponent;
+ private final ResourceLeftSideMenu resourceLeftSideMenu;
+ private final ResourceWorkspaceTopBarComponent workspaceTopBarComponent;
+
+ public ServiceComponentPage(final WebDriver webDriver, final TopNavComponent topNavComponent,
+ final ResourceLeftSideMenu resourceLeftSideMenu,
+ final ResourceWorkspaceTopBarComponent workspaceTopBarComponent) {
+ super(webDriver);
+ this.topNavComponent = topNavComponent;
+ this.resourceLeftSideMenu = resourceLeftSideMenu;
+ this.workspaceTopBarComponent = workspaceTopBarComponent;
+ }
+
+ @Override
+ public void isLoaded() {
+ topNavComponent.isLoaded();
+ resourceLeftSideMenu.isLoaded();
+ workspaceTopBarComponent.isLoaded();
+ }
+
+ public ResourcePropertiesAssignmentPage goToPropertiesAssignment() {
+ return resourceLeftSideMenu.clickOnPropertiesAssignmentMenuItem();
+ }
+
+ public ToscaArtifactsPage goToToscaArtifacts() {
+ return resourceLeftSideMenu.clickOnToscaArtifactsMenuItem();
+ }
+
+}
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
new file mode 100644
index 0000000000..3a1f3bc78b
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ServiceCreatePage.java
@@ -0,0 +1,139 @@
+/*
+ * ============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.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalToIgnoringCase;
+import static org.hamcrest.core.Is.is;
+import static org.onap.sdc.frontend.ci.tests.pages.ServiceCreatePage.XpathSelector.CATEGORY_SELECT;
+import static org.onap.sdc.frontend.ci.tests.pages.ServiceCreatePage.XpathSelector.DESCRIPTION_TEXT_AREA;
+import static org.onap.sdc.frontend.ci.tests.pages.ServiceCreatePage.XpathSelector.ETSI_VERSION_SELECT;
+import static org.onap.sdc.frontend.ci.tests.pages.ServiceCreatePage.XpathSelector.NAME_INPUT;
+
+import org.onap.sdc.frontend.ci.tests.datatypes.LifeCycleStateEnum;
+import org.onap.sdc.frontend.ci.tests.datatypes.ServiceCreateData;
+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.WebDriver;
+import org.openqa.selenium.support.ui.Select;
+
+/**
+ * Represents the Service Create Page
+ */
+public class ServiceCreatePage extends AbstractPageObject {
+
+ private final LoaderHelper loaderHelper;
+ private final NotificationComponent notificationComponent;
+ private final ResourceWorkspaceTopBarComponent topBarComponent;
+
+ public ServiceCreatePage(final WebDriver webDriver) {
+ super(webDriver);
+ this.loaderHelper = new LoaderHelper(webDriver);
+ this.notificationComponent = new NotificationComponent(webDriver);
+ this.topBarComponent = new ResourceWorkspaceTopBarComponent(webDriver);
+ }
+
+ @Override
+ public void isLoaded() {
+ topBarComponent.isLoaded();
+ final String lifeCycleState = topBarComponent.getLifecycleState();
+ assertThat("Life cycle state should be as expected",
+ lifeCycleState, is(equalToIgnoringCase(LifeCycleStateEnum.IN_DESIGN.getValue())));
+ }
+
+ /**
+ * Fill the service create form based on the given ServiceCreateData
+ * @param serviceCreateData the form data
+ */
+ public void fillForm(final ServiceCreateData serviceCreateData) {
+ fillName(serviceCreateData.getName());
+ setCategory(serviceCreateData.getCategory());
+ setEtsiVersion(serviceCreateData.getEtsiVersion());
+ fillDescription(serviceCreateData.getDescription());
+ }
+
+ private void setEtsiVersion(final String etsiVersion) {
+ if (etsiVersion == null) {
+ return;
+ }
+ final Select categorySelect = new Select(waitForElementVisibility(By.xpath(ETSI_VERSION_SELECT.getXpath())));
+ categorySelect.selectByVisibleText(etsiVersion);
+ }
+
+ private void setCategory(final String category) {
+ if (category == null) {
+ return;
+ }
+ final Select categorySelect = new Select(findElement(By.xpath(CATEGORY_SELECT.getXpath())));
+ categorySelect.selectByVisibleText(category);
+ }
+
+ public void fillDescription(final String description) {
+ if (description == null) {
+ return;
+ }
+ findElement(By.xpath(DESCRIPTION_TEXT_AREA.getXpath()))
+ .sendKeys(description);
+ }
+
+ public void fillName(final String name) {
+ if (name == null) {
+ return;
+ }
+ findElement(By.xpath(NAME_INPUT.getXpath()))
+ .sendKeys(name);
+ }
+
+ public void clickOnCreate() {
+ topBarComponent.clickOnCreate();
+ loaderHelper.waitForLoader(20);
+ notificationComponent.waitForNotification(NotificationType.SUCCESS, 20);
+ }
+
+ /**
+ * Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
+ */
+ public enum XpathSelector {
+ CREATE_BTN("create/save", "//button[@data-tests-id='%s']"),
+ FORM_LIFE_CYCLE_STATE("formlifecyclestate", "//span[@data-tests-id='%s']"),
+ NAME_INPUT("name", "//input[@data-tests-id='%s']"),
+ CATEGORY_SELECT("selectGeneralCategory", "//select[@data-tests-id='%s']"),
+ ETSI_VERSION_SELECT("ETSI Version", "//select[@data-tests-id='%s']"),
+ DESCRIPTION_TEXT_AREA("description", "//textarea[@data-tests-id='%s']");
+
+ private final String id;
+ private final String xpathFormat;
+
+ XpathSelector(final String id, final String xpathFormat) {
+ this.id = id;
+ this.xpathFormat = xpathFormat;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getXpath() {
+ return String.format(xpathFormat, id);
+ }
+ }
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/SoftwareProductOnboarding.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/SoftwareProductOnboarding.java
index 189cb5a6f0..cb485b7c18 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/SoftwareProductOnboarding.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/SoftwareProductOnboarding.java
@@ -19,15 +19,7 @@
package org.onap.sdc.frontend.ci.tests.pages;
-import org.hamcrest.core.Is;
-import org.openqa.selenium.By;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.WebElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.onap.sdc.frontend.ci.tests.pages.SoftwareProductOnboarding.XpathSelector.ATTACHMENT_VIEW;
import static org.onap.sdc.frontend.ci.tests.pages.SoftwareProductOnboarding.XpathSelector.BNT_SUBMIT;
import static org.onap.sdc.frontend.ci.tests.pages.SoftwareProductOnboarding.XpathSelector.FILE_INPUT;
@@ -37,6 +29,13 @@ import static org.onap.sdc.frontend.ci.tests.pages.SoftwareProductOnboarding.Xpa
import static org.onap.sdc.frontend.ci.tests.pages.SoftwareProductOnboarding.XpathSelector.PAGE_MAIN_DIV;
import static org.onap.sdc.frontend.ci.tests.pages.SoftwareProductOnboarding.XpathSelector.SELECTED_NAV_BAR_GROUP_ITEM;
+import org.hamcrest.core.Is;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class SoftwareProductOnboarding extends AbstractPageObject {
private static final Logger LOGGER = LoggerFactory.getLogger(SoftwareProductOnboarding.class);
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 8fc54194ee..6b8e4cfbcc 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
@@ -31,6 +31,7 @@ import org.slf4j.LoggerFactory;
import java.util.List;
+import static org.onap.sdc.frontend.ci.tests.pages.TopNavComponent.XpathSelector.*;
import static org.onap.sdc.frontend.ci.tests.pages.TopNavComponent.XpathSelector.ARROW_DROPDOWN;
import static org.onap.sdc.frontend.ci.tests.pages.TopNavComponent.XpathSelector.MAIN_MENU_ONBOARD_BTN;
import static org.onap.sdc.frontend.ci.tests.pages.TopNavComponent.XpathSelector.NAV;
@@ -79,6 +80,15 @@ public class TopNavComponent extends AbstractPageObject {
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(REPOSITORY_ICON.getXpath())));
}
+ public boolean isHomeSelected() {
+ final By homeLinkLocator = By.xpath(MAIN_MENU_LINK_HOME.getXpath());
+ getWait().until(ExpectedConditions.visibilityOfElementLocated(homeLinkLocator));
+ final WebElement homeLinkElement = findElement(homeLinkLocator);
+ final WebElement homeLinkParentElement = homeLinkElement.findElement(By.xpath("./.."));
+ final String aClass = homeLinkParentElement.getAttribute("class");
+ return "selected".equals(aClass);
+ }
+
/**
* Clicks on the VSP repository icon.
*
@@ -122,6 +132,7 @@ public class TopNavComponent extends AbstractPageObject {
public enum XpathSelector {
NAV("top-nav", "//nav[@class='%s']"),
SUB_MENU_BUTTON_HOME("sub-menu-button-home", "//*[@data-tests-id='%s']"),
+ MAIN_MENU_LINK_HOME("main-menu-button-home", "//*[@data-tests-id='%s']"),
ARROW_DROPDOWN("triangle-dropdown", "//li[contains(@class, '%s')]"),
MAIN_MENU_ONBOARD_BTN("main-menu-button-onboard", "//a[@data-tests-id='%s']"),
REPOSITORY_ICON("repository-icon", "//*[@data-tests-id='%s']");
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/VspRepositoryModalComponent.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/VspRepositoryModalComponent.java
index 75887fb7c4..4e3b939ae7 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/VspRepositoryModalComponent.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/VspRepositoryModalComponent.java
@@ -19,26 +19,25 @@
package org.onap.sdc.frontend.ci.tests.pages;
-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.NotificationHelper;
-import org.openqa.selenium.By;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.WebElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNot.not;
-import static org.junit.Assert.assertThat;
import static org.onap.sdc.frontend.ci.tests.pages.VspRepositoryModalComponent.XpathSelector.IMPORT_VSP_BTN;
import static org.onap.sdc.frontend.ci.tests.pages.VspRepositoryModalComponent.XpathSelector.MODAL_DIV;
import static org.onap.sdc.frontend.ci.tests.pages.VspRepositoryModalComponent.XpathSelector.RESULTS_CONTAINER_DIV;
import static org.onap.sdc.frontend.ci.tests.pages.VspRepositoryModalComponent.XpathSelector.SEARCH_TXT;
+import java.util.List;
+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.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* Handles the VSP Repository Modal UI actions
*/
@@ -73,7 +72,7 @@ public class VspRepositoryModalComponent extends AbstractPageObject {
findSubElements(wrappingElement, By.className(RESULTS_CONTAINER_DIV.getId()));
vspResultList.get(listPosition).click();
GeneralUIUtils.clickOnElementByTestId(IMPORT_VSP_BTN.getId());
- return new ResourceCreatePage(webDriver, new LoaderHelper(), new NotificationHelper());
+ return new ResourceCreatePage(webDriver, new LoaderHelper(), new NotificationComponent(webDriver));
}
/**
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/ToscaArtifactsPage.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/ToscaArtifactsPage.java
new file mode 100644
index 0000000000..17ddae194f
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/ToscaArtifactsPage.java
@@ -0,0 +1,96 @@
+/*
+ * ============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.onap.sdc.frontend.ci.tests.pages.component.workspace.ToscaArtifactsPage.XpathSelector.DATA_TABLE_BODY;
+import static org.onap.sdc.frontend.ci.tests.pages.component.workspace.ToscaArtifactsPage.XpathSelector.DOWNLOAD_LINK;
+import static org.onap.sdc.frontend.ci.tests.pages.component.workspace.ToscaArtifactsPage.XpathSelector.MAIN_DIV;
+import static org.onap.sdc.frontend.ci.tests.pages.component.workspace.ToscaArtifactsPage.XpathSelector.TITLE_DIV;
+
+import java.util.ArrayList;
+import java.util.List;
+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 ToscaArtifactsPage extends AbstractPageObject {
+
+ private WebElement wrappingElement;
+ private WebElement artifactsTableBody;
+ private final List<String> downloadedArtifactList = new ArrayList<>();
+
+ public ToscaArtifactsPage(final WebDriver webDriver) {
+ super(webDriver);
+ }
+
+ @Override
+ public void isLoaded() {
+ wrappingElement = waitForElementVisibility(By.xpath(MAIN_DIV.getXpath()), 5);
+ waitForElementVisibility(By.xpath(TITLE_DIV.getXpath()), 5);
+ artifactsTableBody = waitForElementVisibility(By.xpath(DATA_TABLE_BODY.getXpath()), 5);
+ }
+
+ public void clickOnDownload(final String artifactName) {
+ artifactsTableBody.findElement(By.xpath(DOWNLOAD_LINK.getXpath(artifactName))).click();
+ }
+
+ public void addToDownloadedArtifactList(final String downloadedArtifactName) {
+ if (downloadedArtifactName == null) {
+ return;
+ }
+ downloadedArtifactList.add(downloadedArtifactName);
+ }
+
+ public List<String> getDownloadedArtifactList() {
+ return new ArrayList<>(downloadedArtifactList);
+ }
+
+ /**
+ * Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
+ */
+ @AllArgsConstructor
+ public enum XpathSelector {
+ MAIN_DIV("w-sdc-main-right-container", "//div[@class='%s']"),
+ TITLE_DIV("tab-title", "//div[contains(@class,'%s') and contains(text(), 'TOSCA Artifacts')]"),
+ DATA_TABLE_BODY("//datatable-body"),
+ DOWNLOAD_LINK("//div[contains(@data-tests-id,'download_%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... params) {
+ return String.format(xpathFormat, params);
+ }
+
+ }
+}
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
new file mode 100644
index 0000000000..b4f17dd255
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/home/HomePage.java
@@ -0,0 +1,105 @@
+/*
+ * ============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.home;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.onap.sdc.frontend.ci.tests.pages.home.HomePage.XpathSelector.ADD_BUTTONS_AREA;
+import static org.onap.sdc.frontend.ci.tests.pages.home.HomePage.XpathSelector.ADD_SERVICE_BTN;
+
+import lombok.Getter;
+import org.onap.sdc.frontend.ci.tests.pages.AbstractPageObject;
+import org.onap.sdc.frontend.ci.tests.pages.ServiceCreatePage;
+import org.onap.sdc.frontend.ci.tests.pages.TopNavComponent;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+/**
+ * Represents the user home page
+ */
+public class HomePage extends AbstractPageObject {
+
+ @Getter
+ private final TopNavComponent topNavComponent;
+
+ public HomePage(final WebDriver webDriver, final TopNavComponent topNavComponent) {
+ super(webDriver);
+ this.topNavComponent = topNavComponent;
+ }
+
+ @Override
+ public void isLoaded() {
+ topNavComponent.isLoaded();
+ assertThat("The Home tab should be selected", topNavComponent.isHomeSelected(), is(true));
+ }
+
+ /**
+ * Clicks on the add service button.
+ *
+ * @return the following service create page
+ */
+ public ServiceCreatePage clickOnAddService() {
+ hoverToAddArea();
+ final By addServiceBtnLocator = By.xpath(ADD_SERVICE_BTN.getXpath());
+ waitForElementVisibility(addServiceBtnLocator);
+ final WebElement addServiceBtn = findElement(addServiceBtnLocator);
+ addServiceBtn.click();
+ return new ServiceCreatePage(webDriver);
+ }
+
+ /**
+ * Hovers to the Add buttons area.
+ *
+ * @return the add buttons area element
+ */
+ public WebElement hoverToAddArea() {
+ final Actions actions = new Actions(webDriver);
+ final By addButtonsAreaLocator = By.xpath(ADD_BUTTONS_AREA.getXpath());
+ final WebElement addButtonsAreaElement = findElement(addButtonsAreaLocator);
+ actions.moveToElement(addButtonsAreaElement).build().perform();
+ return addButtonsAreaElement;
+ }
+
+ /**
+ * Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
+ */
+ public enum XpathSelector {
+ ADD_SERVICE_BTN("createServiceButton", "//*[@data-tests-id='%s']"),
+ ADD_BUTTONS_AREA("AddButtonsArea", "//*[@data-tests-id='%s']");
+
+ private final String id;
+ private final String xpathFormat;
+
+ XpathSelector(final String id, final String xpathFormat) {
+ this.id = id;
+ this.xpathFormat = xpathFormat;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getXpath() {
+ return String.format(xpathFormat, id);
+ }
+ }
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/FileHandling.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/FileHandling.java
index 7ae346cfe9..04b203798b 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/FileHandling.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/FileHandling.java
@@ -22,9 +22,14 @@ package org.onap.sdc.frontend.ci.tests.utilities;
import com.aventstack.extentreports.Status;
import com.clearspring.analytics.util.Pair;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileNotFoundException;
+import java.nio.file.Path;
import org.apache.commons.io.FileUtils;
import org.onap.sdc.backend.ci.tests.config.Config;
import org.onap.sdc.backend.ci.tests.utils.general.OnboardingUtils;
+import org.onap.sdc.frontend.ci.tests.exception.UnzipException;
import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions;
import org.onap.sdc.frontend.ci.tests.execute.setup.SetupCDTest;
@@ -243,6 +248,57 @@ public class FileHandling {
}
+ public static Map<String, byte[]> getFilesFromZip(byte[] zipFileBytes) throws UnzipException {
+ final Map<String, byte[]> pathAndByteMap = new HashMap<>();
+ try (final ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(zipFileBytes))) {
+ ZipEntry zipEntry = zipInputStream.getNextEntry();
+ final byte[] buffer = new byte[1024];
+ while (zipEntry != null) {
+ final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ try (final ByteArrayOutputStream baos = byteArrayOutputStream) {
+ int length;
+ while ((length = zipInputStream.read(buffer)) >= 0) {
+ baos.write(buffer, 0, length);
+ }
+ }
+ final byte[] bytes = byteArrayOutputStream.toByteArray();
+ pathAndByteMap.put(zipEntry.getName(), bytes);
+ zipEntry = zipInputStream.getNextEntry();
+ }
+ } catch (final IOException e) {
+ throw new UnzipException("Could not unzip file", e);
+ }
+
+ return pathAndByteMap;
+ }
+
+ public static Map<String, byte[]> getFilesFromZip(final String filepath, final String zipFilename) throws UnzipException {
+ final Path zipFilePath = Path.of(filepath, zipFilename);
+ final Map<String, byte[]> pathAndByteMap = new HashMap<>();
+ try (final ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(zipFilePath.toString()))) {
+ ZipEntry zipEntry = zipInputStream.getNextEntry();
+ final byte[] buffer = new byte[1024];
+ while (zipEntry != null) {
+ final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ try (final ByteArrayOutputStream baos = byteArrayOutputStream) {
+ int length;
+ while ((length = zipInputStream.read(buffer)) >= 0) {
+ baos.write(buffer, 0, length);
+ }
+ }
+ final byte[] bytes = byteArrayOutputStream.toByteArray();
+ pathAndByteMap.put(zipEntry.getName(), bytes);
+ zipEntry = zipInputStream.getNextEntry();
+ }
+ } catch (final FileNotFoundException e) {
+ throw new UnzipException("Could not find given file " + zipFilename, e);
+ } catch (final IOException e) {
+ throw new UnzipException("Could not unzip file " + zipFilename, e);
+ }
+
+ return pathAndByteMap;
+ }
+
public static List<String> getZipFileNamesFromFolder(String filepath) {
return filterFileNamesListFromFolder(filepath, ".zip");
}
@@ -261,9 +317,8 @@ public class FileHandling {
/**
* @return last modified file name from default directory
- * @throws Exception
*/
- public static synchronized File getLastModifiedFileNameFromDir() throws Exception {
+ public static synchronized File getLastModifiedFileNameFromDir() {
return getLastModifiedFileNameFromDir(SetupCDTest.getWindowTest().getDownloadDirectory());
}
@@ -274,8 +329,7 @@ public class FileHandling {
public static synchronized File getLastModifiedFileNameFromDir(String dirPath) {
File dir = new File(dirPath);
File[] files = dir.listFiles();
- if (files == null) {
- assertTrue("File not found under directory " + dirPath, false);
+ if (files == null || files.length == 0) {
return null;
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/LoaderHelper.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/LoaderHelper.java
index 0170fbf074..4149a91a2a 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/LoaderHelper.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/LoaderHelper.java
@@ -19,13 +19,22 @@
package org.onap.sdc.frontend.ci.tests.utilities;
+import lombok.NoArgsConstructor;
import org.onap.sdc.frontend.ci.tests.execute.setup.DriverFactory;
import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
+@NoArgsConstructor
public class LoaderHelper {
+ private WebDriver webDriver;
+
+ public LoaderHelper(final WebDriver webDriver) {
+ this.webDriver = webDriver;
+ }
+
private final By locator = By.className("tlv-loader");
public void waitForLoader(final int timeout) {
@@ -43,7 +52,7 @@ public class LoaderHelper {
}
private WebDriverWait getWait(final int timeout) {
- return new WebDriverWait(DriverFactory.getDriver(), timeout);
+ return new WebDriverWait(webDriver == null ? DriverFactory.getDriver() : webDriver, timeout);
}
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/NotificationHelper.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/NotificationComponent.java
index 46d5c646bf..676b0a1224 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/NotificationHelper.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/NotificationComponent.java
@@ -19,25 +19,30 @@
package org.onap.sdc.frontend.ci.tests.utilities;
-import org.onap.sdc.frontend.ci.tests.execute.setup.DriverFactory;
+import static org.onap.sdc.frontend.ci.tests.utilities.NotificationComponent.XpathSelector.MAIN_CONTAINER_DIV;
+import static org.onap.sdc.frontend.ci.tests.utilities.NotificationComponent.XpathSelector.MESSAGE_CONTENT_DIV;
+import static org.onap.sdc.frontend.ci.tests.utilities.NotificationComponent.XpathSelector.MESSAGE_SUCCESS_DIV;
+
+import org.onap.sdc.frontend.ci.tests.pages.AbstractPageObject;
import org.openqa.selenium.By;
-import org.openqa.selenium.support.ui.ExpectedConditions;
-import org.openqa.selenium.support.ui.WebDriverWait;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static org.onap.sdc.frontend.ci.tests.utilities.NotificationHelper.XpathSelector.MAIN_CONTAINER_DIV;
-import static org.onap.sdc.frontend.ci.tests.utilities.NotificationHelper.XpathSelector.MESSAGE_CONTENT_DIV;
-import static org.onap.sdc.frontend.ci.tests.utilities.NotificationHelper.XpathSelector.MESSAGE_SUCCESS_DIV;
+public class NotificationComponent extends AbstractPageObject {
-public class NotificationHelper {
+ public NotificationComponent(final WebDriver webDriver) {
+ super(webDriver);
+ }
- private static final Logger LOGGER = LoggerFactory.getLogger(NotificationHelper.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(NotificationComponent.class);
public void waitForNotification(final NotificationType notificationType, final int timeout) {
final By messageLocator = getMessageLocator(notificationType);
- waitForVisibility(messageLocator, timeout);
- waitForInvisibility(messageLocator, timeout);
+ final WebElement webElement = waitForElementVisibility(messageLocator, timeout);
+ webElement.click();
+ waitForElementInvisibility(messageLocator, 5);
}
private By getMessageLocator(final NotificationType notificationType) {
@@ -49,28 +54,19 @@ public class NotificationHelper {
return String.format("%s%s%s", MAIN_CONTAINER_DIV.getXpath(), MESSAGE_CONTENT_DIV.getXpath(), MESSAGE_SUCCESS_DIV.getXpath());
}
- LOGGER.warn("Xpath for NotificationType {} not yet implemented. Returning empty Xpath.", notificationType);
- return "";
- }
-
- private void waitForVisibility(By messageLocator, final int timeout) {
- getWait(timeout)
- .until(ExpectedConditions.visibilityOfElementLocated(messageLocator));
- }
-
- private void waitForInvisibility(By messageLocator, int timeout) {
- getWait(timeout)
- .until(ExpectedConditions.invisibilityOfElementLocated(messageLocator));
+ LOGGER.warn("Xpath for NotificationType {} not yet implemented.", notificationType);
+ return "notYetImplemented";
}
- private WebDriverWait getWait(final int timeout) {
- return new WebDriverWait(DriverFactory.getDriver(), timeout);
+ @Override
+ public void isLoaded() {
+ //will not be loaded when needed
}
public enum XpathSelector {
MAIN_CONTAINER_DIV("notification-container", "//div[@class='%s']"),
MESSAGE_CONTENT_DIV("msg-content", "//div[@class='%s']"),
- MESSAGE_SUCCESS_DIV("message", "//div[contains(@class, '%s') and contains(text(),'successfully')]");
+ MESSAGE_SUCCESS_DIV("message", "//div[contains(@class, 'message') and (contains(text(),'successfully') or contains(text(), 'Successfully'))]");
private final String id;
private final String xpath;
diff --git a/integration-tests/src/test/resources/ci/conf/sdc-conf.yaml b/integration-tests/src/test/resources/ci/conf/sdc-conf.yaml
index 5303e3b120..e4b07d36ee 100644
--- a/integration-tests/src/test/resources/ci/conf/sdc-conf.yaml
+++ b/integration-tests/src/test/resources/ci/conf/sdc-conf.yaml
@@ -13,7 +13,7 @@ uiSimulator: true
#remoteTesting: false
#useBrowserMobProxy: false
#captureTraffic: false
-#downloadAutomationFolder: /home/seb/Downloads
+#downloadAutomationFolder: /tmp/sdc-integration-tests/downloadAutomation
#uiSimulator: true
#### Backend Testing
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 db352d3848..2cc0808076 100644
--- a/integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml
+++ b/integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml
@@ -26,6 +26,11 @@
</methods>
</class>
<class name="org.onap.sdc.frontend.ci.tests.execute.sanity.GAB"/>
+ <class name="org.onap.sdc.frontend.ci.tests.execute.sanity.EtsiNetworkServiceUiTests">
+ <methods>
+ <include name="createEtsiNetworkService"/>
+ </methods>
+ </class>
</classes>
</test>
</suite>