aboutsummaryrefslogtreecommitdiffstats
path: root/ui-ci/src/main/java/org
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-02-19 10:28:42 +0200
committerMichael Lando <ml636r@att.com>2017-02-19 10:51:01 +0200
commit451a3400b76511393c62a444f588a4ed15f4a549 (patch)
treee4f5873a863d1d3e55618eab48b83262f874719d /ui-ci/src/main/java/org
parent5abfe4e1fb5fae4bbd5fbc340519f52075aff3ff (diff)
Initial OpenECOMP SDC commit
Change-Id: I0924d5a6ae9cdc161ae17c68d3689a30d10f407b Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'ui-ci/src/main/java/org')
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactInfo.java85
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/BreadCrumbsButtonsEnum.java38
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasElement.java65
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java250
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CatalogFilterTitlesEnum.java37
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CheckBoxStatusEnum.java50
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CreateAndImportButtonsEnum.java27
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CreateAndUpdateStepsEnum.java45
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java380
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/GeneralCanvasItemsEnum.java39
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LifeCycleStateEnum.java46
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/MenuOptionsEnum.java45
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/PropertyInfo.java76
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceCategoriesNameEnum.java63
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceCategoriesNameEnum.java39
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TypesEnum.java43
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserCredentials.java57
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/WorkMode.java25
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/environmentLocal10
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/adminworkspace/AdminUserManagment.java141
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/CatalogLeftFilterPanelCheckBoxTest.java272
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/CatalogSearchBoxTest.java130
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/ChangeLifeCycleStatFromCatalogTest.java103
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/ImportAssetInUITest.java480
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VFCanvasTest.java91
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VFUITest.java37
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VfTests.java33
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/WorkspaceCheckBoxFilterTest.java120
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Import.java177
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java222
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java377
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/OnboardCSVReport.java63
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/RemoteWebDriverTest.java45
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java538
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ComponentLeftMenu.java25
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/CompositionPage.java56
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java91
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java139
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GovernorOperationPage.java46
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/IconPage.java51
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InformationalArtifactPage.java57
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OpsOperationPage.java183
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesPage.java61
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertyPopup.java77
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceGeneralPage.java154
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java63
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceGeneralPage.java47
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TesterOperationPage.java71
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ToscaArtifactsPage.java35
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java76
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdditionalConditions.java84
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdminWorkspaceUIUtilies.java71
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java302
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AuditCDUtils.java67
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasElement.java54
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasManager.java181
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CaptureFailedTests.java54
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CatalogUIUtilitis.java148
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java88
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java1081
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ImportAssetUIUtils.java50
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java457
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PropertiesUIUtils.java92
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java864
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/RestCDUtils.java182
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ServiceUIUtils.java241
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java60
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfVerificator.java93
68 files changed, 9650 insertions, 0 deletions
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactInfo.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactInfo.java
new file mode 100644
index 0000000000..4de9ae8436
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactInfo.java
@@ -0,0 +1,85 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes;
+
+public class ArtifactInfo {
+
+ private String filepath;
+ private String filename;
+ private String description;
+ private String artifactType;
+ private String artifactLabel;
+
+ public ArtifactInfo(String filepath, String filename, String description, String artifactLabel,
+ String artifactType) {
+ super();
+ this.filepath = filepath;
+ this.filename = filename;
+ this.description = description;
+ this.artifactType = artifactType;
+ this.artifactLabel = artifactLabel;
+ }
+
+ public ArtifactInfo() {
+ super();
+ }
+
+ public String getFilepath() {
+ return filepath;
+ }
+
+ public void setFilepath(String filepath) {
+ this.filepath = filepath;
+ }
+
+ public String getFilename() {
+ return filename;
+ }
+
+ public void setFilename(String filename) {
+ this.filename = filename;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getArtifactType() {
+ return artifactType;
+ }
+
+ public void setArtifactType(String artifactType) {
+ this.artifactType = artifactType;
+ }
+
+ public String getArtifactLabel() {
+ return artifactLabel;
+ }
+
+ public void setArtifactLabel(String artifactLabel) {
+ this.artifactLabel = artifactLabel;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/BreadCrumbsButtonsEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/BreadCrumbsButtonsEnum.java
new file mode 100644
index 0000000000..21d5f25013
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/BreadCrumbsButtonsEnum.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes;
+
+public enum BreadCrumbsButtonsEnum {
+
+ HOME("main-menu-button-home"), CATALOG("main-menu-button-catalog"), ON_BOARDING("main-menu-button-onboard");
+
+ private String value;
+ private String value2;
+
+ public String getButton() {
+ return value;
+ }
+
+ private BreadCrumbsButtonsEnum(String value) {
+ this.value = value;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasElement.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasElement.java
new file mode 100644
index 0000000000..818b488d64
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasElement.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+
+public final class CanvasElement {
+ private final String uniqueId;
+ private ImmutablePair<Integer, Integer> location;
+ private LeftPanelCanvasItems normativeElementType;
+ private String elementType;
+
+ CanvasElement(String name, ImmutablePair<Integer, Integer> location, LeftPanelCanvasItems canvasItem) {
+ super();
+ this.uniqueId = name;
+ this.location = location;
+ normativeElementType = canvasItem;
+ }
+
+ CanvasElement(String name, ImmutablePair<Integer, Integer> location, String canvasItem) {
+ super();
+ this.uniqueId = name;
+ this.location = location;
+ elementType = canvasItem;
+ }
+
+ public String getUniqueId() {
+ return uniqueId;
+ }
+
+ public ImmutablePair<Integer, Integer> getLocation() {
+ return location;
+ }
+
+ public void setLocation(ImmutablePair<Integer, Integer> location) {
+ this.location = location;
+ }
+
+ public LeftPanelCanvasItems getNormativeElementType() {
+ return normativeElementType;
+ }
+
+ public String getElementType() {
+ return elementType;
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java
new file mode 100644
index 0000000000..d5c76d1ef1
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java
@@ -0,0 +1,250 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes;
+
+import static org.testng.AssertJUnit.assertNotNull;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.UUID;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
+import org.openecomp.sdc.common.api.ArtifactTypeEnum;
+import org.openqa.selenium.By;
+import org.openqa.selenium.StaleElementReferenceException;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+import org.testng.Assert;
+
+import com.relevantcodes.extentreports.LogStatus;
+
+public final class CanvasManager {
+ private static final String LEFT_PANEL_ELEMENT_NAME_PREFIX = "leftbar-section-content-item-";
+ private Map<String, CanvasElement> canvasElements;
+ private Actions actions;
+ private WebElement canvas;
+ private int reduceCanvasWidthFactor;
+ // Offsets Are used to find upper right corner of canvas element in order to
+ // connect links
+ private static final int CANVAS_ELEMENT_Y_OFFSET = 40;
+ private static final int CANVAS_ELEMENT_X_OFFSET = 21; // 14 - 27
+
+ private CanvasManager() {
+ canvasElements = new HashMap<>();
+ actions = new Actions(GeneralUIUtils.getDriver());
+// canvas = GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.CANVAS.getValue());
+ canvas = GeneralUIUtils.waitForClassNameVisibility("w-sdc-designer-canvas");
+ try {
+ WebElement webElement = GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.CANVAS_RIGHT_PANEL.getValue());
+ reduceCanvasWidthFactor = webElement.getSize().width;
+ } catch (Exception e) {
+ reduceCanvasWidthFactor = 0;
+ }
+ }
+
+
+ public static CanvasManager getCanvasManager() {
+ return new CanvasManager();
+ }
+
+ public List<CanvasElement> getCanvasElements() {
+ return canvasElements.values().stream().collect(Collectors.toList());
+ }
+
+ private void addCanvasElement(CanvasElement element) {
+ canvasElements.put(element.getUniqueId(), element);
+ }
+
+ private void moveElementOnCanvas(CanvasElement canvasElement, ImmutablePair<Integer, Integer> newLocation)
+ throws Exception {
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.sleep(500);
+ actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right);
+ actions.clickAndHold();
+ actions.moveToElement(canvas, newLocation.left, newLocation.right);
+ actions.release();
+ actions.perform();
+ canvasElement.setLocation(newLocation);
+ GeneralUIUtils.waitForLoader();
+
+ }
+
+ public void moveToFreeLocation(String containerName) {
+ int maxWait = 5000;
+ int sumOfWaiting = 0;
+ int napPeriod = 200;
+ boolean isKeepWaiting = false;
+ while (!isKeepWaiting) {
+ ImmutablePair<Integer, Integer> freePosition = getFreePosition();
+ actions.moveToElement(canvas, freePosition.left, freePosition.right);
+ actions.clickAndHold();
+ actions.release();
+ actions.perform();
+ GeneralUIUtils.sleep(napPeriod);
+ isKeepWaiting = GeneralUIUtils.getWebElementWaitForVisible("selectedCompTitle").getText()
+ .equals(containerName);
+ sumOfWaiting += napPeriod;
+ if (sumOfWaiting > maxWait) {
+ Assert.fail("Can't click on VF");
+ }
+ }
+ }
+
+ public void clickOnCanvaElement(CanvasElement canvasElement) {
+ actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right);
+ actions.clickAndHold();
+ actions.release();
+ actions.perform();
+ }
+
+ public void moveElementOnCanvas(CanvasElement canvasElement) throws Exception {
+ moveElementOnCanvas(canvasElement, getFreePosition());
+ }
+
+ public void deleteElementFromCanvas(CanvasElement canvasElement) throws Exception {
+ GeneralUIUtils.waitForLoader();
+ actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right);
+ actions.click();
+ actions.perform();
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.DELETE_INSTANCE_BUTTON.getValue())
+ .click();
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.OK.getValue()).click();
+ canvasElements.remove(canvasElement.getUniqueId());
+ GeneralUIUtils.waitForLoader();
+ }
+
+ private WebElement findClickElement(String dataTestId) {
+ int attempts = 0;
+ while (attempts < 2) {
+ try {
+ return GeneralUIUtils.getWebElementWaitForVisible(dataTestId);
+ } catch (StaleElementReferenceException e) {
+ }
+ attempts++;
+ }
+ return null;
+ }
+
+ public CanvasElement createElementOnCanvas(String elementName) throws Exception {
+ final String elementDataTestId = LEFT_PANEL_ELEMENT_NAME_PREFIX + elementName;
+ try {
+ WebElement element = findClickElement(elementDataTestId);
+ ImmutablePair<Integer, Integer> freePosition = getFreePosition();
+ actions.moveToElement(element, 0, 0);
+ actions.clickAndHold();
+ actions.moveToElement(canvas, freePosition.left, freePosition.right);
+ actions.release();
+ actions.perform();
+ GeneralUIUtils.waitForLoader();
+ String uniqueId = elementDataTestId + "_" + UUID.randomUUID().toString();
+ CanvasElement canvasElement = new CanvasElement(uniqueId, freePosition, elementDataTestId);
+ addCanvasElement(canvasElement);
+ SetupCDTest.getExtendTest().log(LogStatus.PASS,
+ String.format("element %s is in canvas now..", elementName));
+ return canvasElement;
+ } catch (Exception e) {
+ System.out.println("Can't create element on canvas");
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public CanvasElement createElementOnCanvas(LeftPanelCanvasItems canvasItem) throws Exception {
+ return createElementOnCanvas(canvasItem.getValue());
+ }
+
+ private ImmutablePair<Integer, Integer> getFreePosition() {
+ ImmutablePair<Integer, Integer> randomPosition = null;
+ boolean freePosition = false;
+ int minSpace = 150;
+ while (!freePosition) {
+ ImmutablePair<Integer, Integer> tempRandomPosition = getRandomPosition();
+ freePosition = !canvasElements.values().stream().map(e -> e.getLocation())
+ .filter(e -> Math.abs(e.left - tempRandomPosition.left) < minSpace
+ && Math.abs(e.right - tempRandomPosition.right) < minSpace)
+ .findAny().isPresent();
+ randomPosition = tempRandomPosition;
+ }
+ return randomPosition;
+ }
+
+ private ImmutablePair<Integer, Integer> getRandomPosition() {
+ int edgeBuffer = 50;
+ Random random = new Random();
+ int xElement = random.nextInt(canvas.getSize().width - 2 * edgeBuffer - reduceCanvasWidthFactor) + edgeBuffer;
+ int yElement = random.nextInt(canvas.getSize().height - 2 * edgeBuffer) + edgeBuffer;
+ return new ImmutablePair<Integer, Integer>(xElement, yElement);
+ }
+
+ public void linkElements(CanvasElement firstElement, CanvasElement secondElement) throws Exception {
+ drawSimpleLink(firstElement, secondElement);
+ selectReqAndCapAndConnect();
+ }
+
+ private void selectReqAndCapAndConnect() throws Exception {
+ // Select First Cap
+ GeneralUIUtils.getWebElementsListByDataTestId(DataTestIdEnum.LinkMenuItems.LINK_ITEM_CAP.getValue()).get(0)
+ .click();
+ // Select First Req
+ GeneralUIUtils.getWebElementsListByDataTestId(DataTestIdEnum.LinkMenuItems.LINK_ITEM_REQ.getValue()).get(0)
+ .click();
+ // Connect
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.LinkMenuItems.CONNECT_BUTTON.getValue()).click();
+
+ GeneralUIUtils.waitForLoader();
+ }
+
+ private void drawSimpleLink(CanvasElement firstElement, CanvasElement secondElement) throws Exception {
+ int yOffset = CANVAS_ELEMENT_Y_OFFSET;
+ int xOffset = CANVAS_ELEMENT_X_OFFSET;
+
+ actions.moveToElement(canvas, firstElement.getLocation().left + xOffset, firstElement.getLocation().right - yOffset);
+ actions.clickAndHold();
+ actions.moveToElement(canvas, secondElement.getLocation().left + xOffset, secondElement.getLocation().right - yOffset);
+ actions.release();
+ actions.perform();
+ GeneralUIUtils.ultimateWait();
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, String.format("Elements %s and %s now connected", firstElement.getElementType().split("-")[4], secondElement.getElementType().split("-")[4]));
+ }
+
+ public String updateElementNameInCanvas(CanvasElement canvasElement, String newInstanceName) throws Exception {
+ GeneralUIUtils.waitForLoader();
+ actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right);
+ actions.click();
+ actions.perform();
+ WebElement updateInstanceName = GeneralUIUtils.getDriver().findElement(By.id("editPencil"));
+ updateInstanceName.click();
+ WebElement instanceNameField = GeneralUIUtils
+ .getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.INSTANCE_NAME_FIELD.getValue());
+ String oldInstanceName = instanceNameField.getText();
+ instanceNameField.clear();
+ instanceNameField.sendKeys(newInstanceName);
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.OK.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ return oldInstanceName;
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CatalogFilterTitlesEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CatalogFilterTitlesEnum.java
new file mode 100644
index 0000000000..1335b51788
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CatalogFilterTitlesEnum.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes;
+
+public enum CatalogFilterTitlesEnum {
+
+ TYPE("typeFilterTitle"), CATEGORIES("categoriesFilterTitle"), STATUS("statusFilterTitle");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private CatalogFilterTitlesEnum(String value) {
+ this.value = value;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CheckBoxStatusEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CheckBoxStatusEnum.java
new file mode 100644
index 0000000000..ffa17ee607
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CheckBoxStatusEnum.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes;
+
+public enum CheckBoxStatusEnum {
+ CHECKOUT("", "checkbox-checkout"),
+ CHECKIN("", "checkbox-checkin"),
+ READY_FOR_TESTING("checkbox-readyfortesting","checkbox-1"),
+ IN_TESTING("checkbox-intesting", "checkbox-2"),
+ WAITING_FOR_DISTRIBUTION("", "checkbox-waitingforapproval"),
+ DISTRIBUTION_REJECTED("", "checkbox-distributionrejected"),
+ DISTRIBUTION_APPROVED("", "checkbox-distributionapproved"),
+ CERTIFIED("checkbox-certified", "checkbox-3"),
+ DISTRIBUTED("", "checkbox-4"),
+ IN_DESIGN("", "checkbox-0");
+
+ private String value;
+ private String value2;
+
+ public String getValue() {
+ return value;
+ }
+
+ public String getCatalogValue() {
+ return value2;
+ }
+
+ private CheckBoxStatusEnum(String value, String value2) {
+ this.value = value;
+ this.value2 = value2;
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CreateAndImportButtonsEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CreateAndImportButtonsEnum.java
new file mode 100644
index 0000000000..a49c5024a6
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CreateAndImportButtonsEnum.java
@@ -0,0 +1,27 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes;
+
+public enum CreateAndImportButtonsEnum {
+
+ IMPORT_VF, IMPORT_VFC, IMPORT_CP, IMPORT_VL, CREATE_VF, CREATE_SERVICE, CREATE_PRODUCT;
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CreateAndUpdateStepsEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CreateAndUpdateStepsEnum.java
new file mode 100644
index 0000000000..ffa7400338
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CreateAndUpdateStepsEnum.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes;
+
+// public enum CreateAndUpdateStepsEnum {
+// GENERAL("Generalstep"),
+// ICON("Iconstep"),
+// DEPLOYMENT_ARTIFACT("Deployment Artifactstep"),
+// INFORMATION_ARTIFACT("Information Artifactstep"),
+// PROPERTIES("Propertiesstep"),
+// COMPOSITION("Compositionstep"),
+// ACTIVITY_LOG("Activity Logstep"),
+// DEPLOYMENT_VIEW("Deploymentstep");
+//
+//
+// private String value;
+//
+// public String getValue(){
+// return value;
+// }
+//
+// private CreateAndUpdateStepsEnum(String value) {
+// this.value = value;
+// }
+//
+//
+// }
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java
new file mode 100644
index 0000000000..16593fc62f
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java
@@ -0,0 +1,380 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes;
+
+public final class DataTestIdEnum {
+ private DataTestIdEnum() {
+ };
+
+ public enum Dashboard {
+ IMPORT_AREA("importButtonsArea"),
+ BUTTON_ADD_VF("createResourceButton"),
+ BUTTON_ADD_SERVICE("createServiceButton"),
+ IMPORT_VFC("importVFCbutton"),
+ IMPORT_VF("importVFbutton"),
+ IMPORT_VFC_FILE("file-importVFCbutton"),
+ IMPORT_VF_FILE("file-importVFbutton");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private Dashboard(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum LifeCyleChangeButtons {
+ CREATE("create/save"), CHECK_IN("check_in"),
+ SUBMIT_FOR_TESTING("submit_for_testing"),
+ START_TESTING("start_testing"),
+ ACCEPT("accept");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private LifeCyleChangeButtons(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum DistributionChangeButtons {
+ APPROVE("approve"), REJECT("reject"),
+ DISTRIBUTE("distribute"),
+ MONITOR("monitor"),
+ APPROVE_MESSAGE("checkindialog"),
+ RE_DISTRIBUTE("redistribute");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private DistributionChangeButtons(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum InformationalArtifacts {
+ CLOUD_QUESTIONNAIRE("Cloud Questionnaire (completed)"),
+ FEATURES("Features"),
+ VENDOR_TEST_RESULT("Vendor Test Result"),
+ TEST_SCRIPTS("Test Scripts"),
+ RESOURCE_SECURITY_TEMPLATE("Resource Security Template"),
+ HEAT_TEMPLATE_FROM_VENDOR("HEAT Template from Vendor"),
+ CAPACITY("Capacity");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private InformationalArtifacts(String value) {
+ this.value = value;
+ }
+
+ }
+
+ public enum ModalItems {
+ BROWSE_BUTTON("browseButton"),
+ ADD("Add"),
+ DESCRIPTION("description"),
+ SUMBIT_FOR_TESTING_MESSAGE("changeLifeCycleMessage"),
+ OK("OK"),
+ CANCEL("Cancel"),
+ ACCEP_TESTING_MESSAGE("checkindialog");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private ModalItems(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum LeftPanelCanvasItems {
+ BLOCK_STORAGE("BlockStorage"),
+ CINDER_VOLUME("CinderVolume"),
+ COMPUTE("Compute"),
+ LOAD_BALANCER("LoadBalancer"),
+ NOVA_SERVER("NovaServer"),
+ OBJECT_STORAGE("ObjectStorage"),
+ NEUTRON_PORT("NeutronPort"),
+ PORT("Port"),
+ DATABASE("Database");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private LeftPanelCanvasItems(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum LinkMenuItems {
+ CANCEL_BUTTON("link-menu-button-cancel"),
+ CONNECT_BUTTON("link-menu-button-connect"),
+ LINK_ITEM_CAP("link-item-capabilities"),
+ LINK_ITEM_REQ("link-item-requirements"),
+ LINK_MENU("link-menu-open");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private LinkMenuItems(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum GeneralCanvasItems {
+ CANVAS("canvas"),
+ CANVAS_RIGHT_PANEL("w-sdc-designer-sidebar-head"),
+ DELETE_INSTANCE_BUTTON("e-sdc-small-icon-delete"),
+ UPDATE_INSTANCE_NAME("e-sdc-small-icon-update"),
+ INSTANCE_NAME_FIELD("instanceName");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private GeneralCanvasItems(String value) {
+ this.value = value;
+ }
+
+ }
+
+ public enum ResourceMetadataEnum {
+ RESOURCE_NAME("name"),
+ DESCRIPTION("description"),
+ CATEGORY("selectGeneralCategory"),
+ VENDOR_NAME("vendorName"),
+ VENDOR_RELEASE("vendorRelease"),
+ TAGS("i-sdc-tag-input"),
+ CONTACT_ID("contactId"),
+ ICON(" iconBox");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private ResourceMetadataEnum(String value) {
+ this.value = value;
+ }
+
+ }
+
+ public enum GeneralElementsEnum {
+ CREATE_BUTTON("create/save"),
+ CHECKIN_BUTTON("check_in"),
+ SUBMIT_FOR_TESTING_BUTTON("submit_for_testing"),
+ DELETE_VERSION_BUTTON("delete_version"),
+ REVERT_BUTTON("revert"),
+ LIFECYCLE_STATE("lifecyclestate"),
+ VERSION_HEADER("versionHeader");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private GeneralElementsEnum(String value) {
+ this.value = value;
+ }
+
+ }
+
+ public enum ArtifactPageEnum {
+
+ ADD_INFORMATIONAL_ARTIFACT("add-information-artifact-button"),
+ ADD_DEPLOYMENT_ARTIFACT("add-deployment-artifact-button"),
+ ADD_ANOTHER_ARTIFACT("add-another-artifact-button"),
+ EDIT_ARTIFACT("edit_"),
+ DELETE_ARTIFACT("delete_"),
+ DOWNLOAD_ARTIFACT("download_"),
+ GET_DEPLOYMENT_ARTIFACT_DESCRIPTION("description"),
+ GET_INFORMATIONAL_ARTIFACT_DESCRIPTION("Description")
+
+ ;
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private ArtifactPageEnum(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum PropertiesPageEnum {
+
+ ADD_NEW_PROPERTY("addGrey"),
+ EDIT_PROPERTY("edit_"),
+ DELETE_PROPERTY("delete_"),
+ PROPERTY_NAME("propertyName"),
+ PROPERTY_VALUE("defaultvalue"),
+ PROPERTY_DESCRIPTION("description"),
+ PROPERTY_TYPE("propertyType"),
+ ADD("Add"),
+ CANCEL("Cancel"),
+ DONE("Done"),
+ PROPERTY_ROW("propertyRow"),
+ SAVE("Save");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private PropertiesPageEnum(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum MainMenuButtons {
+ HOME_BUTTON("main-menu-button-home"),
+ CATALOG_BUTTON("main-menu-button-catalog"),
+ ONBOARD_BUTTON("main-menu-button-onboard");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private MainMenuButtons(String value) {
+ this.value = value;
+ }
+
+ }
+
+ public enum MenuOptionsEnum {
+ EDIT("Edit"),
+ CHECK_IN("Check in"),
+ CHECK_OUT("Check out"),
+ VIEW("View"),
+ SUBMIT_FOR_TEST("Submit For Test"),
+ ACCEPT("Accept"),
+ REJECT("Reject"),
+ START_TEST("Start test"),
+ DISTREBUTE("Distribute");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private MenuOptionsEnum(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum StepsEnum {
+ GENERAL("Generalstep"),
+ ICON("Iconstep"),
+ DEPLOYMENT_ARTIFACT("Deployment Artifactstep"),
+ INFORMATION_ARTIFACT("Information Artifactstep"),
+ PROPERTIES("Propertiesstep"),
+ COMPOSITION("Compositionstep"),
+ ACTIVITY_LOG("Activity Logstep"),
+ DEPLOYMENT_VIEW("Deploymentstep"),
+ TOSCA_ARTIFACTS("TOSCA Artifactsstep"),
+ MONITOR("Monitor step");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private StepsEnum(String value) {
+ this.value = value;
+ }
+
+ }
+
+ public enum ArtifactPopup {
+
+ BROWSE("browseButton"),
+ ARTIFACT_DESCRIPTION("description"),
+ ARTIFACT_LABEL("selectArtifact"),
+ ARTIFACT_TYPE("artifacttype"),
+ ADD_BUTTON("Add"),
+ CANCEL_BUTTON("Cancel"),
+ UPDATE_BUTTON("Update");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private ArtifactPopup(String value) {
+ this.value = value;
+ }
+
+ }
+
+ public enum ServiceMetadataEnum {
+ SERVICE_NAME("name"),
+ DESCRIPTION("description"),
+ CATEGORY("selectGeneralCategory"),
+ PROJECT_CODE("projectCode"),
+ TAGS("i-sdc-tag-input"),
+ CONTACT_ID("contactId"),
+ ICON(" iconBox");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private ServiceMetadataEnum(String value) {
+ this.value = value;
+ }
+
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/GeneralCanvasItemsEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/GeneralCanvasItemsEnum.java
new file mode 100644
index 0000000000..0e8f9cbea1
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/GeneralCanvasItemsEnum.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes;
+
+public enum GeneralCanvasItemsEnum {
+ CANVAS("canvas"), CANVAS_RIGHT_PANEL("w-sdc-designer-sidebar-head"), DELETE_INSTANCE_BUTTON(
+ "e-sdc-small-icon-delete")
+
+ ;
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private GeneralCanvasItemsEnum(String value) {
+ this.value = value;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LifeCycleStateEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LifeCycleStateEnum.java
new file mode 100644
index 0000000000..29274179d1
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LifeCycleStateEnum.java
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes;
+
+public enum LifeCycleStateEnum {
+
+ CHECKOUT("IN DESIGN CHECK OUT"),
+ CHECKIN("IN DESIGN CHECK IN"),
+ READY_FOR_TESTING("READY FOR TESTING"),
+ IN_TESTING("IN TESTING"),
+ WAITING_FOR_DISTRIBUTION("WAITING FOR DISTRIBUTION"),
+ DISTRIBUTION_REJECTED("DISTRIBUTION REJECTED"),
+ DISTRIBUTION_APPROVED("DISTRIBUTION APPROVED"),
+ CERTIFIED("CERTIFIED"),
+ DISTRIBUTED("DISTRIBUTED");
+
+ private String value;
+ private String value2;
+
+ public String getValue() {
+ return value;
+ }
+
+ private LifeCycleStateEnum(String value) {
+ this.value = value;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/MenuOptionsEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/MenuOptionsEnum.java
new file mode 100644
index 0000000000..d23ab18f10
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/MenuOptionsEnum.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes;
+
+public enum MenuOptionsEnum {
+
+ EDIT("Edit"),
+ CHECK_IN("Check in"),
+ CHECK_OUT("Check out"),
+ VIEW("View"),
+ SUBMIT_FOR_TEST("Submit For Test"),
+ ACCEPT("Accept"),
+ REJECT("Reject"),
+ START_TEST("Start test"),
+ DISTREBUTE("Distribute");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private MenuOptionsEnum(String value) {
+ this.value = value;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/PropertyInfo.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/PropertyInfo.java
new file mode 100644
index 0000000000..385093e5ad
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/PropertyInfo.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes;
+
+import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
+
+public class PropertyInfo {
+
+ public PropertyInfo() {
+ super();
+ }
+
+ public PropertyInfo(String name, String value, String desc, PropertyTypeEnum type) {
+ super();
+ this.name = name;
+ this.value = value;
+ this.type = type;
+ this.description = desc;
+ }
+
+ private String name;
+ private String value;
+ private PropertyTypeEnum type;
+ private String description;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public PropertyTypeEnum getType() {
+ return type;
+ }
+
+ public void setType(PropertyTypeEnum type) {
+ this.type = type;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceCategoriesNameEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceCategoriesNameEnum.java
new file mode 100644
index 0000000000..921493f932
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceCategoriesNameEnum.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes;
+
+public enum ResourceCategoriesNameEnum {
+
+ GENERIC("checkbox-resourcenewcategory.generic"),
+ NETWORK_CONNECTIVITY("checkbox-resourcenewcategory.networkconnectivity"),
+ NETWORK_ELEMENTS("checkbox-resourcenewcategory.generic.networkelements"),
+ ABSTRACT("checkbox-resourcenewcategory.generic.abstract"),
+ DATABASE_GENERIC("checkbox-resourcenewcategory.generic.database"),
+ INFRASTRUCTURE("checkbox-resourcenewcategory.generic.infrastructure"),
+ VIRTUAL_LINKS("checkbox-resourcenewcategory.networkconnectivity.virtuallinks"),
+ CONNECTION_POINTS("checkbox-resourcenewcategory.networkconnectivity.connectionpoints"),
+ NETWORKL4("checkbox-resourcenewcategory.networkl4+"),
+ COMMON_NETWORK_RESOURCES("checkbox-resourcenewcategory.networkl4+.commonnetworkresources"),
+ APPLICATIONL4("checkbox-resourcenewcategory.applicationl4+"),
+ WEB_SERVER("checkbox-resourcenewcategory.applicationl4+.webserver"),
+ APPLICATION_SERVER("checkbox-resourcenewcategory.applicationl4+.applicationserver"),
+ CALL_CONTROL("checkbox-resourcenewcategory.applicationl4+.callcontrol"),
+ BORDER_ELEMENT("checkbox-resourcenewcategory.applicationl4+.borderelement"),
+ MEDIA_SERVERS("checkbox-resourcenewcategory.applicationl4+.mediaservers"),
+ DATABASE("checkbox-resourcenewcategory.applicationl4+.database"),
+ FIREWALL("checkbox-resourcenewcategory.applicationl4+.firewall"),
+ LOAD_BALANCER("checkbox-resourcenewcategory.applicationl4+.loadbalancer"),
+ NETWORK_L23("checkbox-resourcenewcategory.networkl2-3"),
+ Router("checkbox-resourcenewcategory.networkl2-3.router"),
+ WAN_Connectors("checkbox-resourcenewcategory.networkl2-3.wanconnectors"),
+ LAN_CONNECTORS("checkbox-resourcenewcategory.networkl2-3.lanconnectors"),
+ GATEWAY("checkbox-resourcenewcategory.networkl2-3.gateway"),
+ INFRASTRUCTUREL23("checkbox-resourcenewcategory.networkl2-3.infrastructure");
+
+
+ private String value;
+
+ public String getValue(){
+ return value;
+ }
+
+ private ResourceCategoriesNameEnum(String value) {
+ this.value = value;
+ }
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceCategoriesNameEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceCategoriesNameEnum.java
new file mode 100644
index 0000000000..d39bba5594
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceCategoriesNameEnum.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes;
+
+public enum ServiceCategoriesNameEnum {
+
+ NETWORK_L13("checkbox-servicenewcategory.networkl1-3"),
+ VOIPCALL_CONTROL("checkbox-servicenewcategory.voipcallcontrol"),
+ NETWORKL4("checkbox-servicenewcategory.networkl4+"),
+ MOBILITY("checkbox-servicenewcategory.mobility");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private ServiceCategoriesNameEnum(String value) {
+ this.value = value;
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TypesEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TypesEnum.java
new file mode 100644
index 0000000000..1bff4d51e6
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TypesEnum.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes;
+
+public enum TypesEnum {
+
+ RESOURCE("checkbox-resource"),
+ VF("checkbox-vf"),
+ VFC("checkbox-vfc"),
+ CP("checkbox-cp"),
+ VL("checkbox-vl"),
+ SERVICE("checkbox-service"),
+ PRODUCT("checkbox-product");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private TypesEnum(String value) {
+ this.value = value;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserCredentials.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserCredentials.java
new file mode 100644
index 0000000000..870d2879bb
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserCredentials.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes;
+
+import org.openecomp.sdc.be.model.User;
+
+public class UserCredentials extends User {
+
+ // private String userName;
+ private String password;
+
+ public UserCredentials(String userId, String password, String firstname, String lastname) {
+ super();
+ setUserId(userId);
+ // this.userName = userName;
+ this.password = password;
+ setFirstName(firstname);
+ setLastName(lastname);
+ }
+
+ public UserCredentials() {
+ super();
+ }
+
+ // public String getUserName() {
+ // return userName;
+ // }
+ // public void setUserName(String userName) {
+ // this.userName = userName;
+ // }
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/WorkMode.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/WorkMode.java
new file mode 100644
index 0000000000..199fa6990a
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/WorkMode.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes;
+
+public enum WorkMode {
+ DEV, CD;
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/environmentLocal b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/environmentLocal
new file mode 100644
index 0000000000..ea93ddfe85
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/environmentLocal
@@ -0,0 +1,10 @@
+//URL designer
+urlDesigner=http://172.20.43.136:8080/sdc1/proxy-designer1#/dashboard
+//URL tester
+urlTester=http://172.20.43.136:8080/sdc1/proxy-tester1
+//URL Vagrant
+urlDesignerVagrant=http://localhost:8181/sdc1/proxy-designer1#/dashboard
+//UrlStaging
+UrlStaging=https://www.e-access.att.com/sdcpstage/sdc1/portal#/dashboard
+//UrlAdmin
+UrlAdmin=http://172.20.43.136:8080/sdc1/proxy-admin1#/adminDashboard \ No newline at end of file
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/adminworkspace/AdminUserManagment.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/adminworkspace/AdminUserManagment.java
new file mode 100644
index 0000000000..19a0d6414f
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/adminworkspace/AdminUserManagment.java
@@ -0,0 +1,141 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.adminworkspace;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import javax.validation.constraints.AssertTrue;
+
+import org.junit.rules.TestName;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.AdminWorkspaceUIUtilies;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.Ordering;
+
+public class AdminUserManagment extends SetupCDTest {
+ //
+ // public AdminUserManagment() {
+ // super(new TestName(), AdminUserManagment.class.getName());
+ // }
+
+ private WebDriver driver = GeneralUIUtils.getDriver();
+
+ // Create new USER_ID user
+ @Test
+ public void creatUserIdNewUserTest() throws Exception {
+ String userId = AdminWorkspaceUIUtilies.defineNewUserId("th0695");
+ String role = AdminWorkspaceUIUtilies.selectUserRole("designer");
+ AdminWorkspaceUIUtilies.deleteuser(userId);
+ GeneralUIUtils.getWebButton("creategreen").click();
+ AdminWorkspaceUIUtilies.typeToSearchBox(userId);
+ String createdUserUserId = GeneralUIUtils.getWebElementWaitForVisible("tdUSER_ID").getText();
+ userId.equals(createdUserUserId);
+ GeneralUIUtils.getWebElementWaitForVisible("tdLast Active").getText().equals("Waiting");
+ GeneralUIUtils.getWebElementWaitForVisible("tdRole").getText().equals(role);
+ AdminWorkspaceUIUtilies.deleteuser(userId);
+
+ }
+
+ // Create new MacId user
+ @Test
+ public void creatMacIdNewUserTest() throws Exception {
+
+ String macId = AdminWorkspaceUIUtilies.defineNewUserId("m12345");
+ String role = AdminWorkspaceUIUtilies.selectUserRole("designer");
+ AdminWorkspaceUIUtilies.deleteuser(macId);
+ GeneralUIUtils.getWebButton("creategreen").click();
+ AdminWorkspaceUIUtilies.typeToSearchBox(macId);
+ String createdUserUserId = GeneralUIUtils.getWebElementWaitForVisible("tdUSER_ID").getText();
+ macId.equals(createdUserUserId);
+ GeneralUIUtils.getWebElementWaitForVisible("tdLast Active").getText().equals("Waiting");
+ GeneralUIUtils.getWebElementWaitForVisible("tdRole").getText().equals(role);
+ AdminWorkspaceUIUtilies.deleteuser(macId);
+ }
+
+ // Create exist user and get error already exist .
+ @Test
+ public void createxistUserTest() throws Exception {
+ String userId = AdminWorkspaceUIUtilies.defineNewUserId("th0695");
+ String role = AdminWorkspaceUIUtilies.selectUserRole("designer");
+ AdminWorkspaceUIUtilies.deleteuser(userId);
+ GeneralUIUtils.getWebButton("creategreen").click();
+ AdminWorkspaceUIUtilies.defineNewUserId(userId);
+ AdminWorkspaceUIUtilies.selectUserRole("admin");
+ GeneralUIUtils.getWebButton("creategreen").click();
+ ResourceUIUtils.getErrorMessageText("w-sdc-modal-body-content")
+ .equals("User with '" + userId + "' ID already exists.");
+ GeneralUIUtils.clickOkButton();
+ AdminWorkspaceUIUtilies.deleteuser(userId);
+
+ }
+
+ // enter Special chars and the create button disabled.
+ @Test
+ public void insertSpacialcharsTest() throws Exception {
+ AdminWorkspaceUIUtilies.defineNewUserId("!@DER%");
+ AdminWorkspaceUIUtilies.selectUserRole("designer");
+ WebElement createbutton = GeneralUIUtils.getWebElementWaitForVisible("creategreen");
+ Assert.assertFalse(createbutton.isEnabled());
+ }
+
+ // enter invalid macid and create button shall be disabled.
+ @Test
+ public void insertInvalidUserMacidTest() throws Exception {
+ AdminWorkspaceUIUtilies.defineNewUserId("k12345");
+ AdminWorkspaceUIUtilies.selectUserRole("designer");
+ WebElement createbutton = GeneralUIUtils.getWebElementWaitForVisible("creategreen");
+ Assert.assertFalse(createbutton.isEnabled());
+ }
+
+ // enter invalid userId and create button shall be disabled.
+ @Test
+ public void insertInvalidUserUserIdTest() throws Exception {
+ AdminWorkspaceUIUtilies.defineNewUserId("ac1c23");
+ AdminWorkspaceUIUtilies.selectUserRole("designer");
+ WebElement createbutton = GeneralUIUtils.getWebElementWaitForVisible("creategreen");
+ Assert.assertFalse(createbutton.isEnabled());
+ }
+
+ // display users list and sort by column name.
+ @Test
+ public void displayuserslistandsorting() throws Exception {
+ GeneralUIUtils.getWebElementWaitForVisible("thFirst Name").click();
+ Collection<WebElement> usersFname = GeneralUIUtils.getWebElements("tdFirst Name");
+ for (WebElement webElement : usersFname) {
+ System.out.println(webElement.getText());
+ }
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.ADMIN;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/CatalogLeftFilterPanelCheckBoxTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/CatalogLeftFilterPanelCheckBoxTest.java
new file mode 100644
index 0000000000..39755a9db8
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/CatalogLeftFilterPanelCheckBoxTest.java
@@ -0,0 +1,272 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.resourceui;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.io.FileWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.BreadCrumbsButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CatalogFilterTitlesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CreateAndImportButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.TypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class CatalogLeftFilterPanelCheckBoxTest extends SetupCDTest {
+
+ public CatalogLeftFilterPanelCheckBoxTest() {
+ // TODO Auto-generated constructor stub
+ }
+
+ private ResourceReqDetails resourceDetails;
+ FileWriter filwriter = GeneralUIUtils.InitializeprintToTxt("CatalogLeftFilterPanelCheckBoxTest");
+
+ @BeforeMethod
+ public void beforTest() {
+ resourceDetails = ElementFactory.getDefaultResource();
+ }
+
+ // filter by Type Resource in catalog
+ @Test
+ public void filterByAssetTypeResource() throws Exception {
+ List<WebElement> elements = null;
+ List<String> validValues = Arrays.asList("VF", "VL", "CP", "VFC");
+ GeneralUIUtils.checkIn();
+ GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG);
+ GeneralUIUtils.catalogFilterTypeChecBox(TypesEnum.RESOURCE);
+ GeneralUIUtils.getWorkspaceElements();
+ elements = GeneralUIUtils.waitForElementsListVisibilityTestMethod("asset-type");
+ for (WebElement webElement : elements) {
+ assertTrue(validValues.contains(webElement.getAttribute("class")));
+ }
+ }
+
+ @Test
+ public void filterByResourceTypeVF() throws Exception {
+ List<WebElement> elements = null;
+ List<String> validValues = Arrays.asList("VF");
+ GeneralUIUtils.checkIn();
+ GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG);
+ GeneralUIUtils.catalogFilterTypeChecBox(TypesEnum.VF);
+ GeneralUIUtils.getWorkspaceElements();
+ elements = GeneralUIUtils.waitForElementsListVisibilityTestMethod("asset-type");
+ for (WebElement webElement : elements) {
+ assertTrue(validValues.contains(webElement.getAttribute("class")));
+ }
+ }
+
+ @Test
+ public void filterByResourceTypeVFC() throws Exception {
+ List<WebElement> elements = null;
+ List<String> validValues = Arrays.asList("VFC");
+ GeneralUIUtils.checkIn();
+ GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG);
+ GeneralUIUtils.catalogFilterTypeChecBox(TypesEnum.VFC);
+ GeneralUIUtils.getWorkspaceElements();
+ elements = GeneralUIUtils.waitForElementsListVisibilityTestMethod("asset-type");
+ for (WebElement webElement : elements) {
+ assertTrue(validValues.contains(webElement.getAttribute("class")));
+ }
+ }
+
+ @Test
+ public void filterByResourceTypeCP() throws Exception {
+ List<WebElement> elements = null;
+ List<String> validValues = Arrays.asList("CP");
+ GeneralUIUtils.checkIn();
+ GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG);
+ GeneralUIUtils.catalogFilterTypeChecBox(TypesEnum.CP);
+ GeneralUIUtils.getWorkspaceElements();
+ elements = GeneralUIUtils.waitForElementsListVisibilityTestMethod("asset-type");
+ for (WebElement webElement : elements) {
+ assertTrue(validValues.contains(webElement.getAttribute("class")));
+ }
+ }
+
+ @Test
+ public void filterByResourceTypeVL() throws Exception {
+ List<WebElement> elements = null;
+ List<String> validValues = Arrays.asList("VL");
+ GeneralUIUtils.checkIn();
+ GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG);
+ GeneralUIUtils.catalogFilterTypeChecBox(TypesEnum.VL);
+ GeneralUIUtils.getWorkspaceElements();
+ elements = GeneralUIUtils.waitForElementsListVisibilityTestMethod("asset-type");
+ for (WebElement webElement : elements) {
+ assertTrue(validValues.contains(webElement.getAttribute("class")));
+ }
+ }
+
+ // @Test
+ // public void filterByProducTType() throws Exception{
+ // List<WebElement> elements = null;
+ // List<String> validValues = Arrays.asList("PRODUCT");
+ // GeneralUIUtils.checkIn();
+ // GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG);
+ // GeneralUIUtils.catalogFilterTypeChecBox(TypesEnum.PRODUCT);
+ // GeneralUIUtils.getWorkspaceElements();
+ // try {
+ // elements =
+ // GeneralUIUtils.getEelementsByClassName1("w-sdc-dashboard-card-avatar");
+ // for (WebElement webElement : elements) {
+ // assertTrue(validValues.contains(webElement.findElement(By.xpath(".//*")).getAttribute("class")));
+ // }
+ // } catch (Exception e) {
+ // System.out.println("No Elements founds!");
+ // }
+ // }
+
+ @Test
+ public void filterByResourceCategories() throws Exception {
+ List<WebElement> elements = null;
+ List<String> validValues = null;
+ GeneralUIUtils.checkIn();
+ GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG);
+ Thread.sleep(2000);
+ GeneralUIUtils.minimizeCatalogFilterByTitle(CatalogFilterTitlesEnum.TYPE);
+ List<String> categories = CatalogUIUtilitis.abcd();
+ for (String category : categories) {
+ validValues = CatalogUIUtilitis.getAllSubcategoriesByUniqueId(category);
+ boolean bool = false;
+ try {
+ GeneralUIUtils.getWebElementWaitForVisible(category).click();
+ bool = true;
+ } catch (Exception e) {
+ while (!bool) {
+ GeneralUIUtils.scrollDown();
+ try {
+ GeneralUIUtils.getWebElementWaitForVisible(category).click();
+ bool = true;
+ } catch (Exception e2) {
+
+ }
+ }
+ }
+ String checkBox = GeneralUIUtils.getWebElementWaitForVisible(category).findElement(By.xpath(".//input"))
+ .getAttribute("class");
+ if (checkBox.contains("ng-not-empty") && validValues != null) {
+ try {
+ GeneralUIUtils.getWorkspaceElements();
+ elements = GeneralUIUtils.getEelementsBycontainsClassName("sprite-resource-icons");
+ for (WebElement webElement : elements) {
+ String elementUniqueId = webElement.getAttribute("data-tests-id");
+ if (!validValues.contains(elementUniqueId)) {
+ System.out.println("assert error!");
+ }
+ }
+ GeneralUIUtils.getWebElementWaitForVisible(category).click();
+ } catch (Exception e) {
+ GeneralUIUtils.getWebElementWaitForVisible(category).click();
+ System.out.println("No Elements founds!");
+ }
+ }
+ }
+ }
+
+ @SuppressWarnings("null")
+ @Test
+ public void filterByStatus() throws Exception {
+
+ List<WebElement> elements = null;
+ List<String> validValues = null;
+ List<ResourceReqDetails> createdComponents = new ArrayList<ResourceReqDetails>();
+ List<String> catalogStatuses = Arrays.asList("IN_DESIGN", "READY_FOR_TESTING", "IN_TESTING", "CERTIFIED",
+ "DISTRIBUTED");
+ GeneralUIUtils.checkIn();
+ for (int i = 1; i < catalogStatuses.size() - 1; i++) {
+ GeneralUIUtils.sleep(3000);
+ GeneralUIUtils.createAndImportButtons(CreateAndImportButtonsEnum.CREATE_VF, GeneralUIUtils.getDriver());
+ resourceDetails.setName(getRandomComponentName("ResourceCDTest-"));
+ ResourceUIUtils.createResourceInUI(resourceDetails, getUser());
+ GeneralUIUtils.clickSubmitForTest();
+ if (catalogStatuses.get(i) == "IN_TESTING") {
+ GeneralUIUtils.testerUser(true, false, resourceDetails);
+ GeneralUIUtils.sleep(3000);
+ navigateToUrl(getUrl());
+
+ }
+ if (catalogStatuses.get(i) == "CERTIFIED") {
+ GeneralUIUtils.testerUser(true, true, resourceDetails);
+ GeneralUIUtils.sleep(3000);
+ navigateToUrl(getUrl());
+ }
+ if (catalogStatuses.get(i) == "DISTRIBUTED") {
+ GeneralUIUtils.testerUser(true, true, resourceDetails);
+ GeneralUIUtils.governorUser(false, true, resourceDetails);
+ GeneralUIUtils.opsUser(true, false, resourceDetails);
+ GeneralUIUtils.sleep(3000);
+ navigateToUrl(getUrl());
+
+ }
+ createdComponents.add(resourceDetails);
+ }
+ GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG);
+ // get filters title close.
+ Thread.sleep(2000);
+ GeneralUIUtils.minimizeCatalogFilterByTitle(CatalogFilterTitlesEnum.TYPE);
+ GeneralUIUtils.minimizeCatalogFilterByTitle(CatalogFilterTitlesEnum.CATEGORIES);
+ for (CheckBoxStatusEnum statusEnum : CheckBoxStatusEnum.values()) {
+ if (catalogStatuses.contains(statusEnum.name().toString())) {
+ validValues = GeneralUIUtils.catalogFilterStatusChecBox(statusEnum);
+ if (GeneralUIUtils.getWorkspaceElements().size() > 0) {
+ String checkBox = GeneralUIUtils.getWebElementByName(statusEnum.getCatalogValue())
+ .getAttribute("class");
+ if (checkBox.contains("ng-not-empty") && validValues != null) {
+ try {
+ elements = GeneralUIUtils.getEelementsBycontainsClassName("w-sdc-dashboard-card-edit");
+ for (WebElement webElement : elements) {
+ String className = webElement.getAttribute("class");
+ String textCategory = className.substring(className.indexOf(" "));
+ assertTrue(validValues.contains(textCategory.replace(" ", "")));
+ }
+ GeneralUIUtils.catalogFilterStatusChecBox(statusEnum);
+ } catch (Exception e) {
+ GeneralUIUtils.catalogFilterStatusChecBox(statusEnum);
+ System.out.println("No Elements founds!");
+ }
+ }
+ } else {
+ break;
+ }
+ }
+ }
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/CatalogSearchBoxTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/CatalogSearchBoxTest.java
new file mode 100644
index 0000000000..efdb9532a4
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/CatalogSearchBoxTest.java
@@ -0,0 +1,130 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.resourceui;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.io.FileWriter;
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.BreadCrumbsButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openqa.selenium.WebElement;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class CatalogSearchBoxTest extends SetupCDTest {
+
+ private ResourceReqDetails resourceDetails;
+
+ @BeforeMethod
+ public void beforTest() {
+ resourceDetails = ElementFactory.getDefaultResource();
+ }
+
+ // search by ResourceName
+ @Test
+ public void searchResourceInCatalogMenuTest() throws Exception {
+ GeneralUIUtils.checkIn();
+ GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG);
+ GeneralUIUtils.catalogSearchBox(resourceDetails.getName());
+ Thread.sleep(500);
+ assertTrue(GeneralUIUtils.getWorkspaceElements().size() == 1);
+ }
+
+ // search by Description
+ @Test
+ public void searchResourceInCatalogMenuByDescriptionTest() throws Exception {
+ GeneralUIUtils.checkIn();
+ GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG);
+ GeneralUIUtils.catalogSearchBox(resourceDetails.getDescription());
+ Thread.sleep(2000);
+ List<WebElement> assets = GeneralUIUtils.getWorkspaceElements();
+
+ int count = 0;
+ for (WebElement webElement : assets) {
+ if (count != 0) {
+ GeneralUIUtils.catalogSearchBox(resourceDetails.getDescription());
+ }
+ if (count == 0) {
+ webElement.click();
+ } else {
+ List<WebElement> assets1 = GeneralUIUtils.getWorkspaceElements();
+ assets1.get(count).click();
+ }
+ GeneralUIUtils.getWebElementWaitForVisible("description").getText()
+ .equals(resourceDetails.getDescription());
+ GeneralUIUtils.clickExitSign();
+ Thread.sleep(500);
+ count++;
+ }
+ }
+
+ // search by tags
+ @Test
+ public void searchResourceInCatalogMenuBytagsTest() throws Exception {
+ GeneralUIUtils.checkIn();
+ GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG);
+ GeneralUIUtils.catalogSearchBox(resourceDetails.getTags().get(0));
+ Thread.sleep(500);
+ GeneralUIUtils.getWorkspaceElements().get(0).click();
+ List<WebElement> expectedTagsList = GeneralUIUtils.getWebElements("i-sdc-tag-text");
+ for (int i = 0; i < expectedTagsList.size(); i++) {
+ expectedTagsList.get(i).equals(resourceDetails.getTags().get(i));
+ }
+
+ }
+
+ // search by Version
+ @Test
+ public void searchResourceInCatalogMenuByVersionTest() throws Exception {
+ GeneralUIUtils.checkIn();
+ GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG);
+ GeneralUIUtils.catalogSearchBox(resourceDetails.getVersion().replace("V", ""));
+ Thread.sleep(500);
+ GeneralUIUtils.getWorkspaceElements().get(0).click();
+ GeneralUIUtils.getSelectList(null, "versionHeader").getFirstSelectedOption().getText()
+ .equals(resourceDetails.getVersion());
+ }
+
+ // search by SpecialCharacters
+ @Test
+ public void searchResourceInCatalogMenuBySpecialCharactersTest() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.GENERAL);
+ GeneralUIUtils.defineDescription(resourceDetails.getDescription() + "!@#$%^&*");
+ GeneralUIUtils.checkIn();
+ GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG);
+ GeneralUIUtils.catalogSearchBox("!@#$%^&*");
+ Thread.sleep(500);
+ GeneralUIUtils.getWorkspaceElements().get(0).click();
+ GeneralUIUtils.getWebElementWaitForVisible("description").getText().equals(resourceDetails.getDescription());
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/ChangeLifeCycleStatFromCatalogTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/ChangeLifeCycleStatFromCatalogTest.java
new file mode 100644
index 0000000000..a75240d2b2
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/ChangeLifeCycleStatFromCatalogTest.java
@@ -0,0 +1,103 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.resourceui;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.BreadCrumbsButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openqa.selenium.WebElement;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class ChangeLifeCycleStatFromCatalogTest extends SetupCDTest {
+
+ public ChangeLifeCycleStatFromCatalogTest() {
+ // TODO Auto-generated constructor stub
+ }
+
+ // This test check the status filter .
+
+ private ResourceReqDetails resourceDetails;
+
+ @BeforeMethod
+ public void beforTest() {
+ resourceDetails = ElementFactory.getDefaultResource();
+ }
+
+ @Test
+ public void checkInFromCatalog() throws InterruptedException {
+ GeneralUIUtils.clickSaveIcon();
+ GeneralUIUtils.clickASDCLogo();
+ GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG);
+ GeneralUIUtils.catalogSearchBox(resourceDetails.getName());
+ List<WebElement> assets = GeneralUIUtils.getWorkspaceElements();
+ if (assets.isEmpty()) {
+ System.out.println("error elements not found.");
+ } else {
+ for (WebElement webElement : assets) {
+ webElement.click();
+ GeneralUIUtils.checkIn();
+ GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click();
+ Thread.sleep(2000);
+ System.out.println(ResourceUIUtils.lifeCycleStateUI());
+ System.out.println(LifeCycleStateEnum.CHECKIN.getValue());
+ assertTrue(ResourceUIUtils.lifeCycleStateUI().contentEquals(LifeCycleStateEnum.CHECKIN.getValue()));
+
+ }
+ }
+
+ }
+
+ @Test
+ public void checkOutFromCatalog() throws Exception {
+ GeneralUIUtils.clickSaveIcon();
+ GeneralUIUtils.clickASDCLogo();
+ GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG);
+ GeneralUIUtils.catalogSearchBox(resourceDetails.getName());
+ List<WebElement> assets = GeneralUIUtils.getWorkspaceElements();
+ if (assets.isEmpty()) {
+ System.out.println("error elements not found.");
+ } else {
+ for (WebElement webElement : assets) {
+ webElement.click();
+ GeneralUIUtils.checkinCheckout(resourceDetails.getName());
+ assertTrue(ResourceUIUtils.lifeCycleStateUI().contentEquals(LifeCycleStateEnum.CHECKOUT.getValue()));
+
+ }
+ }
+
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/ImportAssetInUITest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/ImportAssetInUITest.java
new file mode 100644
index 0000000000..8e9df40068
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/ImportAssetInUITest.java
@@ -0,0 +1,480 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.resourceui;
+
+import static org.testng.Assert.assertNotEquals;
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CreateAndImportButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ImportAssetUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.AssertJUnit;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class ImportAssetInUITest extends SetupCDTest {
+
+ private ResourceReqDetails resourceDetails;
+
+ @BeforeMethod(alwaysRun = true)
+ public void inializeBeforeImportTest() {
+ GeneralUIUtils.fileName = "JDM_vfc.yml";
+ resourceDetails = ElementFactory.getDefaultResource();
+ resourceDetails.setResourceType(ResourceTypeEnum.VFC.toString());
+ }
+
+ @Test
+ public void importAssetFillGeneralInfoAndSelectIconTest() throws Exception {
+ ResourceUIUtils.importFileWithSendKey(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName,
+ CreateAndImportButtonsEnum.IMPORT_CP);
+ ResourceUIUtils.fillGeneralInfoValuesAndIcon(resourceDetails, getUser());
+ GeneralUIUtils.checkIn();
+ GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click();
+ ResourceUIUtils.getVFCGeneralInfoAndValidate(resourceDetails, getUser());
+ }
+
+ @Test
+ public void changeImportedAssetFileTest() throws Exception {
+ ImportAssetUIUtils.importAsssetAndFillGeneralInfo(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName,
+ resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP);
+ String firstFileName = GeneralUIUtils.getWebElementWaitForVisible("filename").getText();
+ AssertJUnit.assertTrue(firstFileName.equals(GeneralUIUtils.fileName));
+ String secondFileName = "Valid_tosca_ReplaceTest.yml";
+ ResourceUIUtils.importFileWithSendKeyBrowse(GeneralUIUtils.FILE_PATH, secondFileName);
+ String secondFileNameFromField = GeneralUIUtils.getWebElementWaitForVisible("filename").getText();
+ // assertThat(fileName, not(secondFileNameFromField));
+ assertNotEquals(GeneralUIUtils.fileName, secondFileNameFromField);
+ }
+
+ @Test
+ public void duplicateFileTest() throws Exception {
+ ResourceUIUtils.importFileWithSendKey(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName,
+ CreateAndImportButtonsEnum.IMPORT_CP);
+ ResourceUIUtils.fillGeneralInfoValuesAndIcon(resourceDetails, getUser());
+ String nameofresource = resourceDetails.getName();
+ resourceDetails.setName(getRandomComponentName("SecondImportCDTest"));
+ GeneralUIUtils.checkIn();
+ ImportAssetUIUtils.importAsssetAndFillGeneralInfo(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName,
+ resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP);
+ GeneralUIUtils.clickSaveIcon();
+ equals(ResourceUIUtils.getErrorMessageText("w-sdc-modal-body-content") == GeneralUIUtils.allReadyExistErro);
+ GeneralUIUtils.clickOkButton();
+ resourceDetails.setName(nameofresource);
+
+ }
+
+ @Test
+ public void importInvalidFileTest() throws Exception {
+ GeneralUIUtils.fileName = "InValid_tosca_File .yml";
+ ImportAssetUIUtils.importAsssetAndFillGeneralInfo(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName,
+ resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP);
+ GeneralUIUtils.clickSaveIcon();
+ equals(ResourceUIUtils.getErrorMessageText("w-sdc-modal-body-content") == GeneralUIUtils.toscaErrorMessage);
+ GeneralUIUtils.clickOkButton();
+ }
+
+ @Test
+ public void deleteImportAssetFileTest() throws Exception {
+ ImportAssetUIUtils.importAsssetAndFillGeneralInfo(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName,
+ resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP);
+ WebElement deleteFileButton = GeneralUIUtils.getDriver()
+ .findElement(By.className("i-sdc-form-file-upload-x-btn"));
+ deleteFileButton.click();
+ WebElement filefield = GeneralUIUtils.getWebElementWaitForVisible("filename");
+ AssertJUnit.assertEquals("", filefield.getText());
+ }
+
+ // Add artifact by Clicking the Place holders button.
+ @Test
+ public void importAssetAddInformationArtifactPlaceHoldersTest() throws Exception {
+ // fileName = "CP_WAN.yml";
+ String artifactByname = "placeHolder";
+ ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName,
+ resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP);
+ GeneralUIUtils.moveToStep(StepsEnum.INFORMATION_ARTIFACT);
+ GeneralUIUtils.getWebElementWaitForVisible("Features");
+ List<WebElement> Placholders = GeneralUIUtils.getDriver().findElements(By.className("add-button"));
+ for (WebElement element : Placholders) {
+ Thread.sleep(500);
+ element.click();
+ // Placholders.get(4).click();
+ System.out.println(element.getText());
+ if (element.getText().equalsIgnoreCase("Add Other Artifact")) {
+ ArtifactUIUtils.valideArtifact(ArtifactUIUtils.addInformationalArtifact("Create New Artifact"), false);
+ } else {
+ ArtifactUIUtils.valideArtifact(ArtifactUIUtils.addInformationalArtifact(null), false);
+ }
+ }
+ }
+
+ // Add information artifact by Clicking the Add button.
+ @Test
+ public void importAssetAddInformationArtifactAddButtonTest() throws Exception {
+ String type = "Create New Artifact";
+ // fileName = "CP_WAN.yml";
+ ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName,
+ resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP);
+ GeneralUIUtils.moveToStep(StepsEnum.INFORMATION_ARTIFACT);
+ GeneralUIUtils.actionBuild(GeneralUIUtils.getWebButton("add-information-artifact-button")).click();
+ ;
+ ;
+ Map<String, String> expected = ArtifactUIUtils.addInformationalArtifact(type);
+ Thread.sleep(1000);
+ ResourceUIUtils.scrollDownPage();
+ ArtifactUIUtils.valideArtifact(expected, false);
+ }
+
+ // Add New property String Type.
+ @Test
+ public void importAssetAddStringPropertyTest() throws Exception {
+ WebElement prop = null;
+ // fileName = "CP_WAN.yml";
+ ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName,
+ resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP);
+ Thread.sleep(500);
+ GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES);
+ GeneralUIUtils.getEelementBycontainsClassName("data-row");
+ GeneralUIUtils.getWebButton("addGrey").click();
+ Map<String, String> propertyValues = PropertiesUIUtils.addProperties("String-Property", "string",
+ "!This is strig123456@#$%$", "This is description.", null);
+ WebElement elementTohover = GeneralUIUtils.getEelementBycontainsClassName("table-arrow");
+ GeneralUIUtils.actionBuild(elementTohover).click();
+ int counter = 0;
+ try {
+ prop = GeneralUIUtils.getWebElementWaitForVisible(propertyValues.get("name"));
+ } catch (Exception e) {
+ ResourceUIUtils.scrollDownPage();
+ prop = GeneralUIUtils.getDriver()
+ .findElement(By.xpath("//*[@data-tests-id='" + propertyValues.get("name") + "']"));
+ } finally {
+ if (prop.isDisplayed()) {
+ counter++;
+ }
+ }
+ PropertiesUIUtils.vlidateProperties(propertyValues);
+ }
+
+ // Add New property Integer Type.
+ @Test
+ public void importAssetAddIntegerPropertyTest() throws Exception {
+ WebElement prop;
+ // fileName = "CP_WAN.yml";
+ ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName,
+ resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP);
+ Thread.sleep(500);
+ GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES);
+ GeneralUIUtils.getEelementBycontainsClassName("data-row");
+ GeneralUIUtils.getWebButton("addGrey").click();
+ Map<String, String> propertyValues = PropertiesUIUtils.addProperties("Integer-Property", "integer", "123456",
+ "This is description.", null);
+ WebElement elementTohover = GeneralUIUtils.getEelementBycontainsClassName("table-arrow");
+ GeneralUIUtils.actionBuild(elementTohover);
+ int counter = 0;
+ prop = GeneralUIUtils.getWebElementWaitForVisible(propertyValues.get("name"));
+ if (prop.isDisplayed()) {
+ counter++;
+ }
+ if (counter == 0) {
+ ResourceUIUtils.scrollDownPage();
+ prop = GeneralUIUtils.getDriver()
+ .findElement(By.xpath("//*[@data-tests-id='" + propertyValues.get("name") + "']"));
+ counter++;
+ }
+ PropertiesUIUtils.vlidateProperties(propertyValues);
+ }
+
+ // Add New property boolean Type.
+ @Test
+ public void importAssetAddBooleanPropertyTest() throws Exception {
+ // fileName = "CP_WAN.yml";
+ WebElement prop;
+ ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName,
+ resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP);
+ GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES);
+ GeneralUIUtils.getEelementBycontainsClassName("data-row");
+ GeneralUIUtils.getWebButton("addGrey").click();
+ Map<String, String> propertyValues = PropertiesUIUtils.addProperties("Boolean-Property", "boolean", "true",
+ "This is boolean description.", null);
+ int counter = 0;
+ WebElement elementTohover = GeneralUIUtils.getDriver().findElement(By.className("table-arrow"));
+ GeneralUIUtils.actionBuild(elementTohover);
+ prop = GeneralUIUtils.getDriver()
+ .findElement(By.xpath("//*[@data-tests-id='" + propertyValues.get("name") + "']"));
+ if (prop.isDisplayed()) {
+ counter++;
+ }
+ if (counter == 0) {
+ ResourceUIUtils.scrollDownPage();
+ prop = GeneralUIUtils.getDriver()
+ .findElement(By.xpath("//*[@data-tests-id='" + propertyValues.get("name") + "']"));
+ counter++;
+ }
+ AssertJUnit.assertEquals(1, counter);
+ }
+
+ // Add New property float Type.
+ @Test
+ public void importAssetAddFloatPropertyTest() throws Exception {
+ WebElement prop;
+ // fileName = "CP_WAN.yml";
+ ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName,
+ resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP);
+ GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES);
+ GeneralUIUtils.getEelementBycontainsClassName("data-row");
+ GeneralUIUtils.getWebButton("addGrey").click();
+ Map<String, String> propertyValues = PropertiesUIUtils.addProperties("floatProperty", "float", "22.5",
+ "This is description.", null);
+ int counter = 0;
+ WebElement elementTohover = GeneralUIUtils.getDriver().findElement(By.className("table-arrow"));
+ GeneralUIUtils.actionBuild(elementTohover);
+ prop = GeneralUIUtils.getDriver()
+ .findElement(By.xpath("//*[@data-tests-id='" + propertyValues.get("name") + "']"));
+ if (prop.isDisplayed()) {
+ counter++;
+ }
+ if (counter == 0) {
+ ResourceUIUtils.scrollDownPage();
+ prop = GeneralUIUtils.getDriver()
+ .findElement(By.xpath("//*[@data-tests-id='" + propertyValues.get("name") + "']"));
+ counter++;
+ }
+ PropertiesUIUtils.vlidateProperties(propertyValues);
+ }
+
+ // Edit property.
+ @Test
+ public void importAssetEditPropertiesTest() throws Exception {
+ // fileName = "CP_WAN.yml";
+ Map<String, String> expected = null;
+ ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName,
+ resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP);
+ GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES);
+ GeneralUIUtils.getEelementBycontainsClassName("table-col-general");
+ GeneralUIUtils.getWebButton("addGrey").click();
+ expected = PropertiesUIUtils.addProperties("BooleanProperty", "boolean", "true", "This is boolean description.",
+ null);
+ GeneralUIUtils.getWebElement(GeneralUIUtils.getDriver(), "table-edit-btn").click();
+ ;
+ List<WebElement> properties = GeneralUIUtils.getDriver().findElements(By.xpath("//*[@*='table-edit-btn']"));
+ ;
+ for (WebElement webElement : properties) {
+ webElement.click();
+ GeneralUIUtils.defineDescription("This is Property update");
+ GeneralUIUtils.getWebButton("Update").click();
+ break;
+ }
+ Thread.sleep(2000);
+ GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='BooleanProperty']")).click();
+ Thread.sleep(1000);
+ String actual = GeneralUIUtils.getDriver()
+ .findElement(By.xpath("//*[@class='item-opened ng-binding ng-scope']")).getText();
+ assertNotEquals(expected.get("name"), actual);
+ // assertThat(expected.get("name"),not(actual));
+ }
+
+ // **************************************************************************************************
+ // change VFC version
+
+ // this test return error 500;
+ @Test(alwaysRun = false)
+ public void importAssetChangeVersionOfVFCTest() throws Exception {
+ // fileName = "VFC.yml";
+ // resourceDetails.setResourceType(ResourceTypeEnum.VFC.toString());
+ ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName,
+ resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP);
+ GeneralUIUtils.clickSaveIcon();
+ GeneralUIUtils.checkinCheckout(resourceDetails.getName());
+ resourceDetails.setVersion("0.2");
+ String version = GeneralUIUtils.getWebElementWaitForVisible("versionHeader").getText();
+ version.equals("0.2");
+ }
+
+ // change VL version
+ // this test return error 500;
+ @Test
+ public void importAssetChangeVersionOfVLTest() throws Exception {
+ GeneralUIUtils.fileName = "VL.yml";
+ resourceDetails.setResourceType(ResourceTypeEnum.VL.getValue());
+ ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName,
+ resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP);
+ GeneralUIUtils.checkinCheckout(resourceDetails.getName());
+ resourceDetails.setVersion("0.2");
+ String version = GeneralUIUtils.getWebElementWaitForVisible("versionHeader").getText();
+ version.equals("0.2");
+ }
+ // change CP version
+
+ @Test
+ public void importAssetChangeVersionOfCPTest() throws Exception {
+ GeneralUIUtils.fileName = "CP_LAN.yml";
+ resourceDetails.setResourceType(ResourceTypeEnum.CP.toString());
+ ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName,
+ resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP);
+ GeneralUIUtils.checkinCheckout(resourceDetails.getName());
+ resourceDetails.setVersion("0.2");
+ String version = GeneralUIUtils.getWebElementWaitForVisible("versionHeader").getText();
+ version.equals("0.2");
+ }
+
+ // @Test
+ // public void viewPageActivityLogTest() throws Exception {
+ // resourceDetails.setResourceType(ResourceTypeEnum.VF.toString());
+ // ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH,
+ // GeneralUIUtils.fileName , resourceDetails, getUser(),
+ // CreateAndImportButtonsEnum.IMPORT_CP);
+ // ResourceUIUtils.waitToFinishButtonEnabled().click();
+ // RestCDUtils.getResource(resourceDetails, getUser());
+ // GeneralUIUtils.checkIn();
+ // GeneralUIUtils.openObjectMenuAndSelectOption(resourceDetails.getUniqueId(),
+ // MenuOptionsEnum.VIEW);
+ // ResourceUIUtils.lifeCycleState();
+ // Thread.sleep(1000);
+ // ViewPageUIUtils.validateActivityLog("Action: Checkin Performed by: Carlos
+ // Santana(cs0008) Status: 200");
+ // }
+
+ // @Test
+ // public void downloadArtifactViewPaage() throws Exception {
+ // importAssetAddInformationArtifactAddButton();
+ // ResourceUIUtils.waitToFinishButtonEnabled().click();
+ // ViewPageUIUtils.openDropDownListOfObject(resourceDetails.getName(),
+ // ImportAssetUIUtils.getAllObjectsOnWorkspace(GeneralUIUtils.getDriver()),
+ // "View",
+ // ImportAssetUIUtils.scrollElement(GeneralUIUtils.getDriver()));
+ // ValidateViewPageParameters.ViewPagedownloadArtifact();
+ // String myheatfile="Heat-File.yaml";
+ // //Assert.assertTrue((GeneralUIUtils.FILE_PATH, "mailmerge.xls"), "Failed
+ // to download
+ // Expected document");
+ // String dowloadedfile=
+ // "C:\\Git_work\\ASDC\\d2-sdnc\\ui-ci\\src\\main\\resources\\Downloads\\"+fileName+"";
+ // int index=dowloadedfile.lastIndexOf("\\");
+ // System.out.println(dowloadedfile.substring(index+1));
+ // File getLatestFile = getLatestFilefromDir();
+ // String fileName = getLatestFile.getName();
+ // Assert.assertTrue(fileName.equals("mailmerge.xls"), "Downloaded file name
+ // is not matching with expected file name");
+ //
+ // }
+
+ @Test
+ public void importAssetcheckInVFCTest() throws Exception {
+ ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName,
+ resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP);
+ GeneralUIUtils.clickSaveIcon();
+ GeneralUIUtils.checkIn();
+ GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click();
+ assertTrue(ResourceUIUtils.lifeCycleStateUI().contentEquals(LifeCycleStateEnum.CHECKIN.getValue()));
+ }
+
+ @Test
+ public void importAssetcheckOutVFCTest() throws Exception {
+ ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName,
+ resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP);
+ GeneralUIUtils.clickSaveIcon();
+ GeneralUIUtils.checkinCheckout(resourceDetails.getName());
+ GeneralUIUtils.clickASDCLogo();
+ GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click();
+ assertTrue(ResourceUIUtils.lifeCycleStateUI().contentEquals(LifeCycleStateEnum.CHECKOUT.getValue()));
+ }
+
+ @Test
+ public void importAssetDeleteVFCVersionTest() throws Exception {
+ ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName,
+ resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP);
+ GeneralUIUtils.checkinCheckout(resourceDetails.getName());
+ GeneralUIUtils.deleteVersionInUI();
+ Thread.sleep(1000);
+ GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click();
+ String version = GeneralUIUtils.getWebElementWaitForVisible("versionHeader").getText();
+ AssertJUnit.assertEquals("0.1", version.replace("V", ""));
+ }
+
+ // @Test(enabled = false)
+ // public void importAssetVFCPrintScreenTest() throws Exception {
+ // ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH,
+ // GeneralUIUtils.fileName , resourceDetails, getUser());
+ // ResourceUIUtils.waitToFinishButtonEnabled().click();
+ // ResourceUIUtils.openDropDownListOfObject(resourceDetails.getName(),
+ // ResourceUIUtils.getAllObjectsOnWorkspace(driver,resourceDetails), "Edit",
+ // ResourceUIUtils.scrollElement(driver));
+ // ResourceUIUtils.waitfunctionforelements("sprite-resource-icons", 7);
+ // Thread.sleep(2000);
+ // WebElement element =
+ // GeneralUIUtils.getDriver().findElement(By.className("network"));
+ // WebElement target =
+ // GeneralUIUtils.getDriver().findElement(By.className("dropzone"));
+ // (new Actions(GeneralUIUtils.getDriver())).dragAndDrop(element,
+ // target).perform();
+ // WebElement element1 =
+ // GeneralUIUtils.getDriver().findElement(By.className("network"));
+ // (new Actions(GeneralUIUtils.getDriver())).dragAndDrop(element1,
+ // target).perform();
+ // ResourceUIUtils.clickPrintScreen();
+ //
+ // // the firefox not support print screen.
+ // }
+
+ @Test
+ public void importAssetVFCSubmitForTestingTest() throws Exception {
+ ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName,
+ resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP);
+ String name = "";
+ GeneralUIUtils.clickSubmitForTest();
+ Thread.sleep(2000);
+ String url = "http://localhost:8181/sdc1/proxy-tester1#/dashboard";
+ navigateToUrl(url);
+ GeneralUIUtils.getWebElementWaitForVisible("w-sdc-dashboard-card-info");
+ int counter = 0;
+ for (WebElement object : ResourceUIUtils.getAllObjectsOnWorkspace(GeneralUIUtils.getDriver(),
+ resourceDetails)) {
+ if (object.getText().equals(resourceDetails.getName())) {
+ name = object.getText();
+ counter++;
+ }
+ }
+ AssertJUnit.assertEquals(1, counter);
+
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VFCanvasTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VFCanvasTest.java
new file mode 100644
index 0000000000..51454173de
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VFCanvasTest.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.resourceui;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Action;
+import org.openqa.selenium.interactions.Actions;
+import org.testng.annotations.Test;
+
+public class VFCanvasTest extends SetupCDTest {
+
+ public List<Integer> getposition(WebElement canvas, int width, int height) {
+
+ width = canvas.getSize().getWidth();
+ height = canvas.getSize().getHeight();
+ Random r = new Random();
+ int Resultx = r.nextInt(width);
+ int Resulty = r.nextInt(height);
+ List<Integer> position = new ArrayList<Integer>();
+ position.add(Resultx);
+ position.add(Resulty);
+ return position;
+ }
+
+ @Test
+ public void VFCanvasTest1() throws Exception {
+ // GeneralUIUtils.waitForContainsdataTestIdVisibility("left-sectioin-element-QA");
+
+ GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION);
+ Thread.sleep(2000);
+ List<Integer> position = null;
+ WebElement canvas = GeneralUIUtils.getWebElementWaitForVisible("canvas");
+ int xPos = 0;
+ int yPos = 0;
+ position = getposition(canvas, xPos, yPos);
+ WebElement otherElement = GeneralUIUtils
+ .getWebElementWaitForVisible("left-sectioin-element-QA left-section-NeutronPort");
+ for (int i = 0; i < 8; i++) {
+ Actions builder = new Actions(GeneralUIUtils.getDriver());
+ Action dragAndDrop = builder.clickAndHold(otherElement)
+ .moveToElement(canvas, position.get(0), position.get(1)).release().build();
+ dragAndDrop.perform();
+ Thread.sleep(2000);
+ }
+ Thread.sleep(2000);
+ Actions builder = new Actions(GeneralUIUtils.getDriver());
+ builder.moveToElement(canvas, position.get(0), position.get(1));
+ builder.clickAndHold();
+ position = getposition(canvas, xPos, yPos);
+ builder.moveToElement(canvas, position.get(0), position.get(1));
+ builder.release();
+ builder.build();
+ builder.perform();
+ builder.moveToElement(canvas, 200, 300);
+ builder.release();
+ builder.perform();
+
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VFUITest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VFUITest.java
new file mode 100644
index 0000000000..eec04bc297
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VFUITest.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.resourceui;
+
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+
+public class VFUITest extends SetupCDTest {
+
+ public VFUITest() {
+ super();
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VfTests.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VfTests.java
new file mode 100644
index 0000000000..5550287aba
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VfTests.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.resourceui;
+
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+
+public class VfTests extends SetupCDTest {
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/WorkspaceCheckBoxFilterTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/WorkspaceCheckBoxFilterTest.java
new file mode 100644
index 0000000000..792d687a72
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/WorkspaceCheckBoxFilterTest.java
@@ -0,0 +1,120 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.resourceui;
+
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.testng.AssertJUnit;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class WorkspaceCheckBoxFilterTest extends SetupCDTest {
+
+ // This test check the status filter .
+
+ private ResourceReqDetails resourceDetails;
+
+ @BeforeMethod
+ public void beforTest() {
+ resourceDetails = ElementFactory.getDefaultResource();
+ }
+
+ @Test
+ public void selectCheckOutMenuTest() throws Exception {
+ GeneralUIUtils.clickSaveIcon();
+ GeneralUIUtils.clickASDCLogo();
+ String Status = GeneralUIUtils
+ .checkBoxLifeCyclestate(org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum.CHECKOUT);
+ Thread.sleep(500);
+ GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click();
+ AssertJUnit.assertEquals(Status, GeneralUIUtils.getWebElementWaitForVisible("lifecyclestate").getText());
+ }
+
+ @Test
+ public void selectCheckInMenuTest() throws Exception {
+ GeneralUIUtils.clickSaveIcon();
+ GeneralUIUtils.checkIn();
+ String Status = GeneralUIUtils
+ .checkBoxLifeCyclestate(org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum.CHECKIN);
+ Thread.sleep(500);
+ GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click();
+ AssertJUnit.assertEquals(Status, GeneralUIUtils.getWebElementWaitForVisible("lifecyclestate").getText());
+ }
+
+ @Test
+ public void selectReadyForTestingMenuTest() throws Exception {
+ GeneralUIUtils.clickSaveIcon();
+ GeneralUIUtils.clickSubmitForTest();
+ String Status = GeneralUIUtils
+ .checkBoxLifeCyclestate(org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum.READY_FOR_TESTING);
+ Thread.sleep(500);
+ GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click();
+
+ AssertJUnit.assertEquals(Status, GeneralUIUtils.getWebElementWaitForVisible("lifecyclestate").getText());
+ }
+
+ @Test
+ public void selectInTestIngMenuTest() throws Exception {
+ GeneralUIUtils.clickSaveIcon();
+ GeneralUIUtils.clickSubmitForTest();
+ GeneralUIUtils.waitForClassNameVisibility("w-sdc-dashboard-card-footer");
+ GeneralUIUtils.getDriver().navigate().to(SetupCDTest.getUrl().replace("designer", "tester"));
+ GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click();
+ GeneralUIUtils.clickStartTesting();
+ GeneralUIUtils.clickASDCLogo();
+ GeneralUIUtils.waitForClassNameVisibility("w-sdc-dashboard-card-footer");
+ GeneralUIUtils.getDriver().navigate().to(SetupCDTest.getUrl().replace("tester", "designer"));
+ String Status = GeneralUIUtils
+ .checkBoxLifeCyclestate(org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum.IN_TESTING);
+ Thread.sleep(500);
+ GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click();
+
+ AssertJUnit.assertEquals(Status, GeneralUIUtils.getWebElementWaitForVisible("lifecyclestate").getText());
+ }
+
+ @Test
+ public void selectCertifiedMenuTest() throws Exception {
+ GeneralUIUtils.clickSaveIcon();
+ GeneralUIUtils.clickSubmitForTest();
+ GeneralUIUtils.waitForClassNameVisibility("w-sdc-dashboard-card-footer");
+ GeneralUIUtils.getDriver().navigate().to(SetupCDTest.getUrl().replace("designer", "tester"));
+ GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click();
+ GeneralUIUtils.clickStartTesting();
+ GeneralUIUtils.clickAccept();
+ GeneralUIUtils.waitForClassNameVisibility("w-sdc-dashboard-card-footer");
+ GeneralUIUtils.getDriver().navigate().to(SetupCDTest.getUrl().replace("tester", "designer"));
+ String Status = GeneralUIUtils
+ .checkBoxLifeCyclestate(org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum.CERTIFIED);
+ Thread.sleep(500);
+ GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click();
+
+ AssertJUnit.assertEquals(Status, GeneralUIUtils.getWebElementWaitForVisible("lifecyclestate").getText());
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Import.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Import.java
new file mode 100644
index 0000000000..c5017a4f34
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Import.java
@@ -0,0 +1,177 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.util.List;
+import java.util.function.Supplier;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.BreadCrumbsButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifacts;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openqa.selenium.ElementNotVisibleException;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.Select;
+import org.testng.annotations.Test;
+
+public class Import extends SetupCDTest {
+
+ @Test
+ public void importResource() throws Exception {
+
+ String filePath = FileHandling.getResourcesFilesPath();
+ String fileName = "CPWithAttributes.yml";
+
+ // import Resource
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VFC, getUser());
+ ResourceUIUtils.importVfc(resourceMetaData, filePath, fileName, getUser());
+
+ }
+
+ @Test
+ public void certifyVFC() throws Exception {
+ String filePath = FileHandling.getResourcesFilesPath();
+ String fileName = "CPWithAttributes.yml";
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(
+ ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+ ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName());
+ ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+ quitAndReLogin(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+ TesterOperationPage.certifyComponent(atomicResourceMetaData.getName());
+
+ quitAndReLogin(UserRoleEnum.DESIGNER);
+ // GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG);
+ String cpVersion = GeneralUIUtils.getComponentVersion(atomicResourceMetaData.getName());
+ assertTrue("V 1.0".equals(cpVersion));
+ }
+
+ @Test
+ public void uploadAllInformationalArtifactPlaceholdersInVFC() throws Exception {
+ String filePath = FileHandling.getResourcesFilesPath();
+ String fileName = "CPWithAttributes.yml";
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(
+ ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+
+ for (InformationalArtifacts infoArtifact : InformationalArtifacts.values()) {
+ ArtifactUIUtils.fillPlaceHolderInformationalArtifact(infoArtifact, filePath, "Heat-File 1.yaml",
+ infoArtifact.name());
+ }
+
+ assertTrue(InformationalArtifactPage.checkElementsCountInTable(InformationalArtifacts.values().length,
+ () -> InformationalArtifactPage.getElemenetsFromTable()));
+
+ InformationalArtifactPage.clickAddNewArtifact();
+ Select artifactLabelList = InformationalArtifactPage.artifactPopup().defineArtifactLabel("");
+ assertEquals(1, artifactLabelList.getAllSelectedOptions().size());
+
+ }
+
+ @Test(expectedExceptions = ElementNotVisibleException.class)
+ public void uploadInformationaArtifactMetdataTest() throws Exception {
+ String filePath = FileHandling.getResourcesFilesPath();
+ String fileName = "CPWithAttributes.yml";
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(
+ ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+ assertTrue(InformationalArtifactPage.checkElementsCountInTable(0,
+ () -> InformationalArtifactPage.getElemenetsFromTable()));
+
+ ArtifactInfo artifactInfo = new ArtifactInfo(filePath, "Heat-File 1.yaml", "new artifact", "artifact1",
+ "OTHER");
+ InformationalArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(artifactInfo);
+
+ assertTrue(InformationalArtifactPage.checkElementsCountInTable(1,
+ () -> InformationalArtifactPage.getElemenetsFromTable()));
+
+ String actulaArtifactDescription = InformationalArtifactPage
+ .getArtifactDescription(artifactInfo.getArtifactLabel());
+ assertTrue(artifactInfo.getDescription().equals(actulaArtifactDescription));
+
+ InformationalArtifactPage.clickEditArtifact(artifactInfo.getArtifactLabel());
+ InformationalArtifactPage.artifactPopup().defineArtifactLabel("artifact2");
+ }
+
+ // @Test()
+ // public void updateInformationalArtifact(){
+ // ArtifactInfo artifactInfo = new ArtifactInfo("", "", "new artifact",
+ // "artifact1", "");
+ // InformationalArtifactPage.clickEditArtifact("artifact1");
+ // String newDesc = "newDesc";
+ // InformationalArtifactPage.artifactPopup().insertDescription(newDesc);
+ // InformationalArtifactPage.artifactPopup().clickUpdateButton();
+ // String actulaArtifactDescription =
+ // InformationalArtifactPage.getArtifactDescription(artifactInfo.getArtifactLabel());
+ // assertTrue(newDesc.equals(actulaArtifactDescription));
+ // InformationalArtifactPage.clickEditArtifact(artifactInfo.getArtifactLabel());
+ // InformationalArtifactPage.artifactPopup().defineArtifactLabel("artifact2");
+ // InformationalArtifactPage.artifactPopup().selectArtifactType(artifactInfo.getArtifactType());
+ // }
+
+ @Test
+ public void verifyTwoToscaArtifacts() throws Exception {
+ String filePath = FileHandling.getResourcesFilesPath();
+ String fileName = "CPWithAttributes.yml";
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(
+ ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+
+ // List<WebElement> elemenetsFromTable =
+ // GeneralPageElements.getElemenetsFromTable();
+ // Supplier<List<WebElement>> supplier = () -> elemenetsFromTable;
+ // assertTrue(ToscaArtifactsPage.checkElementsCountInTable(2,
+ // supplier));
+ assertTrue(ToscaArtifactsPage.checkElementsCountInTable(2));
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java
new file mode 100644
index 0000000000..713bc4df41
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java
@@ -0,0 +1,222 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.AssertJUnit.assertNotNull;
+
+import java.awt.AWTException;
+import java.io.File;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.GovernorOperationPage;
+import org.openecomp.sdc.ci.tests.pages.OpsOperationPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.testng.Assert;
+import org.testng.AssertJUnit;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.relevantcodes.extentreports.LogStatus;
+
+public class Onboard extends SetupCDTest {
+
+
+ public static Object[][] provideData(Object[] fileNamesFromFolder, String filepath) {
+ Object[][] arObject = new Object[fileNamesFromFolder.length][];
+
+ int index = 0;
+ for (Object obj : fileNamesFromFolder) {
+ arObject[index++] = new Object[] { filepath, obj };
+ }
+ return arObject;
+ }
+
+ @DataProvider(name = "VNF_List")
+ private static final Object[][] VnfList() throws Exception {
+ String filepath = getFilePath();
+ Object[] fileNamesFromFolder = OnboardingUtils.getZipFileNamesFromFolder(filepath);
+ System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.length));
+ return provideData(fileNamesFromFolder, filepath);
+ }
+
+ @Test(dataProvider = "VNF_List")
+ public void onboardVNFTest(String filepath, String vnfFile) throws Exception, Throwable {
+ SetupCDTest.setScreenshotFile(vnfFile);
+ extendTest.setDescription(vnfFile);
+
+ String vspName = onboardVNF(filepath, vnfFile);
+
+ ResourceGeneralPage.clickSubmitForTestingButton(vspName);
+
+ quitAndReLogin(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vspName);
+ TesterOperationPage.certifyComponent(vspName);
+
+ quitAndReLogin(UserRoleEnum.DESIGNER);
+ // create service
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CompositionPage.searchForElement(vspName);
+ CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
+ CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName);
+ assertNotNull(vfElement);
+ ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
+
+ ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+
+ quitAndReLogin(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ TesterOperationPage.certifyComponent(serviceMetadata.getName());
+
+ quitAndReLogin(UserRoleEnum.GOVERNOR);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ GovernorOperationPage.approveSerivce(serviceMetadata.getName());
+
+// quitAndReLogin(UserRoleEnum.OPS);
+// GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+// OpsOperationPage.distributeService();
+// OpsOperationPage.displayMonitor();
+//
+// List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
+// AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
+//
+// OpsOperationPage.waitUntilArtifactsDistributed(0);
+//
+// extendTest.log(LogStatus.PASS, String.format("onboarding %s test is passed ! ", vnfFile));
+ }
+
+ private String onboardVNF(String filepath, String vnfFile) throws Exception, Throwable {
+ extendTest.log(LogStatus.INFO, String.format("going to onboard the VNF %s......", vnfFile));
+ System.out.println(String.format("going to onboard the VNF %s......", vnfFile));
+
+ OnboardingUtils.createVendorLicense(getUser());
+ String vspName = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, getUser());
+ GeneralUIUtils.getWebButton("repository-icon").click();
+ extendTest.log(LogStatus.INFO, String.format("searching for onboarded %s", vnfFile));
+ GeneralUIUtils.getWebElementWaitForVisible("onboarding-search").sendKeys(vspName);
+ AssertJUnit.assertTrue(GeneralPageElements.checkElementsCountInTable(2));
+
+ List<WebElement> elemenetsFromTable = GeneralPageElements.getElemenetsFromTable();
+ GeneralUIUtils.waitForLoader();
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 30);
+ WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elemenetsFromTable.get(1)));
+ findElement.click();
+ GeneralUIUtils.waitForLoader();
+ extendTest.log(LogStatus.INFO,
+ String.format("going to import %s......", vnfFile.substring(0, vnfFile.indexOf("."))));
+ GeneralUIUtils.getWebElementWaitForVisible("import-csar").click();
+ GeneralUIUtils.getWebButton("create/save").click();
+ GeneralUIUtils.waitForLoaderOnboarding();
+ WebDriverWait wait2 = new WebDriverWait(GeneralUIUtils.getDriver(), 2 * 60);
+ wait2.until(ExpectedConditions.visibilityOfElementLocated(
+ By.xpath("//*[@data-tests-id='" + DataTestIdEnum.LifeCyleChangeButtons.CHECK_IN.getValue() + "']")));
+ extendTest.log(LogStatus.PASS,
+ String.format("succeeded to import %s......", vnfFile.substring(0, vnfFile.indexOf("."))));
+ return vspName;
+ }
+
+ public static String getFilePath() {
+ String filepath = System.getProperty("filepath");
+ if (filepath == null && System.getProperty("os.name").contains("Windows")) {
+ filepath = FileHandling.getResourcesFilesPath();
+ }
+
+ else if(filepath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+ filepath = FileHandling.getBasePath() + File.separator + "Files";
+ }
+ return filepath;
+ }
+
+ @Test
+ public void twoOnboardedVNFsInService() throws Exception, Throwable{
+
+ String filepath = getFilePath();
+
+ final String dnsScaling = "DNSscaling12.8.16.zip";
+ final String vLB = "vLB12.8.16.zip";
+
+ String[] onboardList = {dnsScaling, vLB};
+
+ Map<String, String> vspMap = new HashMap<String,String>();
+
+ for (String vnf : onboardList){
+ GeneralUIUtils.waitForElementsListInvisibility(By.className("ui-notification"));
+ String vspName = onboardVNF(filepath, vnf);
+ vspMap.put(vnf, vspName);
+ ResourceGeneralPage.clickSubmitForTestingButton(vspName);
+ }
+
+ quitAndReLogin(UserRoleEnum.TESTER);
+ for (String vspName : vspMap.values()){
+ GeneralUIUtils.waitForElementsListInvisibility(By.className("ui-notification"));
+ GeneralUIUtils.findComponentAndClick(vspName);
+ TesterOperationPage.certifyComponent(vspName);
+ }
+
+ quitAndReLogin(UserRoleEnum.DESIGNER);
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
+
+ Map<String, CanvasElement> canvasElements = new HashMap<String,CanvasElement>();
+ for (String vspName : vspMap.values()){
+ CompositionPage.searchForElement(vspName);
+ CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName);
+ assertNotNull(vfElement);
+ canvasElements.put(vspName, vfElement);
+ }
+ ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 2, getUser());
+
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java
new file mode 100644
index 0000000000..96a22ef2fe
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java
@@ -0,0 +1,377 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifacts;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+import org.openecomp.sdc.ci.tests.datatypes.PropertyInfo;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.GovernorOperationPage;
+import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.OpsOperationPage;
+import org.openecomp.sdc.ci.tests.pages.PropertiesPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
+import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.Select;
+import org.testng.AssertJUnit;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class Vf extends SetupCDTest {
+
+ private String filePath;
+
+ @BeforeMethod
+ public void beforeTest() {
+ filePath = System.getProperty("filepath");
+ if (filePath == null) {
+ filePath = FileHandling.getResourcesFilesPath();
+ }
+ }
+
+ @Test
+ public void createVF() throws Exception {
+
+ // create Resource
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(resourceMetaData, getUser());
+
+ }
+
+ @Test
+ public void updateVF() throws Exception {
+
+ // create Resource
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(resourceMetaData, getUser());
+
+ // update Resource
+ String expectedDesc = "kuku";
+ resourceMetaData.setDescription(expectedDesc);
+ ResourceGeneralPage.defineDescription(expectedDesc);
+ GeneralUIUtils.clickUpdateButton();
+
+ VfVerificator.verifyVFUpdatedInUI(resourceMetaData);
+ }
+
+ @Test
+ public void vfcLinkedToComputeInVfWithArtifactsFlow() throws Exception {
+ // String filePath = FileHandling.getResourcesFilesPath();
+ String fileName = "vFW_VFC.yml";
+
+ // import Resource
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(
+ ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+ ArtifactUIUtils.fillPlaceHolderInformationalArtifact(InformationalArtifacts.CAPACITY, filePath,
+ "asc_heat 0 2.yaml", "capacity");
+ ArtifactUIUtils.fillPlaceHolderInformationalArtifact(InformationalArtifacts.FEATURES, filePath,
+ "asc_heat 0 2.yaml", "features");
+ ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+
+ quitAndReLogin(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+ TesterOperationPage.certifyComponent(atomicResourceMetaData.getName());
+
+ quitAndReLogin(UserRoleEnum.DESIGNER);
+
+ // create Resource
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+ ArtifactInfo artifact1 = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER");
+ DeploymentArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact1);
+ ArtifactInfo artifact2 = new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "kuku", "artifact2",
+ "YANG_XML");
+ DeploymentArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact2);
+
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CanvasElement computeElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
+
+ CompositionPage.searchForElement(atomicResourceMetaData.getName());
+ CanvasElement cpElement = canvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+ AssertJUnit.assertNotNull(cpElement);
+ ServiceVerificator.verifyNumOfComponentInstances(vfMetaData, "0.1", 2, getUser());
+ canvasManager.linkElements(cpElement, computeElement);
+
+ vfMetaData.setVersion("0.1");
+ VfVerificator.verifyLinkCreated(vfMetaData, getUser(), 1);
+
+ }
+
+ @Test
+ public void addingDeploymentArtifactToVFInstanceInService() throws Exception {
+ // String filePath = FileHandling.getResourcesFilesPath();
+ // create Resource
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+ List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"));
+ deploymentArtifactList
+ .add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "YANG_XML"));
+ for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+ DeploymentArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
+ }
+
+ ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName());
+ GeneralUIUtils.clickASDCLogo();
+
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CompositionPage.searchForElement(vfMetaData.getName());
+ CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
+ CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vfMetaData.getName());
+
+ serviceCanvasManager.clickOnCanvaElement(vfElement);
+ GeneralUIUtils.waitFordataTestIdVisibility("deployment-artifact-tab").click();
+ GeneralUIUtils.waitFordataTestIdVisibility("add_Artifact_Button").click();
+ GeneralUIUtils.waitForLoader();
+ ArtifactInfo artifact3 = new ArtifactInfo(filePath, "Heat-File.yaml", "kuku", "artifact3",
+ "DCAE_INVENTORY_TOSCA");
+ deploymentArtifactList.add(artifact3);
+ GeneralUIUtils.getWebElementWaitForVisible("artifact-label").sendKeys(artifact3.getArtifactLabel());
+ DeploymentArtifactPage.artifactPopup().selectArtifactType(artifact3.getArtifactType());
+ DeploymentArtifactPage.artifactPopup().insertDescription(artifact3.getDescription());
+ DeploymentArtifactPage.artifactPopup().loadFile(artifact3.getFilepath(), artifact3.getFilename());
+ GeneralUIUtils.getWebElementWaitForVisible("Done").click();
+ GeneralUIUtils.waitForLoader();
+
+ List<WebElement> actualArtifactList = GeneralUIUtils
+ .waitForElementsListVisibility(By.className("i-sdc-designer-sidebar-section-content-item-artifact"));
+ AssertJUnit.assertEquals(deploymentArtifactList.size(), actualArtifactList.size());
+
+ }
+
+ @Test
+ public void distibuteVFCInVFInServiceTest() throws Exception {
+ // String filePath = FileHandling.getResourcesFilesPath();
+ String fileName = "vFW_VFC.yml";
+
+ // import Resource
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(
+ ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+ ArtifactUIUtils.fillPlaceHolderInformationalArtifact(InformationalArtifacts.CAPACITY, filePath,
+ "asc_heat 0 2.yaml", "capacity");
+ ArtifactUIUtils.fillPlaceHolderInformationalArtifact(InformationalArtifacts.FEATURES, filePath,
+ "asc_heat 0 2.yaml", "features");
+ ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+
+ quitAndReLogin(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+ TesterOperationPage.certifyComponent(atomicResourceMetaData.getName());
+
+ quitAndReLogin(UserRoleEnum.DESIGNER);
+
+ // create Resource
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+ List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"));
+ deploymentArtifactList
+ .add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "kuku", "artifact2", "YANG_XML"));
+ for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+ DeploymentArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
+ }
+
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+ CanvasElement computeElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
+ CompositionPage.searchForElement(atomicResourceMetaData.getName());
+ CanvasElement cpElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+
+ vfCanvasManager.linkElements(cpElement, computeElement);
+
+ ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName());
+
+ quitAndReLogin(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ TesterOperationPage.certifyComponent(vfMetaData.getName());
+
+ quitAndReLogin(UserRoleEnum.DESIGNER);
+
+ // create service
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CompositionPage.searchForElement(vfMetaData.getName());
+ CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
+ CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vfMetaData.getName());
+
+ ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+
+ quitAndReLogin(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ TesterOperationPage.certifyComponent(serviceMetadata.getName());
+
+ quitAndReLogin(UserRoleEnum.GOVERNOR);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ GovernorOperationPage.approveSerivce(serviceMetadata.getName());
+
+ quitAndReLogin(UserRoleEnum.OPS);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ OpsOperationPage.distributeService();
+ OpsOperationPage.displayMonitor();
+
+ List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
+ AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
+
+ String deploymentArtifactsSize = String.valueOf(deploymentArtifactList.size() + 1);
+
+ OpsOperationPage.waitUntilArtifactsDistributed(deploymentArtifactsSize, 0);
+
+ }
+
+ @Test
+ public void changesInVFCInstanceInVF() throws Exception {
+ // String filePath = FileHandling.getResourcesFilesPath();
+ String fileName = "vFW_VFC.yml";
+
+ // import Resource
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(
+ ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+ ArtifactUIUtils.fillPlaceHolderInformationalArtifact(InformationalArtifacts.CAPACITY, filePath,
+ "asc_heat 0 2.yaml", "capacity");
+
+ InformationalArtifactPage.getLeftMenu().moveToPropertiesScreen();
+ int propertiesCount = PropertiesPage.getElemenetsFromTable().size();
+
+ PropertyInfo prop1 = new PropertyInfo("p1", "v1", "prop1", PropertyTypeEnum.STRING);
+
+ PropertiesPage.clickAddPropertyArtifact();
+ PropertiesUIUtils.addNewProperty(prop1);
+ AssertJUnit.assertTrue(PropertiesPage.checkElementsCountInTable(propertiesCount + 1,
+ () -> PropertiesPage.getElemenetsFromTable()));
+
+ ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(atomicResourceMetaData.getName());
+ CanvasElement vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+
+ vfCanvasManager.clickOnCanvaElement(vfcElement);
+ CompositionPage.showPropertiesAndAttributesTab();
+ List<WebElement> properties = CompositionPage.getProperties();
+ for (int i = 0; i < 2; i++) {
+ // WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver()
+ // , 30);
+ // WebElement findElement =
+ // wait.until(ExpectedConditions.visibilityOf(properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-and-attribute-label"))));
+ WebElement findElement = properties.get(i).findElement(
+ By.className("i-sdc-designer-sidebar-section-content-item-property-and-attribute-label"));
+ findElement.click();
+ PropertiesPage.getPropertyPopup().insertPropertyDefaultValue("abc123");
+ PropertiesPage.getPropertyPopup().clickSave();
+ GeneralUIUtils.waitForInvisibileElement(DataTestIdEnum.PropertiesPageEnum.SAVE.getValue());
+ }
+ vfCanvasManager.moveToFreeLocation(vfMetaData.getName());
+ GeneralUIUtils.waitFordataTestIdVisibility("deployment-artifact-tab").click();
+ GeneralUIUtils.waitFordataTestIdVisibility("add_Artifact_Button").click();
+ GeneralUIUtils.waitForLoader();
+ ArtifactInfo artifact3 = new ArtifactInfo(filePath, "Heat-File.yaml", "kuku", "artifact3", "OTHER");
+ GeneralUIUtils.getWebElementWaitForVisible("artifact-label").sendKeys(artifact3.getArtifactLabel());
+ DeploymentArtifactPage.artifactPopup().selectArtifactType(artifact3.getArtifactType());
+ DeploymentArtifactPage.artifactPopup().insertDescription(artifact3.getDescription());
+ DeploymentArtifactPage.artifactPopup().loadFile(artifact3.getFilepath(), artifact3.getFilename());
+ GeneralUIUtils.getWebElementWaitForVisible("Done").click();
+ GeneralUIUtils.waitForLoader();
+
+ quitAndReLogin(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+ TesterOperationPage.certifyComponent(atomicResourceMetaData.getName());
+
+ quitAndReLogin(UserRoleEnum.DESIGNER);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ vfCanvasManager = CanvasManager.getCanvasManager();
+ vfCanvasManager.clickOnCanvaElement(vfcElement);
+ // change version
+ GeneralUIUtils.getWebElementByName("changeVersion");
+ Select selectlist = new Select(GeneralUIUtils.getWebElementByName("changeVersion"));
+ selectlist.selectByVisibleText("1.0");
+ GeneralUIUtils.waitForLoader();
+
+ // GeneralUIUtils.waitUntilClickableButton(DataTestIdEnum.LifeCyleChangeButtons.SUBMIT_FOR_TESTING.getValue()).click();
+ // ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName());
+ //
+ // vfMetaData.setVersion("0.1");
+ // VfVerificator.verifyVFLifecycle(vfMetaData, getUser(),
+ // LifecycleStateEnum.READY_FOR_CERTIFICATION);
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/OnboardCSVReport.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/OnboardCSVReport.java
new file mode 100644
index 0000000000..03c9b0281f
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/OnboardCSVReport.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.setup;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.PrintWriter;
+
+public class OnboardCSVReport {
+
+ private StringBuilder sb;
+ private PrintWriter pw;
+
+ public OnboardCSVReport(String filepath, String filename) {
+ sb = new StringBuilder();
+ try {
+ File csvFile = new File(filepath + filename);
+ pw = new PrintWriter(csvFile);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ public StringBuilder appendStringToFile(String content) {
+ return sb.append(content + ",");
+ }
+
+ public void openNewRow() {
+ sb.append("\n");
+ }
+
+ public void writeRow(String... content) {
+ for (String str : content) {
+ appendStringToFile(str);
+ }
+ openNewRow();
+ }
+
+ public void closeFile() {
+ pw.write(sb.toString());
+ pw.close();
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/RemoteWebDriverTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/RemoteWebDriverTest.java
new file mode 100644
index 0000000000..e5fcafb664
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/RemoteWebDriverTest.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.setup;
+
+import java.net.URL;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.openqa.selenium.Platform;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.remote.RemoteWebDriver;
+
+public class RemoteWebDriverTest {
+
+ // @Test
+ public void remoteTest() throws Exception {
+ DesiredCapabilities cap = new DesiredCapabilities().firefox();
+ cap.setPlatform(Platform.WINDOWS);
+ cap.setBrowserName("firefox");
+
+ RemoteWebDriver remoteDriver = new RemoteWebDriver(new URL("http://1.2.3.4:5555/wd/hub"), cap);
+ remoteDriver.navigate().to("http://www.google.co.il");
+ remoteDriver.findElementByName("q").sendKeys("execute automation");
+ remoteDriver.findElementByName("btnK").click();
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java
new file mode 100644
index 0000000000..a72168e4c2
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java
@@ -0,0 +1,538 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.setup;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.stream.Collectors;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.log4j.Logger;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.UserCredentials;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.run.StartTest;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.testng.Assert;
+import org.testng.AssertJUnit;
+import org.testng.ITestResult;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.BeforeSuite;
+
+import com.relevantcodes.extentreports.ExtentReports;
+import com.relevantcodes.extentreports.ExtentTest;
+import com.relevantcodes.extentreports.LogStatus;
+
+public abstract class SetupCDTest {
+
+ public SetupCDTest() {
+ // LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
+ // lc.getLogger("org.apache").setLevel(Level.INFO);
+ //// System.setProperty("org.apache.commons.logging.Log",
+ // "org.apache.commons.logging.impl.SimpleLog");
+ //// System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire",
+ // "OFF");
+ //// System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient",
+ // "OFF");
+
+ }
+
+ public static Logger logger = Logger.getLogger(SetupCDTest.class.getName());
+
+ /**************** CONSTANTS ****************/
+ private static final String CREDENTIALS_FILE = "credentials.yaml";
+ private static final String REPORT_FILE_NAME = "ASDC_UI_Extent_Report.html";
+ public static final String REPORT_FOLDER = "./ExtentReport/";
+ public static final String SELENIUM_NODE_URL = "http://%s:%s/wd/hub";
+ private static final String SCREENSHOT_FOLDER = REPORT_FOLDER + "screenshots/";
+ private static final String SHORT_CSV_REPORT_FILE_NAME = "ShortReport.csv";
+ private static final int NUM_OF_ATTEMPTS_TO_REFTRESH = 2;
+
+ /**************** USERS ****************/
+ protected static User designerUser;
+ protected static User adminUser;
+ protected static User testerUser;
+ protected static User governorUser;
+ protected static User opsUser;
+ protected static User productManagerUser;
+
+ public static Config config;
+
+ /**************** PRIVATES ****************/
+ private Map<?, ?> credentialsYamlFileMap;
+ private static String url;
+ private User user;
+ private static boolean localEnv = true;
+ private int refreshAttempts = 0;
+
+ protected abstract UserRoleEnum getRole();
+
+ protected ExtentReports extentReport;
+ protected static ExtentTest extendTest;
+ private static String screenshotFile;
+
+ public static String getScreenshotFile() {
+ return screenshotFile;
+ }
+
+ public static void setScreenshotFile(String screenshotFile) {
+ SetupCDTest.screenshotFile = screenshotFile;
+ }
+
+ public static ExtentTest getExtendTest() {
+ return extendTest;
+ }
+
+ private OnboardCSVReport csvReport;
+
+ public OnboardCSVReport getCsvReport() {
+ return csvReport;
+ }
+
+ /**************** BEFORE ****************/
+
+ @BeforeSuite(alwaysRun = true)
+ public void setEnvParameters() throws Exception {
+
+ File dir = new File(REPORT_FOLDER);
+ try {
+ FileUtils.deleteDirectory(dir);
+ } catch (IOException e) {
+ }
+ extentReport = new ExtentReports(REPORT_FOLDER + REPORT_FILE_NAME);
+ csvReport = new OnboardCSVReport(REPORT_FOLDER, SHORT_CSV_REPORT_FILE_NAME);
+
+ System.out.println("Setup....");
+ config = Utils.getConfig();
+ setUrl();
+ }
+
+ @BeforeMethod(alwaysRun = true)
+ public void setBrowserBeforeTest(java.lang.reflect.Method method) throws Exception {
+ extendTest = extentReport.startTest(method.getName());
+ extendTest.log(LogStatus.INFO, "Test started");
+ setBrowserBeforeTest(getRole());
+ }
+
+ /**************** AFTER ****************/
+ @AfterMethod(alwaysRun = true)
+ public void quitAfterTest(ITestResult result) throws Exception {
+
+ StringBuilder sb = new StringBuilder();
+ if (result.getParameters().length != 0) {
+ for (int i = 0; i < result.getParameters().length - 1; i++) {
+ sb.append(result.getParameters()[i].toString() + ",");
+ }
+ sb.append(result.getParameters()[result.getParameters().length - 1].toString());
+ }
+
+ File imageFilePath = GeneralUIUtils.takeScreenshot(screenshotFile, SCREENSHOT_FOLDER, result.getName());
+ final String absolutePath = new File(REPORT_FOLDER).toURI().relativize(imageFilePath.toURI()).getPath();
+ if (result.getStatus() == ITestResult.SUCCESS) {
+ extendTest.log(LogStatus.PASS, "Test Result : <span class='label success'>Success</span>");
+ extendTest.log(LogStatus.PASS,
+ "Finished the test with the following screenshot : " + extendTest.addScreenCapture(absolutePath));
+ csvReport.writeRow(result.getName(), sb.toString(), "PASS");
+ } else if (result.getStatus() == ITestResult.FAILURE || result.getStatus() == ITestResult.SKIP) {
+ extendTest.log(LogStatus.ERROR, "ERROR - The following exepction occured");
+ extendTest.log(LogStatus.ERROR, result.getThrowable());
+ extendTest.log(LogStatus.ERROR,
+ "Failure is described in the following screenshot : " + extendTest.addScreenCapture(absolutePath));
+ extendTest.log(LogStatus.FAIL, "<span class='label failure'>Failure</span>");
+ csvReport.writeRow(result.getName(), sb.toString(), "FAIL");
+ }
+
+ extentReport.endTest(extendTest);
+ extentReport.flush();
+
+ quitBrowser();
+// deleteCreatedComponents2(getCatalogAsMap());
+ }
+
+ @AfterClass(alwaysRun = true)
+ public void afterSuite() {
+ csvReport.closeFile();
+ }
+
+ /*************************************/
+
+ private Map<String, ArrayList<Component>> getCatalogAsMap() throws IOException {
+ RestResponse catalog = CatalogRestUtils.getCatalog(getUser().getUserId());
+ Map<String, ArrayList<Component>> convertCatalogResponseToJavaObject = ResponseParser
+ .convertCatalogResponseToJavaObject(catalog.getResponse());
+ return convertCatalogResponseToJavaObject;
+ }
+
+ private void deleteCreatedComponents2(Map<String, ArrayList<Component>> convertCatalogResponseToJavaObject)
+ throws IOException {
+ final String userId = getUser().getUserId();
+ ArrayList<Component> resourcesArrayList = convertCatalogResponseToJavaObject.get("resources");
+
+ List<String> collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci"))
+ .map(e -> e.getUniqueId()).collect(Collectors.toList());
+ for (String uId : collect) {
+ ResourceRestUtils.deleteResource(uId, userId);
+ }
+
+ resourcesArrayList = convertCatalogResponseToJavaObject.get("services");
+ collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci")).map(e -> e.getUniqueId())
+ .collect(Collectors.toList());
+ for (String uId : collect) {
+ ServiceRestUtils.deleteServiceById(uId, userId);
+ }
+
+ resourcesArrayList = convertCatalogResponseToJavaObject.get("products");
+ collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci")).map(e -> e.getUniqueId())
+ .collect(Collectors.toList());
+ for (String uId : collect) {
+ ProductRestUtils.deleteProduct(uId, userId);
+ }
+
+ }
+
+ /**************** MAIN ****************/
+ public static void main(String[] args) {
+ System.out.println("---------------------");
+ System.out.println("running test from CLI");
+ System.out.println("---------------------");
+
+ String attsdcFilePath = FileHandling.getBasePath() + File.separator + "conf" + File.separator + "sdc.yaml";
+ System.setProperty("config.resource", attsdcFilePath);
+ System.out.println("sdc.yaml file path is : " + attsdcFilePath);
+
+ Object[] testSuitsList = FileHandling
+ .getFileNamesFromFolder(FileHandling.getBasePath() + File.separator + "testSuites", ".xml");
+ if (testSuitsList != null) {
+ System.out.println(String.format("Found %s testSuite(s)", testSuitsList.length));
+ args = Arrays.copyOf(testSuitsList, testSuitsList.length, String[].class);
+ StartTest.main(args);
+ }
+ }
+
+ /***********************************************************************************/
+
+ protected static String setUrl() {
+ url = config.getUrl();
+ if (url == null) {
+ String message = "no URL found";
+ System.out.println(message);
+ Assert.fail(message);
+ } else if (!url.contains("localhost") && !url.contains("127.0.0.1")) {
+ localEnv = false;
+ }
+ return url;
+ }
+
+ private Map<String, String> loadCredentialsFile() throws Exception {
+ File credentialsFile = new File(
+ FileHandling.getBasePath() + File.separator + "conf" + File.separator + CREDENTIALS_FILE);
+ if (!credentialsFile.exists()) {
+ credentialsFile = new File(FileHandling.getConfFilesPath() + CREDENTIALS_FILE);
+ }
+ credentialsYamlFileMap = (Map<String, String>) FileHandling.parseYamlFile(credentialsFile.getAbsolutePath());
+ return (Map<String, String>) credentialsYamlFileMap;
+ }
+
+ protected UserCredentials getUserCredentialsFromFile(String userRole) throws Exception {
+ Map<String, String> credentialsMap = (Map<String, String>) credentialsYamlFileMap.get(userRole);
+ String user = (String) credentialsMap.get("username");
+ String password = (String) credentialsMap.get("password");
+ String firstname = (String) credentialsMap.get("firstname");
+ String lastname = (String) credentialsMap.get("lastname");
+
+ return new UserCredentials(user, password, firstname, lastname);
+ }
+
+ public UserCredentials updateUserUserId(String role) throws Exception {
+ System.out.println("updating...");
+ UserCredentials designerCredentialsFromFile = null;
+ UserCredentials testerCredentialsFromFile = null;
+ UserCredentials adminCredentialsFromFile = null;
+ UserCredentials opsCredentialsFromFile = null;
+ UserCredentials governorCredentialsFromFile = null;
+ UserCredentials productCredentialsFromFile = null;
+ UserCredentials productManagerCredentialsFromFile = null;
+
+ String lowerCaseRole = role.toLowerCase();
+ try {
+ if (lowerCaseRole.equals("designer")) {
+ designerCredentialsFromFile = getUserCredentialsFromFile("designer");
+ designerUser.setUserId(designerCredentialsFromFile.getUserId());
+ designerUser.setFirstName(designerCredentialsFromFile.getFirstName());
+ designerUser.setLastName(designerCredentialsFromFile.getLastName());
+ return designerCredentialsFromFile;
+ } else if (lowerCaseRole.equals("tester")) {
+ testerCredentialsFromFile = getUserCredentialsFromFile("tester");
+ testerUser.setUserId(testerCredentialsFromFile.getUserId());
+ testerUser.setFirstName(testerCredentialsFromFile.getFirstName());
+ testerUser.setLastName(testerCredentialsFromFile.getLastName());
+ return testerCredentialsFromFile;
+ } else if (lowerCaseRole.equals("admin")) {
+ adminCredentialsFromFile = getUserCredentialsFromFile("admin");
+ adminUser.setUserId(adminCredentialsFromFile.getUserId());
+ adminUser.setFirstName(adminCredentialsFromFile.getFirstName());
+ adminUser.setLastName(adminCredentialsFromFile.getLastName());
+ return adminCredentialsFromFile;
+ } else if (lowerCaseRole.equals("ops")) {
+ opsCredentialsFromFile = getUserCredentialsFromFile("ops");
+ opsUser.setUserId(opsCredentialsFromFile.getUserId());
+ opsUser.setFirstName(opsCredentialsFromFile.getFirstName());
+ opsUser.setLastName(opsCredentialsFromFile.getLastName());
+ return opsCredentialsFromFile;
+ } else if (lowerCaseRole == "governor") {
+ governorCredentialsFromFile = getUserCredentialsFromFile("governor");
+ governorUser.setUserId(governorCredentialsFromFile.getUserId());
+ governorUser.setFirstName(governorCredentialsFromFile.getFirstName());
+ governorUser.setLastName(governorCredentialsFromFile.getLastName());
+ return governorCredentialsFromFile;
+ } else if (lowerCaseRole == "product_local") {
+ productCredentialsFromFile = getUserCredentialsFromFile("product_local");
+ productManagerUser.setUserId(productCredentialsFromFile.getUserId());
+ productManagerUser.setFirstName(productCredentialsFromFile.getFirstName());
+ productManagerUser.setLastName(productCredentialsFromFile.getLastName());
+ return productCredentialsFromFile;
+ } else if (lowerCaseRole == "product_manager") {
+ productManagerCredentialsFromFile = getUserCredentialsFromFile("product_manager");
+ productManagerUser.setUserId(productManagerCredentialsFromFile.getUserId());
+ productManagerUser.setFirstName(productManagerCredentialsFromFile.getFirstName());
+ productManagerUser.setLastName(productManagerCredentialsFromFile.getLastName());
+ return productManagerCredentialsFromFile;
+ }
+ }
+
+ catch (Exception e) {
+ System.out.print("An exception occured...");
+ System.out.println("->exception message is : " + e.getMessage());
+ }
+
+ return null;
+ }
+
+ public static void navigateToUrl(String url) throws Exception {
+
+ try {
+ WebDriver driver = GeneralUIUtils.getDriver();
+ System.out.println("navigating to URL :" + url);
+ driver.manage().window().maximize();
+ driver.manage().deleteAllCookies();
+ driver.navigate().to(url);
+ GeneralUIUtils.windowZoomOut();
+ GeneralUIUtils.waitForLoader();
+ } catch (Exception e) {
+ System.out.println("browser is unreachable");
+ extendTest.log(LogStatus.ERROR, "browser is unreachable");
+ Assert.fail("browser is unreachable");
+ }
+ }
+
+ protected void loginToSystem(UserCredentials credentials, UserRoleEnum role) throws Exception {
+
+ sendUserAndPasswordKeys(credentials);
+ refreshAttempts = (refreshAttempts == 0) ? NUM_OF_ATTEMPTS_TO_REFTRESH : refreshAttempts;
+ if (!getRole().equals(UserRoleEnum.ADMIN)) {
+ try {
+ if(!localEnv){
+// GeneralUIUtils.ultimateWait();
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 3 * 60);
+ WebElement sdcApp = wait.until(ExpectedConditions.elementToBeClickable(By.id("app-image-SDC")));
+ sdcApp.click();
+ GeneralUIUtils.getDriver().switchTo().frame(1);
+ GeneralUIUtils.waitFordataTestIdVisibility("main-menu-input-search");
+ }
+ else{
+ enterToUserWorkspace();
+ }
+
+ } catch (Exception e) {
+ refreshAttempts--;
+ if (refreshAttempts <= 0) {
+ System.out.println("ERR : Something is wrong with browser!");
+ Assert.fail("ERR : Something is wrong with browser!");
+ }
+ System.out.println("trying again...");
+ System.out.println(String.format("%s attempt(s) left", refreshAttempts));
+ extendTest.log(LogStatus.INFO, "trying again...");
+ extendTest.log(LogStatus.INFO, String.format("%s attempt(s) left", refreshAttempts));
+
+ quitAndReLogin(role);
+ }
+ }
+ }
+
+ private void sendUserAndPasswordKeys(UserCredentials userId) {
+
+ if (localEnv){
+ System.out.println("Login with user : " + userId.getUserId());
+ WebElement userNameTextbox = GeneralUIUtils.waitForElementVisibility(By.name("userid"));
+ userNameTextbox.sendKeys(userId.getUserId());
+ WebElement passwordTextbox = GeneralUIUtils.waitForElementVisibility(By.name("password"));
+ passwordTextbox.sendKeys(userId.getPassword());
+
+ WebElement submitButton = GeneralUIUtils.waitForElementVisibility(By.name("btnSubmit"));
+ submitButton.click();
+ WebElement buttonOK = GeneralUIUtils.waitForElementVisibility(By.name("successOK"));
+ AssertJUnit.assertTrue(buttonOK.isDisplayed());
+ buttonOK.click();
+ }
+ else
+ {
+ System.out.println("Login with user : " + userId.getUserId());
+ WebElement userNameTextbox = GeneralUIUtils.getDriver().findElement(By.cssSelector("input[type='text']"));
+ userNameTextbox.sendKeys(userId.getUserId());
+ WebElement passwordTextbox = GeneralUIUtils.getDriver().findElement(By.cssSelector("input[type='password']"));
+ passwordTextbox.sendKeys(userId.getPassword());
+
+ GeneralUIUtils.getDriver().findElement(By.id("loginBtn")).click();
+ }
+
+
+ }
+
+ public static String getUrl() {
+ return url;
+ }
+
+ public static void setUrl(String url) {
+ SetupCDTest.url = url;
+ }
+
+ public static Config getConfig() {
+ return config;
+ }
+
+ public void loginToSystem(UserRoleEnum role){
+ WebDriver driver = GeneralUIUtils.getDriver();
+ WebDriverWait wait = new WebDriverWait(driver, 30);
+
+ wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath("//*[@method='" + "post" + "']"))));
+
+ WebElement userIdTextbox = GeneralUIUtils.waitForElementVisibility(By.name("userId"));
+ userIdTextbox.sendKeys(role.getUserId());
+ WebElement passwordTextbox = GeneralUIUtils.waitForElementVisibility(By.name("password"));
+ passwordTextbox.sendKeys("123123a");
+
+ wait.until(ExpectedConditions.elementToBeClickable(driver.findElement(By.xpath("//*[@value='" + "Submit" + "']")))).click();
+
+ GeneralUIUtils.waitForLoader();
+ }
+
+ public void loginWithUser(UserRoleEnum role) {
+ setUser(role);
+ try {
+ navigateToUrl(url);
+ extendTest.log(LogStatus.INFO, String.format("login with user %s", role.name().toUpperCase()));
+ if (localEnv) {
+ loginToSystem(role);
+ enterToUserWorkspace();
+ }
+ else{
+ loadCredentialsFile();
+ UserCredentials credentials = getUserCredentialsFromFile(role.name().toLowerCase());
+ loginToSystem(credentials, role);
+ user = credentials;
+ }
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void enterToUserWorkspace() {
+ WebElement enterToUserWorkspaceButton = GeneralUIUtils.waitForElementVisibility(By.className("asdc-welcome-main-back-btn"), 3 * 60);
+ enterToUserWorkspaceButton.click();
+ System.out.println("Entering to system...");
+ GeneralUIUtils.waitForLoader();
+ }
+
+ private void setUser(UserRoleEnum role) {
+ user = new User();
+ user.setUserId(role.getUserId());
+ user.setFirstName(role.getFirstName());
+ user.setRole(role.name());
+ user.setLastName(role.getLastName());
+ }
+
+ public User getUser() {
+ return user;
+ }
+
+ protected void setBrowserBeforeTest(UserRoleEnum role) {
+ refreshAttempts = 0;
+ System.out.println(String.format("Setup before test as %s", role.toString().toUpperCase()));
+ GeneralUIUtils.initDriver();
+ loginWithUser(role);
+ }
+
+ public User getUser(UserRoleEnum role) {
+ User user = new User();
+ user = new User();
+ user.setUserId(role.getUserId());
+ user.setFirstName(role.getFirstName());
+ user.setRole(role.name());
+ return user;
+ }
+
+ protected void quitAndReLogin(UserRoleEnum role) throws Exception {
+ quitBrowser();
+ if (localEnv) {
+ loginToSystem(role);
+ }
+ setBrowserBeforeTest(role);
+ }
+
+ private void quitBrowser() {
+ System.out.println("Closing browser...");
+ GeneralUIUtils.getDriver().quit();
+ }
+
+
+ protected String getRandomComponentName(String prefix) {
+ return prefix + randomNumber();
+ }
+
+ protected int randomNumber() {
+ Random r = new Random();
+ return r.nextInt(10000);
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ComponentLeftMenu.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ComponentLeftMenu.java
new file mode 100644
index 0000000000..d795599f24
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ComponentLeftMenu.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.pages;
+
+public interface ComponentLeftMenu {
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/CompositionPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/CompositionPage.java
new file mode 100644
index 0000000000..e515ce9d64
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/CompositionPage.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.pages;
+
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+
+public class CompositionPage extends GeneralPageElements {
+
+ public CompositionPage() {
+ super();
+ }
+
+ public static void searchForElement(String elementName) {
+ WebElement searchField = GeneralUIUtils.getWebElementWaitForVisible("searchAsset");
+ searchField.clear();
+ searchField.sendKeys(elementName);
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.sleep(500);
+ }
+
+ public static void showDeploymentArtifactTab() {
+ GeneralUIUtils.waitFordataTestIdVisibility("deployment-artifact-tab").click();
+ GeneralUIUtils.waitForLoader();
+ }
+
+ public static void showPropertiesAndAttributesTab() {
+ GeneralUIUtils.waitFordataTestIdVisibility("properties-and-attributes-tab").click();
+ GeneralUIUtils.waitForLoader();
+ }
+
+ public static List<WebElement> getProperties() {
+ return PropertiesPage.getElemenetsFromTable();
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java
new file mode 100644
index 0000000000..4c4edd8684
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
+import org.openqa.selenium.WebElement;
+
+public class DeploymentArtifactPage extends GeneralPageElements {
+
+ public DeploymentArtifactPage() {
+ super();
+ }
+
+ public static ResourceLeftMenu getLeftPanel() {
+ return new ResourceLeftMenu();
+ }
+
+ public static UploadArtifactPopup artifactPopup() {
+ return new UploadArtifactPopup();
+ }
+
+ protected static void addNewArtifact(ArtifactGroupTypeEnum artifactGroupType) {
+ switch (artifactGroupType) {
+ case DEPLOYMENT:
+ GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPageEnum.ADD_DEPLOYMENT_ARTIFACT.getValue()).click();
+ break;
+ case INFORMATIONAL:
+ GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPageEnum.ADD_INFORMATIONAL_ARTIFACT.getValue()).click();
+ break;
+ default:
+ break;
+ }
+ }
+
+ public static void clickAddNewArtifact() {
+ addNewArtifact(ArtifactGroupTypeEnum.DEPLOYMENT);
+ }
+
+ public static void clickAddAnotherArtifact() {
+ GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPageEnum.ADD_ANOTHER_ARTIFACT.getValue()).click();
+ }
+
+ public static void clickEditArtifact(String artifactLabel) {
+ GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue() + artifactLabel).click();
+ }
+
+ public static void clickDeleteArtifact(String artifactLabel) {
+ GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPageEnum.DELETE_ARTIFACT.getValue() + artifactLabel).click();
+ }
+
+ public static void clickDownloadArtifact(String artifactLabel) {
+ GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT.getValue() + artifactLabel)
+ .click();
+ }
+
+ public static String getArtifactDescription(String artifactLabel) throws Exception {
+ clickOnArtifact(artifactLabel); // open artifact
+ WebElement artifactDescriptionElement = GeneralUIUtils.getWebElementWaitForVisible(
+ DataTestIdEnum.ArtifactPageEnum.GET_DEPLOYMENT_ARTIFACT_DESCRIPTION.getValue());
+ String artifactDesc = artifactDescriptionElement.getText();
+ clickOnArtifact(artifactLabel); // close artifact
+
+ return artifactDesc;
+ }
+
+ public static void clickOnArtifact(String artifactLabel) throws Exception {
+ GeneralUIUtils.getWebButton(artifactLabel).click();
+ GeneralUIUtils.waitForLoader();
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java
new file mode 100644
index 0000000000..fea3843b7a
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java
@@ -0,0 +1,139 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.pages;
+
+import static org.testng.AssertJUnit.assertTrue;
+import java.util.List;
+import java.util.function.Supplier;
+
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.relevantcodes.extentreports.LogStatus;
+
+public class GeneralPageElements {
+
+ public GeneralPageElements() {
+ super();
+ }
+
+ public static ResourceLeftMenu getLeftMenu() {
+ return new ResourceLeftMenu();
+ }
+
+ public static void clickCreateButton() {
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, "creating...");
+ GeneralUIUtils.getWebButton(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ }
+
+ public static void clickCheckinButton(String componentName) throws Exception {
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, "clicking on checkin");
+ GeneralUIUtils.getWebButton(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue()).click();
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.ACCEP_TESTING_MESSAGE.getValue())
+ .sendKeys("Checkin " + componentName);
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.OK.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ assertTrue(GeneralUIUtils.getWebElementWaitForVisible("formlifecyclestate").getText()
+ .equals(LifeCycleStateEnum.CHECKIN.getValue()));
+ }
+
+ public static void clickSubmitForTestingButton(String componentName) throws Exception {
+ try {
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, "submiting for testing");
+ GeneralUIUtils
+ .getWebElementWaitForVisible(DataTestIdEnum.LifeCyleChangeButtons.SUBMIT_FOR_TESTING.getValue())
+ .click();
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.SUMBIT_FOR_TESTING_MESSAGE.getValue())
+ .sendKeys("Submit for testing for " + componentName);
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.OK.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.sleep(2000);
+ GeneralUIUtils.getWebElementWaitForVisible("main-menu-input-search");
+ } catch (Exception e) {
+ throw e;
+ }
+ }
+
+ public static void clickDeleteVersionButton() {
+ GeneralUIUtils.getWebButton(DataTestIdEnum.GeneralElementsEnum.DELETE_VERSION_BUTTON.getValue()).click();
+ }
+
+ public static void clickRevertButton() {
+ GeneralUIUtils.getWebButton(DataTestIdEnum.GeneralElementsEnum.REVERT_BUTTON.getValue()).click();
+ }
+
+ public static String getLifeCycleState() {
+ return GeneralUIUtils.getWebButton(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()).getText();
+ }
+
+ public static void selectVersion(String version) {
+ GeneralUIUtils.getSelectList(version, DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue());
+ }
+
+ public static List<WebElement> getElemenetsFromTable() {
+ GeneralUIUtils.waitForLoader();
+ return GeneralUIUtils.getElemenetsFromTable(By.className("flex-container"));
+ }
+
+ public static boolean checkElementsCountInTable(int expectedElementsCount) {
+ // int maxWaitingPeriodMS = 1000;
+ // int napPeriodMS = 100;
+ // int sumOfWaiting = 0;
+ // List<WebElement> elememts = null;
+ // boolean isKeepWaiting = false;
+ // while (!isKeepWaiting){
+ // GeneralUIUtils.sleep(napPeriodMS);
+ // sumOfWaiting += napPeriodMS;
+ // elememts = getElemenetsFromTable();
+ // isKeepWaiting = ( expectedElementsCount == elememts.size() );
+ // if (sumOfWaiting > maxWaitingPeriodMS)
+ // return false;
+ // }
+ //
+ // return true;
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, "checking number of elements in table");
+ return checkElementsCountInTable(expectedElementsCount, () -> getElemenetsFromTable());
+ }
+
+ public static boolean checkElementsCountInTable(int expectedElementsCount, Supplier<List<WebElement>> func) {
+ int maxWaitingPeriodMS = 10000;
+ int napPeriodMS = 100;
+ int sumOfWaiting = 0;
+ List<WebElement> elements = null;
+ boolean isKeepWaiting = false;
+ while (!isKeepWaiting) {
+ GeneralUIUtils.sleep(napPeriodMS);
+ sumOfWaiting += napPeriodMS;
+ elements = func.get();
+ isKeepWaiting = (expectedElementsCount == elements.size());
+ if (sumOfWaiting > maxWaitingPeriodMS)
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GovernorOperationPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GovernorOperationPage.java
new file mode 100644
index 0000000000..9e7eaf1497
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GovernorOperationPage.java
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+
+import com.relevantcodes.extentreports.LogStatus;
+
+public class GovernorOperationPage {
+
+ public GovernorOperationPage() {
+ super();
+ }
+
+ public static void approveSerivce(String serviceName) {
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, "approving distrbution the service " + serviceName);
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.DistributionChangeButtons.APPROVE.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.DistributionChangeButtons.APPROVE_MESSAGE.getValue())
+ .sendKeys("service " + serviceName + " tested successfuly");
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.OK.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.getWebElementWaitForVisible("main-menu-input-search");
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/IconPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/IconPage.java
new file mode 100644
index 0000000000..240272ae30
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/IconPage.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+
+public class IconPage extends GeneralPageElements {
+
+ public IconPage() {
+ super();
+ }
+
+ public static void clickOnIcon(ResourceCategoryEnum iconName) {
+ GeneralUIUtils.getWebButton(iconStringBuilder(iconName) + DataTestIdEnum.ServiceMetadataEnum.ICON.getValue())
+ .click();
+ }
+
+ private static String iconStringBuilder(ResourceCategoryEnum icon) {
+ String iconName = icon.getSubCategory();
+ String[] splitedIconName = iconName.split(" ");
+ splitedIconName[0] = splitedIconName[0].toLowerCase();
+
+ StringBuilder sb = new StringBuilder();
+ for (String word : splitedIconName) {
+ sb.append(word);
+ }
+
+ return sb.toString();
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InformationalArtifactPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InformationalArtifactPage.java
new file mode 100644
index 0000000000..1dbf4dfa61
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InformationalArtifactPage.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.pages;
+
+import java.util.List;
+
+import javax.lang.model.util.Elements;
+
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+public class InformationalArtifactPage extends DeploymentArtifactPage {
+
+ public InformationalArtifactPage() {
+ super();
+ }
+
+ public static void clickAddNewArtifact() {
+ addNewArtifact(ArtifactGroupTypeEnum.INFORMATIONAL);
+ }
+
+ public static String getArtifactDescription(String artifactName) throws Exception {
+ clickOnArtifact(artifactName);
+ String artifactDesc = GeneralUIUtils.getWebElementWaitForVisible(
+ artifactName + DataTestIdEnum.ArtifactPageEnum.GET_INFORMATIONAL_ARTIFACT_DESCRIPTION.getValue())
+ .getText();
+ clickOnArtifact(artifactName); // close artifact
+ return artifactDesc;
+ }
+
+ public static List<WebElement> getElemenetsFromTable() {
+ return GeneralUIUtils.getWebElementsListByDataTestId("InformationalArtifactRow");
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OpsOperationPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OpsOperationPage.java
new file mode 100644
index 0000000000..e7151078f9
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OpsOperationPage.java
@@ -0,0 +1,183 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.pages;
+
+import static org.testng.AssertJUnit.assertEquals;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.junit.Assert;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import com.relevantcodes.extentreports.LogStatus;
+
+public class OpsOperationPage {
+
+ public OpsOperationPage() {
+ super();
+ }
+
+ public static void distributeService() {
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, "distributing...");
+ clickOnButton(DataTestIdEnum.DistributionChangeButtons.DISTRIBUTE);
+ GeneralUIUtils.getWebButton(DataTestIdEnum.DistributionChangeButtons.MONITOR.getValue());
+ }
+
+ public static void displayMonitor() {
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, "clicking on monitor button");
+ // clickOnButton(DataTestIdEnum.DistributionChangeButtons.MONITOR);
+ GeneralUIUtils.moveToStep(StepsEnum.MONITOR);
+ }
+
+ public static void re_distributeService() {
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, "redistributing...");
+ clickOnButton(DataTestIdEnum.DistributionChangeButtons.RE_DISTRIBUTE);
+ GeneralUIUtils.getWebButton(DataTestIdEnum.DistributionChangeButtons.MONITOR.getValue());
+ }
+
+ private static void clickOnButton(DataTestIdEnum.DistributionChangeButtons button) {
+ GeneralUIUtils.getWebElementWaitForVisible(button.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ }
+
+ public static List<WebElement> getRowsFromMonitorTable() {
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, "getting number of rows from distribution table");
+ GeneralPageElements.checkElementsCountInTable(1, () -> GeneralUIUtils.waitForElementsListVisibility("ditributionTable"));
+ List<WebElement> distributionRecords = GeneralUIUtils.waitForElementsListVisibility("ditributionTable");
+ List<WebElement> findElements = distributionRecords.get(0).findElements(By.className("w-sdc-distribute-parent-block"));
+ return findElements;
+
+
+
+ }
+
+ public static void showDistributionStatus(int rowIndex) {
+ GeneralUIUtils.getWebElementWaitForVisible("ShowRecordButton_" + String.valueOf(rowIndex)).click();
+ GeneralUIUtils.waitForLoader();
+ }
+
+ public static String getTotalArtifactsSum(int rowIndex) {
+ return GeneralUIUtils.waitFordataTestIdVisibility("totalArtifacts_" + String.valueOf(rowIndex)).getText();
+ }
+
+ public static String getNotifiedArtifactsSum(int rowIndex) {
+ return GeneralUIUtils.waitFordataTestIdVisibility("notified_" + String.valueOf(rowIndex)).getText();
+ }
+
+ public static String getDownloadedArtifactsSum(int rowIndex) {
+ return GeneralUIUtils.waitFordataTestIdVisibility("downloaded_" + String.valueOf(rowIndex)).getText();
+ }
+
+ public static String getDeployedArtifactsSum(int rowIndex) {
+ return GeneralUIUtils.waitFordataTestIdVisibility("deployed_" + String.valueOf(rowIndex)).getText();
+ }
+
+ public static String getNotNotifiedArtifactsSum(int rowIndex) {
+ return GeneralUIUtils.waitFordataTestIdVisibility("NotNotified_" + String.valueOf(rowIndex)).getText();
+ }
+
+ public static String getErrorsSum(int rowIndex) {
+ return GeneralUIUtils.waitFordataTestIdVisibility("errors_" + String.valueOf(rowIndex)).getText();
+ }
+
+ public static void clickRefreshTableButton(int rowIndex) {
+ // SetupCDTest.getExtendTest().log(LogStatus.INFO, "refreshing
+ // distribution table");
+ GeneralUIUtils.getWebElementWaitForVisible("refreshButton").click();
+
+ // wait until total artifacts field disappear
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 30);
+ wait.until(ExpectedConditions.invisibilityOfElementLocated(
+ By.xpath("//*[@data-tests-id='" + "totalArtifacts_" + String.valueOf(rowIndex) + "']")));
+ }
+
+ public static void waitUntilArtifactsDistributed(int rowIndex) throws Exception {
+ waitUntilArtifactsDistributed("0", 0);
+ }
+
+ public static void waitUntilArtifactsDistributed(String expectedArtifactsSum, int rowIndex) throws Exception {
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, "waiting until all artifacts distributed");
+ boolean isKeepWaiting = true;
+ int maxWaitingPeriodMS = 5 * 60 * 1000;
+ int sumWaitingTime = 0;
+ int napPeriod = 1000;
+ while (isKeepWaiting) {
+ showDistributionStatus(rowIndex);
+ String actualTotalArtifactsSize = getTotalArtifactsSum(rowIndex);
+ String actualNotifiedArtifactsSize = getNotifiedArtifactsSum(rowIndex);
+ String actualDownloadedArtifactsSize = getDownloadedArtifactsSum(rowIndex);
+ String actualDeployedArtifactsSize = getDeployedArtifactsSum(rowIndex);
+ String actualNotNotifedArtifactsSize = getNotNotifiedArtifactsSum(rowIndex);
+ isKeepWaiting = !actualTotalArtifactsSize.equals(actualDownloadedArtifactsSize)
+ || !actualTotalArtifactsSize.equals(actualNotifiedArtifactsSize)
+ || !actualTotalArtifactsSize.equals(actualDeployedArtifactsSize)
+ || actualTotalArtifactsSize.equals("0") || actualDownloadedArtifactsSize.equals("0")
+ || actualNotifiedArtifactsSize.equals("0") || actualDeployedArtifactsSize.equals("0");
+ // isKeepWaiting =
+ // !expectedArtifactsSum.equals(actualTotalArtifactsSize) &&
+ // !expectedArtifactsSum.equals(actualNotifiedArtifactsSize) &&
+ // !expectedArtifactsSum.equals(actualDownloadedArtifactsSize) &&
+ // !expectedArtifactsSum.equals(actualDeployedArtifactsSize) &&
+ // actualNotNotifedArtifactsSize.equals("0");
+ // if (Integer.valueOf(actualTotalArtifactsSize) >
+ // Integer.valueOf(expectedArtifactsSum)){
+ // isKeepWaiting = false;
+ // throw new Exception(String.format("MORE ARTIFACTS THEN EXPECTED -
+ // actual: %s, expected: %s", actualTotalArtifactsSize,
+ // expectedArtifactsSum));
+ //// Assert.fail(String.format("MORE ARTIFACTS THEN EXPECTED -
+ // actual: %s, expected: %s", actualTotalArtifactsSize,
+ // expectedArtifactsSum));
+ // }
+ if (isKeepWaiting) {
+
+ if (Integer.parseInt(actualNotNotifedArtifactsSize) > 1) {
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, "Some artifacts are not notified...");
+ isKeepWaiting = false;
+ throw new Exception("Some artifacts are not notified... check distribution client");
+ }
+
+ GeneralUIUtils.sleep(napPeriod);
+ sumWaitingTime += napPeriod;
+
+ if (sumWaitingTime > maxWaitingPeriodMS) {
+ SetupCDTest.getExtendTest().log(LogStatus.FAIL, "not all artifacts are displayed");
+ isKeepWaiting = false;
+ throw new Exception(String.format("NOT ALL ARTIFACTS ARE DISPLAYED WITHIN %s SECONDS",
+ String.valueOf(maxWaitingPeriodMS / 1000)));
+ }
+
+ clickRefreshTableButton(rowIndex);
+ }
+ }
+
+ SetupCDTest.getExtendTest().log(LogStatus.PASS, "all artifacts are distributed successfully");
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesPage.java
new file mode 100644
index 0000000000..614fa0a81a
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesPage.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.pages;
+
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+public class PropertiesPage extends GeneralPageElements {
+
+ public PropertiesPage() {
+ super();
+ }
+
+ public static List<WebElement> getElemenetsFromTable() {
+ return GeneralUIUtils.getWebElementsListByDataTestId(DataTestIdEnum.PropertiesPageEnum.PROPERTY_ROW.getValue());
+ }
+
+ public static void clickAddPropertyArtifact() {
+ GeneralUIUtils.getWebButton(DataTestIdEnum.PropertiesPageEnum.ADD_NEW_PROPERTY.getValue()).click();
+ }
+
+ public static void clickEditPropertyArtifact(String propertyName) {
+ GeneralUIUtils.getWebButton(DataTestIdEnum.PropertiesPageEnum.EDIT_PROPERTY.getValue() + propertyName).click();
+ }
+
+ public static void clickDeletePropertyArtifact(String propertyName) {
+ GeneralUIUtils.getWebButton(DataTestIdEnum.PropertiesPageEnum.DELETE_PROPERTY.getValue() + propertyName)
+ .click();
+ }
+
+ public static void clickOnProperty(String propertyName) {
+ GeneralUIUtils.getWebButton(propertyName).click();
+ }
+
+ public static PropertyPopup getPropertyPopup() {
+ return new PropertyPopup();
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertyPopup.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertyPopup.java
new file mode 100644
index 0000000000..11cbea3093
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertyPopup.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+
+public class PropertyPopup {
+
+ public PropertyPopup() {
+ }
+
+ public void insertPropertyName(String name) {
+ WebElement propertyNameField = GeneralUIUtils
+ .getWebElementWaitForVisible(DataTestIdEnum.PropertiesPageEnum.PROPERTY_NAME.getValue());
+ propertyNameField.clear();
+ propertyNameField.sendKeys(name);
+ }
+
+ public void insertPropertyDefaultValue(String value) {
+ WebElement propertyValue = GeneralUIUtils
+ .getWebElementWaitForVisible(DataTestIdEnum.PropertiesPageEnum.PROPERTY_VALUE.getValue());
+ propertyValue.clear();
+ propertyValue.sendKeys(value);
+ }
+
+ public void insertPropertyDescription(String description) {
+ WebElement propertyDescription = GeneralUIUtils
+ .getWebElementWaitForVisible(DataTestIdEnum.PropertiesPageEnum.PROPERTY_DESCRIPTION.getValue());
+ propertyDescription.clear();
+ propertyDescription.sendKeys(description);
+ }
+
+ public void selectPropertyType(String propertyType) {
+ GeneralUIUtils.getSelectList(propertyType, DataTestIdEnum.PropertiesPageEnum.PROPERTY_TYPE.getValue());
+ }
+
+ public void clickAdd() {
+ GeneralUIUtils.getWebButton(DataTestIdEnum.PropertiesPageEnum.ADD.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ }
+
+ public void clickSave() {
+ GeneralUIUtils.getWebButton(DataTestIdEnum.PropertiesPageEnum.SAVE.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ }
+
+ public void clickCancel() {
+ GeneralUIUtils.getWebButton(DataTestIdEnum.PropertiesPageEnum.CANCEL.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ }
+
+ public void clickDone() {
+ GeneralUIUtils.getWebButton(DataTestIdEnum.PropertiesPageEnum.DONE.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceGeneralPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceGeneralPage.java
new file mode 100644
index 0000000000..2494282e1c
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceGeneralPage.java
@@ -0,0 +1,154 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.pages;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ComponentType;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.support.ui.Select;
+
+public class ResourceGeneralPage extends GeneralPageElements {
+
+ public ResourceGeneralPage() {
+ super();
+ }
+
+ private static WebElement getNameField() {
+ return GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ResourceMetadataEnum.RESOURCE_NAME.getValue());
+ }
+
+ private static WebElement getDescriptionField() {
+ return GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ServiceMetadataEnum.DESCRIPTION.getValue());
+ }
+
+ private static String getCategoryField() {
+ return DataTestIdEnum.ResourceMetadataEnum.CATEGORY.getValue();
+ }
+
+ private static WebElement getVendorNameField() {
+ return GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ResourceMetadataEnum.VENDOR_NAME.getValue());
+ }
+
+ private static WebElement getVendorReleaseField() {
+ return GeneralUIUtils
+ .getWebElementWaitForVisible(DataTestIdEnum.ResourceMetadataEnum.VENDOR_RELEASE.getValue());
+ }
+
+ private static WebElement getTagsField() {
+ return GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ResourceMetadataEnum.TAGS.getValue());
+ }
+
+ private static WebElement getUserIdField() {
+ return GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ResourceMetadataEnum.CONTACT_ID.getValue());
+ }
+
+ /***************************************************************/
+
+ public static String getNameText() {
+ return getNameField().getAttribute("value");
+ }
+
+ public static void defineName(String resourceName) {
+ WebElement resourceNameTextbox = getNameField();
+ resourceNameTextbox.clear();
+ resourceNameTextbox.sendKeys(resourceName);
+ }
+
+ public static String getDescriptionText() {
+ return getDescriptionField().getAttribute("value");
+ }
+
+ public static void defineDescription(String description) {
+ WebElement descriptionTextbox = getDescriptionField();
+ descriptionTextbox.clear();
+ descriptionTextbox.sendKeys(description);
+ }
+
+ public static String getVendorNameText() {
+ return getVendorNameField().getAttribute("value");
+ }
+
+ public static void defineVendorName(String vendorName) {
+ WebElement vendorNameTextbox = getVendorNameField();
+ vendorNameTextbox.clear();
+ vendorNameTextbox.sendKeys(vendorName);
+ }
+
+ public static String getVendorReleaseText() {
+ return getVendorReleaseField().getAttribute("value");
+ }
+
+ public static void defineVendorRelease(String vendorRelease) {
+ WebElement vendorReleaseTextbox = getVendorReleaseField();
+ vendorReleaseTextbox.clear();
+ vendorReleaseTextbox.sendKeys(vendorRelease);
+ }
+
+ public static void defineTag(String resourceTags) {
+ WebElement tagTextbox = getTagsField();
+ tagTextbox.clear();
+ tagTextbox.sendKeys(resourceTags);
+ tagTextbox.sendKeys(Keys.ENTER);
+ }
+
+ public static void defineTagsList(ComponentReqDetails resource, String[] resourceTags) {
+ List<String> taglist = new ArrayList<String>();
+ ;
+ WebElement resourceTagsTextbox = getTagsField();
+ for (String tag : resourceTags) {
+ resourceTagsTextbox.clear();
+ resourceTagsTextbox.sendKeys(tag);
+ GeneralUIUtils.sleep(1000);
+ resourceTagsTextbox.sendKeys(Keys.ENTER);
+ taglist.add(tag);
+ }
+ resource.setTags(taglist);
+ }
+
+ public static void defineCategory(String category) {
+// GeneralUIUtils.getSelectList(category, getCategoryField());
+
+ Actions action = new Actions(GeneralUIUtils.getDriver());
+ action.click(GeneralUIUtils.getWebElementByDataTestId(getCategoryField()));
+ action.sendKeys(category).perform();
+ }
+
+ public static String getUserIdContactText() {
+ return getUserIdField().getAttribute("value");
+ }
+
+ public static void defineUserIdContact(String userId) {
+ WebElement contactIdTextbox = getUserIdField();
+ contactIdTextbox.clear();
+ contactIdTextbox.sendKeys(userId);
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java
new file mode 100644
index 0000000000..bd93f18d2a
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+
+public class ResourceLeftMenu implements ComponentLeftMenu {
+
+ public void moveToGeneralScreen() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.GENERAL);
+ }
+
+ public void moveToIconScreen() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.ICON);
+ }
+
+ public void moveToDeploymentArtifactScreen() {
+ GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT);
+ }
+
+ public void moveToInformationalArtifactScreen() {
+ GeneralUIUtils.moveToStep(StepsEnum.INFORMATION_ARTIFACT);
+ }
+
+ public void moveToPropertiesScreen() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES);
+ }
+
+ public void moveToCompositionScreen() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION);
+ }
+
+ public void moveToActivityLogScreen() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.ACTIVITY_LOG);
+ }
+
+ public void moveToDeploymentViewScreen() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_VIEW);
+ }
+
+ public void moveToToscaArtifactsScreen() {
+ GeneralUIUtils.moveToStep(StepsEnum.TOSCA_ARTIFACTS);
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceGeneralPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceGeneralPage.java
new file mode 100644
index 0000000000..9e8c4b2265
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceGeneralPage.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+
+public class ServiceGeneralPage extends ResourceGeneralPage {
+
+ public ServiceGeneralPage() {
+ super();
+ }
+
+ public static void defineName(String serviceName) {
+ WebElement serviceNameTextbox = GeneralUIUtils
+ .getWebElementWaitForVisible(DataTestIdEnum.ServiceMetadataEnum.SERVICE_NAME.getValue());
+ serviceNameTextbox.clear();
+ serviceNameTextbox.sendKeys(serviceName);
+ }
+
+ public static void defineProjectCode(String pmat) {
+ WebElement projectCodeTextbox = GeneralUIUtils
+ .getWebElementWaitForVisible(DataTestIdEnum.ServiceMetadataEnum.PROJECT_CODE.getValue());
+ projectCodeTextbox.clear();
+ projectCodeTextbox.sendKeys(pmat);
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TesterOperationPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TesterOperationPage.java
new file mode 100644
index 0000000000..6c18561492
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TesterOperationPage.java
@@ -0,0 +1,71 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.interactions.Actions;
+import org.testng.annotations.Test;
+
+import com.relevantcodes.extentreports.LogStatus;
+
+public class TesterOperationPage {
+
+ public TesterOperationPage() {
+ super();
+ }
+
+ public static void certifyComponent(String componentName) throws Exception {
+ clickStartTestingButton();
+ clickAccpetCertificationButton(componentName);
+
+ }
+
+ public static void clickAccpetCertificationButton(String componentName) {
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, "clicking on accept certification button");
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.LifeCyleChangeButtons.ACCEPT.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.ACCEP_TESTING_MESSAGE.getValue())
+ .sendKeys(componentName + " tested successfuly");
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.OK.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.sleep(2000);
+ GeneralUIUtils.getWebElementWaitForVisible("main-menu-input-search");
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, componentName + " is certifed ");
+ }
+
+ public static void clickStartTestingButton() {
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, "start testing");
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.LifeCyleChangeButtons.START_TESTING.getValue())
+ .click();
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.LifeCyleChangeButtons.ACCEPT.getValue());
+ GeneralUIUtils.sleep(1000);
+
+ // bug
+ // Actions actionObject = new Actions(GeneralUIUtils.getDriver());
+ // actionObject.keyDown(Keys.CONTROL).sendKeys(Keys.F5).perform();
+ //
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ToscaArtifactsPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ToscaArtifactsPage.java
new file mode 100644
index 0000000000..dcc5f0640a
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ToscaArtifactsPage.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.pages;
+
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+public class ToscaArtifactsPage extends InformationalArtifactPage {
+
+ public ToscaArtifactsPage() {
+
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java
new file mode 100644
index 0000000000..5d27809774
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.Select;
+
+public class UploadArtifactPopup {
+
+ public UploadArtifactPopup() {
+ super();
+ }
+
+ public void loadFile(String path, String filename) {
+ final WebElement browseWebElement = GeneralUIUtils
+ .getWebElementByDataTestId(DataTestIdEnum.ArtifactPopup.BROWSE.getValue());
+ browseWebElement.sendKeys(path + "\\" + filename);
+ }
+
+ public void insertDescription(String artifactDescriptoin) {
+ WebElement artifactDescriptionTextbox = GeneralUIUtils
+ .getWebElementWaitForVisible(DataTestIdEnum.ArtifactPopup.ARTIFACT_DESCRIPTION.getValue());
+ artifactDescriptionTextbox.clear();
+ artifactDescriptionTextbox.sendKeys(artifactDescriptoin);
+ }
+
+ public Select defineArtifactLabel(String requiredArtifactLabel) {
+ Select selectList = GeneralUIUtils.getSelectList("Create New Artifact",
+ DataTestIdEnum.ArtifactPopup.ARTIFACT_LABEL.getValue());
+ WebElement artifactLabelWebElement = GeneralUIUtils.getDriver().findElement(By.name("artifactLabel"));
+ artifactLabelWebElement.clear();
+ artifactLabelWebElement.sendKeys(requiredArtifactLabel);
+ return selectList;
+ }
+
+ public Select selectArtifactType(String artifactType) {
+ return GeneralUIUtils.getSelectList(artifactType, DataTestIdEnum.ArtifactPopup.ARTIFACT_TYPE.getValue());
+ }
+
+ public void clickAddButton() throws Exception {
+ GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPopup.ADD_BUTTON.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ }
+
+ public void clickCancelButton() throws Exception {
+ GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPopup.CANCEL_BUTTON.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ }
+
+ public void clickUpdateButton() throws Exception {
+ GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPopup.UPDATE_BUTTON.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdditionalConditions.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdditionalConditions.java
new file mode 100644
index 0000000000..1b7f4c3641
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdditionalConditions.java
@@ -0,0 +1,84 @@
+package org.openecomp.sdc.ci.tests.utilities;
+
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+
+public class AdditionalConditions {
+
+ public static ExpectedCondition<Boolean> jQueryAJAXCallsHaveCompleted() {
+ return new ExpectedCondition<Boolean>() {
+ @Override
+ public Boolean apply(WebDriver driver) {
+ return (Boolean) ((JavascriptExecutor)driver).
+ executeScript("return (window.jQuery!= null) && (jQuery.active === 0);");
+ }
+ };
+ }
+
+ public static ExpectedCondition <Boolean> angularHasFinishedProcessing() {
+ return new ExpectedCondition<Boolean>() {
+ @Override
+ public Boolean apply(WebDriver driver) {
+ String scriptJS = "return (window.angular !==undefined) &&"
+ + " (angular.element(document).injector() !==undefined) &&"
+ + " (angular.element(document).injector().get('$http').pendingRequests.length === 0)";
+ return Boolean.valueOf(( (JavascriptExecutor) driver).executeScript(scriptJS).toString());
+ }
+ };
+ }
+
+ public static ExpectedCondition <Boolean> pageLoadWait() {
+ return new ExpectedCondition<Boolean>() {
+ @Override
+ public Boolean apply(WebDriver driver) {
+ String scriptJS =
+ "try {\r\n" +
+ " if (document.readyState !== 'complete') {\r\n" +
+ " return false; // Page not loaded yet\r\n" +
+ " }\r\n" +
+ " if (window.jQuery) {\r\n" +
+ " if (window.jQuery.active) {\r\n" +
+ " return false;\r\n" +
+ " } else if (window.jQuery.ajax && window.jQuery.ajax.active) {\r\n" +
+ " return false;\r\n" +
+ " }\r\n" +
+ " }\r\n" +
+ " if (window.angular) {\r\n" +
+ " if (!window.qa) {\r\n" +
+ " // Used to track the render cycle finish after loading is complete\r\n" +
+ " window.qa = {\r\n" +
+ " doneRendering: false\r\n" +
+ " };\r\n" +
+ " }\r\n" +
+ " // Get the angular injector for this app (change element if necessary)\r\n" +
+ " var injector = window.angular.element('body').injector();\r\n" +
+ " // Store providers to use for these checks\r\n" +
+ " var $rootScope = injector.get('$rootScope');\r\n" +
+ " var $http = injector.get('$http');\r\n" +
+ " var $timeout = injector.get('$timeout');\r\n" +
+ " // Check if digest\r\n" +
+ " if ($rootScope.$$phase === '$apply' || $rootScope.$$phase === '$digest' || $http.pendingRequests.length !== 0) {\r\n" +
+ " window.qa.doneRendering = false;\r\n" +
+ " return false; // Angular digesting or loading data\r\n" +
+ " }\r\n" +
+ " if (!window.qa.doneRendering) {\r\n" +
+ " // Set timeout to mark angular rendering as finished\r\n" +
+ " $timeout(function() {\r\n" +
+ " window.qa.doneRendering = true;\r\n" +
+ " }, 0);\r\n" +
+ " return false;\r\n" +
+ " }\r\n" +
+ " }\r\n" +
+ " return true;\r\n" +
+ "} catch (ex) {\r\n" +
+ " return false;\r\n" +
+ "}";
+ return Boolean.valueOf(( (JavascriptExecutor) driver).executeScript(scriptJS).toString());
+ }
+ };
+ }
+
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdminWorkspaceUIUtilies.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdminWorkspaceUIUtilies.java
new file mode 100644
index 0000000000..472b69fd0b
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdminWorkspaceUIUtilies.java
@@ -0,0 +1,71 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.utilities;
+
+import org.junit.rules.TestName;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.support.ui.Select;
+
+public class AdminWorkspaceUIUtilies {
+
+ public AdminWorkspaceUIUtilies(TestName name, String className) {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ protected static WebDriver driver;
+
+ public static void deleteuser(String userId) throws Exception {
+ typeToSearchBox(userId);
+ if (GeneralUIUtils.getWebElements("tdRow") != null) {
+ GeneralUIUtils.getWebElementWaitForVisible("delete" + userId + "").click();
+ GeneralUIUtils.clickOkButton();
+ }
+ }
+
+ public static String defineNewUserId(String userId) {
+ GeneralUIUtils.getWebElementWaitForVisible("newUserId").clear();
+ GeneralUIUtils.getWebElementWaitForVisible("newUserId").sendKeys(userId);
+ ;
+ return userId;
+ }
+
+ public static String defineNewMacUid(String MacUid) {
+ GeneralUIUtils.getWebElementWaitForVisible("newUserId").clear();
+ GeneralUIUtils.getWebElementWaitForVisible("newUserId").sendKeys(MacUid);
+ ;
+ return MacUid;
+ }
+
+ public static String selectUserRole(String Role) {
+ Select selectrole = new Select(GeneralUIUtils.getWebElementWaitForVisible("selectrole"));
+ selectrole.deselectByVisibleText(Role);
+ selectrole.selectByVisibleText(Role);
+ return Role;
+ }
+
+ public static void typeToSearchBox(String Text) throws Exception {
+ GeneralUIUtils.getWebElementWaitForVisible("searchbox").clear();
+ GeneralUIUtils.getWebElementWaitForVisible("searchbox").sendKeys(Text);
+ Thread.sleep(1000);
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java
new file mode 100644
index 0000000000..f22d52d3bd
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java
@@ -0,0 +1,302 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.utilities;
+
+import static org.junit.Assert.assertEquals;
+
+import java.awt.AWTException;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.datatransfer.StringSelection;
+import java.awt.event.KeyEvent;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifacts;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.thinkaurelius.titan.diskstorage.util.StaticArrayBuffer;
+
+public final class ArtifactUIUtils {
+
+ private ArtifactUIUtils() {
+ }
+
+ public static void fillAndAddNewArtifactParameters(ArtifactInfo artifactInfo) throws Exception {
+ DeploymentArtifactPage.artifactPopup().loadFile(artifactInfo.getFilepath(), artifactInfo.getFilename());
+ DeploymentArtifactPage.artifactPopup().insertDescription(artifactInfo.getDescription());
+ DeploymentArtifactPage.artifactPopup().defineArtifactLabel(artifactInfo.getArtifactLabel());
+ DeploymentArtifactPage.artifactPopup().selectArtifactType(artifactInfo.getArtifactType());
+ DeploymentArtifactPage.artifactPopup().clickAddButton();
+ }
+
+ public static void fillPlaceHolderInformationalArtifact(DataTestIdEnum.InformationalArtifacts artifactLabel,
+ String filepath, String filename, String description) throws Exception {
+ GeneralUIUtils.getWebButton(artifactLabel.getValue()).click();
+ InformationalArtifactPage.artifactPopup().loadFile(filepath, filename);
+ InformationalArtifactPage.artifactPopup().insertDescription(description);
+ InformationalArtifactPage.artifactPopup().clickAddButton();
+ }
+
+ public static RestResponse deploymentArtifactResourceInUI(ResourceReqDetails resource, User user,
+ ArtifactReqDetails artifact, String file) throws Exception {
+ Thread.sleep(1000);
+
+ List<WebElement> listFormInput = GeneralUIUtils.getDriver()
+ .findElements(By.className("i-sdc-designer-sidebar-tab"));
+ WebElement addArtifactElement = listFormInput.get(2);
+ addArtifactElement.click();
+
+ WebElement addArtifact = GeneralUIUtils.getDriver()
+ .findElement(By.className("i-sdc-designer-sidebar-section-content-item-artifact-details-name"));
+ addArtifact.click();
+
+ Thread.sleep(1000);
+ WebElement descriptionProperty = GeneralUIUtils.getDriver().findElement(By.className("i-sdc-form-textarea"));
+ descriptionProperty.clear();
+ descriptionProperty.sendKeys(artifact.getDescription());
+
+ WebElement uploadFile = GeneralUIUtils.getDriver().findElement(By.className("i-sdc-form-label-upload"));
+ uploadFile.click();
+
+ StringSelection sel = new StringSelection(file);
+ Toolkit.getDefaultToolkit().getSystemClipboard().setContents(sel, null);
+ // System.out.println("selection" + sel);
+ Thread.sleep(1000);
+
+ Robot robot = new Robot();
+ Thread.sleep(1000);
+
+ Thread.sleep(2000);
+
+ robot.keyPress(KeyEvent.VK_ENTER);
+
+ // Release Enter
+ robot.keyRelease(KeyEvent.VK_ENTER);
+
+ // Press CTRL+V
+ robot.keyPress(KeyEvent.VK_CONTROL);
+ robot.keyPress(KeyEvent.VK_V);
+
+ // Release CTRL+V
+ robot.keyRelease(KeyEvent.VK_CONTROL);
+ robot.keyRelease(KeyEvent.VK_V);
+ Thread.sleep(1000);
+
+ // Press Enter
+ robot.keyPress(KeyEvent.VK_ENTER);
+ robot.keyRelease(KeyEvent.VK_ENTER);
+ Thread.sleep(3000);
+
+ WebElement clickDone = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-form-action"));
+ clickDone.click();
+
+ Thread.sleep(3500);
+
+ GeneralUIUtils.getDriver().findElement(By.cssSelector("button[data-ng-click^=save]")).click();
+
+ RestResponse getResource = RestCDUtils.getResource(resource, user);
+ assertEquals("Did not succeed to get resource after create", 200, getResource.getErrorCode().intValue());
+ return getResource;
+ }
+
+ public static void addInformationArtifact(ArtifactReqDetails artifact, String filePath,
+ final InformationalArtifacts dataTestEnum) throws Exception {
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.sleep(2000);
+ GeneralUIUtils.getWebElementWaitForVisible(dataTestEnum.getValue()).click();
+
+ final WebElement browseWebElement = GeneralUIUtils.retryMethodOnException(
+ () -> GeneralUIUtils.getWebElementByDataTestId(DataTestIdEnum.ModalItems.BROWSE_BUTTON.getValue()));
+ browseWebElement.sendKeys(filePath);
+
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.DESCRIPTION.getValue())
+ .sendKeys(artifact.getDescription());
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.ADD.getValue()).click();
+
+ }
+
+ private static void addFileToWindowBrowse(String file) throws InterruptedException, AWTException {
+ StringSelection sel = new StringSelection(file);
+ Toolkit.getDefaultToolkit().getSystemClipboard().setContents(sel, null);
+ // System.out.println("selection" + sel);
+ Thread.sleep(1000);
+
+ Robot robot = new Robot();
+
+ robot.keyPress(KeyEvent.VK_ENTER);
+
+ // Release Enter
+ robot.keyRelease(KeyEvent.VK_ENTER);
+
+ // Press CTRL+V
+ robot.keyPress(KeyEvent.VK_CONTROL);
+ robot.keyPress(KeyEvent.VK_V);
+
+ // Release CTRL+V
+ robot.keyRelease(KeyEvent.VK_CONTROL);
+ robot.keyRelease(KeyEvent.VK_V);
+ Thread.sleep(1000);
+
+ // Press Enter
+ robot.keyPress(KeyEvent.VK_ENTER);
+ robot.keyRelease(KeyEvent.VK_ENTER);
+ Thread.sleep(3000);
+ }
+
+ static WebElement ArtifactLabel;
+
+ public static Map<String, String> addInformationalArtifact(String artifactLabel) throws Exception {
+ String type = GeneralUIUtils.getSelectList(null, "artifacttype").getFirstSelectedOption().getText();
+ Map<String, String> artifactValues = new HashMap<String, String>();
+ String labelName = GeneralUIUtils.getSelectList(artifactLabel, "selectArtifact").getFirstSelectedOption()
+ .getText();
+ ArtifactLabel = GeneralUIUtils.getDriver().findElement(By.name("artifactLabel"));
+ if (ArtifactLabel.getAttribute("value").equals("")) {
+ labelName = "New-Test-Artifact";
+ ArtifactLabel.sendKeys(labelName);
+ type = GeneralUIUtils.getSelectList("HEAT", "artifacttype").getFirstSelectedOption().getText();
+ }
+ String description = "This is Description";
+ String fileName = "Heat-File.yaml";
+ GeneralUIUtils.defineDescription(description);
+ ResourceUIUtils.importFileWithSendKeyBrowse(GeneralUIUtils.FILE_PATH, fileName);
+ GeneralUIUtils.getWebButton("Add").click();
+ GeneralUIUtils.waitFordataTestIdVisibility(labelName);
+
+ artifactValues.put("type", type);
+ artifactValues.put("description", description);
+ artifactValues.put("name", labelName);
+ artifactValues.put("fileName", fileName);
+ return artifactValues;
+ }
+
+ public static Map<String, String> addDeploymentArtifact(String artifactLabel, String artifactType, String fileName)
+ throws Exception {
+ String type = null;
+ String labelName;
+ Map<String, String> artifactValues = new HashMap<String, String>();
+ try {
+ labelName = GeneralUIUtils.getSelectList(artifactLabel, "selectArtifact").getOptions().get(1).getText();
+ GeneralUIUtils.getSelectList(artifactLabel, "selectArtifact").selectByVisibleText(labelName);
+ } catch (Exception e) {
+ labelName = GeneralUIUtils.getWebElementByName(artifactLabel).getText();
+ }
+ ArtifactLabel = GeneralUIUtils.getDriver().findElement(By.name("artifactLabel"));
+ if (ArtifactLabel.getText().equals("")) {
+ labelName = "New-Test-Artifact";
+ ArtifactLabel.sendKeys(labelName);
+ type = GeneralUIUtils.getSelectList(artifactType, "artifacttype").getFirstSelectedOption().getText();
+ }
+ String description = "This is Description";
+ GeneralUIUtils.defineDescription(description);
+ ResourceUIUtils.importFileWithSendKeyBrowse(GeneralUIUtils.FILE_PATH, fileName);
+ try {
+ GeneralUIUtils.getWebButton("Add").click();
+ } catch (Exception e) {
+ GeneralUIUtils.getButtonByClassName("w-sdc-form-action add-property").click();
+ }
+
+ artifactValues.put("type", artifactType);
+ artifactValues.put("description", description);
+ artifactValues.put("name", labelName);
+ artifactValues.put("fileName", fileName);
+ return artifactValues;
+ }
+
+ public static Map<String, String> addDeploymentArtifactFromCanvas(String artifactLabel) throws Exception {
+ String type = null;
+ Map<String, String> artifactValues = new HashMap<String, String>();
+ String labelName = GeneralUIUtils.getSelectList(artifactLabel, "selectArtifact").getFirstSelectedOption()
+ .getText();
+ ArtifactLabel = GeneralUIUtils.getDriver().findElement(By.name("artifactLabel"));
+ if (ArtifactLabel.getText().equals("")) {
+ labelName = "New-Test-Artifact";
+ ArtifactLabel.sendKeys(labelName);
+ type = GeneralUIUtils.getSelectList("OTHER", "artifacttype").getFirstSelectedOption().getText();
+ }
+ String description = "This is Description";
+ String filePath = "C:\\Git_work\\ASDC\\d2-sdnc\\ui-ci\\src\\main\\resources\\Files\\";
+ String fileName = "Heat-File.yaml";
+ GeneralUIUtils.defineDescription(description);
+ ResourceUIUtils.importFileWithSendKeyBrowse(filePath, fileName);
+ GeneralUIUtils.getWebButton("Add").click();
+ artifactValues.put("type", type);
+ artifactValues.put("description", description);
+ artifactValues.put("name", labelName);
+ artifactValues.put("fileName", fileName);
+ return artifactValues;
+ }
+
+ public static Map<String, String> valideArtifact(Map<String, String> artifactValues, Boolean condition)
+ throws Exception {
+ if (condition) {
+ GeneralUIUtils.getEelementBycontainsClassName("table-edit-btn").click();
+ } else {
+ System.out.println(artifactValues.get("name"));
+ GeneralUIUtils.getWebElementWaitForVisible("edit_" + artifactValues.get("name")).click();
+ }
+ Thread.sleep(1000);
+ String labelname = GeneralUIUtils.getWebElementByName("artifactLabel").getAttribute("value");
+ String filename = GeneralUIUtils.getWebElementWaitForVisible("filename").getText();
+ String description = GeneralUIUtils.getWebElementWaitForVisible("description").getAttribute("value");
+ String type = GeneralUIUtils.getSelectList(null, "artifacttype").getFirstSelectedOption().getText();
+ labelname.compareToIgnoreCase(artifactValues.get("name").replaceAll("-", ""));
+ assertEquals(filename, artifactValues.get("fileName").replaceAll(" ", "-"));
+ assertEquals(type, artifactValues.get("type"));
+ assertEquals(description, artifactValues.get("description"));
+ GeneralUIUtils.getWebButton("Update").click();
+ return artifactValues;
+ }
+
+ public static void valideArtifactFromCanvas(Map<String, String> artifactValues) throws Exception {
+ GeneralUIUtils.getWebElementWaitForVisible("artifactDisplayName-" + artifactValues.get("name")).click();
+ Thread.sleep(1000);
+ String labelname = GeneralUIUtils.getWebElementByName("artifactLabel").getAttribute("value");
+ String filename = GeneralUIUtils.getWebElementWaitForVisible("filename").getText();
+ String description = GeneralUIUtils.getWebElementWaitForVisible("description").getAttribute("value");
+ String type = GeneralUIUtils.getSelectList(null, "artifacttype").getFirstSelectedOption().getText();
+ labelname.compareToIgnoreCase(artifactValues.get("name").replaceAll("-", ""));
+ assertEquals(filename, artifactValues.get("fileName"));
+ assertEquals(type, artifactValues.get("type"));
+ assertEquals(description, artifactValues.get("description"));
+ }
+
+ public static Map<String, Map<String, Object>> getArtifactsListFromResponse(String jsonResponse,
+ String fieldOfArtifactList) {
+ JSONObject object = (JSONObject) JSONValue.parse(jsonResponse);
+ Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object.get(fieldOfArtifactList);
+ return map;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AuditCDUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AuditCDUtils.java
new file mode 100644
index 0000000000..c53fef596a
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AuditCDUtils.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.utilities;
+
+import org.codehaus.jettison.json.JSONObject;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject;
+import org.openecomp.sdc.ci.tests.utils.general.Convertor;
+import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
+
+public class AuditCDUtils {
+
+ public static void validateResourceSuccessAudit(ResourceReqDetails resource, User user, String action)
+ throws Exception {
+ JSONObject auditBody = AuditValidationUtils.filterAuditByUuid(action, resource.getUUID());
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+ .constructFieldsForAuditValidation(resource, resource.getVersion(), user);
+ String auditAction = "Create";
+ expectedResourceAuditJavaObject.setAction(auditAction);
+ expectedResourceAuditJavaObject.setPrevVersion("");
+ expectedResourceAuditJavaObject.setPrevState("");
+ expectedResourceAuditJavaObject.setStatus("201");
+ expectedResourceAuditJavaObject.setDesc("OK");
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, auditBody.toString(), false);
+ }
+
+ public static void validateServiceSuccessAudit(ServiceReqDetails service, User user, String action)
+ throws Exception {
+ validateServiceSuccessAudit(service, user, action, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+ }
+
+ public static void validateServiceSuccessAudit(ServiceReqDetails service, User user, String action,
+ LifecycleStateEnum lifecycleStatus) throws Exception {
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = AuditValidationUtils
+ .constructFieldsForAuditValidation(service, service.getVersion(), user);
+ String body = AuditValidationUtils.filterAuditByUuid(action, service.getUUID()).toString();
+ expectedResourceAuditJavaObject.setAction(action);
+ expectedResourceAuditJavaObject.setPrevState("");
+ expectedResourceAuditJavaObject.setPrevVersion("");
+ expectedResourceAuditJavaObject.setCurrState(lifecycleStatus.toString());
+ expectedResourceAuditJavaObject.setStatus("201");
+ expectedResourceAuditJavaObject.setDesc("OK");
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, action, body, false);
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasElement.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasElement.java
new file mode 100644
index 0000000000..fbe8c04036
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasElement.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.utilities;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+import org.openqa.selenium.WebElement;
+
+public final class CanvasElement {
+ private final String uniqueId;
+ private ImmutablePair<Integer, Integer> location;
+ private WebElement elementType;
+
+ CanvasElement(String name, ImmutablePair<Integer, Integer> location, WebElement canvasItem) {
+ super();
+ this.uniqueId = name;
+ this.location = location;
+ elementType = canvasItem;
+ }
+
+ public String getUniqueId() {
+ return uniqueId;
+ }
+
+ public ImmutablePair<Integer, Integer> getLocation() {
+ return location;
+ }
+
+ public void setLocation(ImmutablePair<Integer, Integer> location) {
+ this.location = location;
+ }
+
+ public WebElement getElementType() {
+ return elementType;
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasManager.java
new file mode 100644
index 0000000000..a52367a454
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasManager.java
@@ -0,0 +1,181 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.utilities;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.UUID;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+public final class CanvasManager {
+ private Map<String, CanvasElement> canvasElements;
+ private Actions actions;
+ private WebElement canvas;
+ private int reduceCanvasWidthFactor;
+ // Offsets Are used to find upper right corner of canvas element in order to
+ // connect links
+ private static final int CANVAS_ELEMENT_Y_OFFSET = 40;
+ private static final int CANVAS_ELEMENT_X_OFFSET = 21; // 14 - 27
+
+ private CanvasManager() {
+ canvasElements = new HashMap<>();
+ actions = new Actions(GeneralUIUtils.getDriver());
+ canvas = GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.CANVAS.getValue());
+ try {
+ WebElement webElement = GeneralUIUtils
+ .getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.CANVAS_RIGHT_PANEL.getValue());
+ reduceCanvasWidthFactor = webElement.getSize().width;
+ } catch (Exception e) {
+ reduceCanvasWidthFactor = 0;
+ }
+ }
+
+ public static CanvasManager getCanvasManager() {
+ return new CanvasManager();
+ }
+
+ public List<CanvasElement> getCanvasElements() {
+ return canvasElements.values().stream().collect(Collectors.toList());
+ }
+
+ private void addCanvasElement(CanvasElement element) {
+ canvasElements.put(element.getUniqueId(), element);
+ }
+
+ private void moveElementOnCanvas(CanvasElement canvasElement, ImmutablePair<Integer, Integer> newLocation)
+ throws Exception {
+ GeneralUIUtils.waitForLoader();
+ Thread.sleep(500);
+ actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right);
+ actions.clickAndHold();
+ actions.moveToElement(canvas, newLocation.left, newLocation.right);
+ actions.release();
+ actions.perform();
+ canvasElement.setLocation(newLocation);
+ GeneralUIUtils.waitForLoader();
+
+ }
+
+ public void moveElementOnCanvas(CanvasElement canvasElement) throws Exception {
+ moveElementOnCanvas(canvasElement, getFreePosition());
+ }
+
+ public void deleteElementFromCanvas(CanvasElement canvasElement) throws Exception {
+ GeneralUIUtils.waitForLoader();
+ actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right);
+ actions.click();
+ actions.perform();
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.DELETE_INSTANCE_BUTTON.getValue())
+ .click();
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.OK.getValue()).click();
+ canvasElements.remove(canvasElement.getUniqueId());
+ GeneralUIUtils.waitForLoader();
+ }
+
+ private String getItemName(WebElement canvasItem) {
+ String canvasItemName = canvasItem.getAttribute("data-tests-id");
+
+ return canvasItemName.substring(canvasItemName.lastIndexOf("-"));
+ }
+
+ public CanvasElement createElementOnCanvas(WebElement canvasItem) throws Exception {
+ GeneralUIUtils.waitForLoader();
+ ImmutablePair<Integer, Integer> freePosition = getFreePosition();
+ actions.moveToElement(canvasItem, 0, 0);
+ actions.clickAndHold();
+ actions.moveToElement(canvas, freePosition.left, freePosition.right);
+ actions.release();
+ actions.perform();
+
+ String uniqueId = getItemName(canvasItem) + "_" + UUID.randomUUID().toString();
+ CanvasElement canvasElement = new CanvasElement(uniqueId, freePosition, canvasItem);
+ addCanvasElement(canvasElement);
+ GeneralUIUtils.waitForLoader();
+ return canvasElement;
+ }
+
+ private ImmutablePair<Integer, Integer> getFreePosition() {
+ // TODO mshitrit use better method
+ ImmutablePair<Integer, Integer> randomPosition = null;
+ boolean freePosition = false;
+ int minSpace = 150;
+ while (!freePosition) {
+ ImmutablePair<Integer, Integer> tempRandomPosition = getRandomPosition();
+ freePosition = !canvasElements.values().stream().map(e -> e.getLocation())
+ .filter(e -> Math.abs(e.left - tempRandomPosition.left) < minSpace
+ && Math.abs(e.right - tempRandomPosition.right) < minSpace)
+ .findAny().isPresent();
+ randomPosition = tempRandomPosition;
+ }
+ return randomPosition;
+ }
+
+ private ImmutablePair<Integer, Integer> getRandomPosition() {
+ int edgeBuffer = 50;
+ Random random = new Random();
+ int xElement = random.nextInt(canvas.getSize().width - 2 * edgeBuffer - reduceCanvasWidthFactor) + edgeBuffer;
+ int yElement = random.nextInt(canvas.getSize().height - 2 * edgeBuffer) + edgeBuffer;
+ return new ImmutablePair<Integer, Integer>(xElement, yElement);
+ }
+
+ public void linkElements(CanvasElement firstElement, CanvasElement secondElement) throws Exception {
+ GeneralUIUtils.waitForLoader();
+ drawSimpleLink(firstElement, secondElement);
+
+ selectReqAndCapAndConnect();
+
+ GeneralUIUtils.waitForLoader();
+
+ }
+
+ private void selectReqAndCapAndConnect() {
+ // Select First Cap
+ GeneralUIUtils.getWebElements(DataTestIdEnum.LinkMenuItems.LINK_ITEM_CAP.getValue()).get(0).click();
+ // Select First Req
+ GeneralUIUtils.getWebElements(DataTestIdEnum.LinkMenuItems.LINK_ITEM_REQ.getValue()).get(0).click();
+ // Connect
+ GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.LinkMenuItems.CONNECT_BUTTON.getValue()).click();
+ }
+
+ private void drawSimpleLink(CanvasElement firstElement, CanvasElement secondElement) {
+
+ int yOffset = CANVAS_ELEMENT_Y_OFFSET;
+ int xOffset = CANVAS_ELEMENT_X_OFFSET;
+
+ actions.moveToElement(canvas, firstElement.getLocation().left + xOffset,
+ firstElement.getLocation().right - yOffset);
+
+ actions.clickAndHold();
+ actions.moveToElement(canvas, secondElement.getLocation().left + xOffset,
+ secondElement.getLocation().right - yOffset);
+ actions.release();
+ actions.perform();
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CaptureFailedTests.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CaptureFailedTests.java
new file mode 100644
index 0000000000..e2b2f8800b
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CaptureFailedTests.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.utilities;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.openqa.selenium.OutputType;
+import org.openqa.selenium.TakesScreenshot;
+import org.testng.ITestResult;
+import org.testng.Reporter;
+import org.testng.TestListenerAdapter;
+
+public class CaptureFailedTests extends TestListenerAdapter {
+
+ @Override
+ public void onTestFailure(ITestResult tr) {
+
+ String testName = tr.getName();
+ String parameter = tr.getParameters().length == 1 ? tr.getParameters()[0].toString() : "";
+ File folder = new File(String.format("test-output\\failure_screenshots\\%s_%s.png", testName, parameter));
+
+ File scrFile = ((TakesScreenshot) GeneralUIUtils.getDriver()).getScreenshotAs(OutputType.FILE);
+
+ try {
+ FileUtils.copyFile(scrFile, folder);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ Reporter.setEscapeHtml(false);
+ String screenPath = String.format("<img src=%s />", folder.getAbsolutePath());
+ Reporter.log(screenPath);
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CatalogUIUtilitis.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CatalogUIUtilitis.java
new file mode 100644
index 0000000000..d204645566
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CatalogUIUtilitis.java
@@ -0,0 +1,148 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.utilities;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.json.Json;
+
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONException;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils;
+import org.testng.annotations.Test;
+
+public class CatalogUIUtilitis {
+
+ // Get all Categories , Subcategories and Icons.
+ public void getAllCategoriesAndSubcategories() throws IOException, JSONException {
+ RestResponse allcategoriesJson = CatalogRestUtils.getAllCategoriesTowardsCatalogBe();
+ JSONArray categories = new JSONArray(allcategoriesJson.getResponse());
+ for (int i = 0; i < categories.length(); i++) {
+ String categoryname = (String) categories.getJSONObject(i).get("name");
+ JSONArray subcategories = (JSONArray) categories.getJSONObject(i).get("subcategories");
+ for (int j = 0; j < subcategories.length(); j++) {
+ String subcategoryname = (String) subcategories.getJSONObject(j).get("name");
+ System.out.println(subcategoryname);
+ }
+ for (int j = 0; j < subcategories.length(); j++) {
+ JSONArray icons = (JSONArray) subcategories.getJSONObject(j).get("icons");
+ for (int k = 0; k < icons.length(); k++) {
+ System.out.println(icons.get(k));
+ }
+ }
+ System.out.println("-------------------------------");
+ }
+ }
+
+ @Test
+ // FOr testing---delete.
+ public static List<String> abcd() throws IOException, JSONException {
+ RestResponse allcategoriesJson = CatalogRestUtils.getAllCategoriesTowardsCatalogBe();
+ JSONArray categories = new JSONArray(allcategoriesJson.getResponse());
+ List<String> allcat = new ArrayList<>();
+ String uniqueId = null;
+ for (int i = 0; i < categories.length(); i++) {
+ String categoryname = (String) categories.getJSONObject(i).get("name");
+ uniqueId = (String) categories.getJSONObject(i).get("uniqueId");
+ allcat.add(uniqueId);
+ JSONArray subcategories = (JSONArray) categories.getJSONObject(i).get("subcategories");
+ for (int j = 0; j < subcategories.length(); j++) {
+ String subcategoryname = (String) subcategories.getJSONObject(j).get("name");
+ uniqueId = (String) subcategories.getJSONObject(j).get("uniqueId");
+ allcat.add(uniqueId);
+ }
+ }
+ return allcat;
+
+ }
+
+ // Get all Categories uniqueID .//The parent categories.
+ public static List<String> getCategories() throws IOException, JSONException {
+ List<String> allCategoriesList = new ArrayList<>();
+ RestResponse allcategoriesJson = CatalogRestUtils.getAllCategoriesTowardsCatalogBe();
+ JSONArray categories = new JSONArray(allcategoriesJson.getResponse());
+ for (int i = 0; i < categories.length(); i++) {
+ String categoryname = (String) categories.getJSONObject(i).get("name");
+ System.out.println(categoryname);
+ allCategoriesList.add(categoryname);
+ }
+ return allCategoriesList;
+ }
+
+ @Test
+ // Get Subcategories by Category name
+ public static List<String> getAllSubcategoriesByUniqueId(String uniqueId) throws IOException, JSONException {
+
+ RestResponse allcategoriesJson = CatalogRestUtils.getAllCategoriesTowardsCatalogBe();
+ JSONArray categories = new JSONArray(allcategoriesJson.getResponse());
+ List<String> subCategories = new ArrayList<>();// subCategories to
+ // return.
+ JSONArray subcategories = null;
+
+ for (int i = 0; i < categories.length(); i++) {
+
+ String categoryuniqueId = (String) categories.getJSONObject(i).get("uniqueId");
+
+ if (categoryuniqueId.contentEquals(uniqueId)) {
+ subcategories = (JSONArray) categories.getJSONObject(i).get("subcategories");
+
+ for (int j = 0; j < subcategories.length(); j++) {
+
+ subCategories.add((String) subcategories.getJSONObject(j).get("uniqueId"));
+ }
+
+ break;
+ }
+ }
+ if (subcategories == null) {
+ subCategories.add(uniqueId);
+ }
+ return subCategories;
+ }
+
+ @Test
+ // Get icons by category name
+ public void getSubCategoryIcons() throws IOException, JSONException {
+ RestResponse allcategoriesJson = CatalogRestUtils.getAllCategoriesTowardsCatalogBe();
+
+ JSONArray categories = new JSONArray(allcategoriesJson.getResponse());
+ for (int i = 0; i < categories.length(); i++) {
+ String subcategoryname = (String) categories.getJSONObject(i).get("name");
+ if (subcategoryname.contentEquals("Generic")) {
+ JSONArray subcategories = (JSONArray) categories.getJSONObject(i).get("subcategories");
+ for (int j = 0; j < subcategories.length(); j++) {
+ JSONArray icons = (JSONArray) subcategories.getJSONObject(j).get("icons");
+ for (int k = 0; k < icons.length(); k++) {
+ System.out.println(icons.get(k));
+ }
+ }
+ break;
+ }
+ }
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java
new file mode 100644
index 0000000000..9533b6485e
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java
@@ -0,0 +1,88 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.utilities;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FilenameFilter;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.yaml.snakeyaml.Yaml;
+
+public class FileHandling {
+
+ public static Map<?, ?> parseYamlFile(String filePath) throws Exception {
+ Yaml yaml = new Yaml();
+ File file = new File(filePath);
+ InputStream inputStream = new FileInputStream(file);
+ Map<?, ?> map = (Map<?, ?>) yaml.load(inputStream);
+ return map;
+ }
+
+ public static String getBasePath() {
+ return System.getProperty("user.dir");
+ }
+
+ public static String getResourcesFilesPath() {
+ return getBasePath() + File.separator + "src" + File.separator + "main" + File.separator + "resources"
+ + File.separator + "Files" + File.separator;
+ }
+
+ public static String getCiFilesPath() {
+ return getBasePath() + File.separator + "src" + File.separator + "main" + File.separator + "resources"
+ + File.separator + "ci";
+ }
+
+ public static String getConfFilesPath() {
+ return getCiFilesPath() + File.separator + "conf" + File.separator;
+ }
+
+ public static String getTestSuitesFilesPath() {
+ return getCiFilesPath() + File.separator + "testSuites" + File.separator;
+ }
+
+ public static Object[] getFileNamesFromFolder(String filepath, String extension) {
+ try {
+ File dir = new File(filepath);
+ List<String> filenames = new ArrayList<String>();
+ if (dir.isDirectory()) {
+ for (File file : dir.listFiles(new FilenameFilter() {
+ @Override
+ public boolean accept(File dir, String name) {
+ return name.endsWith(extension);
+ }
+ })) {
+
+ filenames.add(file.getName());
+ }
+ return filenames.toArray();
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java
new file mode 100644
index 0000000000..4fd36955ae
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java
@@ -0,0 +1,1081 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.utilities;
+
+import java.awt.AWTException;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.datatransfer.StringSelection;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.time.StopWatch;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.BreadCrumbsButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CatalogFilterTitlesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CreateAndImportButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.MenuOptionsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.TypesEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.OutputType;
+import org.openqa.selenium.Platform;
+import org.openqa.selenium.TakesScreenshot;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.remote.RemoteWebDriver;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.Select;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.testng.Assert;
+import org.testng.Reporter;
+
+import com.relevantcodes.extentreports.LogStatus;
+
+public final class GeneralUIUtils {
+
+ private static int timeOut=60*3;
+
+ public static final String FILE_NAME = "Valid_tosca_Mycompute.yml";
+
+ /**************** DRIVERS ****************/
+ private static WebDriver driver;
+
+ public static void findComponentAndClick(String componentName) throws Exception {
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, "finding component " + componentName);
+ waitFordataTestIdVisibility("main-menu-input-search").sendKeys(componentName);
+ WebElement foundComp = null;
+ try {
+ foundComp = waitFordataTestIdVisibility(componentName);
+ foundComp.click();
+ GeneralUIUtils.waitForLoader();
+ waitFordataTestIdVisibility("formlifecyclestate");
+ } catch (Exception e) {
+ String msg = String.format("DID NOT FIND A COMPONENT NAMED %s", componentName);
+ SetupCDTest.getExtendTest().log(LogStatus.FAIL, msg);
+ System.out.println(msg);
+ Assert.fail(msg);
+ }
+ }
+
+ public static List<WebElement> getElemenetsFromTable(By by) {
+ return GeneralUIUtils.getDriver().findElements(by);
+ }
+
+ private static List<WebElement> getNewButtonsList() {
+ WebElement createButtonsArea = driver.findElement(By.className("w-sdc-dashboard-card-new"));
+ createButtonsArea.click();
+ List<WebElement> buttonsList = driver.findElements(By.className("w-sdc-dashboard-card-new-button"));
+ return buttonsList;
+ }
+
+ public static final String FILE_PATH = System.getProperty("user.dir") + "\\src\\main\\resources\\Files\\";
+ public static String fileName = "JDM_vfc.yml";
+ public static final String toscaErrorMessage = "Invalid TOSCA template.";
+ public static final String yamlError = "Invalid YAML file.";
+ public static final String allReadyExistErro = "Imported resource already exists in ASDC Catalog.";
+
+ public static WebElement hoverOnArea(String areaId) {
+ Actions actions = new Actions(driver);
+ WebElement area = getWebElementWaitForVisible(areaId);
+ actions.moveToElement(area).perform();
+ return area;
+ }
+
+ public static WebElement actionBuild(WebElement element) throws InterruptedException {
+ // make an action on page//hover on element
+ Actions build = new Actions(driver); // here you state ActionBuider
+ build.moveToElement(element).build().perform();// hover the element.
+ Thread.sleep(1000);
+ return element;
+ }
+
+ public static File takeScreenshot(String zipFile, String dir, String testName) throws IOException {
+ if (zipFile == null) {
+ zipFile = testName;
+ }
+ try {
+ File scrFile = ((TakesScreenshot) GeneralUIUtils.getDriver()).getScreenshotAs(OutputType.FILE);
+ File filePath = new File(String.format("%s/%s.png", dir, zipFile));
+ new File(dir).mkdirs();
+ FileUtils.copyFile(scrFile, filePath);
+ return filePath;
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+ return null;
+ }
+
+ public static void errorMessagePopupHandle(@SuppressWarnings("rawtypes") Supplier func) throws Exception {
+ try {
+ WebElement errorMessagePopupHeader = getDriver().findElement(By.className("w-sdc-modal-head-text"));
+ if (errorMessagePopupHeader.getText().equals("Error")) {
+ WebElement okButton = getWebButton("OK");
+ if (okButton.isDisplayed()) {
+ okButton.click();
+ func.get();
+ }
+ }
+ } catch (Exception e) {
+ throw new Exception("something went wrong, can't do anything");
+ }
+ }
+
+ public static void waitForLoader() {
+ waitForElements(By.className("tlv-loader"), 200, 3 * 60 * 1000);
+ }
+
+ public static void waitForLoaderOnboarding() {
+ waitForElements(By.className("tlv-loader"), 200, 13 * 60 * 1000);
+ }
+
+ public static List<WebElement> waitForElements(By by, int napPeriod, int maxWaitMS) {
+ boolean isKeepWaiting = true;
+ int currentWaitTimeMS = 0;
+ List<WebElement> elements = null;
+ while (isKeepWaiting) {
+ elements = getDriver().findElements(by);
+ isKeepWaiting = elements.size() > 0;
+ if (isKeepWaiting) {
+ sleep(napPeriod);
+ currentWaitTimeMS += napPeriod;
+ if (currentWaitTimeMS > maxWaitMS) {
+ isKeepWaiting = false;
+ }
+ }
+ }
+
+ return elements;
+
+ }
+
+ public static WebDriver getDriver() {
+ return driver;
+ }
+
+ public static WebElement rihtPanelAPI() {
+ return getWebElementWaitForVisible("tab-api");
+ }
+
+ public static void scrollDown() throws AWTException {
+ Robot robot = new Robot();
+ robot.keyPress(KeyEvent.VK_DOWN);
+ robot.keyRelease(KeyEvent.VK_DOWN);
+ }
+
+ // solution for "element not attached to the DOM anymore"
+ public static List<WebElement> getWorkspaceElements() throws InterruptedException {
+ Thread.sleep(1000);
+ List<WebElement> assets = GeneralUIUtils.getEelementsByClassName("w-sdc-dashboard-card-body");
+ return assets;
+ }
+
+ public static String getMethodName(Method method) {
+ return method.getName();
+ }
+
+ public static FileWriter InitializeprintToTxt(String testName) {
+ String idForTxtFile = new SimpleDateFormat("dd.MM.yyyy_HH.mm.ss").format(new Date());
+ File file = new File(testName + idForTxtFile);
+ FileWriter fw = null;
+ try {
+ fw = new FileWriter(file, true);
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.out.println(e.getLocalizedMessage());
+ }
+ return fw;
+ }
+
+ public static void closeFileWriter(FileWriter file) throws IOException {
+ file.flush();
+ file.close();
+ }
+
+ public static WebElement createAndImportButtons(CreateAndImportButtonsEnum type, WebDriver driver)
+ throws InterruptedException {
+ switch (type) {
+ case IMPORT_CP:
+ case IMPORT_VFC:
+ case IMPORT_VL:
+ hoverOnArea("importButtonsArea");
+ return GeneralUIUtils.getWebElementWaitForVisible("importVFCbutton");
+
+ case IMPORT_VF:
+ hoverOnArea("importButtonsArea");
+ return GeneralUIUtils.getWebElement(driver, "importVFbutton");
+ case CREATE_SERVICE:
+ hoverOnArea("AddButtonsArea", driver);
+ GeneralUIUtils.getWebElementWaitForVisible("createServiceButton").click();
+ ;
+ break;
+
+ case CREATE_PRODUCT:
+ GeneralUIUtils.getWebElement(driver, "createServiceButton").click();
+ GeneralUIUtils.getWebElementWaitForVisible("createServiceButton").click();
+ break;
+
+ default:
+ hoverOnArea("AddButtonsArea");
+ driver.findElement(By.xpath("//*[@data-tests-id='createResourceButton']")).click();
+ break;
+ }
+ return null;
+
+ }
+
+ public static String checkBoxLifeCyclestate(CheckBoxStatusEnum lifeCycle) {
+ String Status = "IN DESIGN CHECK OUT";
+ switch (lifeCycle) {
+ case CHECKIN:
+ Status = "IN DESIGN CHECK IN";
+ if (GeneralUIUtils.getWebElementWaitForVisible(lifeCycle.getValue()).isDisplayed()) {
+ GeneralUIUtils.getWebElementWaitForVisible(lifeCycle.getValue()).click();
+ }
+ break;
+ case CHECKOUT:
+ GeneralUIUtils.getWebElementWaitForVisible(lifeCycle.getValue()).click();
+ Status = "IN DESIGN CHECK OUT";
+ break;
+ case IN_TESTING:
+ GeneralUIUtils.getWebElementWaitForVisible(lifeCycle.getValue()).click();
+ Status = "IN TESTING";
+ break;
+ case READY_FOR_TESTING:
+ GeneralUIUtils.getWebElementWaitForVisible(lifeCycle.getValue()).click();
+ Status = "READY FOR TESTING";
+ break;
+ case CERTIFIED:
+ GeneralUIUtils.getWebElementWaitForVisible(lifeCycle.getValue()).click();
+ Status = "CERTIFIED";
+ break;
+ }
+ return Status;
+ }
+
+ public static String setFileTypeAndGetUniqId(ResourceTypeEnum fileType, ResourceReqDetails resourceDetails,
+ User user) throws IOException, Exception {
+ resourceDetails.setResourceType(fileType.toString());
+ RestCDUtils.getResource(resourceDetails, user);
+ return resourceDetails.getUniqueId();
+ }
+
+ public static void minimizeCatalogFilterByTitle(CatalogFilterTitlesEnum titlesEnum) {
+
+ switch (titlesEnum) {
+ case CATEGORIES:
+ GeneralUIUtils.getWebElementWaitForVisible(titlesEnum.getValue()).click();
+ break;
+ case STATUS:
+ GeneralUIUtils.getWebElementWaitForVisible(titlesEnum.getValue()).click();
+ break;
+ case TYPE:
+ GeneralUIUtils.getWebElementWaitForVisible(titlesEnum.getValue()).click();
+ break;
+ default:
+ break;
+ }
+ // webElementWaitForVisible.get(0).click();
+ // }
+ }
+
+ public static WebElement getWebElementWaitForVisible(String dataTestId) {
+ // try{
+ return waitFordataTestIdVisibility(dataTestId);
+ // }
+ // catch(Exception e){
+ // try{
+ // WebElement errorMessagePopupHeader =
+ // GeneralUIUtils.getDriver().findElement(By.className("w-sdc-modal-head-text"));
+ // if (errorMessagePopupHeader.getText().equals("Error")){
+ // WebElement okButton = GeneralUIUtils.getWebButton("OK");
+ // if (okButton.isDisplayed()){
+ //// takeScreenshot(LocalDateTime.now().toString().replaceAll(":", ""),
+ // SetupCDTest.SCREENSHOT_LOG_DIR);
+ // okButton.click();
+ // return getWebElementWaitForVisible(dataTestId);
+ // }
+ // }
+ // }
+ // catch(Exception exception){
+ // System.out.println(String.format("didn't find element with
+ // data-tests-id of %s", dataTestId));
+ // }
+ // }
+ // return null;
+
+ }
+
+ public static WebElement getWebElementById(String id) {
+ WebDriverWait wait = new WebDriverWait(driver, 5);
+ return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='" + id + "']")));
+ }
+
+ public static WebElement getWebElementByName(String name) {
+ return driver.findElement(By.name(name));
+ }
+
+ // New tedy , this function will get the web elements by The new attribute
+ // value(data-tests-id)
+ public static List<WebElement> getWebElements(String dataTestId) {
+ return waitForElementsListVisibility(dataTestId);
+ }
+
+ // New tedy , this function will get the web element Button by The new
+ // attribute value(data-tests-id)
+ public static WebElement getWebButton(String dataTestId) {
+ WebDriverWait wait = new WebDriverWait(driver, 3 * 60);
+ return wait
+ .until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@data-tests-id='" + dataTestId + "']")));
+ }
+
+ // New tedy , this function will wait till the web element be
+ // visible(data-tests-id)
+ public static Boolean waitForInvisibileElement(String dataTestId) {
+ WebDriverWait wait = new WebDriverWait(driver, 3 * 60);
+ return wait.until(
+ ExpectedConditions.invisibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "']")));
+ }
+
+ public static WebElement waitFordataTestIdVisibility(String dataTestId) {
+ WebDriverWait wait = new WebDriverWait(driver, 3 * 60);
+ return wait.until(
+ ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "']")));
+ }
+
+ public static boolean clickcheckbox(String category) {
+ try {
+
+ } catch (Exception e) {
+ return false;
+ }
+ return true;
+ }
+
+ public static WebElement waitForContainsdataTestIdVisibility2(String dataTestId) {
+ WebDriverWait wait = new WebDriverWait(driver, 5);
+ return wait.until(ExpectedConditions
+ .visibilityOfElementLocated(By.xpath("//*[contains (@data-tests-id, '" + dataTestId + "'])")));
+ }
+
+ public static List<WebElement> waitForContainsdataTestIdVisibility(String dataTestId) {
+ WebDriverWait wait = new WebDriverWait(driver, 5);
+ return wait.until(ExpectedConditions
+ .visibilityOfAllElementsLocatedBy(By.xpath("//*[contains (@data-tests-id, '" + dataTestId + "'])")));
+ }
+
+ public static WebElement waitForClassNameVisibility(String className) {
+ return waitForElementVisibility(By.className(className));
+ }
+
+ public static WebElement waitForElementVisibility(By by) {
+ return waitForElementVisibility(by, 3 * 60);
+ }
+
+ public static WebElement waitForElementVisibility(By by, int duration) {
+ WebDriverWait wait = new WebDriverWait(driver, duration);
+ return wait.until(ExpectedConditions.visibilityOf(driver.findElement(by)));
+ }
+
+ public static List<WebElement> waitForElementsListVisibility(By by) {
+ WebDriverWait wait = new WebDriverWait(driver, 3 * 60);
+ return wait.until(ExpectedConditions.visibilityOfAllElements(driver.findElements(by)));
+ }
+
+ public static boolean waitForElementsListInvisibility(By by) {
+ WebDriverWait wait = new WebDriverWait(driver, 3 * 60);
+ return wait.until(ExpectedConditions.invisibilityOfElementLocated(by));
+ }
+
+ // New tedy , this function will wait till the web elements be
+ // visible(data-tests-id)
+ public static List<WebElement> waitForElementsListVisibility(String dataTestId) {
+ WebDriverWait wait = new WebDriverWait(driver, 3 * 60);
+ List<WebElement> findElements = wait.until(ExpectedConditions
+ .visibilityOfAllElementsLocatedBy(By.xpath("//*[@data-tests-id='" + dataTestId + "']")));
+ if (findElements.size() > 0) {
+ return findElements;
+ }
+ System.out.println("Elements not Exist!");
+ return null;
+ }
+
+ public static List<WebElement> waitForElementsListVisibilityTestMethod(String dataTestId) {
+ return driver.findElements(By.xpath("//*[@data-tests-id='" + dataTestId + "']"));
+ }
+
+ public static WebElement waitForBrowseButton(String dataTestId) {
+
+ return driver.findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']"));
+ }
+
+ public static List<WebElement> getWebElementsListByDataTestId(String dataTestId) {
+ return driver.findElements(By.xpath("//*[@data-tests-id='" + dataTestId + "']"));
+
+ }
+
+ public static WebElement getWebElementByDataTestId(String dataTestId) {
+ return driver.findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']"));
+ }
+
+ public static WebElement waitUntilClickableButton(String dataTestId) {
+ WebDriverWait wait = new WebDriverWait(driver, 3 * 60);
+ return wait.until(ExpectedConditions
+ .elementToBeClickable(driver.findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))));
+ }
+
+ // interface Throws {
+ // <T,R, E extends Exception> R apply(T t) throws E;
+ // }
+ // public static <R> R swallowException(Throws<T,R,E> supplier){
+ // R returnValue;
+ // try{
+ // returnValue = supplier.get();
+ // }
+ // catch(Exception e){
+ // returnValue = null;
+ // }
+ // return returnValue;
+ // }
+ // Use this method only for special cases, otherwise use
+ // org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils.getWebElementWaitForVisible(WebDriver,
+ // String)
+
+ public static boolean isElementPresent(String dataTestId) {
+ try {
+ driver.findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']"));
+ return true;
+ } catch (org.openqa.selenium.NoSuchElementException e) {
+ return false;
+ }
+ }
+
+ public static <R> R retryMethodOnException(Supplier<R> supplier) {
+ boolean stopSearch = false;
+ R ret = null;
+ Exception throwMe = null;
+ int timeElapsed = 0;
+ while (!stopSearch) {
+ try {
+ ret = supplier.get();
+ } catch (Exception e) {
+ throwMe = e;
+ GeneralUIUtils.sleep(250);
+ timeElapsed += 250;
+ if (timeElapsed > 5000) {
+ stopSearch = true;
+ }
+
+ } finally {
+ if (ret != null) {
+ stopSearch = true;
+ }
+ }
+ }
+ if (ret == null) {
+ throw new RuntimeException(throwMe);
+ } else {
+ return ret;
+ }
+
+ }
+
+ // this method will login as tester and start test or accept Assets.
+ public static void testerUser(Boolean startTest, Boolean accept, ResourceReqDetails resource) throws Exception {
+ // GeneralUIUtils.getWebElement(ResourceUIUtils.getName()).click();
+ String url = "http://localhost:8181/sdc1/proxy-tester1#/dashboard";
+ sleep(2000);
+ SetupCDTest.navigateToUrl(url);
+ GeneralUIUtils.getWebElementWaitForVisible(resource.getName()).click();
+
+ if (startTest) {
+ clickStartTesting();
+ }
+
+ if (accept) {
+ clickAccept();
+ }
+ }
+
+ public static void governorUser(Boolean reject, Boolean approve, ResourceReqDetails resource) throws Exception {
+ // GeneralUIUtils.getWebElement(ResourceUIUtils.getName()).click();
+ String url = "http://localhost:8181/sdc1/proxy-governor1#/dashboard";
+ sleep(2000);
+ SetupCDTest.navigateToUrl(url);
+ GeneralUIUtils.getWebElementWaitForVisible("w-sdc-dashboard-card-info");
+ GeneralUIUtils.getWebElementWaitForVisible(resource.getName()).click();
+ if (reject) {
+ clickReject();
+ }
+ if (approve) {
+ clickApprove();
+ }
+ sleep(1000);
+ }
+
+ public static void opsUser(Boolean disribute, Boolean reDisribute, ResourceReqDetails resource) throws Exception {
+ // GeneralUIUtils.getWebElement(ResourceUIUtils.getName()).click();
+ String url = "http://localhost:8181/sdc1/proxy-ops1#/dashboard";
+ sleep(2000);
+ SetupCDTest.navigateToUrl(url);
+ sleep(2000);
+ GeneralUIUtils.getWebElementWaitForVisible("w-sdc-dashboard-card-info");
+ GeneralUIUtils.getWebElementWaitForVisible(resource.getName()).click();
+ if (reDisribute) {
+ clickReDistribute();
+ }
+ if (disribute) {
+ clickDistribute();
+ }
+ sleep(1000);
+ }
+
+ // this function located select list by the data-test-id value and the item
+ // to be selected..
+ public static Select getSelectList(String item, String datatestsid) {
+ Select selectlist = new Select(waitFordataTestIdVisibility(datatestsid));
+ if (item != null) {
+ selectlist.selectByVisibleText(item);
+ }
+ return selectlist;
+ }
+
+ // Define description area .
+ public static String defineDescription(String descriptionText) {
+
+ WebElement resourceDescriptionTextbox = GeneralUIUtils.getWebElementWaitForVisible("description");
+ resourceDescriptionTextbox.clear();
+ resourceDescriptionTextbox.sendKeys(descriptionText);
+ return descriptionText;
+ }
+
+ public static WebElement catalogSearchBox(String searchText) {
+ WebElement searchBox = GeneralUIUtils.getWebElementWaitForVisible("main-menu-input-search");
+ searchBox.clear();
+ searchBox.sendKeys(searchText);
+ return searchBox;
+ }
+
+ // enum
+ public static void selectMenuOptionbyname(List<WebElement> options, MenuOptionsEnum optionName)
+ throws InterruptedException {
+
+ for (WebElement webElement : options) {
+ if (webElement.getText().equals(optionName.getValue())) {
+ actionBuild(webElement).click();
+ } else {
+ System.out.println("No such element!");
+ }
+ }
+
+ }
+
+ // back to workspace by Clicking the ASDC Logo.!
+ public static void clickASDCLogo() {
+ WebDriverWait wait = new WebDriverWait(driver, 15);
+ wait.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("ASDC")));
+ WebElement ClickASDCLogo = driver.findElement(By.linkText("ASDC"));
+ ClickASDCLogo.click();
+ GeneralUIUtils.waitForLoader();
+ }
+
+ public static void clickExitSign() throws InterruptedException {
+ WebElement exitSign = driver.findElement(By.xpath("//*[contains(@class, 'x-btn')]"));
+ actionBuild(exitSign);
+ Thread.sleep(1000);
+ driver.findElement(By.xpath("//*[contains(@class, 'x-btn')]")).click();
+ }
+
+ public static void clickCreateButton() throws Exception {
+ getWebButton("create/save").click();
+ GeneralUIUtils.waitForLoader();
+ getWebElementWaitForVisible(DataTestIdEnum.LifeCyleChangeButtons.CHECK_IN.getValue());
+ }
+
+ public static void clickUpdateButton() throws Exception {
+ GeneralUIUtils.sleep(500);
+ clickCreateButton();
+ }
+
+ public static void checkOut() throws InterruptedException, AWTException {
+ actionBuild(getWebButton("check_out"));
+ getWebButton("check_out").click();
+ waitForInvisibileElement("check_out");
+ }
+
+ public static void clickStartTesting() throws InterruptedException {
+ actionBuild(getWebButton("start_testing"));
+ getWebButton("start_testing").click();
+ waitForInvisibileElement("start_testing");
+ getWebButton("create/save").click();
+ }
+
+ public static void clickAccept() throws InterruptedException {
+ actionBuild(getWebButton("accept"));
+ getWebButton("accept").click();
+ getWebElementWaitForVisible("checkindialog").sendKeys("Accept!");
+ clickOkButton();
+ sleep(1000);
+ }
+
+ public static void clickReject() throws InterruptedException {
+ actionBuild(getWebButton("reject"));
+ getWebButton("reject").click();
+ waitForInvisibileElement("reject");
+ }
+
+ public static void clickApprove() throws InterruptedException {
+ actionBuild(getWebButton("approve"));
+ getWebButton("approve").click();
+ waitForInvisibileElement("approve");
+ }
+
+ public static void clickDistribute() throws InterruptedException {
+ actionBuild(getWebButton("distribute"));
+ getWebButton("distribute").click();
+ waitForInvisibileElement("redistribute");
+ }
+
+ public static void clickReDistribute() throws InterruptedException {
+ actionBuild(getWebButton("redistribute"));
+ getWebButton("redistribute").click();
+ }
+
+ public static void clickCancel() {
+ getWebButton("cancel").click();
+ waitForInvisibileElement("cancel");
+ }
+
+ public static void checkIn() throws InterruptedException {
+ actionBuild(getWebButton("check_in"));
+ getWebButton("check_in").click();
+ getWebElementWaitForVisible("checkindialog").sendKeys("Check in!");
+ clickOkButton();
+ waitForInvisibileElement("checkindialog");
+ }
+
+ public static void clickSaveIcon() throws InterruptedException {
+ actionBuild(GeneralUIUtils.waitFordataTestIdVisibility("create/save"));
+ GeneralUIUtils.getWebButton(/* "delete_version" */"create/save").click();
+ Thread.sleep(1000);
+
+ }
+
+ // Open menu of Created Object and select option.
+ public static void openObjectMenuAndSelectOption(String uniqid, MenuOptionsEnum optionName)
+ throws InterruptedException, AWTException {
+ WebElement hoverOnMenu = actionBuild(getWebElementWaitForVisible(uniqid));
+ List<WebElement> menuOptions = hoverOnMenu.findElement(By.xpath("./following-sibling::*[1]"))
+ .findElements(By.xpath(".//*"));
+ selectMenuOptionbyname(menuOptions, optionName);
+ }
+
+ // Get elements by className.
+ public static WebElement getEelementByClassName(String element) {
+ try {
+ WebDriverWait wait = new WebDriverWait(driver, 3 * 60);
+ return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@class='" + element + "']")));
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ public static List<WebElement> getEelementsByClassName(String element) {
+ WebDriverWait wait = new WebDriverWait(driver, 3 * 60);
+ return wait
+ .until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//*[@class='" + element + "']")));
+ }
+
+ public static WebElement getEelementByContainsdatatestsid(String datatestId) {
+ WebDriverWait wait = new WebDriverWait(driver, 3 * 60);
+ return wait.until(ExpectedConditions
+ .visibilityOfElementLocated(By.xpath("//*[contains(@data-tests-id, '" + datatestId + "')]")));
+ }
+
+ // list
+ public static List<WebElement> getEelementsByContainsDataTestsId(String datatestId) {
+ WebDriverWait wait = new WebDriverWait(driver, 3 * 60);
+ return wait.until(ExpectedConditions
+ .visibilityOfAllElementsLocatedBy(By.xpath("//*[contains(@data-tests-id, '" + datatestId + "')]")));
+ }
+
+ public static WebElement getEelementBycontainsClassName(String classname) {
+ WebDriverWait wait = new WebDriverWait(driver, 3 * 60);
+ return wait.until(
+ ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[contains(@class, '" + classname + "')]")));
+ }
+
+ public static WebElement getEelementByLinkText(String linkText) {
+ WebDriverWait wait = new WebDriverWait(driver, 3 * 60);
+ return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@text='" + linkText + "']")));
+ }
+
+ public static List<WebElement> getEelementsBycontainsClassName(String classname) {
+ WebDriverWait wait = new WebDriverWait(driver, 3 * 60);
+ return wait.until(ExpectedConditions
+ .visibilityOfAllElementsLocatedBy(By.xpath("//*[contains(@class, '" + classname + "')]")));
+ }
+
+ public static WebElement getButtonByClassName(String element) {
+ WebDriverWait wait = new WebDriverWait(driver, 3 * 60);
+ return wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//button[@class='" + element + "']")));
+ }
+
+ public static void checkinCheckout(String elementName) throws Exception, Exception {
+ checkIn();
+ getWebElementWaitForVisible(elementName).click();
+ ;
+ checkOut();
+
+ }
+
+ public static void moveToStep(DataTestIdEnum.StepsEnum Stepname) {
+ moveToStep(Stepname.getValue());
+ }
+
+ public static void moveToStep(String dataTestId) {
+ getWebButton(dataTestId).click();
+ waitForLoader();
+ }
+
+ public static void editFile(String name) {
+ WebElement editfilebutton = driver.findElement(By.id("edit" + name + ""));
+ editfilebutton.click();
+ }
+
+ public static void deleteFile(String name) {
+ WebElement deletebutton = driver.findElement(By.id("delete" + name + ""));
+ deletebutton.click();
+ }
+
+ public static void downloadFile(String name) {
+ WebElement downloadbutton = driver.findElement(By.id("download" + name + ""));
+ downloadbutton.click();
+ }
+
+ public static void sleep(int duration) {
+ try {
+ Thread.sleep(duration);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static void hasDriver() {
+ try {
+ driver.getCurrentUrl();
+ driver.quit();
+ } catch (NullPointerException e) {
+ }
+ }
+
+ public static void initDriver() {
+ try {
+ boolean remoteTesting = SetupCDTest.config.isRemoteTesting();
+ if (!remoteTesting) {
+ System.out.println("opening LOCAL browser");
+ driver = new FirefoxDriver();
+
+ } else {
+ System.out.println("opening REMOTE browser");
+ String remoteEnvIP = SetupCDTest.config.getRemoteTestingMachineIP();
+ String remoteEnvPort = SetupCDTest.config.getRemoteTestingMachinePort();
+ DesiredCapabilities cap = new DesiredCapabilities();
+ cap = DesiredCapabilities.firefox();
+ cap.setPlatform(Platform.WINDOWS);
+ cap.setBrowserName("firefox");
+
+ String remoteNodeUrl = String.format(SetupCDTest.SELENIUM_NODE_URL, remoteEnvIP, remoteEnvPort);
+ driver = new RemoteWebDriver(new URL(remoteNodeUrl), cap);
+ }
+
+
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public static void windowZoomOut() {
+ final int zoomOutFactor = 2;
+ for (int i = 0; i < zoomOutFactor; i++) {
+ driver.findElement(By.tagName("html")).sendKeys(Keys.chord(Keys.CONTROL, Keys.SUBTRACT));
+ }
+ }
+
+ public static void defineTagsList(ResourceReqDetails resource, String[] resourceTags) {
+ List<String> taglist = new ArrayList<String>();
+ ;
+ WebElement resourceTagsTextbox = getWebElementWaitForVisible("i-sdc-tag-input");
+ for (String tag : resourceTags) {
+ resourceTagsTextbox.clear();
+ resourceTagsTextbox.sendKeys(tag);
+ resourceTagsTextbox.sendKeys(Keys.ENTER);
+ taglist.add(tag);
+ // waitForElements(By.className("sdc-loader"), 250, 15000);
+ }
+ }
+
+ // public static List<WebElement> waitForElements(By by, int napPeriod, int
+ // maxWaitMS){
+ // List<WebElement> elements = null;
+ //
+ // elements = getDriver().findElements(by);
+ // if( currentWaitTimeMS > maxWaitMS){
+ // }
+ // resource.setTags(taglist);
+ // return elements;
+ // }
+ public static void selectTabInRightPallete(String className) throws Exception {
+ WebElement tab = getEelementBycontainsClassName(className);
+ tab.click();
+ }
+
+ public static WebElement getWebElement(WebDriver driver, String dataTestId) {
+ return waitForElementVisibility(dataTestId);
+ }
+
+ public static void clickOkButton() throws InterruptedException {
+ // actionBuild(getWebButton("OK"));
+ // sleep(2000);
+ getWebButton("OK").click();
+ }
+
+ public static WebElement waitForElementVisibility(String dataTestId) {
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 30);
+ return wait.until(
+ ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "']")));
+ }
+
+ public static WebElement deleteVersion() {
+ return GeneralUIUtils.waitFordataTestIdVisibility("delete_version");
+ }
+
+ // public static List<WebElement> getFilterTitles() throws Exception {
+ //
+ // return
+ // GeneralUIUtils.getEelementsByClassName("i-sdc-designer-leftbar-section-title-text");
+ //
+ // }
+
+ public static void deleteVersionInUI() throws Exception {
+
+ actionBuild(deleteVersion());
+ deleteVersion().click();
+ GeneralUIUtils.clickOkButton();
+ }
+
+ public static void uploadFileWithJavaRobot(String FilePath, String FileName) throws Exception {
+ StringSelection sel = new StringSelection(FilePath + FileName);
+ Toolkit.getDefaultToolkit().getSystemClipboard().setContents(sel, null);
+ Thread.sleep(1000);
+ Robot robot = new Robot();
+ robot.delay(1000);
+
+ // Release Enter
+ robot.keyRelease(KeyEvent.VK_ENTER);
+
+ // Press CTRL+V
+ robot.keyPress(KeyEvent.VK_CONTROL);
+ robot.keyPress(KeyEvent.VK_V);
+
+ // Release CTRL+V
+ robot.keyRelease(KeyEvent.VK_CONTROL);
+ robot.keyRelease(KeyEvent.VK_V);
+ Thread.sleep(1000);
+
+ // Press Enter
+ robot.keyPress(KeyEvent.VK_ENTER);
+ robot.keyRelease(KeyEvent.VK_ENTER);
+ Thread.sleep(3000);
+ }
+
+ public static String catalogFilterTypeChecBox(TypesEnum enumtype) throws Exception {
+ String Type = enumtype.toString().toLowerCase();
+ getWebElementWaitForVisible(enumtype.getValue()).click();
+ return Type;
+ }
+
+ public static List<String> catalogFilterStatusChecBox(CheckBoxStatusEnum statusEnum) throws Exception {
+ List<String> status = null;
+ switch (statusEnum) {
+ case IN_DESIGN:
+ status = Arrays.asList("NOT_CERTIFIED_CHECKIN", "NOT_CERTIFIED_CHECKOUT");
+ getWebElementWaitForVisible(statusEnum.getCatalogValue()).click();
+ break;
+ case READY_FOR_TESTING:
+ status = Arrays.asList("READY_FOR_CERTIFICATION");
+ getWebElementWaitForVisible(statusEnum.getCatalogValue()).click();
+ break;
+ case IN_TESTING:
+ status = Arrays.asList("CERTIFICATION_IN_PROGRESS");
+ getWebElementWaitForVisible(statusEnum.getCatalogValue()).click();
+ break;
+ case CERTIFIED:
+ status = Arrays.asList("CERTIFIED");
+ getWebElementWaitForVisible(statusEnum.getCatalogValue()).click();
+ break;
+ case DISTRIBUTED:
+ status = Arrays.asList("CERTIFIED");
+ getWebElementWaitForVisible(statusEnum.getCatalogValue()).click();
+ break;
+ }
+ return status;
+ }
+
+ public static void clickBreadCrumbs(BreadCrumbsButtonsEnum button) {
+ switch (button) {
+ case CATALOG:
+ GeneralUIUtils.getWebButton(button.getButton()).click();
+ break;
+ case HOME:
+ GeneralUIUtils.getWebButton(button.getButton()).click();
+ break;
+ case ON_BOARDING:
+ GeneralUIUtils.getWebButton(button.getButton()).click();
+ break;
+ default:
+ break;
+ }
+ }
+
+ public static void clickPrintScreen() {
+ getEelementByClassName("e-sdc-small-print-screen").click();
+ }
+
+ public static void clickSubmitForTest() throws InterruptedException {
+ getWebButton("submit_for_testing").click();
+ WebElement commentText = getDriver().findElement(By.className("w-sdc-modal-body-email"));
+ commentText.sendKeys("Submit For Test");
+ sleep(3000);
+ clickOkButton();
+ }
+
+ public static WebElement hoverOnArea(String areaId, WebDriver driver) {
+ Actions actions = new Actions(driver);
+ WebElement area = getWebElement(driver, areaId);
+ actions.moveToElement(area).perform();
+ return area;
+ }
+
+ public static WebElement moveToNextStep(DataTestIdEnum.StepsEnum Stepname) {
+ return getWebButton(Stepname.getValue());
+ }
+
+ public static String getComponentVersion(String componentName) {
+ return GeneralUIUtils.getWebElementWaitForVisible(componentName + "Version").getText();
+ }
+
+ public static void clickOnHTMLElementByDataTestId(String dataTestId) throws Exception {
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 20);
+ StopWatch performanceMesuring = new StopWatch();
+ performanceMesuring.start();
+ WebElement element = wait
+ .until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@data-tests-id='" + dataTestId + "']")));
+ performanceMesuring.stop();
+ element.click();
+ performanceMesuring(dataTestId, performanceMesuring);
+
+ }
+
+ private static void performanceMesuring(String dataTestId, StopWatch performanceMesuring) {
+ Reporter.log("click on: " + dataTestId);
+ System.out.println("click on: " + dataTestId);
+ Reporter.log("Total Load Time Until click on button : " + dataTestId + " "
+ + (((double) performanceMesuring.getTime()) / 1000) + " seconds");
+ System.out.println("Total Load Time Until click on button : " + dataTestId + " "
+ + (((double) performanceMesuring.getTime()) / 1000) + " seconds");
+ performanceMesuring.reset();
+ performanceMesuring.start();
+ Boolean waitForElementInVisibilityByClassName = GeneralUIUtils.waitForElementInVisibilityByClassName(driver,
+ "tlv-loader");
+ performanceMesuring.stop();
+ Reporter.log("Total time before loader disappear: " + (((double) performanceMesuring.getTime()) / 1000)
+ + " seconds");
+ System.out.println("Total time before loader disappear: " + (((double) performanceMesuring.getTime()) / 1000)
+ + " seconds");
+ }
+
+ public static Boolean waitForElementInVisibilityByClassName(WebDriver driver, String className) {
+ WebDriverWait wait = new WebDriverWait(driver, 30);
+ return wait.until(ExpectedConditions.invisibilityOfElementLocated(By.className(className)));
+ }
+
+ public static void findComponentAndClick(ResourceReqDetails resource) throws Exception {
+
+ WebElement searchTextbox = GeneralUIUtils.getWebElementWaitForVisible("main-menu-input-search");
+ searchTextbox.clear();
+ searchTextbox.sendKeys(resource.getName());
+ clickOnHTMLElementByDataTestId(resource.getName());
+ }
+
+ public static void clickOnHTMLElementBylinkText(String linkText) throws Exception {
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 20);
+ StopWatch performanceMesuring = new StopWatch();
+ performanceMesuring.start();
+ WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.linkText(linkText)));
+ performanceMesuring.stop();
+ element.click();
+ performanceMesuring(linkText, performanceMesuring);
+ }
+
+ public static void ultimateWait(){
+ long startTime = System.nanoTime();
+
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.waitForAngular();
+
+ long estimateTime = System.nanoTime();
+ long duration = TimeUnit.NANOSECONDS.toSeconds(estimateTime - startTime);
+ if(duration > timeOut){
+ SetupCDTest.getExtendTest().log(LogStatus.WARNING, String.format("Delays on page, %d seconds", duration));
+ }
+ }
+
+ public static void waitForAngular(){
+ WebDriverWait wait = new WebDriverWait(getDriver(), 90, 100);
+ wait.until(AdditionalConditions.pageLoadWait());
+ wait.until(AdditionalConditions.angularHasFinishedProcessing());
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ImportAssetUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ImportAssetUIUtils.java
new file mode 100644
index 0000000000..f917a4784f
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ImportAssetUIUtils.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.utilities;
+
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.CreateAndImportButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+public class ImportAssetUIUtils {
+
+ public static void importAsssetAndFillGeneralInfo(String FILE_PATH, String fileName,
+ ResourceReqDetails resourceDetails, User user, CreateAndImportButtonsEnum type) throws Exception {
+ ResourceUIUtils.importFileWithSendKey(FILE_PATH, fileName, type);
+ ResourceUIUtils.fillResourceGeneralInformationPage(resourceDetails, user);
+ }
+
+ public static void importAsssetFillGeneralInfoAndSelectIcon(String FILE_PATH, String fileName,
+ ResourceReqDetails resourceDetails, User user, CreateAndImportButtonsEnum type) throws Exception {
+ importAsssetAndFillGeneralInfo(FILE_PATH, fileName, resourceDetails, user, type);
+ GeneralUIUtils.clickCreateButton();
+ ResourceUIUtils.selectRandomResourceIcon();
+ }
+
+ // checking or unchecking the checkbox on right palette at designer
+ // workspace
+ public static void checkbox(String checkBoxname, WebDriver driver) {
+ driver.findElement(By.xpath("//label[@for='" + checkBoxname + "']")).click();
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java
new file mode 100644
index 0000000000..db6bada41e
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java
@@ -0,0 +1,457 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.utilities;
+
+import static org.testng.AssertJUnit.assertEquals;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.nio.file.FileSystems;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.zip.ZipFile;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.mime.MultipartEntityBuilder;
+import org.apache.http.entity.mime.content.FileBody;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.json.JSONObject;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.testng.Assert;
+
+import com.relevantcodes.extentreports.LogStatus;
+
+public class OnboardingUtils {
+
+ public OnboardingUtils() {
+ }
+
+ private static String vendorId;
+ private static String vendorLicenseName;
+ private static String vendorLicenseAgreementId;
+ private static String featureGroupId;
+
+ public int countFilesInZipDirectory(String filepath, String filename) throws Exception, Throwable {
+ ZipFile zipFile = new ZipFile(filepath + filename);
+ return zipFile.size() - 1;
+ }
+
+ public static Object[] getZipFileNamesFromFolder(String filepath) {
+ return FileHandling.getFileNamesFromFolder(filepath, ".zip");
+ }
+
+ public static String createVendorSoftwareProduct(String HeatFileName, String filepath, User user)
+ throws Exception, Throwable {
+ String vspName = handleFilename(HeatFileName);
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, "Starting to create vendor software product");
+
+ RestResponse createNewVendorSoftwareProduct = createNewVendorSoftwareProduct(vspName, vendorLicenseName,
+ vendorId, vendorLicenseAgreementId, featureGroupId, user);
+ assertEquals("did not succeed to create new VSP", 200,
+ createNewVendorSoftwareProduct.getErrorCode().intValue());
+ String vspid = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "vspId");
+
+ RestResponse uploadHeatPackage = uploadHeatPackage(filepath, HeatFileName, vspid, user);
+ assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue());
+
+ RestResponse checkin = checkinVendorSoftwareProduct(vspid, user);
+ assertEquals("did not succeed to checking new VSP", 200, checkin.getErrorCode().intValue());
+
+ RestResponse submit = submitVendorSoftwareProduct(vspid, user);
+ assertEquals("did not succeed to submit new VSP", 200, submit.getErrorCode().intValue());
+
+ RestResponse createPackage = createPackageOfVendorSoftwareProduct(vspid, user);
+ assertEquals("did not succeed to create package of new VSP ", 200, createPackage.getErrorCode().intValue());
+
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, "Succeeded to create vendor software product");
+
+ return vspName;
+ }
+
+ private static String handleFilename(String heatFileName) {
+ final String namePrefix = "ciVFOnboarded-";
+ final String nameSuffix = "-" + getShortUUID();
+
+ String subHeatFileName = heatFileName.substring(0, heatFileName.lastIndexOf("."));
+
+ if ((namePrefix + subHeatFileName + nameSuffix).length() >= 50) {
+ subHeatFileName = subHeatFileName.substring(0, 50 - namePrefix.length() - nameSuffix.length());
+ }
+
+ if (subHeatFileName.contains("(") || subHeatFileName.contains(")")) {
+ subHeatFileName = subHeatFileName.replace("(", "-");
+ subHeatFileName = subHeatFileName.replace(")", "-");
+ }
+
+ String vnfName = namePrefix + subHeatFileName + nameSuffix;
+ return vnfName;
+ }
+
+ public static void createVendorLicense(User user) throws Exception {
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, "Starting to create vendor license");
+ vendorLicenseName = "ciLicense" + getShortUUID();
+ RestResponse vendorLicenseResponse = createVendorLicenseModels_1(vendorLicenseName, user);
+ assertEquals("did not succeed to create vendor license model", 200,
+ vendorLicenseResponse.getErrorCode().intValue());
+ vendorId = ResponseParser.getValueFromJsonResponse(vendorLicenseResponse.getResponse(), "value");
+
+ RestResponse vendorKeyGroupsResponse = createVendorKeyGroups_2(vendorId, user);
+ assertEquals("did not succeed to create vendor key groups", 200,
+ vendorKeyGroupsResponse.getErrorCode().intValue());
+ String keyGroupId = ResponseParser.getValueFromJsonResponse(vendorKeyGroupsResponse.getResponse(), "value");
+
+ RestResponse vendorEntitlementPool = createVendorEntitlementPool_3(vendorId, user);
+ assertEquals("did not succeed to create vendor entitlement pool", 200,
+ vendorEntitlementPool.getErrorCode().intValue());
+ String entitlementPoolId = ResponseParser.getValueFromJsonResponse(vendorEntitlementPool.getResponse(),
+ "value");
+
+ RestResponse vendorLicenseFeatureGroups = createVendorLicenseFeatureGroups_4(vendorId, keyGroupId,
+ entitlementPoolId, user);
+ assertEquals("did not succeed to create vendor license feature groups", 200,
+ vendorLicenseFeatureGroups.getErrorCode().intValue());
+ featureGroupId = ResponseParser.getValueFromJsonResponse(vendorLicenseFeatureGroups.getResponse(), "value");
+
+ RestResponse vendorLicenseAgreement = createVendorLicenseAgreement_5(vendorId, featureGroupId, user);
+ assertEquals("did not succeed to create vendor license agreement", 200,
+ vendorLicenseAgreement.getErrorCode().intValue());
+ vendorLicenseAgreementId = ResponseParser.getValueFromJsonResponse(vendorLicenseAgreement.getResponse(),
+ "value");
+
+ RestResponse checkinVendorLicense = checkinVendorLicense(vendorId, user);
+ assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue());
+
+ RestResponse submitVendorLicense = submitVendorLicense(vendorId, user);
+ assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue());
+
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, "Succeeded to create vendor license");
+ }
+
+ private static String getShortUUID() {
+ return UUID.randomUUID().toString().split("-")[0];
+ }
+
+ private static RestResponse actionOnComponent(String vspid, String action, String onboardComponent, User user) throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format("http://%s:%s/onboarding-api/v1.0/" + onboardComponent + "/%s/actions", config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+ String userId = user.getUserId();
+
+ JSONObject jObject = new JSONObject();
+ jObject.put("action", action);
+
+ Map<String, String> headersMap = prepareHeadersMap(userId);
+
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendPut(url, jObject.toString(), headersMap);
+ return response;
+ }
+
+ private static RestResponse checkinVendorLicense(String vspid, User user) throws Exception {
+ return actionOnComponent(vspid, "Checkin", "vendor-license-models", user);
+ }
+
+ private static RestResponse submitVendorLicense(String vspid, User user) throws Exception {
+ return actionOnComponent(vspid, "Submit", "vendor-license-models", user);
+ }
+
+ private static RestResponse createVendorLicenseModels_1(String name, User user) throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models", config.getCatalogBeHost(), config.getCatalogBePort());
+ String userId = user.getUserId();
+ JSONObject jObject = new JSONObject();
+ jObject.put("vendorName", name);
+ jObject.put("description", "new vendor license model");
+ jObject.put("iconRef", "icon");
+
+ Map<String, String> headersMap = prepareHeadersMap(userId);
+
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap);
+ return response;
+
+ }
+
+ private static RestResponse createVendorLicenseAgreement_5(String vspid, String featureGroupId, User user)
+ throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/license-agreements",
+ config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+
+ String userId = user.getUserId();
+
+ JSONObject licenseTermpObject = new JSONObject();
+ licenseTermpObject.put("choice", "Fixed_Term");
+ licenseTermpObject.put("other", "");
+
+ JSONObject jObjectBody = new JSONObject();
+ jObjectBody.put("name", "abc");
+ jObjectBody.put("description", "new vendor license agreement");
+ jObjectBody.put("requirementsAndConstrains", "abc");
+ jObjectBody.put("licenseTerm", licenseTermpObject);
+ jObjectBody.put("addedFeatureGroupsIds", Arrays.asList(featureGroupId).toArray());
+
+ Map<String, String> headersMap = prepareHeadersMap(userId);
+
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap);
+ return response;
+ }
+
+ private static RestResponse createVendorLicenseFeatureGroups_4(String vspid, String licenseKeyGroupId,
+ String entitlementPoolId, User user) throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/feature-groups",
+ config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+
+ String userId = user.getUserId();
+
+ JSONObject jObject = new JSONObject();
+ jObject.put("name", "xyz");
+ jObject.put("description", "new vendor license feature groups");
+ jObject.put("partNumber", "123abc456");
+ jObject.put("addedLicenseKeyGroupsIds", Arrays.asList(licenseKeyGroupId).toArray());
+ jObject.put("addedEntitlementPoolsIds", Arrays.asList(entitlementPoolId).toArray());
+
+ Map<String, String> headersMap = prepareHeadersMap(userId);
+
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap);
+ return response;
+
+ }
+
+ private static RestResponse createVendorEntitlementPool_3(String vspid, User user) throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/entitlement-pools",
+ config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+
+ String userId = user.getUserId();
+
+ JSONObject jEntitlementMetricObject = new JSONObject();
+ jEntitlementMetricObject.put("choice", "CPU");
+ jEntitlementMetricObject.put("other", "");
+
+ JSONObject jAggregationFunctionObject = new JSONObject();
+ jAggregationFunctionObject.put("choice", "Peak");
+ jAggregationFunctionObject.put("other", "");
+
+ JSONObject jOperationalScope = new JSONObject();
+ jOperationalScope.put("choices", Arrays.asList("Availability_Zone").toArray());
+ jOperationalScope.put("other", "");
+
+ JSONObject jTimeObject = new JSONObject();
+ jTimeObject.put("choice", "Hour");
+ jTimeObject.put("other", "");
+
+ JSONObject jObjectBody = new JSONObject();
+ jObjectBody.put("name", "def");
+ jObjectBody.put("description", "new vendor license entitlement pool");
+ jObjectBody.put("thresholdValue", "23");
+ jObjectBody.put("thresholdUnits", "Absolute");
+ jObjectBody.put("entitlementMetric", jEntitlementMetricObject);
+ jObjectBody.put("increments", "abcd");
+ jObjectBody.put("aggregationFunction", jAggregationFunctionObject);
+ jObjectBody.put("operationalScope", jOperationalScope);
+ jObjectBody.put("time", jTimeObject);
+ jObjectBody.put("manufacturerReferenceNumber", "123aaa");
+
+ Map<String, String> headersMap = prepareHeadersMap(userId);
+
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap);
+ return response;
+ }
+
+ private static RestResponse createVendorKeyGroups_2(String vspid, User user) throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/license-key-groups",
+ config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+
+ String userId = user.getUserId();
+
+ JSONObject jOperationalScope = new JSONObject();
+ jOperationalScope.put("choices", Arrays.asList("Tenant").toArray());
+ jOperationalScope.put("other", "");
+
+ JSONObject jObjectBody = new JSONObject();
+ jObjectBody.put("name", "keyGroup");
+ jObjectBody.put("description", "new vendor license key group");
+ jObjectBody.put("operationalScope", jOperationalScope);
+ jObjectBody.put("type", "Universal");
+
+ Map<String, String> headersMap = prepareHeadersMap(userId);
+
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap);
+ return response;
+ }
+
+ private static RestResponse createNewVendorSoftwareProduct(String name, String vendorName, String vendorId,
+ String licenseAgreementId, String featureGroupsId, User user) throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products",
+ config.getCatalogBeHost(), config.getCatalogBePort());
+
+ String userId = user.getUserId();
+
+ JSONObject jlicensingDataObj = new JSONObject();
+ jlicensingDataObj.put("licenseAgreement", licenseAgreementId);
+ jlicensingDataObj.put("featureGroups", Arrays.asList(featureGroupsId).toArray());
+
+ JSONObject jObject = new JSONObject();
+ jObject.put("name", name);
+ jObject.put("description", "new VSP description");
+ jObject.put("category", "resourceNewCategory.generic");
+ jObject.put("subCategory", "resourceNewCategory.generic.database");
+ jObject.put("licensingVersion", "1.0");
+ jObject.put("vendorName", vendorName);
+ jObject.put("vendorId", vendorId);
+ jObject.put("icon", "icon");
+ jObject.put("licensingData", jlicensingDataObj);
+
+ Map<String, String> headersMap = prepareHeadersMap(userId);
+ HttpRequest http = new HttpRequest();
+
+ RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap);
+
+ return response;
+ }
+
+ private static RestResponse uploadHeatPackage(String filepath, String filename, String vspid, User user)
+ throws Exception {
+ Config config = Utils.getConfig();
+ CloseableHttpResponse response = null;
+
+ MultipartEntityBuilder mpBuilder = MultipartEntityBuilder.create();
+ mpBuilder.addPart("upload", new FileBody(getTestZipFile(filepath, filename)));
+
+ String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/upload", config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+
+ Map<String, String> headersMap = prepareHeadersMap(user.getUserId());
+ headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "multipart/form-data");
+
+ CloseableHttpClient client = HttpClients.createDefault();
+ try {
+ HttpPost httpPost = new HttpPost(url);
+ RestResponse restResponse = new RestResponse();
+
+ Iterator<String> iterator = headersMap.keySet().iterator();
+ while (iterator.hasNext()) {
+ String key = iterator.next();
+ String value = headersMap.get(key);
+ httpPost.addHeader(key, value);
+ }
+ httpPost.setEntity(mpBuilder.build());
+ response = client.execute(httpPost);
+ HttpEntity entity = response.getEntity();
+ String responseBody = null;
+ if (entity != null) {
+ InputStream instream = entity.getContent();
+ StringWriter writer = new StringWriter();
+ IOUtils.copy(instream, writer);
+ responseBody = writer.toString();
+ try {
+
+ } finally {
+ instream.close();
+ }
+ }
+
+ restResponse.setErrorCode(response.getStatusLine().getStatusCode());
+ restResponse.setResponse(responseBody);
+
+ return restResponse;
+
+ } finally {
+ closeResponse(response);
+ closeHttpClient(client);
+
+ }
+ }
+
+ private static void closeResponse(CloseableHttpResponse response) {
+ try {
+ if (response != null) {
+ response.close();
+ }
+ } catch (IOException e) {
+ System.out.println(String.format("failed to close client or response: %s", e.getMessage()));
+ }
+ }
+
+ private static void closeHttpClient(CloseableHttpClient client) {
+ try {
+ if (client != null) {
+ client.close();
+ }
+ } catch (IOException e) {
+ System.out.println(String.format("failed to close client or response: %s", e.getMessage()));
+ }
+ }
+
+ private static File getTestZipFile(String filepath, String filename) throws IOException {
+ Config config = Utils.getConfig();
+ String sourceDir = config.getImportResourceTestsConfigDir();
+ java.nio.file.Path filePath = FileSystems.getDefault().getPath(filepath + File.separator + filename);
+ return filePath.toFile();
+ }
+
+ private static RestResponse checkinVendorSoftwareProduct(String vspid, User user) throws Exception {
+ return actionOnComponent(vspid, "Checkin", "vendor-software-products", user);
+ }
+
+ private static RestResponse submitVendorSoftwareProduct(String vspid, User user) throws Exception {
+ return actionOnComponent(vspid, "Submit", "vendor-software-products", user);
+ }
+
+ private static RestResponse createPackageOfVendorSoftwareProduct(String vspid, User user) throws Exception {
+ return actionOnComponent(vspid, "Create_Package", "vendor-software-products", user);
+ }
+
+ protected static Map<String, String> prepareHeadersMap(String userId) {
+ Map<String, String> headersMap = new HashMap<String, String>();
+ headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json");
+ headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json");
+ headersMap.put(HttpHeaderEnum.USER_ID.getValue(), userId);
+
+ return headersMap;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PropertiesUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PropertiesUIUtils.java
new file mode 100644
index 0000000000..a625630196
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PropertiesUIUtils.java
@@ -0,0 +1,92 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.utilities;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openecomp.sdc.ci.tests.datatypes.PropertyInfo;
+import org.openecomp.sdc.ci.tests.pages.PropertiesPage;
+import org.openqa.selenium.WebElement;
+
+public class PropertiesUIUtils {
+
+ // public static void addPropertByType(String type,String name,String
+ // defaultValue,String description) throws Exception{
+ //
+ // ResourceUIUtils.defineNewSelectList(type);
+ // ResourceUIUtils.definePropertyName(name);
+ // ResourceUIUtils.defineDefaultValueByType(defaultValue);
+ // ResourceUIUtils.defineDescription(description);
+ // Thread.sleep(2000);
+ // ResourceUIUtils.clickButton("Add");
+ // }
+ public static Map<String, String> addProperties(String name, String itemType, String defaultValue,
+ String description, String schemaType) throws Exception {
+ Map<String, String> propertyvalues = new HashMap<String, String>();
+ GeneralUIUtils.getSelectList(itemType, "propertyType");
+ ResourceUIUtils.definePropertyName(name);
+ if (itemType == "boolean") {
+ ResourceUIUtils.defineBoolenDefaultValue(defaultValue);
+ GeneralUIUtils.defineDescription(description);
+ Thread.sleep(2000);
+ GeneralUIUtils.getWebButton("Add").click();
+ ;
+ } else if (itemType == "list" || itemType == "map") {
+ GeneralUIUtils.getSelectList(schemaType, "schemaType");
+ }
+ if (!(itemType == "boolean")) {
+ ResourceUIUtils.defineDefaultValueByType(defaultValue);
+ GeneralUIUtils.defineDescription(description);
+ GeneralUIUtils.getWebButton("Add").click();
+ ;
+ Thread.sleep(2000);
+ }
+ propertyvalues.put("type", itemType);
+ propertyvalues.put("defaultValue", defaultValue);
+ propertyvalues.put("description", description);
+ propertyvalues.put("name", name);
+
+ return propertyvalues;
+ }
+
+ public static void vlidateProperties(Map<String, String> propertyValues) throws InterruptedException {
+ WebElement name = GeneralUIUtils
+ .actionBuild(GeneralUIUtils.getWebElementWaitForVisible(propertyValues.get("name")));
+ name.getText().equalsIgnoreCase(propertyValues.get("name"));
+ WebElement defaultValue = GeneralUIUtils
+ .actionBuild(GeneralUIUtils.getWebElementWaitForVisible(propertyValues.get("name")));
+ defaultValue.getText().equalsIgnoreCase(propertyValues.get("defaultValue"));
+ WebElement type = GeneralUIUtils
+ .actionBuild(GeneralUIUtils.getWebElementWaitForVisible(propertyValues.get("type")));
+ type.getText().equalsIgnoreCase(propertyValues.get("type"));
+ }
+
+ public static void addNewProperty(PropertyInfo property) {
+ PropertiesPage.getPropertyPopup().insertPropertyName(property.getName());
+ PropertiesPage.getPropertyPopup().selectPropertyType(property.getType().getType());
+ PropertiesPage.getPropertyPopup().insertPropertyDescription(property.getDescription());
+ PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(property.getValue());
+
+ PropertiesPage.getPropertyPopup().clickSave();
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java
new file mode 100644
index 0000000000..9b374c10b8
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java
@@ -0,0 +1,864 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.utilities;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.awt.AWTException;
+import java.awt.Robot;
+import java.awt.event.KeyEvent;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.http.HttpStatus;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CreateAndImportButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.Dashboard;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceCategoriesNameEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.Select;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.testng.AssertJUnit;
+
+public final class ResourceUIUtils {
+ public static final String RESOURCE_NAME_PREFIX = "ResourceCDTest-";
+ protected static final boolean IS_BEFORE_TEST = true;
+ public static final String INITIAL_VERSION = "0.1";
+ public static final String ICON_RESOURCE_NAME = "call_controll";
+ protected static final String UPDATED_RESOURCE_ICON_NAME = "objectStorage";
+
+ private ResourceUIUtils() {
+ }
+
+ static WebDriver driver = GeneralUIUtils.getDriver();
+
+ public static void defineResourceName(String resourceName) {
+
+ WebElement resourceNameTextbox = GeneralUIUtils.getDriver().findElement(By.name("componentName"));
+ resourceNameTextbox.clear();
+ resourceNameTextbox.sendKeys(resourceName);
+ }
+
+ public static void defineResourceCategory(String category, String datatestsid) {
+
+ GeneralUIUtils.getSelectList(category, datatestsid);
+ }
+
+ public static void importFileWithSendKey(String FilePath, String FileName, CreateAndImportButtonsEnum type)
+ throws Exception {
+ WebElement importButton = GeneralUIUtils.createAndImportButtons(type, driver).findElement(By.tagName("input"));
+ importButton.sendKeys(FilePath + FileName);
+ }
+
+ public static void importFileWithSendKeyBrowse(String FilePath, String FileName) throws Exception {
+ WebElement browsebutton = GeneralUIUtils.waitForBrowseButton("browseButton");
+ browsebutton.sendKeys(FilePath + FileName);
+ }
+
+ public static String defineUserId(String userId) {
+ WebElement resourceUserIdTextbox = GeneralUIUtils.getWebElementWaitForVisible("contactId");
+ resourceUserIdTextbox.clear();
+ resourceUserIdTextbox.sendKeys(userId);
+ return userId;
+ }
+
+ public static void defineVendorRelease(String resourceVendorRelease) {
+
+ WebElement resourceVendorReleaseTextbox = GeneralUIUtils.getWebElementWaitForVisible("vendorRelease");
+ resourceVendorReleaseTextbox.clear();
+ resourceVendorReleaseTextbox.sendKeys(resourceVendorRelease);
+ }
+
+ public static void selectResourceIcon(String resourceIcon) throws Exception {
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 10);
+ wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//div[@data-tests-id='" + resourceIcon + "']")))
+ .click();
+ }
+
+ public static String definePropertyName(String name) {
+
+ WebElement nameProperty = GeneralUIUtils.getDriver().findElement(By.name("propertyName"));
+ nameProperty.sendKeys(name);
+ return name;
+ }
+
+ public static void selectRandomResourceIcon() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.ICON);
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 4);
+ wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[contains(@data-tests-id, 'iconBox')]")));
+ List<WebElement> iconElement = GeneralUIUtils.getDriver()
+ .findElements(By.xpath("//*[contains(@data-tests-id, 'iconBox')]"));
+ iconElement.get(0).click();
+ }
+
+ public static List<WebElement> getAllObjectsOnWorkspace(WebDriver driver, ResourceReqDetails resource)
+ throws Exception {
+
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 10);
+ wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@*='" + resource.getName() + "']")));
+ return GeneralUIUtils.getDriver()
+ .findElements(By.xpath("//div[@class='" + "w-sdc-dashboard-card-info-name" + "']"));
+
+ }
+
+ public static String getErrorMessageText(String text) throws Exception {
+
+ return GeneralUIUtils.getEelementBycontainsClassName(text).getText();
+
+ }
+
+ public static WebElement scrollElement(WebDriver driver) throws Exception {
+
+ return GeneralUIUtils.getDriver().findElement(By.className("ps-scrollbar-y"));
+ }
+
+ public static void scrollDownPage() throws AWTException, InterruptedException {
+ Robot robot = new Robot();
+ robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+ robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+ robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+ robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+ robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+ robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+ robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+ robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+ robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+ robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+ robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+ robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+ robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+ robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+ }
+
+ public static void defineNewSelectList(String Text) {
+ WebElement mySelectElm = GeneralUIUtils.getDriver().findElement(By.className("i-sdc-form-select"));
+ Select mySelectString = new Select(mySelectElm);
+ mySelectString.selectByVisibleText(Text);
+ }
+
+ public static void defineDefaultValueByType(String Value) {
+
+ WebElement valueString = GeneralUIUtils.getDriver().findElement(By.name("value"));
+ valueString.clear();
+ valueString.sendKeys(Value);
+ }
+
+ public static void defineBoolenDefaultValue(String Value) {
+
+ WebElement elementBoolean = GeneralUIUtils.getDriver().findElement(By.name("value"));
+ Select se = new Select(elementBoolean);
+ se.selectByValue(Value);
+ }
+
+ public static void clickButtonBlue() {
+ WebElement clickButtonBlue = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-btn-blue"));
+ clickButtonBlue.click();
+ }
+
+ public static void clickButton(String selectButton) {
+
+ WebElement clickButton = GeneralUIUtils.getDriver()
+ .findElement(By.xpath("//*[@data-tests-id='" + selectButton + "']"));
+ clickButton.click();
+ }
+
+ public static WebElement Waitfunctionforbuttons(String element, int timeout) {
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), timeout);
+ return wait.until(ExpectedConditions.elementToBeClickable(By.xpath(element)));
+ }
+
+ public static WebElement waitToButtonSubmitForTesting() {
+ return Waitfunctionforbuttons("//*[@data-tests-id='submitForTesting']", 10);
+ }
+
+ public static WebElement waitToFinishButtonEnabled() {
+ return Waitfunctionforbuttons("//button[@data-tests-id='Finish']", 10);
+ }
+
+ public static WebElement waitToNextButtonEnabled() {
+ return Waitfunctionforbuttons("//button[@data-tests-id='Next']", 10);
+ }
+
+ public static WebElement waitToHomeMenu() {
+ return Waitfunctionforbuttons("//*[@data-tests-id='main-menu-button-home']", 10);
+ }
+
+ public static WebElement waitToCatalogMenu() {
+ return Waitfunctionforbuttons("//*[@data-tests-id='main-menu-button-catalog']", 10);
+ }
+
+ public static WebElement waitSearch() {
+ return Waitfunctionforbuttons("//*[@data-tests-id='main-menu-input-search']", 10);
+ }
+
+ public static WebElement waitSubmitforTestingCard() {
+ return Waitfunctionforbuttons("//*[@data-tests-id='i-sdc-dashboard-card-menu-item-SubmitforTesting']", 10);
+ }
+
+ public static WebElement waitViewCard() {
+ return Waitfunctionforbuttons("//*[@data-tests-id='i-sdc-dashboard-card-menu-item-View']", 5);
+ }
+
+ public static void waitOpenCard(String requiredElementUniqueId) throws Exception {
+ WebElement menu = GeneralUIUtils.getDriver()
+ .findElement(By.xpath("//*[@data-tests-id='" + requiredElementUniqueId + "']"));
+ GeneralUIUtils.actionBuild(menu);
+ }
+
+ public static void fillResourceGeneralInformationPage(ResourceReqDetails resource, User user) {
+ try {
+
+ ResourceGeneralPage.defineName(resource.getName());
+ ResourceGeneralPage.defineDescription(resource.getDescription());
+ ResourceGeneralPage.defineCategory(resource.getCategories().get(0).getSubcategories().get(0).getName());
+ ResourceGeneralPage.defineVendorName(resource.getVendorName());
+ ResourceGeneralPage.defineVendorRelease(resource.getVendorRelease());
+ ResourceGeneralPage.defineTagsList(resource, new String[] { "This-is-tag", "another-tag", "Test-automation-tag" });
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static void fillNewResourceValues(ResourceReqDetails resource, User user) throws Exception {
+ fillResourceGeneralInformationPage(resource, user);
+ GeneralUIUtils.clickCreateButton();
+ }
+
+ // coded by teddy.
+ public static WebElement waitfunctionforallelements(String element) {
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 5);
+ return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@*='" + element + "']")));
+ }
+
+ public static WebElement waitFunctionForaGetElements(String element, int timeout) {
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), timeout);
+ return wait.until(
+ ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + element + "']")));
+ }
+
+ public static void getVFCGeneralInfo(ResourceReqDetails resource, User user) throws InterruptedException {
+ Thread.sleep(2000);
+ String version = GeneralUIUtils.getWebElements("versionvalue").get(0).getText().substring(1);
+ String name = GeneralUIUtils.getWebElementWaitForVisible("name").getAttribute("value");
+ String description = GeneralUIUtils.getWebElementWaitForVisible("description").getAttribute("value");
+ String category = GeneralUIUtils.getSelectList(null, "selectGeneralCategory").getFirstSelectedOption()
+ .getText();
+ String vendorName = GeneralUIUtils.getWebElementWaitForVisible("vendorName").getAttribute("value");
+ String vendorRelease = GeneralUIUtils.getWebElementWaitForVisible("vendorRelease").getAttribute("value");
+ List<WebElement> tags = GeneralUIUtils.waitForElementsListVisibility("i-sdc-tag-text");
+ String type = GeneralUIUtils.waitForElementsListVisibility("type").get(1).getText();
+ int index = type.lastIndexOf(":");
+ System.out.println(type.substring(0, index));
+ String ContactId = GeneralUIUtils.getWebElementWaitForVisible("contactId").getAttribute("value");
+ System.out.println(resource.getVersion());
+ assertTrue(resource.getVersion().equals(version));
+ assertTrue(resource.getName().equals(name));
+ assertTrue(resource.getDescription().equals(description));
+ System.out.println(resource.getVendorName());
+ System.out.println(resource.getVendorRelease());
+ assertTrue(resource.getCategories().get(0).getSubcategories().get(0).getName().equals(category));
+ assertTrue(resource.getVendorName().equals(vendorName));
+ assertTrue(resource.getVendorRelease().equals(vendorRelease));
+ assertTrue(resource.getCreatorUserId().equals(ContactId));
+ assertEquals(type.substring(0, index), resource.getResourceType());
+
+ for (int i = 0; i < tags.size(); i++) {
+ assertEquals(resource.getTags().get(i), tags.get(i).getText());
+ }
+ }
+
+ public static void getGeneralInfo(ResourceReqDetails resource, User user) {
+ List<WebElement> tags = GeneralUIUtils.waitForElementsListVisibility("tag");
+
+ for (WebElement tag : tags) {
+ System.out.println(resource.getTags().get(0));
+ }
+ }
+
+ public static void getGeneralInfoForTags(ResourceReqDetails resource, User user) {
+
+ clickMore();
+ String componentType = waitFunctionForaGetElements("componentType", 3).getText();
+ String version = waitFunctionForaGetElements("version", 3).getText();
+ String category = waitFunctionForaGetElements("category", 3).getText();// get
+ // right
+ // panel
+ // Category.
+ String resourceType = waitFunctionForaGetElements("resourceType", 3).getText();// get
+ // right
+ // panel
+ // SubCategory.
+ String date = GeneralUIUtils.getEelementByClassName("creationDate").getText();
+ String aouthor = waitfunctionforallelements("author'").getText();
+ String vendorName = waitFunctionForaGetElements("vendorName", 3).getText();
+ String vendorRelease = waitFunctionForaGetElements("vendorRelease", 3).getText();
+ String contactId = waitFunctionForaGetElements("contactId", 3).getText();
+ String description = waitFunctionForaGetElements("description", 3).getText();
+ List<WebElement> tags = GeneralUIUtils.waitForElementsListVisibility("tag");
+ assertTrue(componentType.equals("RESOURCE"));
+ assertTrue(version.equals(resource.getVersion()));
+ assertTrue(category.equals(resource.getCategories().get(0).getName()));
+ assertEquals(resourceType, resource.getResourceType());
+ // assertEquals(Date,resource.getCreationDate());
+ // assertEquals(Aouthor,resource.getCreatorFullName());
+ assertTrue(vendorName.equals(resource.getVendorName()));
+ assertTrue(vendorRelease.equals(resource.getVendorRelease()));
+ assertTrue(contactId.equals(resource.getContactId()));
+ assertTrue(description.equals(resource.getDescription() + "\nLess"));
+ assertTrue(tags.equals("Tag-150"));
+ }
+
+ public static WebElement searchVFNameInWorkspace(ResourceReqDetails resource, User user) throws Exception {
+
+ List<WebElement> findElements = GeneralUIUtils.getDriver()
+ .findElements(By.xpath("//div[@data-tests-id='" + resource.getUniqueId() + "']"));
+ assertNotNull("did not find any elements", findElements);
+ for (WebElement webElement : findElements) {
+ if (webElement.getText().contains(resource.getUniqueId())) {
+ System.out.println("I find it");
+ return webElement;
+ }
+ }
+ return null;
+ }
+
+ public static Boolean searchCheckOutWorkspace(ResourceReqDetails resource, User user,
+ CheckBoxStatusEnum checkBoxStatusEnum) throws Exception {
+
+ List<WebElement> findElements = GeneralUIUtils.getDriver()
+ .findElements(By.xpath("//div[@data-tests-id='component.lifecycleState']"));
+ assertNotNull("did not find any elements", findElements);
+ for (WebElement webElement : findElements) {
+ if (!webElement.getAttribute("class").contains(checkBoxStatusEnum.name())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ // coded by tedy.
+ public static void validateWithRightPalett(ResourceReqDetails resource, User user) {
+ // String
+ // Type=Waitfunctionforallelements("sharingService.selectedEntity.getTypeForView()",3).getText();
+ String ResourceType = waitfunctionforallelements("selectedComponent.resourceType").getText();
+ System.out.println(ResourceType);
+ String Version = waitfunctionforallelements("selectedComponent.version").getText();
+ String Category = waitfunctionforallelements("selectedComponent.categories[0].name").getText();// get
+ // right
+ // panel
+ // Category.
+ String CanvasSubCategory = waitfunctionforallelements("selectedComponent.categories[0].subcategories[0].name")
+ .getText();// get right panel SubCategory.
+ // String Date=Waitfunctionforelements("selectedComponent.creationDate |
+ // date: 'MM/dd/yyyy'").getText();
+ // String
+ // Aouthor=waitfunctionforallelements("selectedComponent.creatorFullName'").getText();
+ String VendorName = waitfunctionforallelements("selectedComponent.vendorName").getText();
+ String VendorRelease = waitfunctionforallelements("selectedComponent.vendorRelease").getText();
+ String contactId = waitfunctionforallelements("selectedComponent.contactId").getText();
+ String Description = waitfunctionforallelements("selectedComponent.description").getText();
+ String TagVF = waitfunctionforallelements("tag").getText();
+ AssertJUnit.assertEquals(ResourceType, resource.getResourceType());
+ AssertJUnit.assertEquals(Version, resource.getVersion());
+ AssertJUnit.assertEquals(Category, resource.getCategories().get(0).getName());
+ AssertJUnit.assertEquals(CanvasSubCategory,
+ resource.getCategories().get(0).getSubcategories().get(0).getName());
+ // assertEquals(Date,resource.getCreationDate());
+ // assertEquals(Aouthor,resource.getCreatorFullName());
+ AssertJUnit.assertEquals(VendorName, resource.getVendorName());
+ AssertJUnit.assertEquals(VendorRelease, resource.getVendorRelease());
+ AssertJUnit.assertEquals(contactId, resource.getContactId());
+ AssertJUnit.assertEquals(Description, resource.getDescription() + "\nLess");
+ AssertJUnit.assertEquals(TagVF, "qa123");
+ }
+
+ public static void clickMore() {
+ WebElement clickButtonSubmit = GeneralUIUtils.getDriver()
+ .findElement(By.className("ellipsis-directive-more-less"));
+ clickButtonSubmit.click();
+ }
+
+ public static RestResponse createResourceInUI(ResourceReqDetails resource, User user)
+ throws Exception, AWTException {
+ System.out.println("creating resource...");
+ fillNewResourceValues(resource, user);
+ RestResponse getCreatedResource = RestCDUtils.getResource(resource, user);
+ AssertJUnit.assertEquals("Did not succeed to get any resource", HttpStatus.SC_OK,
+ getCreatedResource.getErrorCode().intValue());
+
+ return getCreatedResource;
+ }
+
+ public static RestResponse createResource(ResourceReqDetails resource, User user) throws Exception, AWTException {
+
+ ResourceUIUtils.moveToHTMLElementByClassName("w-sdc-dashboard-card-new");
+ ResourceUIUtils.clickOnHTMLElementByDataTestId(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue());
+ GeneralUIUtils.waitForLoader();
+ // GeneralUIUtils.sleep(1000);
+ fillResourceGeneralInformationPage(resource, user);
+ GeneralUIUtils.clickCreateButton();
+ return null;
+
+ }
+
+ public static RestResponse updateResourceInformationPage(ResourceReqDetails resource, User user)
+ throws Exception, AWTException {
+
+ fillResourceGeneralInformationPage(resource, user);
+ GeneralUIUtils.clickCreateButton();
+ return null;
+
+ }
+
+ public static RestResponse checkInResourceInUI(ResourceReqDetails resource, User user) throws Exception {
+
+ WebElement ASDCLink = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-header-logo-link"));
+ ASDCLink.click();
+ Thread.sleep(2000);
+
+ List<WebElement> listFormInput = GeneralUIUtils.getDriver()
+ .findElements(By.className("i-sdc-left-sidebar-nav-item"));
+ WebElement addPropertyElement = listFormInput.get(0);
+ addPropertyElement.click();
+ Thread.sleep(2000);
+
+ WebElement searchResource = GeneralUIUtils.getDriver()
+ .findElement(By.className("w-sdc-header-catalog-search-input"));
+ searchResource.sendKeys("newresource4test");
+
+ Thread.sleep(1000);
+
+ WebElement buttonClickMenu = GeneralUIUtils.getDriver()
+ .findElement(By.className("w-sdc-dashboard-card-menu-button"));
+ buttonClickMenu.click();
+
+ WebElement clickMenu = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-dashboard-card-menu"));
+ clickMenu.click();
+
+ List<WebElement> clickCheckIn = GeneralUIUtils.getDriver()
+ .findElements(By.className("i-sdc-dashboard-card-menu-item"));
+ WebElement clickCheckInMenu = clickCheckIn.get(1);
+ clickCheckInMenu.click();
+
+ WebElement descriptionForSubmit = GeneralUIUtils.getDriver()
+ .findElement(By.className("w-sdc-modal-body-comment"));
+ descriptionForSubmit.sendKeys("checkin resource");
+ Thread.sleep(2000);
+ WebElement clickButtonSubmitTwo = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-btn-blue"));
+ clickButtonSubmitTwo.click();
+ Thread.sleep(2000);
+
+ WebElement buttonClickMenu1 = GeneralUIUtils.getDriver()
+ .findElement(By.className("w-sdc-dashboard-card-menu-button"));
+ buttonClickMenu1.click();
+
+ WebElement clickMenu1 = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-dashboard-card-menu"));
+ clickMenu1.click();
+
+ List<WebElement> clickCheckOut = GeneralUIUtils.getDriver()
+ .findElements(By.className("i-sdc-dashboard-card-menu-item"));
+ WebElement clickCheckOutMenu = clickCheckOut.get(0);
+ clickCheckOutMenu.click();
+
+ Thread.sleep(3000);
+ RestResponse getResource = RestCDUtils.getResource(resource, user);
+ AssertJUnit.assertEquals("Did not succeed to get resource after create", 200,
+ getResource.getErrorCode().intValue());
+ return getResource;
+
+ }
+
+ public static String lifeCycleStateUI() throws InterruptedException {
+ return GeneralUIUtils.getWebElementWaitForVisible("formlifecyclestate").getText();
+ }
+
+ public static List<String> catalogFilterResourceCategoriesChecBox(ResourceCategoriesNameEnum enumName)
+ throws Exception {
+ List<String> categories = Arrays.asList();
+ switch (enumName) {
+ case APPLICATIONL4:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("applicationServer", "defaulticon", "vl", "cp", "call_controll", "borderElement",
+ "network", "firewall", "database", "loadBalancer");
+ break;
+ case APPLICATION_SERVER:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("applicationServer", "vl", "cp", "defaulticon");
+ break;
+ case BORDER_ELEMENT:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("borderElement", "vl", "cp", "defaulticon");
+ break;
+ case CALL_CONTROL:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("call_controll", "vl", "cp", "defaulticon");
+ break;
+ case COMMON_NETWORK_RESOURCES:
+ GeneralUIUtils.getEelementByLinkText("Common Network Resources").click();
+ categories = Arrays.asList("network", "vl", "cp", "defaulticon");
+ break;
+ case CONNECTION_POINTS:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("cp", "defaulticon");
+ break;
+ case DATABASE:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("database", "vl", "cp", "defaulticon");
+ break;
+ case DATABASE_GENERIC:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("database", "vl", "cp", "defaulticon");
+ break;
+ case FIREWALL:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("firewall", "vl", "cp", "defaulticon");
+ break;
+ case GATEWAY:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("gateway", "vl", "cp", "defaulticon");
+ break;
+ case INFRASTRUCTURE:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("connector", "vl", "cp", "defaulticon");
+ break;
+ case INFRASTRUCTUREL23:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("ucpe", "vl", "cp", "defaulticon");
+ break;
+ case LAN_CONNECTORS:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("network", "port", "connector", "vl", "cp", "defaulticon");
+ break;
+ case LOAD_BALANCER:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("loadBalancer", "vl", "cp", "defaulticon");
+ break;
+ case MEDIA_SERVERS:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("network", "vl", "cp", "defaulticon");
+ break;
+ case NETWORKL4:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("network", "vl", "cp", "defaulticon");
+ break;
+ case NETWORK_ELEMENTS:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("port", "defaulticon", "network", "connector", "vl", "cp");
+ break;
+ case NETWORK_L23:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("network", "vl", "defaulticon", "cp", "router", "port", "connector", "gateway",
+ "ucpe");
+ break;
+ case NETWORK_CONNECTIVITY:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("network", "vl", "cp", "defaulticon");
+ break;
+ case GENERIC:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("database", "port", "loadBalancer", "vl", "cp", "objectStorage", "compute",
+ "defaulticon", "ucpe", "network", "connector");
+ break;
+ case ABSTRACT:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("objectStorage", "compute", "defaulticon", "cp", "vl");
+ break;
+ case Router:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("router", "vl", "cp", "defaulticon");
+ break;
+ case VIRTUAL_LINKS:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("vl", "defaulticon");
+ break;
+ case WAN_Connectors:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("network", "port", "connector", "vl", "cp", "defaulticon");
+ break;
+ case WEB_SERVER:
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ categories = Arrays.asList("applicationServer", "vl", "cp", "defaulticon");
+ break;
+ }
+ return categories;
+ }
+
+ public static void deleteVersionInUI() throws Exception {
+
+ waitToDeleteVersion().click();
+ ResourceUIUtils.clickButtonBlue();
+ }
+
+ public static void selectTabInRightPallete(String className) throws Exception {
+ WebElement tab = GeneralUIUtils.getEelementBycontainsClassName(className);
+ tab.click();
+ }
+
+ public static WebElement waitToDeleteVersion() {
+ return Waitfunctionforbuttons("//*[@data-tests-id='deleteVersion']", 10);
+ }
+
+ public static WebElement rihtPanelAPI() {
+ return waitFunctionForaGetElements("tab-api", 10);
+ }
+
+ /**
+ * Click on HTML element.
+ *
+ * @param dataTestId
+ * @throws Exception
+ */
+ public static void clickOnHTMLElementByDataTestId(String dataTestId) throws Exception {
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 20);
+ WebElement element = wait
+ .until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@data-tests-id='" + dataTestId + "']")));
+ element.click();
+ // wait.until(ExpectedConditions.elemetto)
+ // WebElement serviceButton =
+ // GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='"
+ // + dataTestId + "']"));
+ // serviceButton.
+ // serviceButton.click();
+ }
+
+ /**
+ * Move to HTML element by class name. When moving to the HTML element, it
+ * will raise hover event.
+ *
+ * @param className
+ */
+ public static void moveToHTMLElementByClassName(String className) {
+ Actions actions = new Actions(GeneralUIUtils.getDriver());
+ final WebElement createButtonsArea = GeneralUIUtils
+ .retryMethodOnException(() -> GeneralUIUtils.getDriver().findElement(By.className(className)));
+ actions.moveToElement(createButtonsArea).perform();
+ }
+
+ /**
+ * Move to HTML element by element id. When moving to the HTML element, it
+ * will raise hover event.
+ *
+ * @param className
+ */
+ static void moveToHTMLElementByDataTestId(String dataTestId) {
+ // WebElement hoverArea =
+ // GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='"
+ // + dataTestId + "']"));
+ WebElement hoverArea = GeneralUIUtils.waitForElementVisibility(dataTestId);
+ // WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(),
+ // 30);
+ // wait.until(ExpectedConditions.visibilityOf(hoverArea));
+
+ Actions actions = new Actions(GeneralUIUtils.getDriver());
+ actions.moveToElement(hoverArea).perform();
+ }
+
+ // public static ResourceReqDetails createResourceInUI(User user){
+ // try{
+ // ResourceReqDetails defineResourceDetails =
+ // defineResourceDetails(ResourceTypeEnum.VF);
+ // ResourceUIUtils.moveToHTMLElementByClassName("w-sdc-dashboard-card-new");
+ // ResourceUIUtils.clickOnHTMLElementByDataTestId(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue());
+ // GeneralUIUtils.waitForLoader();
+ //// GeneralUIUtils.sleep(1000);
+ // fillResourceGeneralInformationPage(defineResourceDetails, user);
+ // GeneralUIUtils.clickCreateButton();
+ // return defineResourceDetails;
+ // }
+ // catch( Exception e){
+ // throw new RuntimeException(e);
+ // }
+ // }
+
+ /**
+ * Import VFC
+ *
+ * @param user
+ * @param filePath
+ * @param fileName
+ * @return
+ * @throws Exception
+ */
+
+ public static void importVfc(ResourceReqDetails resourceMetaData, String filePath, String fileName, User user)
+ throws Exception {
+ GeneralUIUtils.hoverOnArea(Dashboard.IMPORT_AREA.getValue());
+ // Insert file to the browse dialog
+ final WebElement browseWebElement = GeneralUIUtils
+ .getWebElementByDataTestId(DataTestIdEnum.Dashboard.IMPORT_VFC_FILE.getValue());
+ browseWebElement.sendKeys(filePath + fileName);
+
+ // Fill the general page fields.
+ GeneralUIUtils.waitForLoader();
+ fillResourceGeneralInformationPage(resourceMetaData, user);
+ GeneralUIUtils.clickCreateButton();
+
+ }
+
+ // public static ResourceReqDetails importVfcInUI(User user, String
+ // filePath, String fileName, ResourceTypeEnum resourceType) {
+ // ResourceReqDetails defineResourceDetails =
+ // defineResourceDetails(resourceType);
+ // ResourceUIUtils.moveToHTMLElementByDataTestId(Dashboard.IMPORT_AREA.getValue());
+ //
+ // // Insert file to the browse dialog
+ // final WebElement browseWebElement =
+ // GeneralUIUtils.getWebElementByDataTestId(DataTestIdEnum.Dashboard.IMPORT_VFC_FILE.getValue());
+ // browseWebElement.sendKeys(filePath + fileName);
+ //
+ // // Fill the general page fields.
+ // GeneralUIUtils.waitForLoader();
+ // fillResourceGeneralInformationPage(defineResourceDetails, user);
+ // GeneralUIUtils.clickCreateButton();
+ // return defineResourceDetails;
+ // }
+
+ /**
+ * Import VF
+ *
+ * @param user
+ * @param filePath
+ * @param fileName
+ * @return
+ * @throws Exception
+ */
+ // public static ResourceReqDetails importVfInUI(User user, String filePath,
+ // String fileName) throws Exception {
+ // ResourceReqDetails defineResourceDetails =
+ // defineResourceDetails(ResourceTypeEnum.VF);
+ // ResourceUIUtils.moveToHTMLElementByDataTestId(Dashboard.IMPORT_AREA.getValue());
+ //
+ // // Insert file to the browse dialog
+ // final WebElement browseWebElement =
+ // GeneralUIUtils.getWebElementByDataTestId(DataTestIdEnum.Dashboard.IMPORT_VF_FILE.getValue());
+ // browseWebElement.sendKeys(filePath + fileName);
+ //
+ // // Fill the general page fields.
+ // GeneralUIUtils.waitForLoader();
+ // fillResourceGeneralInformationPage(defineResourceDetails, user);
+ // GeneralUIUtils.clickCreateButton();
+ // return defineResourceDetails;
+ // }
+
+ // public static ResourceReqDetails defineResourceDetails(ResourceTypeEnum
+ // resourceType) {
+ // ResourceReqDetails resource = new ResourceReqDetails();
+ // resource = ElementFactory.getDefaultResource(NormativeTypesEnum.ROOT,
+ // ResourceCategoryEnum.APPLICATION_L4_CALL_CONTROL);
+ // resource.setVersion(INITIAL_VERSION);
+ // resource.setIcon(ICON_RESOURCE_NAME);
+ // resource.setResourceType(resourceType.toString());
+ // resource.setName(getRandomComponentName(RESOURCE_NAME_PREFIX));
+ //
+ // SetupCDTest.setCreatedComponents(Arrays.asList(resource));
+ //
+ // return resource;
+ // }
+
+ protected static String getRandomComponentName(String prefix) {
+ return prefix + new Random().nextInt(10000);
+ }
+
+ public static ImmutablePair<String, String> getFirstRIPos(ResourceReqDetails createResourceInUI, User user) {
+ String responseAfterDrag = RestCDUtils.getResource(createResourceInUI, user).getResponse();
+ JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+ String xPosPostDrag = (String) ((JSONObject) ((JSONArray) jsonResource.get("componentInstances")).get(0))
+ .get("posX");
+ String yPosPostDrag = (String) ((JSONObject) ((JSONArray) jsonResource.get("componentInstances")).get(0))
+ .get("posY");
+ return new ImmutablePair<String, String>(xPosPostDrag, yPosPostDrag);
+
+ }
+
+ public static WebElement getErrorMessageText(WebDriver driver, String text) throws Exception {
+
+ return GeneralUIUtils.getEelementBycontainsClassName(text);
+
+ }
+
+ public static void fillGeneralInfoValuesAndIcon(ResourceReqDetails resource, User user) throws Exception {
+ fillResourceGeneralInformationPage(resource, user);
+ GeneralUIUtils.clickCreateButton();
+
+ selectRandomResourceIcon();
+ }
+
+ // coded by teddy.
+ public static void getVFCGeneralInfoAndValidate(ResourceReqDetails resource, User user)
+ throws InterruptedException {
+ Thread.sleep(2000);
+ WebDriver driver = GeneralUIUtils.getDriver();
+ String version = GeneralUIUtils.getSelectList(null, "versionHeader").getFirstSelectedOption().getText();
+ String name = GeneralUIUtils.getWebElement(driver, "name").getAttribute("value");
+ String description = GeneralUIUtils.getWebElement(driver, "description").getAttribute("value");
+ String category = GeneralUIUtils.getSelectList(null, "selectGeneralCategory").getFirstSelectedOption()
+ .getText();
+ String vendorName = GeneralUIUtils.getWebElement(driver, "vendorName").getAttribute("value");
+ String vendorRelease = GeneralUIUtils.getWebElement(driver, "vendorRelease").getAttribute("value");
+ List<WebElement> tags = GeneralUIUtils.waitForElementsListVisibility("i-sdc-tag-text");
+ String type = GeneralUIUtils.waitForElementsListVisibility("type").get(1).getText();
+ int index = type.lastIndexOf(":");
+ System.out.println(type.substring(0, index));
+ String contactId = GeneralUIUtils.getWebElement(driver, "contactId").getAttribute("value");
+ System.out.println(resource.getVersion());
+ assertTrue(resource.getVersion().equals(version.substring(1)));
+ assertTrue(resource.getName().equals(name));
+ assertTrue(resource.getDescription().equals(description));
+ System.out.println(resource.getVendorName());
+ System.out.println(resource.getVendorRelease());
+ assertTrue(resource.getCategories().get(0).getSubcategories().get(0).getName().equals(category));
+ assertTrue(resource.getVendorName().equals(vendorName));
+ assertTrue(resource.getVendorRelease().equals(vendorRelease));
+ assertTrue(resource.getCreatorUserId().equals(contactId));
+ assertEquals(type.substring(0, index), resource.getResourceType());
+
+ for (int i = 0; i < tags.size(); i++) {
+ assertEquals(resource.getTags().get(i), tags.get(i).getText());
+ }
+ }
+
+ public static RestResponse createResourceNG(ResourceReqDetails resource, User user) throws Exception, AWTException {
+
+ ResourceUIUtils.moveToHTMLElementByClassName("w-sdc-dashboard-card-new");
+ ResourceUIUtils.clickOnHTMLElementByDataTestId(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue());
+ fillResourceGeneralInformationPage(resource, user);
+ GeneralUIUtils.clickOnHTMLElementByDataTestId(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue());
+ return null;
+
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/RestCDUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/RestCDUtils.java
new file mode 100644
index 0000000000..10535e0157
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/RestCDUtils.java
@@ -0,0 +1,182 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.utilities;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONObject;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
+
+public class RestCDUtils {
+
+ private static void setResourceUniqueIdAndUUID(ComponentReqDetails element, RestResponse getResourceResponse) {
+ element.setUniqueId(ResponseParser.getUniqueIdFromResponse(getResourceResponse));
+ element.setUUID(ResponseParser.getUuidFromResponse(getResourceResponse));
+ }
+
+ public static RestResponse getResource(ResourceReqDetails resource, User user) {
+ try {
+ System.out.println("trying to get resource");
+ GeneralUIUtils.sleep(1000);
+ RestResponse getResourceResponse = null;
+ String reourceUniqueId = resource.getUniqueId();
+ if (reourceUniqueId != null) {
+ getResourceResponse = ResourceRestUtils.getResource(reourceUniqueId);
+ if (getResourceResponse.getErrorCode().intValue() == 200) {
+ System.out.println("succeeded to get resource");
+ }
+ return getResourceResponse;
+ }
+ JSONObject getResourceJSONObject = null;
+ getResourceResponse = ResourceRestUtils.getResourceByNameAndVersion(user.getUserId(), resource.getName(),
+ resource.getVersion());
+ if (getResourceResponse.getErrorCode().intValue() == 200) {
+ JSONArray jArray = new JSONArray(getResourceResponse.getResponse());
+ for (int i = 0; i < jArray.length(); i++) {
+ getResourceJSONObject = jArray.getJSONObject(i);
+ String resourceType = ResponseParser.getValueFromJsonResponse(getResourceJSONObject.toString(),
+ "resourceType");
+ if (resourceType.equals(resource.getResourceType())) {
+ getResourceResponse.setResponse(getResourceJSONObject.toString());
+ setResourceUniqueIdAndUUID(resource, getResourceResponse);
+ System.out.println("succeeded to get resource");
+ return getResourceResponse;
+ }
+ }
+ }
+
+ return getResourceResponse;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static RestResponse getService(ServiceReqDetails service, User user) {
+ try {
+ Thread.sleep(3500);
+ RestResponse getServiceResponse = ServiceRestUtils.getServiceByNameAndVersion(user, service.getName(),
+ service.getVersion());
+ if (getServiceResponse.getErrorCode().intValue() == 200) {
+ setResourceUniqueIdAndUUID(service, getServiceResponse);
+ }
+ return getServiceResponse;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public static RestResponse getProduct(ProductReqDetails product, User user) {
+ try {
+ Thread.sleep(3500);
+ RestResponse getProductResponse = ProductRestUtils.getProductByNameAndVersion(product.getName(),
+ product.getVersion(), user.getUserId());
+ if (getProductResponse.getErrorCode().intValue() == 200) {
+ setResourceUniqueIdAndUUID(product, getProductResponse);
+ }
+ return getProductResponse;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static Map<String, String> getAllElementVersionsFromResponse(RestResponse getResource) throws Exception {
+ Map<String, String> versionsMap = new HashMap<String, String>();
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+
+ JSONObject object = new JSONObject(getResource.getResponse());
+ versionsMap = mapper.readValue(object.get("allVersions").toString(), Map.class);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ return versionsMap;
+
+ }
+
+ return versionsMap;
+ }
+
+ public static void deleteElementVersions(Map<String, String> elementVersions, boolean isBeforeTest, Object clazz,
+ User user) throws Exception {
+ Iterator<String> iterator = elementVersions.keySet().iterator();
+ while (iterator.hasNext()) {
+ String singleVersion = iterator.next();
+ String uniqueId = elementVersions.get(singleVersion);
+ RestResponse deleteResponse = null;
+ if (clazz instanceof ServiceReqDetails) {
+ deleteResponse = ServiceRestUtils.deleteServiceById(uniqueId, user.getUserId());
+ } else if (clazz instanceof ResourceReqDetails) {
+ deleteResponse = ResourceRestUtils.deleteResource(uniqueId, user.getUserId());
+ } else if (clazz instanceof ProductReqDetails) {
+ deleteResponse = ProductRestUtils.deleteProduct(uniqueId, user.getUserId());
+ }
+
+ if (isBeforeTest) {
+ assertTrue(deleteResponse.getErrorCode().intValue() == 204
+ || deleteResponse.getErrorCode().intValue() == 404);
+ } else {
+ assertTrue(deleteResponse.getErrorCode().intValue() == 204);
+ }
+ }
+ }
+
+ public static void deleteAllResourceVersionsAfterTest(ComponentReqDetails componentDetails,
+ RestResponse getObjectResponse, User user) {
+ try {
+ deleteAllComponentVersion(false, componentDetails, getObjectResponse, user);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void deleteAllResourceVersionsBeforeTest(ComponentReqDetails componentDetails,
+ RestResponse getObjectResponse, User user) throws Exception {
+ deleteAllComponentVersion(true, componentDetails, getObjectResponse, user);
+ }
+
+ public static void deleteAllComponentVersion(boolean isBeforeTest, ComponentReqDetails componentDetails,
+ RestResponse getObjectResponse, User user) throws Exception {
+ if (getObjectResponse.getErrorCode().intValue() == 404)
+ return;
+ Map<String, String> componentVersionsMap = getAllElementVersionsFromResponse(getObjectResponse);
+ System.out.println("deleting...");
+ deleteElementVersions(componentVersionsMap, isBeforeTest, componentDetails, user);
+ componentDetails.setUniqueId(null);
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ServiceUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ServiceUIUtils.java
new file mode 100644
index 0000000000..5c2608b51e
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ServiceUIUtils.java
@@ -0,0 +1,241 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.utilities;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.awt.AWTException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceCategoriesNameEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.Select;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import com.relevantcodes.extentreports.LogStatus;
+
+public class ServiceUIUtils {
+
+ protected static WebDriver driver;
+
+ public ServiceUIUtils(TestName name, String className) {
+ super();
+ }
+
+ public static String defineServiceName(String Name) {
+ WebElement serviceName = GeneralUIUtils.getWebElementWaitForVisible("name");
+ serviceName.clear();
+ serviceName.sendKeys(Name);
+ return Name;
+ }
+
+ public void moveResourceInstanceToCanvasUI() throws Exception {
+ List<WebElement> moveResource = driver.findElements(By.className("sprite-resource-icons"));
+ WebElement moveResourceToCanvasResourceOne = moveResource.get(0);
+ // WebElement moveResource =
+ // driver.findElement(By.className("sprite-resource-icons"));
+ Actions action = new Actions(driver);
+ action.moveToElement(moveResourceToCanvasResourceOne);
+ action.clickAndHold(moveResourceToCanvasResourceOne);
+ action.moveByOffset(635, 375);
+ action.release();
+ action.perform();
+ WebElement moveResourceToCanvasResourceTwo = moveResource.get(1);
+ action.moveToElement(moveResourceToCanvasResourceTwo);
+ action.clickAndHold(moveResourceToCanvasResourceTwo);
+ action.moveByOffset(535, 375);
+ action.release();
+ action.perform();
+ WebElement moveResourceToCanvasResourceTree = moveResource.get(2);
+ action.moveToElement(moveResourceToCanvasResourceTree);
+ action.clickAndHold(moveResourceToCanvasResourceTree);
+ action.moveByOffset(435, 375);
+ action.release();
+ action.perform();
+ Thread.sleep(2000);
+ }
+
+ public static String catalogFilterServiceCategoriesChecBox(ServiceCategoriesNameEnum enumName) throws Exception {
+ String Type = null;
+ GeneralUIUtils.getWebElementWaitForVisible(enumName.getValue()).click();
+ return Type;
+ }
+
+ public static List<String> catalogServiceTypeChecBox(ServiceCategoriesNameEnum enumtype) throws Exception {
+ List<String> categories = null;
+ switch (enumtype) {
+ case NETWORK_L13:
+ GeneralUIUtils.getWebElementWaitForVisible(enumtype.getValue()).click();
+ categories = Arrays.asList("network_l_1-3");
+ break;
+ case NETWORKL4:
+ GeneralUIUtils.getWebElementWaitForVisible(enumtype.getValue()).click();
+ categories = Arrays.asList("network_l_4 ");
+ break;
+ case MOBILITY:
+ GeneralUIUtils.getWebElementWaitForVisible(enumtype.getValue()).click();
+ categories = Arrays.asList("mobility");
+ break;
+ case VOIPCALL_CONTROL:
+ GeneralUIUtils.getWebElementWaitForVisible(enumtype.getValue()).click();
+ categories = Arrays.asList("call_controll ");
+ break;
+ }
+ return categories;
+ }
+
+ public static WebElement waitToNextButtonEnabled() {
+ return GeneralUIUtils.getWebButton("Next");
+ }
+
+ public static WebElement waitToFinishButtonEnabled() {
+ return GeneralUIUtils.getWebButton("Finish");
+ }
+
+ public static WebElement deleteServiceInUI() {
+
+ return GeneralUIUtils.getWebButton("deleteVersion");
+ }
+
+ // get the service view data for validate.
+ // created by tedy.
+ public static void getServiceGeneralInfo(ServiceReqDetails service, User user) throws InterruptedException {
+ Thread.sleep(2000);
+ String version = GeneralUIUtils.getSelectList(null, "versionHeader").getFirstSelectedOption().getText()
+ .substring(1);
+ String name = GeneralUIUtils.getWebElementWaitForVisible("name").getAttribute("value");
+ String description = GeneralUIUtils.getWebElementWaitForVisible("description").getAttribute("value");
+ String category = GeneralUIUtils.getSelectList(null, "selectGeneralCategory").getFirstSelectedOption()
+ .getText();
+ List<WebElement> tags = GeneralUIUtils.waitForElementsListVisibility("i-sdc-tag-text");
+ String type = GeneralUIUtils.waitForElementsListVisibility("type").get(1).getText();
+ int index = type.lastIndexOf(":");
+ System.out.println(type.substring(0, index));
+ String contactId = GeneralUIUtils.getWebElementWaitForVisible("contactId").getAttribute("value");
+ String projectCode = GeneralUIUtils.getWebElementWaitForVisible("projectCode").getAttribute("value");
+ System.out.println(service.getVersion());
+ assertTrue(service.getVersion().equals(version));
+ assertTrue(service.getName().equals(name));
+ assertTrue(service.getDescription().equals(description));
+ assertTrue(service.getCategories().get(0).getName().equals(category));
+ System.out.println(service.getContactId());
+ assertTrue(service.getContactId().equals(contactId));
+ assertTrue(service.getProjectCode().equals(projectCode));
+ for (int i = 0; i < tags.size(); i++) {
+ assertEquals(service.getTags().get(i), tags.get(i).getText());
+ }
+
+ }
+
+ public static void defineTagsList(ServiceReqDetails service, String[] serviceTags) {
+ List<String> taglist = new ArrayList<String>();
+ ;
+ WebElement serviceTagsTextbox = GeneralUIUtils.getWebElementWaitForVisible("i-sdc-tag-input");
+ for (String tag : serviceTags) {
+ serviceTagsTextbox.clear();
+ serviceTagsTextbox.sendKeys(tag);
+ serviceTagsTextbox.sendKeys(Keys.ENTER);
+ taglist.add(tag);
+ }
+ taglist.add(0, service.getName());
+ service.setTags(taglist);
+ }
+
+ public static Select defineServiceCategory(String category) {
+
+ return GeneralUIUtils.getSelectList(category, "selectGeneralCategory");
+ }
+
+ public static void defineServiceProjectCode(String projectCode) {
+ WebElement projectCodeTextbox = GeneralUIUtils.getWebElementWaitForVisible("projectCode");
+ projectCodeTextbox.clear();
+ projectCodeTextbox.sendKeys(projectCode);
+ }
+
+ public static void selectRandomResourceIcon() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.ICON);
+ WebDriverWait wait = new WebDriverWait(driver, 6);
+ wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[contains(@data-tests-id, 'iconBox')]")));
+ List<WebElement> iconElement = driver.findElements(By.xpath("//*[contains(@data-tests-id, 'iconBox')]"));
+ iconElement.get(0).click();
+ }
+
+ public static String defineDescription(String description) {
+ WebElement descriptionTextbox = GeneralUIUtils.getWebElementWaitForVisible("description");
+ descriptionTextbox.clear();
+ descriptionTextbox.sendKeys(description);
+ return description;
+ }
+
+ public static void defineContactId(String userId) {
+ WebElement contactId = GeneralUIUtils.getWebElementWaitForVisible("contactId");
+ contactId.clear();
+ contactId.sendKeys(userId);
+ }
+
+ public static WebElement clickAddArtifact() {
+
+ return GeneralUIUtils.getWebButton("addArtifactButton");
+ }
+
+ public static WebElement getArtifactName() {
+ return GeneralUIUtils.getWebButton("artifactName");
+ }
+
+ public static WebElement getArtifactDetails() {
+ return GeneralUIUtils.getWebButton("artifactDisplayName");
+ }
+
+ public static void fillServiceGeneralPage(ServiceReqDetails service, User user) throws Exception {
+ ServiceGeneralPage.defineName(service.getName());
+ ServiceGeneralPage.defineDescription(service.getDescription());
+ ServiceGeneralPage.defineCategory(service.getCategories().get(0).getName());
+ ServiceGeneralPage.defineProjectCode(service.getProjectCode());
+ ServiceGeneralPage.defineTagsList(service, new String[] { "This-is-tag", "another-tag" });
+
+ }
+
+ public static void createService(ServiceReqDetails service, User user) throws Exception, AWTException {
+
+ ResourceUIUtils.moveToHTMLElementByClassName("w-sdc-dashboard-card-new");
+ ResourceUIUtils.clickOnHTMLElementByDataTestId(DataTestIdEnum.Dashboard.BUTTON_ADD_SERVICE.getValue());
+ GeneralUIUtils.waitForLoader();
+ fillServiceGeneralPage(service, user);
+ GeneralUIUtils.clickCreateButton();
+ SetupCDTest.getExtendTest().log(LogStatus.INFO, String.format("Service %s created", service.getName()));
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java
new file mode 100644
index 0000000000..cbad80d344
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.verificator;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+
+public class ServiceVerificator {
+
+ private ServiceVerificator() {
+ }
+
+ public static void verifyNumOfComponentInstances(ComponentReqDetails component, String version, int numOfVFC,
+ User user) {
+ String responseAfterDrag = null;
+ component.setVersion(version);
+ if (component instanceof ServiceReqDetails) {
+ responseAfterDrag = RestCDUtils.getService((ServiceReqDetails) component, user).getResponse();
+ } else if (component instanceof ResourceReqDetails) {
+ responseAfterDrag = RestCDUtils.getResource((ResourceReqDetails) component, user).getResponse();
+ }
+ JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+ int size = ((JSONArray) jsonResource.get("componentInstances")).size();
+ assertTrue(size == numOfVFC);
+ }
+
+ public static void verifyLinkCreated(ServiceReqDetails createServiceInUI, User user, int expectedRelationsSize) {
+ String responseAfterDrag = RestCDUtils.getService(createServiceInUI, user).getResponse();
+ JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+ assertTrue(((JSONArray) jsonResource.get("componentInstancesRelations")).size() == expectedRelationsSize);
+
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfVerificator.java
new file mode 100644
index 0000000000..1ffde75414
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfVerificator.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.verificator;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.util.Iterator;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+
+public final class VfVerificator {
+ private VfVerificator() {
+ }
+
+ public static void verifyNumOfComponentInstances(ResourceReqDetails createResourceInUI, int numOfVFC, User user) {
+ String responseAfterDrag = RestCDUtils.getResource(createResourceInUI, user).getResponse();
+ JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+ int size = ((JSONArray) jsonResource.get("componentInstances")).size();
+ assertTrue(size == numOfVFC);
+ }
+
+ public static void verifyRILocationChanged(ResourceReqDetails createResourceInUI,
+ ImmutablePair<String, String> prevRIPos, User user) {
+
+ ImmutablePair<String, String> currRIPos = ResourceUIUtils.getFirstRIPos(createResourceInUI, user);
+ assertTrue(!prevRIPos.left.equals(currRIPos.left) || !prevRIPos.right.equals(currRIPos.right));
+ }
+
+ public static void verifyLinkCreated(ResourceReqDetails createResourceInUI, User user, int expectedRelationsSize) {
+ String responseAfterDrag = RestCDUtils.getResource(createResourceInUI, user).getResponse();
+ JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+ assertTrue(((JSONArray) jsonResource.get("componentInstancesRelations")).size() == expectedRelationsSize);
+
+ }
+
+ public static void verifyVFUpdatedInUI(ResourceReqDetails vf) {
+ assertTrue(vf.getName().equals(ResourceGeneralPage.getNameText()));
+ assertTrue(vf.getDescription().equals(ResourceGeneralPage.getDescriptionText()));
+ assertTrue(vf.getVendorName().equals(ResourceGeneralPage.getVendorNameText()));
+ assertTrue(vf.getVendorRelease().equals(ResourceGeneralPage.getVendorReleaseText()));
+ assertTrue(vf.getContactId().equals(ResourceGeneralPage.getUserIdContactText()));
+ }
+
+ public static void verifyVFUpdated(ResourceReqDetails vf, User user) {
+ String response = RestCDUtils.getResource(vf, user).getResponse();
+ Resource resource = ResponseParser.convertResourceResponseToJavaObject(response);
+ assertTrue(vf.getName().equals(resource.getName()));
+ assertTrue(vf.getDescription().equals(resource.getDescription()));
+ assertTrue(vf.getCategories().equals(resource.getCategories()));
+ assertTrue(vf.getVendorName().equals(resource.getVendorName()));
+ assertTrue(vf.getVendorRelease().equals(resource.getVendorRelease()));
+ assertTrue(vf.getTags().equals(resource.getTags()));
+ assertTrue(vf.getContactId().equals(resource.getContactId()));
+ }
+
+ public static void verifyVFLifecycle(ResourceReqDetails vf, User user, LifecycleStateEnum expectedLifecycleState) {
+ String responseAfterDrag = RestCDUtils.getResource(vf, user).getResponse();
+ JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+ String actualLifecycleState = jsonResource.get("lifecycleState").toString();
+ assertTrue("actual: " + actualLifecycleState + "--expected: " + expectedLifecycleState,
+ expectedLifecycleState.name().equals(actualLifecycleState));
+ }
+}