summaryrefslogtreecommitdiffstats
path: root/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace
diff options
context:
space:
mode:
Diffstat (limited to 'integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace')
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionApiArtifactsTab.java50
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionCanvasComponent.java249
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionDeploymentArtifactsTab.java50
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionDetailSideBarComponent.java124
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionElementsComponent.java92
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionInformationTab.java50
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionInformationalArtifactsTab.java50
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionInputsTab.java50
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionPage.java87
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionSubstitutionFilterTab.java52
10 files changed, 854 insertions, 0 deletions
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionApiArtifactsTab.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionApiArtifactsTab.java
new file mode 100644
index 0000000000..df611a8089
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionApiArtifactsTab.java
@@ -0,0 +1,50 @@
+/*
+ * ============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 lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.onap.sdc.frontend.ci.tests.pages.AbstractPageObject;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Represents the composition page, details panel, API Artifacts tab
+ */
+public class CompositionApiArtifactsTab extends AbstractPageObject {
+
+ public CompositionApiArtifactsTab(final WebDriver webDriver) {
+ super(webDriver);
+ }
+
+ @Override
+ public void isLoaded() {
+ waitForElementVisibility(By.xpath(XpathSelector.API_ARTIFACTS_TAB.getXpath()));
+ }
+
+ @AllArgsConstructor
+ @Getter
+ private enum XpathSelector {
+ API_ARTIFACTS_TAB("//artifacts-tab[.//header[contains(text(), 'API Artifacts')]]");
+
+ private final String xpath;
+
+ }
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionCanvasComponent.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionCanvasComponent.java
new file mode 100644
index 0000000000..6ecea473c5
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionCanvasComponent.java
@@ -0,0 +1,249 @@
+/*
+ * ============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 com.aventstack.extentreports.Status;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Optional;
+import java.util.Random;
+import java.util.Set;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.onap.sdc.backend.ci.tests.datatypes.enums.UserRoleEnum;
+import org.onap.sdc.backend.ci.tests.utils.general.AtomicOperationUtils;
+import org.onap.sdc.frontend.ci.tests.datatypes.CanvasNodeElement;
+import org.onap.sdc.frontend.ci.tests.exception.CompositionCanvasRuntimeException;
+import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions;
+import org.onap.sdc.frontend.ci.tests.pages.AbstractPageObject;
+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.Dimension;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.Point;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CompositionCanvasComponent extends AbstractPageObject {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(CompositionCanvasComponent.class);
+ private static final String nodePositionJs = "var cy = window.jQuery('.sdc-composition-graph-wrapper').cytoscape('get');%n"
+ + "var n = cy.nodes('[name=\"%s\"]');%n"
+ + "var nPos = n.renderedPosition();%n"
+ + "return JSON.stringify({%n"
+ + " x: nPos.x,%n"
+ + " y: nPos.y%n"
+ + "})";
+
+ private static final String getNodesJs = "var cy = window.jQuery('.sdc-composition-graph-wrapper').cytoscape('get');\n"
+ + "var nodes = [];"
+ + "cy.nodes().forEach((node) => {nodes.push(JSON.stringify({name: node.data('name'), position: node.renderedPosition()}))});\n"
+ + "return nodes;";
+
+ private final CompositionElementsComponent compositionElementsComponent;
+ private final CompositionDetailSideBarComponent compositionDetailSideBarComponent;
+
+ private WebElement canvasWebElement;
+ private Set<CanvasNodeElement> canvasElementList;
+ private int canvasCenterX;
+ private int canvasCenterY;
+ private int canvasWidth;
+ private int canvasHeight;
+
+ public CompositionCanvasComponent(final WebDriver webDriver) {
+ super(webDriver);
+ compositionElementsComponent = new CompositionElementsComponent(webDriver);
+ compositionDetailSideBarComponent = new CompositionDetailSideBarComponent(webDriver);
+ }
+
+ @Override
+ public void isLoaded() {
+ //waiting the canvas data to be load and animation finishes.
+ new Actions(webDriver).pause(Duration.ofSeconds(2)).perform();
+ canvasWebElement = waitToBeClickable(XpathSelector.CANVAS_ELEMENT.getXpath());
+ compositionElementsComponent.isLoaded();
+ compositionDetailSideBarComponent.isLoaded();
+ loadCanvas();
+ loadElements();
+ }
+
+ private void loadCanvas() {
+ canvasWidth = canvasWebElement.getSize().getWidth();
+ canvasHeight = canvasWebElement.getSize().getHeight();
+ canvasCenterX = canvasWidth / 2;
+ canvasCenterY = canvasHeight / 2;
+ LOGGER.debug("Canvas with size [{}, {}] and center [{}, {}]", canvasWidth, canvasHeight, canvasCenterX, canvasCenterY);
+ final String scriptJS = "var cy = window.jQuery('.sdc-composition-graph-wrapper').cytoscape('get');\n"
+ + "return JSON.stringify({width: cy.width(), height: cy.height()});";
+ final Object sizeObj = ((JavascriptExecutor) webDriver).executeScript(scriptJS);
+ final JsonObject size = new JsonParser().parse(sizeObj.toString()).getAsJsonObject();
+
+ LOGGER.debug("Canvas with size [{}, {}]", size.get("width"), size.get("height"));
+ }
+
+ private void loadElements() {
+ canvasElementList = new HashSet<>();
+ final Object nodeListObj = ((JavascriptExecutor) webDriver).executeScript(getNodesJs);
+ if (!(nodeListObj instanceof ArrayList)) {
+ return;
+ }
+ final ArrayList<String> nodeList = (ArrayList<String>) nodeListObj;
+ if (nodeList.isEmpty()) {
+ return;
+ }
+ nodeList.forEach(nodeString -> {
+ final JsonObject node = new JsonParser().parse(nodeString).getAsJsonObject();
+ final JsonObject position = node.get("position").getAsJsonObject();
+ final CanvasNodeElement canvasElement =
+ new CanvasNodeElement(node.get("name").getAsString(), position.get("x").getAsInt(), position.get("y").getAsInt());
+ canvasElementList.add(canvasElement);
+ });
+ }
+
+ public void selectNode(final String elementName) {
+ final Optional<CanvasNodeElement> canvasElementOptional = canvasElementList.stream()
+ .filter(canvasNodeElement -> canvasNodeElement.getName().equals(elementName))
+ .findFirst();
+ if (canvasElementOptional.isEmpty()) {
+ throw new CompositionCanvasRuntimeException(String.format("Given element '%s' does not exist on the element list", elementName));
+ }
+ final CanvasNodeElement canvasNodeElement = canvasElementOptional.get();
+ final Point positionFromCenter = calculateOffsetFromCenter(canvasNodeElement.getPositionX(),
+ canvasNodeElement.getPositionY());
+ final Actions actions = new Actions(webDriver);
+ int offsetFromElementCenter = 10;
+ actions.moveToElement(canvasWebElement, positionFromCenter.getX() - offsetFromElementCenter,
+ positionFromCenter.getY() + offsetFromElementCenter)
+ .pause(Duration.ofSeconds(1))
+ .click()
+ .perform();
+ ExtentTestActions.takeScreenshot(Status.INFO, "canvas-node-selected", String.format("'%s' was selected", elementName));
+ }
+
+ public ComponentInstance createNodeOnServiceCanvas(final String serviceName, final String serviceVersion, final String resourceName,
+ final String resourceVersion) {
+ final Point freePositionInCanvas = getFreePositionInCanvas(20);
+ final Point pointFromCanvasCenter = calculateOffsetFromCenter(freePositionInCanvas);
+ try {
+ final Service service =
+ AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, serviceName, serviceVersion);
+ final Resource resourceToAdd =
+ AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceName, resourceVersion);
+ final ComponentInstance componentInstance = AtomicOperationUtils
+ .addComponentInstanceToComponentContainer(resourceToAdd, service, UserRoleEnum.DESIGNER, true,
+ String.valueOf(pointFromCanvasCenter.getX()), String.valueOf(pointFromCanvasCenter.getY()))
+ .left().value();
+
+ LOGGER.debug("Created instance {} in the Service {}", componentInstance.getName(), serviceName);
+ return componentInstance;
+ } catch (final Exception e) {
+ throw new CompositionCanvasRuntimeException("Could not create node through the API", e);
+ }
+ }
+
+ private Point getFreePositionInCanvas(int maxAttempts) {
+ boolean isPositionFree;
+ final int minSpace = 150;
+ for (int attemptCount = 0; attemptCount < maxAttempts; attemptCount++) {
+ final Point randomPositionInCanvas = getRandomPositionInCanvas();
+ isPositionFree = canvasElementList.stream()
+ .noneMatch(canvasNodeElement -> Math.abs(canvasNodeElement.getPositionX() - randomPositionInCanvas.getX()) < minSpace
+ && Math.abs(canvasNodeElement.getPositionX() - randomPositionInCanvas.getY()) < minSpace);
+ if (isPositionFree) {
+ return randomPositionInCanvas;
+ }
+ }
+ throw new CompositionCanvasRuntimeException("Could not find a free Canvas position");
+ }
+
+ private Point getRandomPositionInCanvas() {
+ final Random random = new Random();
+ int x = random.nextInt(canvasWidth);
+ final int maxAllowedWidth = canvasWidth - getRightMarginWidth();
+ final int minAllowedWidth = 30;
+ if (x > maxAllowedWidth) {
+ x = x - getRightMarginWidth();
+ } else if (x < minAllowedWidth) {
+ x = x + minAllowedWidth;
+ }
+ int bottomMargin = 0;
+ int heightTopMargin = 100;
+ int y = random.nextInt(canvasHeight);
+ int maxAllowedHeight = canvasHeight - bottomMargin;
+
+ if (y > maxAllowedHeight) {
+ y = y - bottomMargin;
+ } else if (y < heightTopMargin) {
+ y = y + heightTopMargin;
+ }
+ LOGGER.debug("Generated random position in canvas [{},{}]", x, y);
+
+ return new Point(x, y);
+ }
+
+ private int getRightMarginWidth() {
+ int canvasIconsOffset = 100;
+ final Dimension sideBarSize = compositionDetailSideBarComponent.getSize();
+ return sideBarSize.getWidth() + canvasIconsOffset;
+ }
+
+ private Point calculateOffsetFromCenter(final Point point) {
+ return calculateOffsetFromCenter(point.getX(), point.getY());
+ }
+
+ private Point calculateOffsetFromCenter(final int xPosition, final int yPosition) {
+ final int positionX = xPosition - canvasCenterX;
+ final int positionY = yPosition - canvasCenterY;
+ return new Point(positionX, positionY);
+ }
+
+ public ImmutablePair<Integer, Integer> getElementPositionByName(final String elementName) {
+ final String scriptJs = String.format(nodePositionJs, elementName);
+ final Object position = ((JavascriptExecutor) webDriver).executeScript(scriptJs);
+ final JsonObject positionAsJson = new JsonParser().parse(position.toString()).getAsJsonObject();
+ int xElement = positionAsJson.get("x").getAsInt();
+ int yElement = positionAsJson.get("y").getAsInt();
+ return new ImmutablePair<>(xElement, yElement);
+ }
+
+ /**
+ * Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
+ */
+ @AllArgsConstructor
+ private enum XpathSelector {
+ CANVAS_ELEMENT("canvas", "//*[@data-tests-id='%s']//canvas[1]");
+
+ @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/component/workspace/CompositionDeploymentArtifactsTab.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionDeploymentArtifactsTab.java
new file mode 100644
index 0000000000..2dbd6ba6f1
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionDeploymentArtifactsTab.java
@@ -0,0 +1,50 @@
+/*
+ * ============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 lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.onap.sdc.frontend.ci.tests.pages.AbstractPageObject;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Represents the composition page, details panel, Deployment Artifacts tab
+ */
+public class CompositionDeploymentArtifactsTab extends AbstractPageObject {
+
+ public CompositionDeploymentArtifactsTab(final WebDriver webDriver) {
+ super(webDriver);
+ }
+
+ @Override
+ public void isLoaded() {
+ waitForElementVisibility(By.xpath(XpathSelector.DEPLOYMENT_ARTIFACTS_TAB.getXpath()));
+ }
+
+ @AllArgsConstructor
+ @Getter
+ private enum XpathSelector {
+ DEPLOYMENT_ARTIFACTS_TAB("//artifacts-tab[.//header[contains(text(), 'Deployment Artifacts')]]");
+
+ private final String xpath;
+
+ }
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionDetailSideBarComponent.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionDetailSideBarComponent.java
new file mode 100644
index 0000000000..214885ac3d
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionDetailSideBarComponent.java
@@ -0,0 +1,124 @@
+/*
+ * ============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.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.onap.sdc.frontend.ci.tests.pages.AbstractPageObject;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Dimension;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+
+public class CompositionDetailSideBarComponent extends AbstractPageObject {
+
+ private WebElement wrappingElement;
+
+ public CompositionDetailSideBarComponent(final WebDriver webDriver) {
+ super(webDriver);
+ }
+
+ @Override
+ public void isLoaded() {
+ wrappingElement = waitForElementVisibility(By.xpath(XpathSelector.MAIN_ELEMENT_DIV.getXpath()));
+ }
+
+ public String getSelectedComponentName() {
+ return wrappingElement.findElement(By.xpath(XpathSelector.DETAIL_COMPONENT_NAME_DIV.getXpath())).getText();
+ }
+
+ public void checkComponentIsSelected(final String componentName) {
+ assertThat("The selected component should be as expected", getSelectedComponentName(), is(componentName));
+ }
+
+ public Dimension getSize() {
+ final WebElement sideBarToggle = waitForElementVisibility(XpathSelector.DETAIL_SIDE_BAR_TOGGLE_DIV.getXpath());
+ if (!sideBarToggle.getAttribute("class").contains("active")) {
+ return new Dimension(0, 0);
+ }
+
+ return wrappingElement.getSize();
+ }
+
+ public AbstractPageObject selectTab(final CompositionDetailTabName tabName) {
+ final WebElement tabElement = wrappingElement.findElement(By.xpath(tabName.getXpathSelector().getXpath()));
+ tabElement.click();
+ switch (tabName) {
+ case INFORMATION:
+ return new CompositionInformationTab(webDriver);
+ case INPUTS:
+ return new CompositionInputsTab(webDriver);
+ case DEPLOYMENT_ARTIFACTS:
+ return new CompositionDeploymentArtifactsTab(webDriver);
+ case INFORMATIONAL_ARTIFACTS:
+ return new CompositionInformationalArtifactsTab(webDriver);
+ case API_ARTIFACTS:
+ return new CompositionApiArtifactsTab(webDriver);
+ case SUBSTITUTION_FILTER:
+ return new CompositionSubstitutionFilterTab(webDriver);
+ default:
+ throw new IllegalStateException("Not yet implemented: " + tabName);
+ }
+ }
+
+ /**
+ * Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
+ */
+ @AllArgsConstructor
+ private enum XpathSelector {
+ MAIN_ELEMENT_DIV("w-sdc-designer-sidebar", "//div[@class='%s']"),
+ DETAIL_SIDE_BAR_TOGGLE_DIV("w-sdc-designer-sidebar-toggle", "//div[contains(concat(' ',normalize-space(@class),' '),' %s ')]"),
+ DETAIL_HEADER("w-sdc-designer-sidebar-head", "//div[@data-tests-id='%s']"),
+ DETAIL_COMPONENT_NAME_DIV("selectedCompTitle", "//div[@data-tests-id='%s']"),
+ TAB_LIST("sdc-tabs-list", "//ul[@class='%s']/li"),
+ INFORMATION_TAB("detail-tab-information", "//li[@data-tests-id='%s']"),
+ INPUTS_TAB("detail-tab-inputs", "//li[@data-tests-id='%s']"),
+ DEPLOYMENT_ARTIFACTS_TAB("detail-tab-deployment-artifacts", "//li[@data-tests-id='%s']"),
+ INFORMATION_ARTIFACTS_TAB("detail-tab-information-artifacts", "//li[@data-tests-id='%s']"),
+ API_ARTIFACTS_TAB("detail-tab-api-artifacts", "//li[@data-tests-id='%s']"),
+ SUBSTITUTION_FILTER_TAB("detail-tab-substitution-filter", "//li[@data-tests-id='%s']");
+
+ @Getter
+ private final String id;
+ private final String xpathFormat;
+
+ public String getXpath() {
+ return String.format(xpathFormat, id);
+ }
+ }
+
+ @Getter
+ @AllArgsConstructor
+ public enum CompositionDetailTabName {
+ INFORMATION(XpathSelector.INFORMATION_TAB),
+ INPUTS(XpathSelector.INPUTS_TAB),
+ DEPLOYMENT_ARTIFACTS(XpathSelector.DEPLOYMENT_ARTIFACTS_TAB),
+ INFORMATIONAL_ARTIFACTS(XpathSelector.INFORMATION_ARTIFACTS_TAB),
+ API_ARTIFACTS(XpathSelector.API_ARTIFACTS_TAB),
+ SUBSTITUTION_FILTER(XpathSelector.SUBSTITUTION_FILTER_TAB);
+
+ private final XpathSelector xpathSelector;
+
+ }
+}
+
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionElementsComponent.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionElementsComponent.java
new file mode 100644
index 0000000000..a4fc8b9019
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionElementsComponent.java
@@ -0,0 +1,92 @@
+/*
+ * ============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 java.time.Duration;
+import java.util.Optional;
+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;
+import org.openqa.selenium.interactions.Actions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CompositionElementsComponent extends AbstractPageObject {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(CompositionElementsComponent.class);
+
+ private WebElement wrappingElement;
+
+ public CompositionElementsComponent(final WebDriver webDriver) {
+ super(webDriver);
+ }
+
+ @Override
+ public void isLoaded() {
+ final By xpath = By.xpath(XpathSelector.MAIN_ELEMENT.getXpath());
+ wrappingElement = waitToBeClickable(xpath);
+ }
+
+ public Optional<WebElement> searchElement(final String elementName) {
+ final WebElement searchElementInput = wrappingElement.findElement(By.xpath(XpathSelector.SEARCH_INPUT.getXpath()));
+ searchElementInput.sendKeys(elementName);
+ new Actions(webDriver).pause(Duration.ofSeconds(1)).perform();
+ try {
+ final WebElement accordionElement = waitForElementVisibility("//div[@class='sdc-accordion-header']");
+ final String aClass = accordionElement.getAttribute("class");
+ if (!aClass.contains("open")) {
+ accordionElement.click();
+ }
+ return Optional.ofNullable(waitToBeClickable(XpathSelector.ELEMENT_DIV.getXpath(elementName)));
+ } catch (final Exception e) {
+ LOGGER.debug("Could not find element " + elementName, e);
+ return Optional.empty();
+ }
+ }
+
+ /**
+ * Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
+ */
+ @AllArgsConstructor
+ private enum XpathSelector {
+ MAIN_ELEMENT("composition-palette", "//composition-palette"),
+ SEARCH_INPUT("searchAsset-input", "//*[@data-tests-id='%s']"),
+ ELEMENT_DIV("//*[@data-tests-id='%s']");
+
+ @Getter
+ private String id;
+ private final String xpathFormat;
+
+ XpathSelector(final String xpathFormat) {
+ this.xpathFormat = xpathFormat;
+ }
+
+ public String getXpath() {
+ return String.format(xpathFormat, id);
+ }
+
+ public String getXpath(final String... params) {
+ return String.format(xpathFormat, params);
+ }
+ }
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionInformationTab.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionInformationTab.java
new file mode 100644
index 0000000000..b911c632c7
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionInformationTab.java
@@ -0,0 +1,50 @@
+/*
+ * ============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 lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.onap.sdc.frontend.ci.tests.pages.AbstractPageObject;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Represents the composition page, details panel, Information tab
+ */
+public class CompositionInformationTab extends AbstractPageObject {
+
+ public CompositionInformationTab(final WebDriver webDriver) {
+ super(webDriver);
+ }
+
+ @Override
+ public void isLoaded() {
+ waitForElementVisibility(By.xpath(XpathSelector.INFORMATION_TAB.getXPath()));
+ }
+
+ @AllArgsConstructor
+ @Getter
+ private enum XpathSelector {
+ INFORMATION_TAB("//panel-info-tab");
+
+ private final String xPath;
+
+ }
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionInformationalArtifactsTab.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionInformationalArtifactsTab.java
new file mode 100644
index 0000000000..401dd7988e
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionInformationalArtifactsTab.java
@@ -0,0 +1,50 @@
+/*
+ * ============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 lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.onap.sdc.frontend.ci.tests.pages.AbstractPageObject;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Represents the composition page, details panel, Informational Artifacts tab
+ */
+public class CompositionInformationalArtifactsTab extends AbstractPageObject {
+
+ public CompositionInformationalArtifactsTab(final WebDriver webDriver) {
+ super(webDriver);
+ }
+
+ @Override
+ public void isLoaded() {
+ waitForElementVisibility(By.xpath(XpathSelector.INFORMATIONAL_ARTIFACTS_TAB.getXpath()));
+ }
+
+ @AllArgsConstructor
+ @Getter
+ private enum XpathSelector {
+ INFORMATIONAL_ARTIFACTS_TAB("//artifacts-tab[.//header[contains(text(), 'Informational Artifacts')]]");
+
+ private final String xpath;
+
+ }
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionInputsTab.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionInputsTab.java
new file mode 100644
index 0000000000..08f5074a84
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionInputsTab.java
@@ -0,0 +1,50 @@
+/*
+ * ============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 lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.onap.sdc.frontend.ci.tests.pages.AbstractPageObject;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Represents the composition page, details panel, Inputs tab
+ */
+public class CompositionInputsTab extends AbstractPageObject {
+
+ public CompositionInputsTab(final WebDriver webDriver) {
+ super(webDriver);
+ }
+
+ @Override
+ public void isLoaded() {
+ waitForElementVisibility(By.xpath(XpathSelector.INPUTS_TAB.getXPath()));
+ }
+
+ @AllArgsConstructor
+ @Getter
+ private enum XpathSelector {
+ INPUTS_TAB("//properties-tab[.//header[contains(text(), 'Inputs')]]");
+
+ private final String xPath;
+
+ }
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionPage.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionPage.java
new file mode 100644
index 0000000000..c013247a28
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionPage.java
@@ -0,0 +1,87 @@
+/*
+ * ============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 org.onap.sdc.frontend.ci.tests.pages.AbstractPageObject;
+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.openecomp.sdc.be.model.ComponentInstance;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Represents the Component (Service, VF, VFC, etc.) Composition Page
+ */
+public class CompositionPage extends AbstractPageObject {
+
+ private final ResourceWorkspaceTopBarComponent resourceWorkspaceTopBarComponent;
+ private final TopNavComponent topNavComponent;
+ private final CompositionElementsComponent compositionElementsComponent;
+ private final CompositionCanvasComponent compositionCanvasComponent;
+ private final CompositionDetailSideBarComponent compositionDetailSideBarComponent;
+
+ public CompositionPage(final WebDriver webDriver) {
+ super(webDriver);
+ topNavComponent = new TopNavComponent(webDriver);
+ resourceWorkspaceTopBarComponent = new ResourceWorkspaceTopBarComponent(webDriver);
+ compositionElementsComponent = new CompositionElementsComponent(webDriver);
+ compositionCanvasComponent = new CompositionCanvasComponent(webDriver);
+ compositionDetailSideBarComponent = new CompositionDetailSideBarComponent(webDriver);
+ }
+
+ @Override
+ public void isLoaded() {
+ compositionElementsComponent.isLoaded();
+ resourceWorkspaceTopBarComponent.isLoaded();
+ topNavComponent.isLoaded();
+ compositionCanvasComponent.isLoaded();
+ compositionDetailSideBarComponent.isLoaded();
+ }
+
+ public ComponentInstance addNodeToCompositionUsingApi(final String serviceName, final String serviceVersion, final String resourceName,
+ final String resourceVersion) {
+ return compositionCanvasComponent.createNodeOnServiceCanvas(serviceName, serviceVersion, resourceName, resourceVersion);
+ }
+
+ /**
+ * Select a node in the canvas
+ *
+ * @param nodeName the node name to select
+ */
+ public void selectNode(final String nodeName) {
+ compositionCanvasComponent.selectNode(nodeName);
+ compositionDetailSideBarComponent.checkComponentIsSelected(nodeName);
+ }
+
+ public ServiceComponentPage goToServiceGeneral() {
+ topNavComponent.clickOnBreadCrumb(1);
+ return new ServiceComponentPage(webDriver);
+ }
+
+ /**
+ * Get the composition page detail sidebar component
+ *
+ * @return the composition detail sideBar component
+ */
+ public CompositionDetailSideBarComponent getDetailSideBar() {
+ return compositionDetailSideBarComponent;
+ }
+
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionSubstitutionFilterTab.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionSubstitutionFilterTab.java
new file mode 100644
index 0000000000..d279e1f07d
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionSubstitutionFilterTab.java
@@ -0,0 +1,52 @@
+/*
+ * ============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 lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.onap.sdc.frontend.ci.tests.pages.AbstractPageObject;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Represents the composition page, details panel, Substitution Filters tab
+ */
+public class CompositionSubstitutionFilterTab extends AbstractPageObject {
+
+ public CompositionSubstitutionFilterTab(final WebDriver webDriver) {
+ super(webDriver);
+ }
+
+ @Override
+ public void isLoaded() {
+ waitForElementVisibility(By.xpath(XpathSelector.SUBSTITUTION_FILTER_TAB.getXPath()));
+ waitForElementVisibility(By.xpath(XpathSelector.ADD_SUBSTITUTION_FILTER_BTN.getXPath()));
+ }
+
+ @AllArgsConstructor
+ @Getter
+ private enum XpathSelector {
+ SUBSTITUTION_FILTER_TAB("//substitution-filter-tab"),
+ ADD_SUBSTITUTION_FILTER_BTN("//button[@data-tests-id='add-substitution-filter-button']");
+
+ private final String xPath;
+
+ }
+}