diff options
author | ys9693 <ys9693@att.com> | 2020-01-19 13:50:02 +0200 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-01-22 12:33:31 +0000 |
commit | 16a9fce0e104a38371a9e5a567ec611ae3fc7f33 (patch) | |
tree | 03a2aff3060ddb5bc26a90115805a04becbaffc9 /ui-ci/src/main/java | |
parent | aa83a2da4f911c3ac89318b8e9e8403b072942e1 (diff) |
Catalog alignment
Issue-ID: SDC-2724
Signed-off-by: ys9693 <ys9693@att.com>
Change-Id: I52b4aacb58cbd432ca0e1ff7ff1f7dd52099c6fe
Diffstat (limited to 'ui-ci/src/main/java')
51 files changed, 323 insertions, 258 deletions
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java index 7ea23c1ff3..f71efa2ee3 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java @@ -28,10 +28,10 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/LocalGeneralUtilities.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/LocalGeneralUtilities.java index f5ebac6eeb..01cd57a133 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/LocalGeneralUtilities.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/LocalGeneralUtilities.java @@ -24,9 +24,9 @@ import org.json.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.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.pages.HomePage; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java index d2c37c2b88..0a7d814572 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java @@ -23,7 +23,6 @@ package org.openecomp.sdc.ci.tests.US; import com.aventstack.extentreports.Status; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.ci.tests.data.providers.OnboardingDataProviders; -import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ToscaArtifactsScreenEnum; @@ -31,6 +30,7 @@ import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition; +import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar; @@ -58,7 +58,7 @@ import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator; import org.openecomp.sdc.ci.tests.verificator.VfModuleVerificator; import org.testng.annotations.Test; -import java.awt.AWTException; +import java.awt.*; import java.io.File; import java.util.LinkedList; import java.util.List; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java index 89d90df24d..2536e090c5 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java @@ -20,16 +20,17 @@ package org.openecomp.sdc.ci.tests.dataProvider; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; import org.openecomp.sdc.ci.tests.datatypes.enums.XnfTypeEnum; import org.openecomp.sdc.ci.tests.utilities.FileHandling; import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; import org.testng.Assert; import org.testng.annotations.DataProvider; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + public class OnbordingDataProviders { private static final String VSP_VGW_CSAR = "vsp-vgw.csar"; 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 0d216572ba..7a8bcd3aba 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 @@ -20,13 +20,14 @@ package org.openecomp.sdc.ci.tests.datatypes; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; import lombok.AllArgsConstructor; import lombok.Getter; import org.openecomp.sdc.ci.tests.pages.TopSearchComponent; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + public final class DataTestIdEnum { private DataTestIdEnum() { @@ -101,7 +102,7 @@ public final class DataTestIdEnum { ADD("Add"), DESCRIPTION("description"), SUMBIT_FOR_TESTING_MESSAGE("changeLifeCycleMessage"), - OK("OK"), + OK("confirm-modal-button-ok"), CANCEL("Cancel"), DELETE_INSTANCE_OK("deleteInstanceModal-button-ok"), DELETE_INSTANCE_CANCEL("deleteInstanceModal-button-cancel"), @@ -418,6 +419,8 @@ public final class DataTestIdEnum { DESCRIPTION("description"), CATEGORY("selectGeneralCategory"), PROJECT_CODE("projectCode"), + NAMING_POLICY("namingPolicy"), + SERVICE_FUNCTION("serviceFunction"), TAGS("i-sdc-tag-input"), CONTACT_ID("contactId"), ICON(" iconBox"), @@ -523,7 +526,7 @@ public final class DataTestIdEnum { CHANGE_VERSION("changeVersion", Collections.emptyList()), DEPLOYMENT_ARTIFACT_TAB("deployment-artifact-tab", Collections.singletonList("Deployment Artifacts")), ADD_ARTIFACT("add_Artifact_Button", Collections.emptyList()), - SEARCH_ASSET("searchAsset", Collections.emptyList()), + SEARCH_ASSET("searchAsset-input", Arrays.asList()), PROPERTIES_AND_ATTRIBUTES_TAB("properties-and-attributes-tab", Collections.emptyList()), MENU_INPUTS("sub-menu-button-inputs", Collections.emptyList()), MENU_ONBOARD("sub-menu-button-onboard", Collections.emptyList()), @@ -708,7 +711,7 @@ public final class DataTestIdEnum { @AllArgsConstructor @Getter public enum ImportVfRepository { - SEARCH("onboarding-search"), + SEARCH("onboarding-search-input"), IMPORT_VSP("import-csar"), DOWNLOAD_CSAR("download-csar"), UPDATE_VSP("update-csar"); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ArchiveRestoreTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ArchiveRestoreTest.java index 0e6bfc9dfc..95ee634050 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ArchiveRestoreTest.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ArchiveRestoreTest.java @@ -27,11 +27,11 @@ import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; +import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java index 83e64ef570..a751cc2126 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java @@ -28,9 +28,9 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders; -import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsThroughAPI.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsThroughAPI.java index 136fcb5c07..d2851efc17 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsThroughAPI.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsThroughAPI.java @@ -28,10 +28,10 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.data.providers.OnboardingDataProviders; -import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; +import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; import org.openecomp.sdc.ci.tests.datatypes.enums.CvfcTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsUi.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsUi.java index 17c953ee13..a3a9d1a9e0 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsUi.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsUi.java @@ -20,20 +20,11 @@ package org.openecomp.sdc.ci.tests.execute.sanity; -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertFalse; -import static org.testng.AssertJUnit.assertNotNull; -import static org.testng.AssertJUnit.assertTrue; -import static org.testng.AssertJUnit.fail; - import com.aventstack.extentreports.ExtentTest; import com.aventstack.extentreports.Status; -import java.io.File; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.ci.tests.data.providers.OnboardingDataProviders; import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders; import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; @@ -45,7 +36,6 @@ import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.XnfTypeEnum; -import org.openecomp.sdc.ci.tests.execute.setup.ArtifactsCorrelationManager; import org.openecomp.sdc.ci.tests.execute.setup.DriverFactory; import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; @@ -58,7 +48,6 @@ 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.HomePage; -import org.openecomp.sdc.ci.tests.pages.HomePage.PageElement; import org.openecomp.sdc.ci.tests.pages.OpsOperationPage; import org.openecomp.sdc.ci.tests.pages.ResourceCreatePage; import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; @@ -72,6 +61,7 @@ import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils; import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; import org.openecomp.sdc.ci.tests.utils.Utils; +import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; import org.openecomp.sdc.ci.tests.utils.general.VendorLicenseModelRestUtils; @@ -87,6 +77,20 @@ import org.testng.annotations.Optional; import org.testng.annotations.Parameters; import org.testng.annotations.Test; +import java.io.File; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import static org.openecomp.sdc.ci.tests.pages.GeneralPageElements.clickOKButton; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertFalse; +import static org.testng.AssertJUnit.assertNotNull; +import static org.testng.AssertJUnit.assertTrue; +import static org.testng.AssertJUnit.fail; + public class OnboardingFlowsUi extends SetupCDTest { private static final Logger LOGGER = LoggerFactory.getLogger(OnboardingFlowsUi.class); @@ -415,28 +419,15 @@ public class OnboardingFlowsUi extends SetupCDTest { ServiceUIUtils.createService(serviceMetadata); ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); - CompositionPage.searchForElement(vspName); - final CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager(); - final CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName); - ArtifactsCorrelationManager.addVNFtoServiceArtifactCorrelation(serviceMetadata.getName(), vspName); - - assertNotNull(vfElement); - ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser()); - ExtentTestActions.addScreenshot(Status.INFO, "ServiceComposition_" + vnfFile, "The service topology is as follows: "); - - ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName()); - - reloginWithNewRole(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); - TesterOperationPage.certifyComponent(serviceMetadata.getName()); - - reloginWithNewRole(UserRoleEnum.GOVERNOR); - HomePage.waitForElement(PageElement.COMPONENT_PANEL); - HomePage.findComponentAndClick(serviceMetadata.getName()); - GovernorOperationPage.approveService(serviceMetadata.getName()); + Service containerObject = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, serviceMetadata.getName(), "0.1"); + Resource instanceObject = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "1.0"); + ComponentInstance componentInstanceDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(instanceObject, containerObject, UserRoleEnum.DESIGNER, true).left().value(); - runDistributionFlow(serviceMetadata); + GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.LifeCyleChangeButtons.CERTIFY.getValue()); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DistributionChangeButtons.APPROVE_MESSAGE.getValue()) + .sendKeys("service " + serviceMetadata.getName() + " certified successfully"); + clickOKButton(); getExtendTest().log(Status.INFO, String.format("Successfully onboarded the package '%s'", vnfFile)); } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PropertiesAssignmentUpdateFlow.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PropertiesAssignmentUpdateFlow.java index ec2b88dbf9..41c0d406b7 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PropertiesAssignmentUpdateFlow.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PropertiesAssignmentUpdateFlow.java @@ -27,13 +27,13 @@ import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; 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.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; +import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PropertiesAssignmentUpdateFlow_New.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PropertiesAssignmentUpdateFlow_New.java index 92123f66d6..c4b17f6594 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PropertiesAssignmentUpdateFlow_New.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PropertiesAssignmentUpdateFlow_New.java @@ -26,13 +26,13 @@ import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; 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.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; +import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java index 530c3fba96..fc4dd88185 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java @@ -73,7 +73,7 @@ import org.testng.TestException; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.awt.AWTException; +import java.awt.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/UpgradeServices.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/UpgradeServices.java index 9fc4cd7243..d8266f19df 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/UpgradeServices.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/UpgradeServices.java @@ -25,7 +25,6 @@ import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; import org.openecomp.sdc.ci.tests.datatypes.ConnectionWizardPopUpObject; @@ -36,6 +35,7 @@ import org.openecomp.sdc.ci.tests.datatypes.PortMirroringEnum; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; +import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java index 56b6fb7f17..9ee8c06938 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java @@ -23,9 +23,9 @@ package org.openecomp.sdc.ci.tests.execute.sanity; import com.aventstack.extentreports.Status; import org.apache.http.HttpStatus; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; 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 6a1ec57837..51f78f9eb3 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 @@ -20,15 +20,10 @@ package org.openecomp.sdc.ci.tests.execute.sanity; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - import com.aventstack.extentreports.Status; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo; @@ -76,6 +71,12 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.assertEquals; + public class Vf extends SetupCDTest { private static final Logger LOGGER = LoggerFactory.getLogger(Vf.class); @@ -426,15 +427,16 @@ public class Vf extends SetupCDTest { } @Test - public void changeInstanceNameInVfTest() { + public void changeInstanceNameInVfTest() throws Exception { final ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); ResourceUIUtils.createVF(vfMetaData, getUser()); + Resource containerObject = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vfMetaData.getName(), vfMetaData.getVersion()); + Resource computeObject = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, "Compute", "1.0"); + ComponentInstance componentInstanceDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(computeObject, containerObject, UserRoleEnum.DESIGNER, true).left().value(); + containerObject = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vfMetaData.getName(), vfMetaData.getVersion()); + String intanceWithUpdatedName = AtomicOperationUtils.updateComponentInstanceName("newName", containerObject, componentInstanceDetails.getName(), getUser(), true).getRight().getName(); ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); - final CanvasManager vfCanvasManager = CanvasManager.getCanvasManager(); - final CanvasElement computeElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE); - final String updatedInstanceName = "updatedName"; - vfCanvasManager.updateElementNameInCanvas(computeElement, updatedInstanceName); - assertEquals(CompositionPage.getSelectedInstanceName(), updatedInstanceName); + assertEquals(intanceWithUpdatedName, "newName"); } @Test diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestActions.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestActions.java index 4fc05d93a8..d05d3c5498 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestActions.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestActions.java @@ -26,15 +26,15 @@ import com.aventstack.extentreports.Status; import com.aventstack.extentreports.markuputils.ExtentColor; import com.aventstack.extentreports.markuputils.Markup; import com.aventstack.extentreports.markuputils.MarkupHelper; -import java.util.Optional; import org.openecomp.sdc.ci.tests.api.SomeInterface; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; +import java.util.Optional; import java.util.UUID; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public final class ExtentTestActions { diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java index 1effea93b8..669cbe17ef 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java @@ -22,9 +22,10 @@ package org.openecomp.sdc.ci.tests.execute.setup; import com.aventstack.extentreports.ExtentReports; import com.aventstack.extentreports.ExtentTest; -import java.util.HashMap; import org.openecomp.sdc.ci.tests.api.SomeInterface; +import java.util.HashMap; + public class ExtentTestManager implements SomeInterface { private final HashMap<Long, ExtentTest> extentTestByThreadIdMap = new HashMap<>(); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ReportAfterTestManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ReportAfterTestManager.java index 50b6dafe1a..e35ba05004 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ReportAfterTestManager.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ReportAfterTestManager.java @@ -20,12 +20,7 @@ package org.openecomp.sdc.ci.tests.execute.setup; -import static org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions.addScreenshot; -import static org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions.addTag; -import static org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions.log; - import com.aventstack.extentreports.Status; -import java.io.IOException; import org.apache.commons.lang3.StringUtils; import org.openecomp.sdc.ci.tests.execute.setup.ExtentManager.suiteNameXml; import org.slf4j.Logger; @@ -33,6 +28,12 @@ import org.slf4j.LoggerFactory; import org.testng.ITestContext; import org.testng.ITestResult; +import java.io.IOException; + +import static org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions.addScreenshot; +import static org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions.addTag; +import static org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions.log; + public class ReportAfterTestManager { private static final Logger LOGGER = LoggerFactory.getLogger(ReportAfterTestManager.class); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WebDriverThread.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WebDriverThread.java index 8fdad16497..6118fa2fee 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WebDriverThread.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WebDriverThread.java @@ -35,13 +35,13 @@ import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.LocalFileDetector; import org.openqa.selenium.remote.RemoteWebDriver; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.File; import java.net.MalformedURLException; import java.net.URL; import java.util.UUID; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class WebDriverThread { diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/flow/CheckSoftwareVersionPropertyFlow.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/flow/CheckSoftwareVersionPropertyFlow.java index dbdbe10c6d..c91f89370d 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/flow/CheckSoftwareVersionPropertyFlow.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/flow/CheckSoftwareVersionPropertyFlow.java @@ -19,18 +19,19 @@ package org.openecomp.sdc.ci.tests.flow; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.hasSize; -import static org.junit.Assert.assertThat; - import com.aventstack.extentreports.Status; -import java.util.List; -import java.util.Optional; import org.openecomp.sdc.ci.tests.pages.PageObject; import org.openecomp.sdc.ci.tests.pages.ResourceLeftSideMenu; import org.openecomp.sdc.ci.tests.pages.ResourcePropertiesAssignmentPage; import org.openqa.selenium.WebDriver; +import java.util.List; +import java.util.Optional; + +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.hasSize; +import static org.junit.Assert.assertThat; + /** * UI Flow for checking the software version property in a resource */ diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/flow/CreateResourceFlow.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/flow/CreateResourceFlow.java index 0ff923c42a..65d55993f0 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/flow/CreateResourceFlow.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/flow/CreateResourceFlow.java @@ -20,12 +20,13 @@ package org.openecomp.sdc.ci.tests.flow; import com.aventstack.extentreports.Status; -import java.util.Optional; import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; import org.openecomp.sdc.ci.tests.pages.PageObject; import org.openecomp.sdc.ci.tests.pages.ResourceCreatePage; import org.openqa.selenium.WebDriver; +import java.util.Optional; + /** * UI Flow for Resource creation */ diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/flow/CreateVspFlow.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/flow/CreateVspFlow.java index 910ef4d4ed..b5af962243 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/flow/CreateVspFlow.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/flow/CreateVspFlow.java @@ -19,11 +19,7 @@ package org.openecomp.sdc.ci.tests.flow; -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; - import com.aventstack.extentreports.Status; -import java.util.Optional; import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; import org.openecomp.sdc.ci.tests.pages.OnboardHomePage; import org.openecomp.sdc.ci.tests.pages.PageObject; @@ -33,6 +29,11 @@ import org.openecomp.sdc.ci.tests.pages.VspCreationModal; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebDriver; +import java.util.Optional; + +import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertThat; + /** * UI Flow for VSP creation */ diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/flow/ImportVspFlow.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/flow/ImportVspFlow.java index e59a5c179c..5d05479b41 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/flow/ImportVspFlow.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/flow/ImportVspFlow.java @@ -20,7 +20,6 @@ package org.openecomp.sdc.ci.tests.flow; import com.aventstack.extentreports.Status; -import java.util.Optional; import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; import org.openecomp.sdc.ci.tests.pages.PageObject; import org.openecomp.sdc.ci.tests.pages.ResourceCreatePage; @@ -28,6 +27,8 @@ import org.openecomp.sdc.ci.tests.pages.TopNavComponent; import org.openecomp.sdc.ci.tests.pages.VspRepositoryModalComponent; import org.openqa.selenium.WebDriver; +import java.util.Optional; + /** * UI Flow for importing a VSP */ diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/flow/UiTestFlow.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/flow/UiTestFlow.java index eedecbfd61..c323479833 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/flow/UiTestFlow.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/flow/UiTestFlow.java @@ -19,9 +19,10 @@ package org.openecomp.sdc.ci.tests.flow; -import java.util.Optional; import org.openecomp.sdc.ci.tests.pages.PageObject; +import java.util.Optional; + /** * Represents a UI test flow */ diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/AbstractPageObject.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/AbstractPageObject.java index 1c051db087..c9b4f4994d 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/AbstractPageObject.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/AbstractPageObject.java @@ -19,13 +19,14 @@ package org.openecomp.sdc.ci.tests.pages; -import java.util.List; 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 java.util.List; + /** * Base UI test object that represents a page or component in a html page */ 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 index 669a79ac39..bc0165bb5f 100644 --- 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 @@ -168,7 +168,7 @@ public class DeploymentArtifactPage extends GeneralPageElements { SetupCDTest.getExtendTest().log(Status.INFO, "Verifying the artifacts in the table");
List<String> artifactList = Lists.newArrayList(artifactsFromZipFile).stream().filter(p -> !p.contains(".env")).map(p -> getVisualArtifactName(p)).collect(Collectors.toList());
try {
- List<WebElement> rows = GeneralUIUtils.getElementsByCSS("div div[data-tests-id^='artifact-item'] span[data-tests-id^='artifactDisplayName']");
+ List<WebElement> rows = GeneralUIUtils.getWebElementsListByContainsClassName("datatable-body-row");
for (WebElement r : rows) {
String artifactDisplayed = r.getAttribute("textContent").trim();
if (artifactList.contains(artifactDisplayed)) {
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 index 611c24a2a5..0342661232 100644 --- 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 @@ -149,10 +149,12 @@ public class GeneralPageElements { GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DistributionChangeButtons.APPROVE_MESSAGE.getValue()) .sendKeys("resource " + componentName + " certified successfully"); clickOKButton(); - clickUpgradeServicesCloseButton(); + GeneralUIUtils.ultimateWait(); + HomePage.navigateToHomePage(); GeneralUIUtils.ultimateWait(); HomePage.navigateToHomePage(); GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue(), GeneralUIUtils.getTimeOut() / WAIT_FOR_ELEMENT_TIME_OUT_DIVIDER); + GeneralUIUtils.ultimateWait(); } catch (Exception e) { throw new Exception("Certification of " + componentName + " failed"); } @@ -231,7 +233,7 @@ public class GeneralPageElements { public static List<WebElement> getElementsFromTable() { GeneralUIUtils.ultimateWait(); - return GeneralUIUtils.getElementsByLocator(By.className("flex-container")); + return GeneralUIUtils.getElementsByLocator(By.className("datatable-body")); } public static boolean checkElementsCountInTable(int expectedElementsCount) { 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 index 5ffd6c80a7..d4c0c9054b 100644 --- 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 @@ -21,7 +21,6 @@ package org.openecomp.sdc.ci.tests.pages; import com.aventstack.extentreports.Status; -import java.io.IOException; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; @@ -29,6 +28,8 @@ import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.IOException; + public class GovernorOperationPage { private static final Logger LOGGER = LoggerFactory.getLogger(GovernorOperationPage.class); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java index 3454c202a6..a0747fce0b 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java @@ -20,16 +20,7 @@ package org.openecomp.sdc.ci.tests.pages; -import static org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest.getExtendTest; -import static org.openecomp.sdc.ci.tests.pages.HomePage.PageElement.REPOSITORY_ICON; - import com.aventstack.extentreports.Status; -import java.io.File; -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.List; -import java.util.UUID; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.exception.HomePageRuntimeException; import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; @@ -43,6 +34,16 @@ import org.openqa.selenium.support.ui.WebDriverWait; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.File; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.List; +import java.util.UUID; + +import static org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest.getExtendTest; +import static org.openecomp.sdc.ci.tests.pages.HomePage.PageElement.REPOSITORY_ICON; + public class HomePage { private static final Logger LOGGER = LoggerFactory.getLogger(HomePage.class); @@ -60,6 +61,7 @@ public class HomePage { } public static boolean searchForVSP(String vspName) { + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ImportVfRepository.SEARCH.getValue()).clear(); GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ImportVfRepository.SEARCH.getValue()).sendKeys(vspName); GeneralUIUtils.ultimateWait(); return true; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OnboardHeaderComponent.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OnboardHeaderComponent.java index 5e82f769c1..f5801ad70f 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OnboardHeaderComponent.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OnboardHeaderComponent.java @@ -19,15 +19,15 @@ package org.openecomp.sdc.ci.tests.pages; -import static org.openecomp.sdc.ci.tests.pages.OnboardHeaderComponent.XpathSelector.MAIN_DIV; -import static org.openecomp.sdc.ci.tests.pages.OnboardHeaderComponent.XpathSelector.ONBOARD_TAB_DIV; -import static org.openecomp.sdc.ci.tests.pages.OnboardHeaderComponent.XpathSelector.WORKSPACE_TAB_DIV; - import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; +import static org.openecomp.sdc.ci.tests.pages.OnboardHeaderComponent.XpathSelector.MAIN_DIV; +import static org.openecomp.sdc.ci.tests.pages.OnboardHeaderComponent.XpathSelector.ONBOARD_TAB_DIV; +import static org.openecomp.sdc.ci.tests.pages.OnboardHeaderComponent.XpathSelector.WORKSPACE_TAB_DIV; + /** * Handles the Onboard Header Component UI test actions */ diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OnboardHomePage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OnboardHomePage.java index 22e4c17f17..3acb34b6c6 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OnboardHomePage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OnboardHomePage.java @@ -19,14 +19,14 @@ package org.openecomp.sdc.ci.tests.pages; -import static org.openecomp.sdc.ci.tests.pages.OnboardHomePage.XpathSelector.ADD_NEW_VLM_BTN; -import static org.openecomp.sdc.ci.tests.pages.OnboardHomePage.XpathSelector.ADD_NEW_VSP_BTN; - import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; +import static org.openecomp.sdc.ci.tests.pages.OnboardHomePage.XpathSelector.ADD_NEW_VLM_BTN; +import static org.openecomp.sdc.ci.tests.pages.OnboardHomePage.XpathSelector.ADD_NEW_VSP_BTN; + /** * Handles the Onboard Home Page UI test actions */ diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesAssignmentPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesAssignmentPage.java index a90f4632c3..629753f077 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesAssignmentPage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesAssignmentPage.java @@ -124,7 +124,7 @@ public class PropertiesAssignmentPage { try { SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on the %s component in Properties", resourceName)); - GeneralUIUtils.clickOnElementChildByTestIdWithoutWait(resourceName); + GeneralUIUtils.clickOnElementByInputTestIdWithoutWait(resourceName); GeneralUIUtils.ultimateWait(); GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()); } catch (final Exception e) { diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceCreatePage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceCreatePage.java index 5c9ec97ebd..26b3d6f0c6 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceCreatePage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceCreatePage.java @@ -19,11 +19,6 @@ package org.openecomp.sdc.ci.tests.pages; -import static org.hamcrest.Matchers.equalToIgnoringCase; -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; -import static org.openecomp.sdc.ci.tests.pages.ResourceCreatePage.XpathSelector.FORM_LIFE_CYCLE_STATE; - import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum; import org.openecomp.sdc.ci.tests.utilities.LoaderHelper; import org.openecomp.sdc.ci.tests.utilities.NotificationHelper; @@ -35,6 +30,11 @@ import org.openqa.selenium.support.ui.ExpectedConditions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.hamcrest.Matchers.equalToIgnoringCase; +import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertThat; +import static org.openecomp.sdc.ci.tests.pages.ResourceCreatePage.XpathSelector.FORM_LIFE_CYCLE_STATE; + /** * Handles the Resource Create Page UI actions */ diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftSideMenu.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftSideMenu.java index 5153107600..fd2f06a9b7 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftSideMenu.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftSideMenu.java @@ -19,14 +19,14 @@ package org.openecomp.sdc.ci.tests.pages; -import static org.openecomp.sdc.ci.tests.pages.ResourceLeftSideMenu.XpathSelector.MAIN_DIV; -import static org.openecomp.sdc.ci.tests.pages.ResourceLeftSideMenu.XpathSelector.PROPERTIES_ASSIGNMENT_MENU; - import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; +import static org.openecomp.sdc.ci.tests.pages.ResourceLeftSideMenu.XpathSelector.MAIN_DIV; +import static org.openecomp.sdc.ci.tests.pages.ResourceLeftSideMenu.XpathSelector.PROPERTIES_ASSIGNMENT_MENU; + /** * Handles the Resource Page Left Side Menu UI actions */ diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourcePropertiesAssignmentPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourcePropertiesAssignmentPage.java index 433d79e7b4..4cbac6ec92 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourcePropertiesAssignmentPage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourcePropertiesAssignmentPage.java @@ -19,6 +19,14 @@ package org.openecomp.sdc.ci.tests.pages; +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.ExpectedConditions; + +import java.util.ArrayList; +import java.util.List; + import static org.openecomp.sdc.ci.tests.pages.ResourcePropertiesAssignmentPage.XpathSelector.MAIN_DIV; import static org.openecomp.sdc.ci.tests.pages.ResourcePropertiesAssignmentPage.XpathSelector.NO_DATA_MESSAGE; import static org.openecomp.sdc.ci.tests.pages.ResourcePropertiesAssignmentPage.XpathSelector.PROPERTIES_TABLE; @@ -26,13 +34,6 @@ import static org.openecomp.sdc.ci.tests.pages.ResourcePropertiesAssignmentPage. import static org.openecomp.sdc.ci.tests.pages.ResourcePropertiesAssignmentPage.XpathSelector.SOFTWARE_VERSION_PROPERTY_CHECKBOX; import static org.openecomp.sdc.ci.tests.pages.ResourcePropertiesAssignmentPage.XpathSelector.TITLE_DIV; -import java.util.ArrayList; -import java.util.List; -import org.openqa.selenium.By; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.ui.ExpectedConditions; - /** * Handles the Resource Properties Assignment Page UI actions */ 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 index 07f3f23215..08bd580fc7 100644 --- 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 @@ -55,12 +55,39 @@ public class ServiceGeneralPage extends ResourceGeneralPage { serviceNameTextbox.sendKeys(serviceName); } + + public static void defineServiceFunction(String serviceFunction) { + WebElement serviceFunctionTextbox = GeneralUIUtils + .getWebElementByTestID(DataTestIdEnum.ServiceMetadataEnum.SERVICE_FUNCTION.getValue()); + serviceFunctionTextbox.clear(); + serviceFunctionTextbox.sendKeys(serviceFunction); + } + public static void defineProjectCode(String pmat) { WebElement projectCodeTextbox = GeneralUIUtils .getWebElementByTestID(DataTestIdEnum.ServiceMetadataEnum.PROJECT_CODE.getValue()); projectCodeTextbox.clear(); projectCodeTextbox.sendKeys(pmat); } + public static void defineNamingPolicy(String namingPolicyText) { + WebElement namingPolicyTextbox = GeneralUIUtils + .getWebElementByTestID(DataTestIdEnum.ServiceMetadataEnum.NAMING_POLICY.getValue()); + namingPolicyTextbox.clear(); + namingPolicyTextbox.sendKeys(namingPolicyText); + } + + public static String getServiceFunctionText(){ + return getServiceFunctionField().getAttribute("value"); + } + + public static String getNamingPolicyText(){ + return getNamingPolicyField().getAttribute("value"); + } + + private static WebElement getNamingPolicyField() { + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ServiceMetadataEnum.NAMING_POLICY.getValue()); + } + public static String getProjectCodeText() { return getProjectCodeField().getAttribute("value"); @@ -69,6 +96,9 @@ public class ServiceGeneralPage extends ResourceGeneralPage { public static String[] getTags() { return ResourceGeneralPage.getElementsFromTagsTable().stream().map(WebElement::getText).toArray(String[]::new); } + private static WebElement getServiceFunctionField() { + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ServiceMetadataEnum.SERVICE_FUNCTION.getValue()); + } private static WebElement getProjectCodeField() { return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ServiceMetadataEnum.PROJECT_CODE.getValue()); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/SoftwareProductOnboarding.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/SoftwareProductOnboarding.java index 169ded44ad..10f493e9c6 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/SoftwareProductOnboarding.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/SoftwareProductOnboarding.java @@ -19,6 +19,12 @@ package org.openecomp.sdc.ci.tests.pages; +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; import static org.openecomp.sdc.ci.tests.pages.SoftwareProductOnboarding.XpathSelector.ATTACHMENT_VIEW; @@ -30,12 +36,6 @@ import static org.openecomp.sdc.ci.tests.pages.SoftwareProductOnboarding.XpathSe import static org.openecomp.sdc.ci.tests.pages.SoftwareProductOnboarding.XpathSelector.PAGE_MAIN_DIV; import static org.openecomp.sdc.ci.tests.pages.SoftwareProductOnboarding.XpathSelector.SELECTED_NAV_BAR_GROUP_ITEM; -import org.openqa.selenium.By; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - public class SoftwareProductOnboarding extends AbstractPageObject { private static final Logger LOGGER = LoggerFactory.getLogger(SoftwareProductOnboarding.class); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TopNavComponent.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TopNavComponent.java index d16270ff54..acac74fbd2 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TopNavComponent.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TopNavComponent.java @@ -19,13 +19,6 @@ package org.openecomp.sdc.ci.tests.pages; -import static org.openecomp.sdc.ci.tests.pages.TopNavComponent.XpathSelector.ARROW_DROPDOWN; -import static org.openecomp.sdc.ci.tests.pages.TopNavComponent.XpathSelector.MAIN_MENU_ONBOARD_BTN; -import static org.openecomp.sdc.ci.tests.pages.TopNavComponent.XpathSelector.NAV; -import static org.openecomp.sdc.ci.tests.pages.TopNavComponent.XpathSelector.REPOSITORY_ICON; -import static org.openecomp.sdc.ci.tests.pages.TopNavComponent.XpathSelector.SUB_MENU_BUTTON_HOME; - -import java.util.List; import org.openecomp.sdc.ci.tests.execute.setup.DriverFactory; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; @@ -36,6 +29,14 @@ import org.openqa.selenium.support.ui.ExpectedConditions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.List; + +import static org.openecomp.sdc.ci.tests.pages.TopNavComponent.XpathSelector.ARROW_DROPDOWN; +import static org.openecomp.sdc.ci.tests.pages.TopNavComponent.XpathSelector.MAIN_MENU_ONBOARD_BTN; +import static org.openecomp.sdc.ci.tests.pages.TopNavComponent.XpathSelector.NAV; +import static org.openecomp.sdc.ci.tests.pages.TopNavComponent.XpathSelector.REPOSITORY_ICON; +import static org.openecomp.sdc.ci.tests.pages.TopNavComponent.XpathSelector.SUB_MENU_BUTTON_HOME; + /** * Handles the Top Navigation Component UI actions */ diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspCommitModal.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspCommitModal.java index 7a6aa7f055..48082f959f 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspCommitModal.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspCommitModal.java @@ -19,12 +19,6 @@ package org.openecomp.sdc.ci.tests.pages; -import static org.openecomp.sdc.ci.tests.pages.VspCommitModal.XpathSelector.COMMIT_AND_SUBMIT_BTN; -import static org.openecomp.sdc.ci.tests.pages.VspCommitModal.XpathSelector.COMMIT_COMMENT_TXT; -import static org.openecomp.sdc.ci.tests.pages.VspCommitModal.XpathSelector.MODAL_CANCEL_BTN; -import static org.openecomp.sdc.ci.tests.pages.VspCommitModal.XpathSelector.MODAL_DIV; -import static org.openecomp.sdc.ci.tests.pages.VspCommitModal.XpathSelector.SUCCESS_MODAL_DIV; - import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; @@ -32,6 +26,12 @@ import org.openqa.selenium.support.ui.ExpectedConditions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.openecomp.sdc.ci.tests.pages.VspCommitModal.XpathSelector.COMMIT_AND_SUBMIT_BTN; +import static org.openecomp.sdc.ci.tests.pages.VspCommitModal.XpathSelector.COMMIT_COMMENT_TXT; +import static org.openecomp.sdc.ci.tests.pages.VspCommitModal.XpathSelector.MODAL_CANCEL_BTN; +import static org.openecomp.sdc.ci.tests.pages.VspCommitModal.XpathSelector.MODAL_DIV; +import static org.openecomp.sdc.ci.tests.pages.VspCommitModal.XpathSelector.SUCCESS_MODAL_DIV; + /** * Handles the VSP Commit Modal UI actions */ diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspCreationModal.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspCreationModal.java index efd26b9a06..c4540c748d 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspCreationModal.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspCreationModal.java @@ -19,9 +19,6 @@ package org.openecomp.sdc.ci.tests.pages; -import static org.openecomp.sdc.ci.tests.pages.VspCreationModal.XpathSelector.METHOD_RADIO; -import static org.openecomp.sdc.ci.tests.pages.VspCreationModal.XpathSelector.MODAL_XPATH; - import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; @@ -29,6 +26,9 @@ import org.openqa.selenium.support.ui.Select; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.openecomp.sdc.ci.tests.pages.VspCreationModal.XpathSelector.METHOD_RADIO; +import static org.openecomp.sdc.ci.tests.pages.VspCreationModal.XpathSelector.MODAL_XPATH; + /** * Handles the VSP Creation Modal UI actions */ diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspRepositoryModalComponent.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspRepositoryModalComponent.java index b7611c69e5..f610074a55 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspRepositoryModalComponent.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspRepositoryModalComponent.java @@ -19,16 +19,6 @@ package org.openecomp.sdc.ci.tests.pages; -import static org.hamcrest.Matchers.empty; -import static org.hamcrest.core.Is.is; -import static org.hamcrest.core.IsNot.not; -import static org.junit.Assert.assertThat; -import static org.openecomp.sdc.ci.tests.pages.VspRepositoryModalComponent.XpathSelector.IMPORT_VSP_BTN; -import static org.openecomp.sdc.ci.tests.pages.VspRepositoryModalComponent.XpathSelector.MODAL_DIV; -import static org.openecomp.sdc.ci.tests.pages.VspRepositoryModalComponent.XpathSelector.RESULTS_CONTAINER_DIV; -import static org.openecomp.sdc.ci.tests.pages.VspRepositoryModalComponent.XpathSelector.SEARCH_TXT; - -import java.util.List; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openecomp.sdc.ci.tests.utilities.LoaderHelper; import org.openecomp.sdc.ci.tests.utilities.NotificationHelper; @@ -38,6 +28,17 @@ import org.openqa.selenium.WebElement; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.List; + +import static org.hamcrest.Matchers.empty; +import static org.hamcrest.core.Is.is; +import static org.hamcrest.core.IsNot.not; +import static org.junit.Assert.assertThat; +import static org.openecomp.sdc.ci.tests.pages.VspRepositoryModalComponent.XpathSelector.IMPORT_VSP_BTN; +import static org.openecomp.sdc.ci.tests.pages.VspRepositoryModalComponent.XpathSelector.MODAL_DIV; +import static org.openecomp.sdc.ci.tests.pages.VspRepositoryModalComponent.XpathSelector.RESULTS_CONTAINER_DIV; +import static org.openecomp.sdc.ci.tests.pages.VspRepositoryModalComponent.XpathSelector.SEARCH_TXT; + /** * Handles the VSP Repository Modal UI actions */ diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationPage.java index 12b5251e81..9fa278b1e0 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationPage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationPage.java @@ -17,8 +17,6 @@ package org.openecomp.sdc.ci.tests.pages; import com.aventstack.extentreports.Status; -import java.io.File; -import java.util.List; import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; @@ -27,6 +25,9 @@ import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.testng.Assert; +import java.io.File; +import java.util.List; + public class VspValidationPage extends GeneralPageElements { private VspValidationPage() { diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java index a88f7267d8..88efa26681 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java @@ -52,7 +52,7 @@ public class DownloadManager { if (vspFound) { ExtentTestActions.log(Status.INFO, String.format("Going to downloading VSP %s", vspName)); final List<WebElement> elementsFromTable = GeneralPageElements.getElementsFromTable(); - elementsFromTable.get(1).click(); + elementsFromTable.get(0).click(); GeneralUIUtils.waitForLoader(); GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.DOWNLOAD_CSAR.getValue()); ExtentTestActions.log(Status.INFO, "Succeeded to downloaded CSAR file named " + vspName + " into folder " + SetupCDTest.getWindowTest().getDownloadDirectory()); 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 index ef91c1cbb3..d4766c9bba 100644 --- 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 @@ -25,6 +25,7 @@ import org.apache.commons.io.FileUtils; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.exception.GeneralUiRuntimeException; import org.openecomp.sdc.ci.tests.execute.setup.DriverFactory; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; import org.openecomp.sdc.ci.tests.pages.HomePage; import org.openecomp.sdc.ci.tests.utils.Utils; import org.openqa.selenium.By; @@ -40,8 +41,10 @@ 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.slf4j.Logger; +import org.slf4j.LoggerFactory; -import java.awt.Toolkit; +import java.awt.*; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; import java.io.File; @@ -51,8 +54,6 @@ import java.util.List; import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import static org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest.getExtendTest; import static org.testng.AssertJUnit.assertTrue; @@ -62,7 +63,7 @@ public final class GeneralUIUtils { private static final Logger LOGGER = LoggerFactory.getLogger(GeneralUIUtils.class); - private static final String DATA_TESTS_ID = "//*[@data-tests-id='%1$s' or @data-test-id='%1$s']"; + private static final String DATA_TESTS_ID = "//*[@data-tests-id='"; private static final String COLOR_YELLOW_BORDER_4PX_SOLID_YELLOW = "color: yellow; border: 4px solid yellow;"; private static final int TIME_OUT = (int) (60 * 1.5); @@ -117,13 +118,18 @@ public final class GeneralUIUtils { } public static WebElement getWebElementByTestID(final String dataTestId, final int timeout) { - final WebDriverWait wait = new WebDriverWait(getDriver(), timeout); - return wait - .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(String.format(DATA_TESTS_ID, dataTestId)))); + try { + final WebDriverWait wait = new WebDriverWait(getDriver(), timeout); + return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(String.format(DATA_TESTS_ID, dataTestId, "']")))); + } + catch (Exception e) { + System.out.println("Element with dataTestId name: "+dataTestId+" not found"); + return null; + } } public static boolean isWebElementExistByTestId(String dataTestId) { - return getDriver().findElements(By.xpath(String.format(DATA_TESTS_ID, dataTestId))).size() != 0; + return getDriver().findElements(By.xpath(String.format(DATA_TESTS_ID, dataTestId, "']"))).size() != 0; } public static boolean isWebElementExistByClass(String className) { @@ -133,7 +139,7 @@ public final class GeneralUIUtils { public static WebElement getInputElement(String dataTestId) { try { ultimateWait(); - return getDriver().findElement(By.xpath(String.format(DATA_TESTS_ID, dataTestId))); + return getDriver().findElement(By.xpath(String.format(DATA_TESTS_ID, dataTestId, "']"))); } catch (Exception e) { return null; } @@ -141,7 +147,7 @@ public final class GeneralUIUtils { public static List<WebElement> getInputElements(String dataTestId) { ultimateWait(); - return getDriver().findElements(By.xpath(String.format(DATA_TESTS_ID, dataTestId))); + return getDriver().findElements(By.xpath(String.format(DATA_TESTS_ID, dataTestId, "']"))); } @@ -179,7 +185,7 @@ public final class GeneralUIUtils { public static List<WebElement> getWebElementsListByContainTestID(String dataTestId) { try { WebDriverWait wait = new WebDriverWait(getDriver(), WEB_DRIVER_WAIT_TIME_OUT); - return wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath(String.format("//*[contains(@data-tests-id, '%1$s') or contains(@data-test-id, '%1$s')]", dataTestId)))); + return wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath(String.format("//*[contains(@data-tests-id, '", dataTestId, "')]")))); } catch (Exception e) { return new ArrayList<WebElement>(); } @@ -201,7 +207,7 @@ public final class GeneralUIUtils { public static List<WebElement> getWebElementsListByTestID(String dataTestId) { WebDriverWait wait = new WebDriverWait(getDriver(), TIME_OUT); - return wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath(String.format(DATA_TESTS_ID, dataTestId)))); + return wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath(String.format(DATA_TESTS_ID, dataTestId, "']")))); } public static List<WebElement> getWebElementsListByClassName(String className) { @@ -213,50 +219,68 @@ public final class GeneralUIUtils { public static Boolean isElementInvisibleByTestId(String dataTestId) { WebDriverWait wait = new WebDriverWait(getDriver(), TIME_OUT); return wait.until( - ExpectedConditions.invisibilityOfElementLocated(By.xpath(String.format(DATA_TESTS_ID, dataTestId)))); + ExpectedConditions.invisibilityOfElementLocated(By.xpath(String.format(DATA_TESTS_ID, dataTestId, "']")))); } public static Boolean isElementVisibleByTestId(String dataTestId) { try { WebDriverWait wait = new WebDriverWait(getDriver(), TIME_OUT); - return wait.until(ExpectedConditions.visibilityOfElementLocated((By.xpath(String.format(DATA_TESTS_ID, dataTestId))))).isDisplayed(); + return wait.until(ExpectedConditions.visibilityOfElementLocated((By.xpath(String.format(DATA_TESTS_ID, dataTestId, "']"))))).isDisplayed(); } catch (Exception e) { return false; } } public static void clickOnElementByTestId(String dataTestId) { - LOGGER.debug("Clicking on the element by test id " + dataTestId); - clickOnElementByTestIdWithoutWait(dataTestId); - LOGGER.debug("Waiting after clicking element by test id " + dataTestId); - ultimateWait(); - LOGGER.debug(String.format("Waiting after clicking element by test id '%s' finished", dataTestId)); + try { + clickOnElementByTestIdWithoutWait(dataTestId); + ultimateWait(); + }catch (Exception e) { + LOGGER.debug("", e); + } } - public static void clickOnElementChildByTestId(String dataTestId) { - clickOnElementChildByTestIdWithoutWait(dataTestId); - ultimateWait(); + public static boolean tryToclickOnElementByTestId(String dataTestId, int timeOut) { + try { + clickOnElementByTestId(dataTestId, timeOut); + ultimateWait(); + return true; + } catch (Exception e) { + LOGGER.debug("", e); + return false; + } } - public static void clickOnElementByTestIdWithoutWait(final String dataTestId) { - final WebDriverWait wait = new WebDriverWait(getDriver(), TIME_OUT); - wait - .until(ExpectedConditions.elementToBeClickable(By.xpath(String.format(DATA_TESTS_ID, dataTestId)))).click(); + public static void clickOnElementByTestIdWithoutWait(String dataTestId) { + WebDriverWait wait = new WebDriverWait(getDriver(), TIME_OUT); + try { + wait.until(ExpectedConditions + .elementToBeClickable(By.xpath(String.format(DATA_TESTS_ID, dataTestId, "']")))).click(); + getExtendTest().log(Status.INFO, String.format("Click on element ", DATA_TESTS_ID, dataTestId, "']")); + } catch (Exception e) { + ExtentTestActions.log(Status.FAIL, dataTestId + " element isn't clickable"); + ExtentTestActions.log(Status.FAIL, e); + } } - public static void clickOnElementChildByTestIdWithoutWait(String dataTestId) { + public static void clickOnElementByInputTestIdWithoutWait(String dataTestId) { WebDriverWait wait = new WebDriverWait(getDriver(), TIME_OUT); - wait.until(ExpectedConditions.elementToBeClickable(By.xpath(String.format(DATA_TESTS_ID, dataTestId) + "//*"))).click(); + wait.until(ExpectedConditions.elementToBeClickable(By.xpath(String.format(DATA_TESTS_ID, dataTestId, "']//*")))).click(); } public static void clickOnElementByTestId(String dataTestId, int customTimeout) { WebDriverWait wait = new WebDriverWait(getDriver(), customTimeout); - wait.until(ExpectedConditions.elementToBeClickable(By.xpath(String.format(DATA_TESTS_ID, dataTestId)))).click(); + wait.until(ExpectedConditions.elementToBeClickable(By.xpath(String.format(DATA_TESTS_ID, dataTestId, "']")))).click(); } public static WebElement waitForElementVisibilityByTestId(String dataTestId) { WebDriverWait wait = new WebDriverWait(getDriver(), TIME_OUT); - return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(String.format(DATA_TESTS_ID, dataTestId)))); + return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(String.format(DATA_TESTS_ID, dataTestId, "']")))); + } + + public static WebElement waitForElementVisibilityByClass(String className) { + WebDriverWait wait = new WebDriverWait(getDriver(), TIME_OUT); + return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(String.format("//*[contains(@class, '", className, "')]")))); } public static Boolean waitForElementInVisibilityByTestId(String dataTestId) { @@ -265,10 +289,9 @@ public final class GeneralUIUtils { public static Boolean waitForElementInVisibilityByTestId(String dataTestId, int timeOut) { WebDriverWait wait = new WebDriverWait(getDriver(), timeOut); - boolean displayed = getDriver().findElements(By.xpath(String.format(DATA_TESTS_ID, dataTestId))).isEmpty(); + boolean displayed = getDriver().findElements(By.xpath(String.format(DATA_TESTS_ID, dataTestId, "']"))).isEmpty(); if (!displayed) { - Boolean until = wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath(String.format(DATA_TESTS_ID, dataTestId)))); - ultimateWait(); + Boolean until = wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath(String.format(DATA_TESTS_ID, dataTestId, "'])")))); return until; } return false; @@ -363,7 +386,7 @@ public final class GeneralUIUtils { } public static void moveToStep(final String dataTestId) { - clickOnElementChildByTestId(dataTestId); + clickOnElementByTestId(dataTestId); } @@ -393,7 +416,7 @@ public final class GeneralUIUtils { public static WebElement getSelectedElementFromDropDown(String dataTestId) { GeneralUIUtils.ultimateWait(); - return new Select(getDriver().findElement(By.xpath(String.format(DATA_TESTS_ID, dataTestId)))).getFirstSelectedOption(); + return new Select(getDriver().findElement(By.xpath(String.format(DATA_TESTS_ID, dataTestId, "']")))).getFirstSelectedOption(); } public static boolean checkElementsCountInTable(int expectedElementsCount, Supplier<List<WebElement>> func) { @@ -419,7 +442,7 @@ public final class GeneralUIUtils { func.run(); long estimateTime = System.nanoTime(); long duration = TimeUnit.NANOSECONDS.toSeconds(estimateTime - startTime); - return String.format("%02d:%02d", duration / DURATION_FORMATIN, duration % DURATION_FORMATIN); + return String.format("%02`d:%02d", duration / DURATION_FORMATIN, duration % DURATION_FORMATIN); } public static WebElement clickOnAreaJS(String areaId) { diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/NotificationHelper.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/NotificationHelper.java index 89ff4e7b98..6366447e70 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/NotificationHelper.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/NotificationHelper.java @@ -19,10 +19,6 @@ package org.openecomp.sdc.ci.tests.utilities; -import static org.openecomp.sdc.ci.tests.utilities.NotificationHelper.XpathSelector.MAIN_CONTAINER_DIV; -import static org.openecomp.sdc.ci.tests.utilities.NotificationHelper.XpathSelector.MESSAGE_CONTENT_DIV; -import static org.openecomp.sdc.ci.tests.utilities.NotificationHelper.XpathSelector.MESSAGE_SUCCESS_DIV; - import org.openecomp.sdc.ci.tests.execute.setup.DriverFactory; import org.openqa.selenium.By; import org.openqa.selenium.support.ui.ExpectedConditions; @@ -30,6 +26,10 @@ import org.openqa.selenium.support.ui.WebDriverWait; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.openecomp.sdc.ci.tests.utilities.NotificationHelper.XpathSelector.MAIN_CONTAINER_DIV; +import static org.openecomp.sdc.ci.tests.utilities.NotificationHelper.XpathSelector.MESSAGE_CONTENT_DIV; +import static org.openecomp.sdc.ci.tests.utilities.NotificationHelper.XpathSelector.MESSAGE_SUCCESS_DIV; + public class NotificationHelper { private static final Logger LOGGER = LoggerFactory.getLogger(NotificationHelper.class); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUiUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUiUtils.java index d4d2731c1e..6bc08ec81e 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUiUtils.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUiUtils.java @@ -22,11 +22,11 @@ package org.openecomp.sdc.ci.tests.utilities; import com.aventstack.extentreports.Status; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar; import org.openecomp.sdc.ci.tests.execute.setup.ArtifactsCorrelationManager; @@ -59,7 +59,8 @@ public class OnboardingUiUtils { if (vspFound) { List<WebElement> elementsFromTable = GeneralPageElements.getElementsFromTable(); - elementsFromTable.get(1).click(); + elementsFromTable.get(0).click(); + elementsFromTable.get(0).click(); GeneralUIUtils.waitForLoader(); if (isUpdate) { @@ -184,7 +185,7 @@ public class OnboardingUiUtils { validateDeploymentArtifactsVersion(deploymentArtifacts, heatEnvFilesFromCSAR); - DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile); +// DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile); return createVendorSoftwareProduct; } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PortMirroringUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PortMirroringUtils.java index e26e5f3219..062d11eb9f 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PortMirroringUtils.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PortMirroringUtils.java @@ -29,7 +29,6 @@ import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; import org.openecomp.sdc.ci.tests.datatypes.ConnectionWizardPopUpObject; @@ -40,6 +39,7 @@ import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceContainer; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; +import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ProductUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ProductUIUtils.java index 63ff158d24..33c6317590 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ProductUIUtils.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ProductUIUtils.java @@ -21,7 +21,6 @@ package org.openecomp.sdc.ci.tests.utilities; import com.aventstack.extentreports.Status; -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.ProductReqDetails; 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 index 2e5ba74f91..41a540ce7b 100644 --- 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 @@ -21,8 +21,6 @@ package org.openecomp.sdc.ci.tests.utilities; import com.aventstack.extentreports.Status; -import java.util.ArrayList; -import java.util.List; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; @@ -30,11 +28,13 @@ import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.pages.GeneralPageElements; -import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage; import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; +import java.util.ArrayList; +import java.util.List; + public class ServiceUIUtils { private ServiceUIUtils() { @@ -54,11 +54,12 @@ public class ServiceUIUtils { public static void fillServiceGeneralPage(final ServiceReqDetails service) { SetupCDTest.getExtendTest().log(Status.INFO, "Fill in metadata values in general page"); ServiceGeneralPage.defineName(service.getName()); - ResourceGeneralPage.defineDescription(service.getDescription()); - ResourceGeneralPage.defineCategory(service.getCategories().get(0).getName()); - ServiceGeneralPage.defineProjectCode(service.getProjectCode()); + ServiceGeneralPage.defineDescription(service.getDescription()); + ServiceGeneralPage.defineCategory(service.getCategories().get(0).getName()); + ServiceGeneralPage.defineServiceFunction(service.getServiceFunction()); + ServiceGeneralPage.defineNamingPolicy(service.getNamingPolicy()); defineTagsList2(service.getTags()); - ResourceGeneralPage.defineContactId(service.getContactId()); + ServiceGeneralPage.defineContactId(service.getContactId()); GeneralUIUtils.clickSomewhereOnPage(); } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CatalogVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CatalogVerificator.java index d2aa1497ec..470f2966b3 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CatalogVerificator.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CatalogVerificator.java @@ -156,10 +156,6 @@ public class CatalogVerificator { } else { return LifeCycleStateEnum.CERTIFIED; } - case READY_FOR_CERTIFICATION: - return LifeCycleStateEnum.READY_FOR_TESTING; - case CERTIFICATION_IN_PROGRESS: - return LifeCycleStateEnum.IN_TESTING; case NOT_CERTIFIED_CHECKIN: return LifeCycleStateEnum.CHECKIN; //to IN DESIGN case NOT_CERTIFIED_CHECKOUT: 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 index 4110985781..1e6a0c37df 100644 --- 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 @@ -68,44 +68,45 @@ public class ServiceVerificator { private ServiceVerificator() { } - public static void verifyNumOfComponentInstances(ComponentReqDetails component, String version, int numOfVFC, - User user) { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifing the number of components on the canvas; should be %s", numOfVFC)); - 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(); - } - int size = 0; - JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag); - if (jsonResource.get("componentInstances") != null) { - size = ((JSONArray) jsonResource.get("componentInstances")).size(); - assertTrue(size == numOfVFC, "Expected number of componenet instances is " + numOfVFC + ", but actual is " + size); - ExtentTestActions.log(Status.INFO, "The number of components on the canvas was verified."); - } else { - assertTrue(false, "Expected number of componenet instances is " + numOfVFC + ", but actual is " + size); - } - } - - public static void verifyServiceUpdatedInUI(ServiceReqDetails service) { - assertTrue(service.getName().equals(ResourceGeneralPage.getNameText())); - assertTrue(service.getDescription().equals(ResourceGeneralPage.getDescriptionText())); - assertTrue(service.getCategory().equals(ServiceGeneralPage.getCategoryText())); - assertTrue(service.getProjectCode().equals(ServiceGeneralPage.getProjectCodeText())); - for (String tag : ServiceGeneralPage.getTags()) { - assertTrue(service.getTags().contains(tag)); - } - assertTrue(service.getContactId().equals(ResourceGeneralPage.getContactIdText())); - } - - public static void verifyServiceDeletedInUI(ServiceReqDetails service) throws InterruptedException { - Thread.sleep(SLEEP_TIME); - List<WebElement> cardElements = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DashboardCardEnum.DASHBOARD_CARD.getValue()); - if (!(cardElements.isEmpty())) { - for (WebElement cardElement : cardElements) { - WebElement componentName = GeneralUIUtils.getElementfromElementByCSS(cardElement, + public static void verifyNumOfComponentInstances(ComponentReqDetails component, String version, int numOfVFC, + User user) { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifing the number of components on the canvas; should be %s", numOfVFC)); + 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(); + } + int size = 0; + JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag); + if(jsonResource.get("componentInstances")!= null){ + size = ((JSONArray) jsonResource.get("componentInstances")).size(); + assertTrue(size == numOfVFC, "Expected number of componenet instances is " + numOfVFC + ", but actual is " + size); + ExtentTestActions.log(Status.INFO, "The number of components on the canvas was verified."); + }else{ + assertTrue(false, "Expected number of componenet instances is " + numOfVFC + ", but actual is " + size); + } + } + + public static void verifyServiceUpdatedInUI(ServiceReqDetails service) { + assertTrue(service.getName().equals(ResourceGeneralPage.getNameText())); + assertTrue(service.getDescription().equals(ResourceGeneralPage.getDescriptionText())); + assertTrue(service.getCategory().equals(ServiceGeneralPage.getCategoryText())); + assertTrue(service.getServiceFunction().equals(ServiceGeneralPage.getServiceFunctionText())); + assertTrue(service.getNamingPolicy().equals(ServiceGeneralPage.getNamingPolicyText())); + for(String tag: ServiceGeneralPage.getTags()){ + assertTrue(service.getTags().contains(tag)); + } + assertTrue(service.getContactId().equals(ResourceGeneralPage.getContactIdText())); + } + + public static void verifyServiceDeletedInUI(ServiceReqDetails service) throws InterruptedException { + Thread.sleep(1000); + List<WebElement> cardElements = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DashboardCardEnum.DASHBOARD_CARD.getValue()); + if (!(cardElements.isEmpty())){ + for (WebElement cardElement: cardElements){ + WebElement componentName = GeneralUIUtils.getElementfromElementByCSS(cardElement, DataTestIdEnum.DashboardCardEnum.INFO_NAME.getValue()); WebElement componentType = GeneralUIUtils.getElementfromElementByCSS(cardElement, DataTestIdEnum.DashboardCardEnum.ASSET_TYPE_CSS.getValue()); |