summaryrefslogtreecommitdiffstats
path: root/ui-ci/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'ui-ci/src/main/java')
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java6
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/GAB.java123
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java28
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java18
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java4
5 files changed, 145 insertions, 34 deletions
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
index 7a8bcd3aba..0046489a7d 100644
--- 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
@@ -112,6 +112,7 @@ public final class DataTestIdEnum {
UPGRADE_SERVICES_OK("upgradeVspModal-button-upgrade"),
UPDATE_SERVICES_OK("upgradeVspModal-button-update"),
UPGRADE_SERVICES_CLOSE("upgradeVspModal-button-close"),
+ UPGRADE_ARTIFACT_BUTTON("upgradeVspModal-button-done"),
ACCEPT_TESTING_MESSAGE("checkindialog");
private final String value;
@@ -203,7 +204,7 @@ public final class DataTestIdEnum {
@AllArgsConstructor
@Getter
public enum ArtifactPageEnum {
- ADD_DEPLOYMENT_ARTIFACT("add-deployment-artifact-button"),
+ ADD_DEPLOYMENT_ARTIFACT("add_artifact_btn"),
ADD_INFORMATIONAL_ARTIFACT("add-information-artifact-button"),
DOWNLOAD_ARTIFACT_ENV("download_env_"),
ADD_ANOTHER_ARTIFACT("add-another-artifact-button"),
@@ -396,11 +397,12 @@ public final class DataTestIdEnum {
@AllArgsConstructor
@Getter
public enum ArtifactPopup {
-
BROWSE("browseButton"),
+ FILE_UNDEFINED("fileundefined"),
ARTIFACT_DESCRIPTION("description"),
ARTIFACT_LABEL("artifactLabel"),
ARTIFACT_TYPE("artifacttype"),
+ ARTIFACT_TYPE_ICON("artifacttype-icon"),
OK("OK"),
SAVE("Save"),
DONE_BUTTON("Done"),
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/GAB.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/GAB.java
new file mode 100644
index 0000000000..348400e32e
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/GAB.java
@@ -0,0 +1,123 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2020 Nokia 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 com.aventstack.extentreports.Status;
+import java.util.Collections;
+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.DataTestIdEnum;
+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.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+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.WebElement;
+import org.testng.AssertJUnit;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+public class GAB extends SetupCDTest {
+
+ private static final int THREAD_SLEEP_TIME = 1000;
+ private static final int MAIN_PAGE_ROWS_SIZE = 2;
+ private static final int MAIN_PAGE_COLUMN_SIZE = 5;
+
+ private String pnfFilePath;
+ private String vnfFilePath;
+
+ @BeforeClass
+ public void beforeClass() {
+ pnfFilePath = FileHandling.getFilePath("PNFs");
+ vnfFilePath = FileHandling.getFilePath("VNFs");
+ }
+
+ @Test
+ public void addPmDictionaryDeploymentArtifactToPnfAndCheckMagnifierTest() throws Exception {
+ final int expectedHeaderSize = MAIN_PAGE_COLUMN_SIZE + 10;
+ final int expectedRowSize = MAIN_PAGE_ROWS_SIZE + 3;
+ ResourceReqDetails pnfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.PNF, getUser());
+ ResourceUIUtils.createPNF(pnfMetaData, getUser());
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+ ArtifactInfo art1 = new ArtifactInfo(pnfFilePath, "pmDictionary.yml", "desc", "artifactpm", "PM_DICTIONARY");
+ addArtifactAndOpenGAB(art1);
+ assertHeaderAndRowSize(expectedHeaderSize, expectedRowSize);
+ }
+
+ @Test
+ public void addVesEventsDeploymentArtifactToVfAndCheckMagnifierTest() throws Exception {
+ final int expectedHeaderSize = MAIN_PAGE_COLUMN_SIZE + 4;
+ final int expectedRowSize = MAIN_PAGE_ROWS_SIZE + 3;
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+ ArtifactInfo art1 = new ArtifactInfo(vnfFilePath, "vesEvent.yml", "desc", "artifactfault", "VES_EVENTS");
+ addArtifactAndOpenGAB(art1);
+ assertHeaderAndRowSize(expectedHeaderSize, expectedRowSize);
+ }
+
+ private void addArtifactAndOpenGAB(ArtifactInfo art1) throws Exception {
+ addNewArtifact(Collections.singletonList(art1));
+ openGABPopup(art1);
+ }
+
+ private void assertHeaderAndRowSize(int expectedHeaderSize, int expectedRowSize) {
+ List<WebElement> headers = getListOfHeaders();
+ AssertJUnit.assertEquals(expectedHeaderSize, headers.size());
+ List<WebElement> rows = GeneralUIUtils.getWebElementsListByContainsClassName("datatable-body-row");
+ AssertJUnit.assertEquals(expectedRowSize, rows.size());
+ }
+
+ private void openGABPopup(ArtifactInfo art1) throws InterruptedException {
+ SetupCDTest.getExtendTest()
+ .log(Status.INFO, String.format("Clicking on magnifier button %s", art1.getArtifactLabel()));
+ WebElement magnifierButtonElement = GeneralUIUtils.getWebElementByTestID(
+ DataTestIdEnum.ArtifactPageEnum.BROWSE_ARTIFACT.getValue() + art1.getArtifactLabel());
+ SetupCDTest.getExtendTest()
+ .log(Status.INFO, String.format("Found magnifier button: %s", magnifierButtonElement.getText()));
+ magnifierButtonElement.click();
+ Thread.sleep(THREAD_SLEEP_TIME); // have to wait until table will be rendered
+ }
+
+ private List<WebElement> getListOfHeaders() {
+ return GeneralUIUtils.getWebElementsListByClassName("datatable-header-cell");
+ }
+
+ private void addNewArtifact(List<ArtifactInfo> deploymentArtifactList) throws Exception {
+ for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+ DeploymentArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
+ }
+ AssertJUnit.assertTrue(DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));
+ }
+
+ @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
index 51f78f9eb3..1bbebd3d66 100644
--- 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
@@ -510,34 +510,6 @@ public class Vf extends SetupCDTest {
}
- @Test
- public void addVesEventsDeploymentArtifactToVfAndCheckMagnifierTest() throws Exception {
- final int expectedHeaderAndRowSize = 3;
- ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createVF(vfMetaData, getUser());
-
- ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
-
- List<ArtifactInfo> deploymentArtifactList = new ArrayList<>();
- ArtifactInfo art1 = new ArtifactInfo(filePath, "fm_metadata_three_fault_defs.yml", "desc", "artifactfault", "VES_EVENTS");
- deploymentArtifactList.add(art1);
- for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
- DeploymentArtifactPage.clickAddNewArtifact();
- ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
- }
- AssertJUnit.assertTrue(DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));
-
- SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on magnifier button %s", art1.getArtifactLabel()));
- WebElement magnifierButtonElement = GeneralUIUtils.getWebElementByTestID(ArtifactPageEnum.BROWSE_ARTIFACT.getValue() + art1.getArtifactLabel());
- SetupCDTest.getExtendTest().log(Status.INFO, String.format("Found magnifier button: %s", magnifierButtonElement.getText()));
- magnifierButtonElement.click();
- List<WebElement> headers = GeneralUIUtils.getWebElementsListByClassName("datatable-header-cell");
- AssertJUnit.assertEquals(expectedHeaderAndRowSize, headers.size());
- headers.get(0).getText();
- List<WebElement> rows = GeneralUIUtils.getWebElementsListByContainsClassName("datatable-body-row");
- AssertJUnit.assertEquals(expectedHeaderAndRowSize, rows.size());
- }
-
private void takeScreenshot(final String screenshotName, final String errorMsg) {
try {
ExtentTestActions.addScreenshot(Status.ERROR, screenshotName, errorMsg);
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
index d8007c013b..586f02c0f9 100644
--- 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
@@ -54,6 +54,13 @@ public class UploadArtifactPopup {
GeneralUIUtils.ultimateWait();
}
+ public void loadUndefinedFile(String path, String filename) {
+ final WebElement browseWebElement = GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPopup.FILE_UNDEFINED.getValue());
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Uploading file: %s", path + File.separator + filename));
+ browseWebElement.sendKeys(path + File.separator + filename);
+ GeneralUIUtils.ultimateWait();
+ }
+
public void insertDescription(String artifactDescriptoin) {
SetupCDTest.getExtendTest().log(Status.INFO, String.format("Changing artifact description to: %s", artifactDescriptoin));
@@ -76,8 +83,9 @@ public class UploadArtifactPopup {
return selectList;
}
- public Select selectArtifactType(String artifactType) {
- return GeneralUIUtils.getSelectList(artifactType, DataTestIdEnum.ArtifactPopup.ARTIFACT_TYPE.getValue());
+ public void selectArtifactType(String artifactType) {
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPopup.ARTIFACT_TYPE_ICON.getValue());
+ GeneralUIUtils.clickOnElementByTestId(artifactType);
}
public void clickDoneButton() throws Exception {
@@ -86,6 +94,12 @@ public class UploadArtifactPopup {
GeneralUIUtils.waitForElementInVisibilityBy(By.className("sdc-add-artifact"), WAITING_FOR_ELEMENT_TIME_OUT);
}
+ public void clickUpgradeArtifactsButton() throws Exception {
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.UPGRADE_ARTIFACT_BUTTON.getValue());
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.waitForElementInVisibilityBy(By.className("sdc-add-artifact"), WAITING_FOR_ELEMENT_TIME_OUT);
+ }
+
public void clickCancelButton() throws Exception {
GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.CANCEL_BUTTON.getValue()).click();
GeneralUIUtils.waitForLoader();
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
index 61a648cbfe..d85e17fa3f 100644
--- 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
@@ -58,8 +58,8 @@ public final class ArtifactUIUtils {
artifactPopup.defineArtifactLabel(artifactInfo.getArtifactLabel());
artifactPopup.selectArtifactType(artifactInfo.getArtifactType());
artifactPopup.insertDescription(artifactInfo.getDescription());
- artifactPopup.loadFile(artifactInfo.getFilepath(), artifactInfo.getFilename());
- artifactPopup.clickDoneButton();
+ artifactPopup.loadUndefinedFile(artifactInfo.getFilepath(), artifactInfo.getFilename());
+ artifactPopup.clickUpgradeArtifactsButton();
SetupCDTest.getExtendTest().log(Status.INFO, String.format("A new artifact of type %s was added", artifactInfo.getArtifactType()));
}