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/frontend/ci/tests/execute/sanity/ImportVfcUiTest.java40
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java16
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/InterfaceDefinitionFlow.java56
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ComponentPage.java5
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceLeftSideMenu.java14
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionInterfaceOperationsTab.java6
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/InterfaceDefinitionOperationsModal.java (renamed from integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionInterfaceOperationsModal.java)9
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/InterfaceDefinitionPage.java96
8 files changed, 219 insertions, 23 deletions
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ImportVfcUiTest.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ImportVfcUiTest.java
index 834732b6f2..bac613861b 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ImportVfcUiTest.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ImportVfcUiTest.java
@@ -47,6 +47,7 @@ import org.onap.sdc.frontend.ci.tests.flow.AddNodeToCompositionFlow;
import org.onap.sdc.frontend.ci.tests.flow.CreateVfFlow;
import org.onap.sdc.frontend.ci.tests.flow.CreateVfcFlow;
import org.onap.sdc.frontend.ci.tests.flow.DownloadCsarArtifactFlow;
+import org.onap.sdc.frontend.ci.tests.flow.InterfaceDefinitionFlow;
import org.onap.sdc.frontend.ci.tests.flow.exception.UiTestFlowRuntimeException;
import org.onap.sdc.frontend.ci.tests.pages.AttributeModal;
import org.onap.sdc.frontend.ci.tests.pages.AttributesPage;
@@ -55,9 +56,10 @@ import org.onap.sdc.frontend.ci.tests.pages.ResourceCreatePage;
import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionDetailSideBarComponent;
import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionDetailSideBarComponent.CompositionDetailTabName;
import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionInformationTab;
-import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionInterfaceOperationsModal;
import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionInterfaceOperationsTab;
import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionPage;
+import org.onap.sdc.frontend.ci.tests.pages.component.workspace.InterfaceDefinitionOperationsModal;
+import org.onap.sdc.frontend.ci.tests.pages.component.workspace.InterfaceDefinitionPage;
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;
@@ -115,6 +117,10 @@ public class ImportVfcUiTest extends SetupCDTest {
yamlObject = downloadToscaArtifact(componentPage);
checkMetadata(yamlObject, vfcCreateData);
checkNodeTypes(yamlObject);
+
+ componentPage = viewInterfaceDefinitionFromVFC(componentPage);
+ componentPage.isLoaded();
+
homePage.getTopNavComponent().clickOnHome();
// TC - Import VFC with interface inputs
@@ -135,6 +141,23 @@ public class ImportVfcUiTest extends SetupCDTest {
}
+ private ComponentPage viewInterfaceDefinitionFromVFC(final ComponentPage componentPage) {
+ final InterfaceDefinitionFlow interfaceDefinitionFlow = new InterfaceDefinitionFlow(webDriver);
+ interfaceDefinitionFlow.run(componentPage);
+ final InterfaceDefinitionPage interfaceDefinitionPage = interfaceDefinitionFlow.getLandedPage()
+ .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return InterfaceDefinitionPage"));
+ final var OPERATION_NAME = "create";
+ assertTrue(interfaceDefinitionPage.isInterfaceDefinitionOperationPresent(OPERATION_NAME));
+ final InterfaceDefinitionOperationsModal interfaceDefinitionOperationsModal = interfaceDefinitionPage.clickOnInterfaceDefinitionOperation(
+ OPERATION_NAME);
+ interfaceDefinitionOperationsModal.isLoaded();
+ ExtentTestActions
+ .takeScreenshot(Status.INFO, "clickOnOInterfaceOperation", "Interface Definition Operation Modal opened");
+ checkInterfaceDefinitionData(interfaceDefinitionOperationsModal);
+ interfaceDefinitionOperationsModal.clickOnCancel();
+ return interfaceDefinitionPage;
+ }
+
@Test
public void importVfcWithModel() {
final String fileName = "VFC-For-Model.yaml";
@@ -146,6 +169,13 @@ public class ImportVfcUiTest extends SetupCDTest {
componentPage.isLoaded();
}
+ private void checkInterfaceDefinitionData(final InterfaceDefinitionOperationsModal interfaceDefinitionOperationsModal) {
+ assertTrue(interfaceDefinitionOperationsModal.getDescription().isEmpty());
+ assertEquals(interfaceDefinitionOperationsModal.getImplementationName(), "path/to/my/implementation.sh");
+ assertEquals(interfaceDefinitionOperationsModal.getInputName(), "first");
+ assertEquals(interfaceDefinitionOperationsModal.getInputValue(), "1234");
+ }
+
private ComponentPage manageAttributes(final ComponentPage componentPage) {
final AttributesPage attributesPage = componentPage.goToAttributes();
attributesPage.isLoaded();
@@ -189,7 +219,7 @@ public class ImportVfcUiTest extends SetupCDTest {
compositionInterfaceOperationsTab.isLoaded();
ExtentTestActions.takeScreenshot(Status.INFO, "compositionInterfaceOperationsTab", "Composition Interface Operations Tab opened");
assertTrue(compositionInterfaceOperationsTab.isOperationPresent("create"));
- CompositionInterfaceOperationsModal compositionInterfaceOperationsModal = compositionInterfaceOperationsTab.clickOnOperation("create");
+ InterfaceDefinitionOperationsModal compositionInterfaceOperationsModal = compositionInterfaceOperationsTab.clickOnOperation("create");
compositionInterfaceOperationsModal.isLoaded();
ExtentTestActions
.takeScreenshot(Status.INFO, "compositionInterfaceOperationsTab.clickOnOperation", "Composition Interface Operations Modal opened");
@@ -198,7 +228,7 @@ public class ImportVfcUiTest extends SetupCDTest {
compositionInterfaceOperationsModal.addInput();
ExtentTestActions.takeScreenshot(Status.INFO, "compositionInterfaceOperationsModal.addInput", "Adding Input");
- final CompositionInterfaceOperationsModal.InterfaceOperationsData interfaceOperationsData = new CompositionInterfaceOperationsModal.InterfaceOperationsData
+ final InterfaceDefinitionOperationsModal.InterfaceOperationsData interfaceOperationsData = new InterfaceDefinitionOperationsModal.InterfaceOperationsData
("This is CREATE operation", "fullPath/to/my/newImplementation.sh", "second", "9876");
compositionInterfaceOperationsModal.updateInterfaceOperation(interfaceOperationsData);
compositionInterfaceOperationsTab.isLoaded();
@@ -370,8 +400,8 @@ public class ImportVfcUiTest extends SetupCDTest {
}
- private void checkCompositionInterfaceOperations(final CompositionInterfaceOperationsModal compositionInterfaceOperationsModal,
- final CompositionInterfaceOperationsModal.InterfaceOperationsData interfaceOperationsData) {
+ private void checkCompositionInterfaceOperations(final InterfaceDefinitionOperationsModal compositionInterfaceOperationsModal,
+ final InterfaceDefinitionOperationsModal.InterfaceOperationsData interfaceOperationsData) {
assertEquals(interfaceOperationsData.getDescription(), compositionInterfaceOperationsModal.getDescription());
assertEquals(interfaceOperationsData.getImplementationName(), compositionInterfaceOperationsModal.getImplementationName());
assertEquals(interfaceOperationsData.getInputName(), compositionInterfaceOperationsModal.getInputName());
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java
index 8bec8353ef..a2dbd5729e 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java
@@ -78,7 +78,7 @@ import org.onap.sdc.frontend.ci.tests.pages.ResourcePropertiesPage;
import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionDetailSideBarComponent;
import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionDetailSideBarComponent.CompositionDetailTabName;
import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionInformationTab;
-import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionInterfaceOperationsModal;
+import org.onap.sdc.frontend.ci.tests.pages.component.workspace.InterfaceDefinitionOperationsModal;
import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionInterfaceOperationsTab;
import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionPage;
import org.onap.sdc.frontend.ci.tests.pages.component.workspace.RelationshipWizardInterfaceOperation.InterfaceOperationsData;
@@ -247,8 +247,8 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
compositionPage.isLoaded();
ExtentTestActions.addScreenshot(Status.INFO, "select-VFC-node", "Selecting Node on composition");
compositionPage.selectNode(vfcs.get(1).getName());
- final CompositionInterfaceOperationsModal.InterfaceOperationsData interfaceOperationsData =
- new CompositionInterfaceOperationsModal.InterfaceOperationsData("IT for updating an Interface Operation",
+ final InterfaceDefinitionOperationsModal.InterfaceOperationsData interfaceOperationsData =
+ new InterfaceDefinitionOperationsModal.InterfaceOperationsData("IT for updating an Interface Operation",
"MyIntegrationTestImplementationName", "My_IT_InputName", "My_IT_InputValue");
updateInterfaceOperation(compositionPage, interfaceOperationsData);
componentPage = compositionPage.goToGeneral();
@@ -374,7 +374,7 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
* @throws IOException
*/
private void updateInterfaceOperation(final CompositionPage compositionPage,
- final CompositionInterfaceOperationsModal.InterfaceOperationsData interfaceOperationsData) throws IOException {
+ final InterfaceDefinitionOperationsModal.InterfaceOperationsData interfaceOperationsData) throws IOException {
final CompositionDetailSideBarComponent detailSideBar = compositionPage.getDetailSideBar();
detailSideBar.isLoaded();
final CompositionInterfaceOperationsTab compositionInterfaceOperationsTab =
@@ -383,7 +383,7 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
ExtentTestActions.takeScreenshot(Status.INFO, "compositionInterfaceOperationsTab",
"Composition Interface Operations Tab loaded");
assertTrue(compositionInterfaceOperationsTab.isOperationPresent(interfaceOperationName));
- final CompositionInterfaceOperationsModal compositionInterfaceOperationsModal = compositionInterfaceOperationsTab
+ final InterfaceDefinitionOperationsModal compositionInterfaceOperationsModal = compositionInterfaceOperationsTab
.clickOnOperation(interfaceOperationName);
compositionInterfaceOperationsModal.isLoaded();
ExtentTestActions.takeScreenshot(Status.INFO, "update-interface-operation-modal", "Loading Interface Operations Modal");
@@ -405,13 +405,13 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
* @param interfaceOperationsData The Updated Interface Definition
*/
private void validateUpdatedInterfaceOperation(final CompositionDetailSideBarComponent detailSideBar,
- final CompositionInterfaceOperationsModal.InterfaceOperationsData interfaceOperationsData) {
+ final InterfaceDefinitionOperationsModal.InterfaceOperationsData interfaceOperationsData) {
final CompositionInterfaceOperationsTab compositionInterfaceOperationsTab = (CompositionInterfaceOperationsTab) detailSideBar
.selectTab(CompositionDetailTabName.INTERFACE_OPERATIONS);
compositionInterfaceOperationsTab.isLoaded();
assertTrue(compositionInterfaceOperationsTab.isOperationPresent(interfaceOperationName));
assertTrue(compositionInterfaceOperationsTab.isDescriptionPresent());
- final CompositionInterfaceOperationsModal compositionInterfaceOperationsModal = compositionInterfaceOperationsTab
+ final InterfaceDefinitionOperationsModal compositionInterfaceOperationsModal = compositionInterfaceOperationsTab
.clickOnOperation(interfaceOperationName);
compositionInterfaceOperationsModal.isLoaded();
ExtentTestActions.takeScreenshot(Status.INFO, "validate-updated-interface-operation",
@@ -428,7 +428,7 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
}
private void verifyToscaTemplateHasUpdatedInterfaceOperation(final Map<?, ?> toscaTemplateYaml,
- final CompositionInterfaceOperationsModal.InterfaceOperationsData interfaceOperationsData) {
+ final InterfaceDefinitionOperationsModal.InterfaceOperationsData interfaceOperationsData) {
assertNotNull(toscaTemplateYaml, "No contents in TOSCA Template");
final Map<String, Object> topologyTemplateTosca = getMapEntry((Map<String, Object>) toscaTemplateYaml, "topology_template");
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/InterfaceDefinitionFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/InterfaceDefinitionFlow.java
new file mode 100644
index 0000000000..a0955ff800
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/InterfaceDefinitionFlow.java
@@ -0,0 +1,56 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2022 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.Optional;
+import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions;
+import org.onap.sdc.frontend.ci.tests.pages.ComponentPage;
+import org.onap.sdc.frontend.ci.tests.pages.PageObject;
+import org.onap.sdc.frontend.ci.tests.pages.component.workspace.InterfaceDefinitionPage;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * UI Flow for managing an Interface Definition from a component
+ */
+public class InterfaceDefinitionFlow extends AbstractUiTestFlow {
+
+ private InterfaceDefinitionPage interfaceDefinitionPage;
+
+ public InterfaceDefinitionFlow(final WebDriver webDriver) {
+ super(webDriver);
+ }
+
+ @Override
+ public Optional<PageObject> run(final PageObject... pageObjects) {
+ extendTest.log(Status.INFO, "Downloading Tosca CSAR generated");
+ final ComponentPage componentPage = findParameter(pageObjects, ComponentPage.class);
+ componentPage.isLoaded();
+ interfaceDefinitionPage = componentPage.goToInterfaceDefinition();
+ interfaceDefinitionPage.isLoaded();
+ ExtentTestActions.takeScreenshot(Status.INFO, "interface-definition-page", "Interface Definition page loaded");
+ return Optional.of(interfaceDefinitionPage);
+ }
+
+ @Override
+ public Optional<InterfaceDefinitionPage> getLandedPage() {
+ return Optional.ofNullable(interfaceDefinitionPage);
+ }
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ComponentPage.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ComponentPage.java
index ada3410318..f690cca3f5 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ComponentPage.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ComponentPage.java
@@ -20,6 +20,7 @@ package org.onap.sdc.frontend.ci.tests.pages;
import org.onap.sdc.frontend.ci.tests.datatypes.LifeCycleStateEnum;
import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionPage;
+import org.onap.sdc.frontend.ci.tests.pages.component.workspace.InterfaceDefinitionPage;
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.LoaderHelper;
@@ -59,6 +60,10 @@ public class ComponentPage extends AbstractPageObject {
return resourceLeftSideMenu.clickOnToscaArtifactsMenuItem();
}
+ public InterfaceDefinitionPage goToInterfaceDefinition() {
+ return resourceLeftSideMenu.clickOnInterfaceDefinitionMenuItem();
+ }
+
public CompositionPage goToComposition() {
return resourceLeftSideMenu.clickOnCompositionMenuItem();
}
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 f0a973910f..68a447eadf 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
@@ -22,6 +22,7 @@ package org.onap.sdc.frontend.ci.tests.pages;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionPage;
+import org.onap.sdc.frontend.ci.tests.pages.component.workspace.InterfaceDefinitionPage;
import org.onap.sdc.frontend.ci.tests.pages.component.workspace.ToscaArtifactsPage;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
@@ -95,6 +96,16 @@ public class ResourceLeftSideMenu extends AbstractPageObject {
}
/**
+ * Clicks on the Interface Definition menu item.
+ *
+ * @return the next page object
+ */
+ public InterfaceDefinitionPage clickOnInterfaceDefinitionMenuItem() {
+ wrappingElement.findElement(By.xpath(XpathSelector.INTERFACE_DEFINITION_MENU.getXpath())).click();
+ return new InterfaceDefinitionPage(webDriver);
+ }
+
+ /**
* Clicks on the 'General' menu item.
*
* @return the next page object
@@ -127,7 +138,8 @@ public class ResourceLeftSideMenu extends AbstractPageObject {
GENERAL_MENU("GeneralLeftSideMenu", "//*[@data-tests-id='%s']"),
COMPOSITION_MENU("CompositionLeftSideMenu", "//*[@data-tests-id='%s']"),
REQUIREMENT_CAPABILITY_MENU("Req. & CapabilitiesLeftSideMenu", "//*[@data-tests-id='%s']"),
- TOSCA_ARTIFACTS_MENU("TOSCA ArtifactsLeftSideMenu", "//*[@data-tests-id='%s']");
+ TOSCA_ARTIFACTS_MENU("TOSCA ArtifactsLeftSideMenu", "//*[@data-tests-id='%s']"),
+ INTERFACE_DEFINITION_MENU("InterfacesLeftSideMenu", "//*[@data-tests-id='%s']");
@Getter
private final String id;
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionInterfaceOperationsTab.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionInterfaceOperationsTab.java
index c67293939e..60a732afd5 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionInterfaceOperationsTab.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionInterfaceOperationsTab.java
@@ -19,8 +19,6 @@
package org.onap.sdc.frontend.ci.tests.pages.component.workspace;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.onap.sdc.frontend.ci.tests.pages.AbstractPageObject;
@@ -66,10 +64,10 @@ public class CompositionInterfaceOperationsTab extends AbstractPageObject {
}
}
- public CompositionInterfaceOperationsModal clickOnOperation(final String operationName) {
+ public InterfaceDefinitionOperationsModal clickOnOperation(final String operationName) {
final WebElement webElementInterfaceRow = webElement.findElement(By.xpath(XpathSelector.INTERFACE_ROW.getXPath()));
webElementInterfaceRow.findElement(By.xpath(XpathSelector.FIELD_NAME_SPAN.getXPath(operationName))).click();
- return new CompositionInterfaceOperationsModal(webDriver);
+ return new InterfaceDefinitionOperationsModal(webDriver);
}
@AllArgsConstructor
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionInterfaceOperationsModal.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/InterfaceDefinitionOperationsModal.java
index 8fac69c944..cb2ee3d282 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionInterfaceOperationsModal.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/InterfaceDefinitionOperationsModal.java
@@ -31,9 +31,9 @@ import org.openqa.selenium.WebElement;
/**
* Represents the Composition Interface Operations Modal.
*/
-public class CompositionInterfaceOperationsModal extends AbstractPageObject {
+public class InterfaceDefinitionOperationsModal extends AbstractPageObject {
- public CompositionInterfaceOperationsModal(final WebDriver webDriver) {
+ public InterfaceDefinitionOperationsModal(final WebDriver webDriver) {
super(webDriver);
}
@@ -44,9 +44,8 @@ public class CompositionInterfaceOperationsModal extends AbstractPageObject {
waitForElementVisibility(By.xpath(XpathSelector.OPERATION_NAME_LABEL.getXPath()));
waitForElementVisibility(By.xpath(XpathSelector.INPUT_NAME_SPAN.getXPath()));
waitForElementVisibility(By.xpath(XpathSelector.INPUT_VALUE_SPAN.getXPath()));
-
- waitToBeClickable(By.xpath(XpathSelector.ADD_INPUT_BTN.getXPath()));
- waitToBeClickable(By.xpath(XpathSelector.SAVE_BTN.getXPath()));
+ waitForElementVisibility(By.xpath(XpathSelector.ADD_INPUT_BTN.getXPath()));
+ waitForElementVisibility(By.xpath(XpathSelector.SAVE_BTN.getXPath()));
waitToBeClickable(By.xpath(XpathSelector.CANCEL_BTN.getXPath()));
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/InterfaceDefinitionPage.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/InterfaceDefinitionPage.java
new file mode 100644
index 0000000000..a40878ac14
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/InterfaceDefinitionPage.java
@@ -0,0 +1,96 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2022 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 lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.onap.sdc.frontend.ci.tests.pages.ComponentPage;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+
+public class InterfaceDefinitionPage extends ComponentPage {
+
+ private WebElement wrappingElement;
+
+ public InterfaceDefinitionPage(final WebDriver webDriver) {
+ super(webDriver);
+ }
+
+ @Override
+ public void isLoaded() {
+ wrappingElement = waitForElementVisibility(By.xpath(XpathSelector.MAIN_DIV.getXpath()), 5);
+ waitForElementVisibility(By.xpath(XpathSelector.TITLE_DIV.getXpath()), 5);
+ waitForElementVisibility(By.xpath(XpathSelector.INTERFACE_NAME_SPAN.getXpath()), 5);
+ }
+
+ public boolean isInterfaceDefinitionOperationPresent(final String operationName) {
+ try {
+ final WebElement webElementInterfaceRow = wrappingElement.findElement(
+ By.xpath(InterfaceDefinitionPage.XpathSelector.INTERFACE_ROW.getXpath()));
+ webElementInterfaceRow.findElement(By.xpath(InterfaceDefinitionPage.XpathSelector.FIELD_NAME_SPAN.getXpath(operationName)));
+ } catch (final Exception e) {
+ return false;
+ }
+ return true;
+ }
+
+ public InterfaceDefinitionOperationsModal clickOnInterfaceDefinitionOperation(final String operationName) {
+ final WebElement webElementInterfaceRow = wrappingElement.findElement(
+ By.xpath(InterfaceDefinitionPage.XpathSelector.INTERFACE_ROW.getXpath()));
+ webElementInterfaceRow.findElement(By.xpath(InterfaceDefinitionPage.XpathSelector.FIELD_NAME_SPAN.getXpath(operationName))).click();
+ return new InterfaceDefinitionOperationsModal(webDriver);
+ }
+
+ /**
+ * Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
+ */
+ @AllArgsConstructor
+ private enum XpathSelector {
+ MAIN_DIV("w-sdc-main-right-container", "//div[@class='%s']"),
+ TITLE_DIV("tab-title", "//div[contains(@class,'%s') and contains(text(), 'Interfaces')]"),
+ INTERFACE_NAME_SPAN("//span[@class='interface-name']"),
+
+ INTERFACE_OPERATIONS("//div[@class='interface-operations']"),
+ OPERATION_LIST("//div[@class='operation-list']"),
+ EXPAND_COLLAPSE("//div[@class='expand-collapse']"),
+ INTERFACE_ACCORDION("//div[@class='interface-accordion']"),
+ INTERFACE_ROW("//div[contains(@class,'interface-row')]"),
+ FIELD_NAME_SPAN("//span[contains(@class,'field-name') and contains(text(), '%s')]"),
+ FIELD_DESCRIPTION_SPAN("//span[contains(@class,'field-description')]");
+
+ @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);
+ }
+
+ }
+}