diff options
author | andre.schmid <andre.schmid@est.tech> | 2019-11-15 10:07:12 +0000 |
---|---|---|
committer | andre.schmid <andre.schmid@est.tech> | 2019-11-21 09:08:34 +0000 |
commit | 8b0c94492906d7db528af73834c0d2299b8eb382 (patch) | |
tree | 08d271940ff9507aadb758eb8740a49ac6aa91df /ui-ci/src | |
parent | fa1db43d43abd43a8f18bb26d0054de41fdb2a22 (diff) |
Fix to stabilize sanity ui test suite
Fix the selection of the Resource Composition screen.
Fix the search for a Resource in the home screen.
Refactor some related classes, mainly removing exceptions not thrown,
correcting typos, removing unused/commented code, fixing SonarQube
issues.
Improve the logs and report logs.
Change-Id: I89b5a0d89652367520cededa6744831492bbbaba
Issue-ID: SDC-2648
Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'ui-ci/src')
57 files changed, 1280 insertions, 1143 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 fd23fbed3a..7ea23c1ff3 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,7 +28,7 @@ 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.AmdocsLicenseMembers; +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; @@ -87,9 +87,10 @@ public class AddComponentInstancesArtifactsInCsar extends SetupCDTest { String vnfFile = "FDNT.zip"; String snmpFile = "Fault-alarms-ASDC-vprobes-vLB.zip"; - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject createVSP = VendorSoftwareProductRestUtils.createVSP(resourceReqDetails, vnfFile, filePath, getUser(), amdocsLicenseMembers); + VendorSoftwareProductObject createVSP = VendorSoftwareProductRestUtils.createVSP(resourceReqDetails, vnfFile, filePath, getUser(), + vendorLicenseModel); String vspName = createVSP.getName(); resourceMetaData.setName(vspName); VendorSoftwareProductRestUtils.addVFCArtifacts(filePath, snmpFile, null, createVSP, getUser()); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Inputs.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Inputs.java index 2f0cc302f4..aa927326b8 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Inputs.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Inputs.java @@ -68,7 +68,7 @@ public class Inputs extends SetupCDTest { @Test public void deletingAnInputThatWasDeclaredFromComplexProperty() throws Exception { ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); CanvasManager canvasManager = CanvasManager.getCanvasManager(); @@ -126,7 +126,7 @@ public class Inputs extends SetupCDTest { @Test public void deleteInputsWhoComeFromCpVlProperties() throws Exception { ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); CanvasManager canvasManager = CanvasManager.getCanvasManager(); 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 38a347e712..f5ebac6eeb 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,7 +24,7 @@ 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.AmdocsLicenseMembers; +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.VendorSoftwareProductObject; @@ -77,8 +77,9 @@ public class LocalGeneralUtilities { } public static String simpleOnBoarding(ResourceReqDetails resourceReqDetails, String fileName, String filePath, User user) throws Exception { - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(user); - VendorSoftwareProductObject createVendorSoftwareProduct = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, fileName, filePath, user, amdocsLicenseMembers); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(user); + VendorSoftwareProductObject createVendorSoftwareProduct = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, fileName, filePath, user, + vendorLicenseModel); String vspName = createVendorSoftwareProduct.getName(); HomePage.showVspRepository(); OnboardingUiUtils.importVSP(createVendorSoftwareProduct); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java index 58d4899d1e..59c18fe311 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java @@ -230,7 +230,7 @@ public class MIBsArtifactsOnResourceInstance extends SetupCDTest { // 4. Create service. ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); // 5. Click on composition. ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java index 7c913d9782..1bde1c1767 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java @@ -52,7 +52,7 @@ public class RemoveRestrictionOfDeploymentArtifacts extends SetupCDTest { @Test public void createServiceWithoutRIAndArtifacts() throws Exception { ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); //TODO Andrey should click on certify button ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName()); } @@ -63,7 +63,7 @@ public class RemoveRestrictionOfDeploymentArtifacts extends SetupCDTest { @Test public void createServiceWithVlAndWithoutArtfiacts() throws Exception { ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); CanvasManager canvasManager = CanvasManager.getCanvasManager(); @@ -100,7 +100,7 @@ public class RemoveRestrictionOfDeploymentArtifacts extends SetupCDTest { reloginWithNewRole(UserRoleEnum.DESIGNER);*/ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); CanvasManager canvasManager = CanvasManager.getCanvasManager(); CanvasElement resourceInstance = canvasManager.createElementOnCanvas(resourceMetaData.getName()); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java index 31df507184..b8430c433a 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java @@ -54,7 +54,7 @@ public class Service_Tests_UI extends SetupCDTest { ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); VendorSoftwareProductObject vendorSoftwareProductObject = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, FileHandling.getVnfRepositoryPath(), vnfFile, getUser()); ServiceReqDetails servicemetadata = ElementFactory.getDefaultService(getUser()); - ServiceUIUtils.createService(servicemetadata, getUser()); + ServiceUIUtils.createService(servicemetadata); GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION); CanvasManager service_CanvasManager = CanvasManager.getCanvasManager(); CompositionPage.searchForElement(vendorSoftwareProductObject.getName()); @@ -74,7 +74,7 @@ public class Service_Tests_UI extends SetupCDTest { ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); VendorSoftwareProductObject vendorSoftwareProductObject = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, FileHandling.getVnfRepositoryPath(), vnfFile, getUser()); ServiceReqDetails servicemetadata = ElementFactory.getDefaultService(getUser()); - ServiceUIUtils.createService(servicemetadata, getUser()); + ServiceUIUtils.createService(servicemetadata); GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION); CanvasManager service_CanvasManager = CanvasManager.getCanvasManager(); CompositionPage.searchForElement(vendorSoftwareProductObject.getName()); 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 5286d22800..d2c37c2b88 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 @@ -22,8 +22,8 @@ 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.dataProviders.OnbordingDataProviders; -import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; +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; @@ -81,15 +81,16 @@ public class VfModule extends SetupCDTest { // String vnfFile = "LDSA.zip"; // String vnfFile = "FDNT.zip"; List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); - List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(1, fileNamesFromFolder); + List<String> newRandomFileNamesFromFolder = OnboardingDataProviders.getRandomElements(1, fileNamesFromFolder); String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath(); String vnfFile = newRandomFileNamesFromFolder.get(0); getExtendTest().log(Status.INFO, String.format("Going to onboard the VNF %s......", vnfFile)); System.out.println(String.format("Going to onboard the VNF %s......", vnfFile)); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject createVendorSoftwareProduct = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, getUser(), amdocsLicenseMembers); + VendorSoftwareProductObject createVendorSoftwareProduct = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, getUser(), + vendorLicenseModel); String vspName = createVendorSoftwareProduct.getName(); // DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.getVspId()); @@ -129,7 +130,7 @@ public class VfModule extends SetupCDTest { // create service ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); CompositionPage.searchForElement(vspName); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java index 7c448d5b86..92ab4a7ba8 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java @@ -74,7 +74,7 @@ public class extendNode_TemplatePropertiesWithDefaultValues extends SetupCDTest if (ComponentTypeEnum.SERVICE == componentTypeEnum) { ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); } else { ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); ResourceUIUtils.createVF(resourceMetaData, getUser()); @@ -157,7 +157,7 @@ public class extendNode_TemplatePropertiesWithDefaultValues extends SetupCDTest if (ComponentTypeEnum.SERVICE == componentTypeEnum) { ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); } else { ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); ResourceUIUtils.createVF(resourceMetaData, getUser()); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java index 985c84246d..0541ab97d3 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java @@ -385,7 +385,7 @@ public final class CanvasManager { } private void addFirstReqOrCap() { - GeneralUIUtils.getWebElementsListByClassName(DataTestIdEnum.LinkMenuItems.LINK_ITEM_CAP_Or_REQ.getValue()).get(0).click(); + GeneralUIUtils.getWebElementsListByClassName(DataTestIdEnum.LinkMenuItems.LINK_ITEM_CAP_OR_REQ.getValue()).get(0).click(); } private void linkMenuClickOnNextButton() throws Exception { 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 f099bab6f8..0d216572ba 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 @@ -21,12 +21,19 @@ 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; public final class DataTestIdEnum { + private DataTestIdEnum() { } + @AllArgsConstructor + @Getter public enum Dashboard { IMPORT_AREA("importButtonsArea"), ADD_AREA("AddButtonsArea"), @@ -40,17 +47,11 @@ public final class DataTestIdEnum { BUTTON_ADD_PNF("createPNFButton"), BUTTON_ADD_CR("createCRButton"); - private String value; - - public String getValue() { - return value; - } - - Dashboard(String value) { - this.value = value; - } + private final String value; } + @AllArgsConstructor + @Getter public enum LifeCyleChangeButtons { CREATE("create/save"), CHECK_IN("check_in"), @@ -60,17 +61,12 @@ public final class DataTestIdEnum { CERTIFY("certify"), CHECKOUT("check_out"); - private String value; - - public String getValue() { - return value; - } + private final String value; - LifeCyleChangeButtons(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum DistributionChangeButtons { APPROVE("approve"), REJECT("reject"), @@ -79,17 +75,12 @@ public final class DataTestIdEnum { APPROVE_MESSAGE("checkindialog"), RE_DISTRIBUTE("redistribute"); - private String value; + private final String value; - public String getValue() { - return value; - } - - DistributionChangeButtons(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum InformationalArtifactsPlaceholders { CLOUD_QUESTIONNAIRE("Cloud Questionnaire (completed)"), FEATURES("Features"), @@ -99,17 +90,12 @@ public final class DataTestIdEnum { HEAT_TEMPLATE_FROM_VENDOR("HEAT Template from Vendor"), CAPACITY("Capacity"); - private String value; - - public String getValue() { - return value; - } + private final String value; - InformationalArtifactsPlaceholders(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum ModalItems { BROWSE_BUTTON("browseButton"), ADD("Add"), @@ -127,17 +113,12 @@ public final class DataTestIdEnum { UPGRADE_SERVICES_CLOSE("upgradeVspModal-button-close"), ACCEPT_TESTING_MESSAGE("checkindialog"); - private String value; - - public String getValue() { - return value; - } + private final String value; - ModalItems(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum LeftPanelCanvasItems { BLOCK_STORAGE("BlockStorage"), CINDER_VOLUME("CinderVolume"), @@ -151,39 +132,23 @@ public final class DataTestIdEnum { CONTRAIL_PORT("ContrailPort"), CONTRAIL_VIRTUAL_NETWORK("ContrailVirtualNetwork"); - private String value; + private final String value; - public String getValue() { - return value; - } - - LeftPanelCanvasItems(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum LinkMenuItems { - // CANCEL_BUTTON("link-menu-button-cancel"), - // CONNECT_BUTTON("link-menu-button-connect"), - // LINK_ITEM_CAP("link-item-capabilities"), - // LINK_ITEM_REQ("link-item-requirements"), - // LINK_MENU("link-menu-open"); - LINK_ITEM_CAP_Or_REQ("req-or-cap-item"), - // REQ_CAP_SELECT_DATA_TESTS_ID("SelectType"); + LINK_ITEM_CAP_OR_REQ("req-or-cap-item"), REQ_CAP_SELECT_DATA_TESTS_ID("value-select"); - private String value; - - public String getValue() { - return value; - } + private final String value; - LinkMenuItems(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum GeneralCanvasItems { CANVAS("canvas"), CANVAS_RIGHT_PANEL("w-sdc-designer-sidebar-head"), @@ -191,17 +156,12 @@ public final class DataTestIdEnum { UPDATE_INSTANCE_NAME("e-sdc-small-icon-update"), INSTANCE_NAME_FIELD("instanceName"); - private String value; + private final String value; - public String getValue() { - return value; - } - - GeneralCanvasItems(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum ResourceMetadataEnum { RESOURCE_NAME("name"), DESCRIPTION("description"), @@ -213,17 +173,13 @@ public final class DataTestIdEnum { ICON(" iconBox"), TAGS_TABLE("i-sdc-tag-text"), SELECT_VSP("filename"); - private String value; - public String getValue() { - return value; - } + private final String value; - ResourceMetadataEnum(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum GeneralElementsEnum { CREATE_BUTTON("create/save"), CHECKIN_BUTTON("check_in"), @@ -236,21 +192,15 @@ public final class DataTestIdEnum { OK("OK"), UPDATE_SERVICES_BUTTON("open-upgrade-vsp-popup"), UPLOAD_FILE_INPUT("browseButton"), - // RESTORE_BUTTON("restore"), RESTORE_BUTTON("restore-component-button"), - // ARCHIVE_BUTTON("archive"); ARCHIVE_BUTTON("archive-component-button"); - private String value; - public String getValue() { - return value; - } + private final String value; - GeneralElementsEnum(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum ArtifactPageEnum { ADD_DEPLOYMENT_ARTIFACT("add-deployment-artifact-button"), ADD_INFORMATIONAL_ARTIFACT("add-information-artifact-button"), @@ -273,19 +223,14 @@ public final class DataTestIdEnum { UPLOAD_HEAT_ENV_PARAMETERS("uplaodEnv_"), VERSION_ENV("artifactEnvVersion_"), ADD_OTHER_ARTIFACT_BUTTON("//button[@class='add-button ng-scope']"); - private String value; - public String getValue() { - return value; - } + private final String value; - ArtifactPageEnum(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum PropertiesPageEnum { - ADD_NEW_PROPERTY("addGrey"), EDIT_PROPERTY("edit_"), DELETE_PROPERTY("delete_"), @@ -299,19 +244,14 @@ public final class DataTestIdEnum { PROPERTY_ROW("propertyRow"), SAVE("Save"), POPUP_FORM("sdc-edit-property-container"); - private String value; - public String getValue() { - return value; - } + private final String value; - PropertiesPageEnum(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum PropertiesPopupEnum { - PROPERTY_NAME("propertyName"), PROPERTY_VALUE("defaultvalue"), PROPERTY_BOOLEAN_VALUE("booleantype"), @@ -325,39 +265,29 @@ public final class DataTestIdEnum { DONE("Done"), PROPERTY_RADIO_BUTTON_CONTAINER("propertyRadioButton_"), RADIO_BUTTON_CLASS("tlv-radio-label"); - private String value; - public String getValue() { - return value; - } + private final String value; - PropertiesPopupEnum(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum AdminPageTabs { USER_MANAGEMENT("usermanagmenttab"), CATEGORY_MANAGEMENT("categorymanagmenttab"); - private String value; - - public String getValue() { - return value; - } + private final String value; - AdminPageTabs(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum UserManagementEnum { - SEARCH_BOX("searchbox"), NEW_USER_FIELD("newuserId"), ROLE_SELECT("selectrole"), CREATE_BUTTON("creategreen"), - CLASS__USER_MANAGEMENT_TABLE("sdc-user-management-table"), + CLASS_USER_MANAGEMENT_TABLE("sdc-user-management-table"), ROW_TABLE("row_"), FIRST_NAME("firstName_"), LAST_NAME("lastName__"), @@ -370,20 +300,13 @@ public final class DataTestIdEnum { SAVE_USER("save_"), DELETE_USER("delete_"); + private final String value; - private String value; - - public String getValue() { - return value; - } - - UserManagementEnum(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum CategoryManagement { - SERVICE_CATEGORY_HEADER("servicecategoryheader"), RESOURCE_CATEGORY_HEADER("resourcecategoryheader"), SERVICE_CATEGORY_LIST("servicecategory"), @@ -392,63 +315,46 @@ public final class DataTestIdEnum { NEW_SUB_CATEGORY_BUTTON("newsubcategory"), NEW_CATEGORY_NAME("i-sdc-form-input"); - private String value; - - public String getValue() { - return value; - } + private final String value; - CategoryManagement(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum MainMenuButtons { HOME_BUTTON("main-menu-button-home"), CATALOG_BUTTON("main-menu-button-catalog"), ONBOARD_BUTTON("main-menu-button-onboard"), - SEARCH_BOX("main-menu-input-search"), + SEARCH_BOX(TopSearchComponent.SEARCH_INPUT_TEST_ID), REPOSITORY_ICON("repository-icon"); - private String value; - public String getValue() { - return value; - } + private final String value; - MainMenuButtons(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum CatalogSwitchButtons { CATALOG_SWITCH_BUTTON("catalog-selector-button"), // get possible catalog types(active/archive) CATALOG_ACTIVE_ITEMS("catalog-selector-0"), // select active catalog CATALOG_ARCHIVE("catalog-selector-1"); // select archive catalog - private String value; - public String getValue() { - return value; - } + private final String value; - CatalogSwitchButtons(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum MainMenuButtonsFromInsideFrame { HOME_BUTTON("breadcrumbs-button-0"); - private String value; - public String getValue() { - return value; - } + private final String value; - MainMenuButtonsFromInsideFrame(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum MenuOptionsEnum { EDIT("Edit"), CHECK_IN("Check in"), @@ -460,17 +366,12 @@ public final class DataTestIdEnum { START_TEST("Start test"), DISTREBUTE("Distribute"); - private String value; + private final String value; - public String getValue() { - return value; - } - - MenuOptionsEnum(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum StepsEnum { GENERAL("GeneralLeftSideMenu"), ICON("Iconstep"), @@ -487,17 +388,12 @@ public final class DataTestIdEnum { HIERARCHY("Hierarchy"), PROPERTIES_ASSIGNMENT("Properties AssignmentLeftSideMenu"); - private String value; - - public String getValue() { - return value; - } + private final String value; - StepsEnum(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum ArtifactPopup { BROWSE("browseButton"), @@ -511,17 +407,12 @@ public final class DataTestIdEnum { URL("input[class^='i-sdc-form-input']"), MODAL_WINDOW("sdc-add-artifact"); - private String value; - - public String getValue() { - return value; - } + private final String value; - ArtifactPopup(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum ServiceMetadataEnum { SERVICE_NAME("name"), DESCRIPTION("description"), @@ -532,17 +423,12 @@ public final class DataTestIdEnum { ICON(" iconBox"), INSTANTIATION_TYPE("selectInstantiationType"); - private String value; + private final String value; - public String getValue() { - return value; - } - - ServiceMetadataEnum(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum ProductMetadataEnum { PRODUCT_NAME("name"), FULL_NAME("fullName"), @@ -552,17 +438,12 @@ public final class DataTestIdEnum { ATT_CONTACT("attContact"), ICON(" iconBox"); - private String value; - - public String getValue() { - return value; - } + private final String value; - ProductMetadataEnum(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum DashboardCardEnum { ASSET_TYPE("asset-type"), LIFECYCLE_STATE("span[class^='w-sdc-dashboard-card-info-lifecycleState']"), INFO_NAME("div.sdc-tile-info-line"), @@ -571,17 +452,12 @@ public final class DataTestIdEnum { INFO_TITLE_XPATH("//div[contains(@class,'sdc-tile-info-line title')]"), ASSET_TYPE_CSS("span[data-tests-id='asset-type']"); - private String value; + private final String value; - public String getValue() { - return value; - } - - DashboardCardEnum(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum CatalogPageLeftPanelCategoryCheckbox { GENERIC_CHECKBOX("span[data-tests-id='checkbox-resourcenewcategory.generic']"), NETWORK_L2_3("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3']"), @@ -590,39 +466,29 @@ public final class DataTestIdEnum { APPLICATION_L4_PLUS("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+']"), DCAE("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent']"); - private String value; - - public String getValue() { - return value; - } + private final String value; - CatalogPageLeftPanelCategoryCheckbox(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum CatalogPageLeftPanelFilterTitle { TYPE("span[data-tests-id='typeFilterTitle']"), CATEGORIES("span[data-tests-id='categoriesFilterTitle']"), STATUS("span[data-tests-id='statusFilterTitle']"); - private String value; + private final String value; - public String getValue() { - return value; - } - - CatalogPageLeftPanelFilterTitle(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum CatalogPageLeftPanelSubCategoryCheckbox { COMMON_NETWORK_RESOURCES("span[data-tests-id='checkbox-resourcenewcategory.networkl4+.commonnetworkresources']"), ROUTER("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.router']"), WAN_CONNECTORS("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.wanconnectors']"), LAN_CONNECTORS("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.lanconnectors']"), - INFRASTRUCTERE_NETWORKl2_3("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.infrastructure']"), + INFRASTRUCTURE_NETWORK_L2_3("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.infrastructure']"), GATEWAY("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.gateway']"), NETWORK_ELEMENTS("span[data-tests-id='checkbox-resourcenewcategory.generic.networkelements']"), ABSTRACT("span[data-tests-id='checkbox-resourcenewcategory.generic.abstract']"), @@ -647,58 +513,43 @@ public final class DataTestIdEnum { UTILITY("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.utility']"), ANALYTICS("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.analytics']"); - private String value; - - public String getValue() { - return value; - } + private final String value; - CatalogPageLeftPanelSubCategoryCheckbox(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum CompositionScreenEnum { - - CHANGE_VERSION("changeVersion", Arrays.asList()), - DEPLOYMENT_ARTIFACT_TAB("deployment-artifact-tab", Arrays.asList("Deployment Artifacts")), - ADD_ARTIFACT("add_Artifact_Button", Arrays.asList()), - SEARCH_ASSET("searchAsset", Arrays.asList()), - PROPERTIES_AND_ATTRIBUTES_TAB("properties-and-attributes-tab", Arrays.asList()), - MENU_INPUTS("sub-menu-button-inputs", Arrays.asList()), - MENU_ONBOARD("sub-menu-button-onboard", Arrays.asList()), - MENU_HOME("sub-menu-button-home", Arrays.asList()), - MENU_PROPERTIES_ASSIGNMENT("sub-menu-button-properties assignment", Arrays.asList()), - MENU_TRIANGLE_DROPDOWN("triangle-dropdown", Arrays.asList()), - ARTIFACTS_LIST("artifactName", Arrays.asList()), - INFORMATION_ARTIFACTS("button[tooltip-content='Information Artifacts']", Arrays.asList("Informational Artifacts")), - API("button[tooltip-content='API']", Arrays.asList("API Artifacts")), + 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()), + 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()), + MENU_HOME("sub-menu-button-home", Collections.emptyList()), + MENU_PROPERTIES_ASSIGNMENT("sub-menu-button-properties assignment", Collections.emptyList()), + MENU_TRIANGLE_DROPDOWN("triangle-dropdown", Collections.emptyList()), + ARTIFACTS_LIST("artifactName", Collections.emptyList()), + INFORMATION_ARTIFACTS("button[tooltip-content='Information Artifacts']", + Collections.singletonList("Informational Artifacts")), + API("button[tooltip-content='API']", Collections.singletonList("API Artifacts")), INFORMATION("button[tooltip-content='Information']", Arrays.asList("General Info", "Additional Information", "Tags")), - COMPOSITION("button[tooltip-content='Composition']", Arrays.asList("Composition")), - INPUTS("button[tooltip-content='Inputs']", Arrays.asList("")), - REQUIREMENTS_AND_CAPABILITIES("button[tooltip-content='Requirements and Capabilities']", Arrays.asList()), - INFORMATION_TAB("information-tab", Arrays.asList()), - CUSTOMIZATION_UUID("rightTab_customizationModuleUUID", Arrays.asList()); - - private String value; - private List<String> title; - - public String getValue() { - return value; - } - - public List<String> getTitle() { - return title; - } - - CompositionScreenEnum(String value, List<String> title) { - this.value = value; - this.title = title; - } + COMPOSITION("button[tooltip-content='Composition']", Collections.singletonList("Composition")), + INPUTS("button[tooltip-content='Inputs']", Collections.singletonList("")), + REQUIREMENTS_AND_CAPABILITIES("button[tooltip-content='Requirements and Capabilities']", + Collections.emptyList()), + INFORMATION_TAB("information-tab", Collections.emptyList()), + CUSTOMIZATION_UUID("rightTab_customizationModuleUUID", Collections.emptyList()); + + private final String value; + private final List<String> title; + } + @AllArgsConstructor + @Getter public enum ToscaArtifactsScreenEnum { - TOSCA_MODEL("download-Tosca Model"), TOSCA_TEMPLATE("download-Tosca Template"), ARTIFACT_VERSION("version-"), @@ -708,17 +559,12 @@ public final class DataTestIdEnum { DOWNLOAD_ARTIFACT("download-"), DOWNLOAD_CSAR("download-Tosca Model"); - private String value; - - public String getValue() { - return value; - } + private final String value; - ToscaArtifactsScreenEnum(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum InformationalArtifactsService { AFFINITY_RULES("artifact_Display_Name-Affinity Rules"), CONTROL_LOOP_FUNCTIONS("artifact_Display_Name-Control Loop Functions"), @@ -734,19 +580,13 @@ public final class DataTestIdEnum { SUMMARY_OF_IMPACTS_TO_ECOMP("artifact_Display_Name-Summary of impacts to ECOMP elements,OSSs, BSSs"), TD_CERTIFICATION_TEST_RESULTS("artifact_Display_Name-TD Certification Test Results"); - private String value; + private final String value; - public String getValue() { - return value; - } - - InformationalArtifactsService(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum APIArtifactsService { - CONFIGURATION("artifact_Display_Name-Configuration"), INSTANTIATION("artifact_Display_Name-Instantiation"), LOGGING("artifact_Display_Name-Logging"), @@ -754,17 +594,12 @@ public final class DataTestIdEnum { REPORTING("artifact_Display_Name-Reporting"), TESTING("artifact_Display_Name-Testing"); - private String value; - - public String getValue() { - return value; - } + private final String value; - APIArtifactsService(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum DeploymentArtifactCompositionRightMenu { ARTIFACT_NAME("artifactName-"), ARTIFACT_DISPLAY_NAME("artifact_Display_Name-"), @@ -775,18 +610,12 @@ public final class DataTestIdEnum { ARTIFACT_ITEM("artifact-item-"), ARTIFACT_ENV("heat_env_"); - private String value; - - public String getValue() { - return value; - } - - DeploymentArtifactCompositionRightMenu(String value) { - this.value = value; - } + private final String value; } + @AllArgsConstructor + @Getter public enum InputsScreenService { ADD_SELECTED_INPUTS_BTN("add-inputs-to-service-button"), VF_INSTANCE_ROWS("expand-collapse[expanded-selector^='.vf-instance-list.']"), @@ -802,18 +631,12 @@ public final class DataTestIdEnum { RESOURCE_INSTANCE_PROPERTY_CHECKBOX("propertyCheckbox_"), SERVICE_INPUTS_DELETE_BUTTON("deleteInput_"); - private String value; - - public String getValue() { - return value; - } - - InputsScreenService(String value) { - this.value = value; - } + private final String value; } + @AllArgsConstructor + @Getter public enum DeploymentScreen { MODULES("span[class^='expand-collapse-title-text']"), MEMBERS("div[class^='expand-collapse-sub-title']"), @@ -837,19 +660,13 @@ public final class DataTestIdEnum { CANCEL("popover-close-button"), X_BUTTON("popover-x-button"); - private String value; + private final String value; - public String getValue() { - return value; - } - - DeploymentScreen(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum PropertiesAssignmentScreen { - PROPERTIES_TAB("Properties"), INPUTS_TAB("Inputs"), COMPOSITION_TAB("Composition"), @@ -884,52 +701,35 @@ public final class DataTestIdEnum { FILTER_SET_BUTTON("filter-set-button"), PROPERTY_NAME_COLUMN("property-name"); - - private String value; - - public String getValue() { - return value; - } - - PropertiesAssignmentScreen(String value) { - this.value = value; - } + private final String value; } + @AllArgsConstructor + @Getter public enum ImportVfRepository { SEARCH("onboarding-search"), IMPORT_VSP("import-csar"), DOWNLOAD_CSAR("download-csar"), UPDATE_VSP("update-csar"); - private String value; + private final String value; - public String getValue() { - return value; - } - - ImportVfRepository(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum EnvParameterView { SEARCH_ENV_PARAM_NAME("search-env-param-name"), ENV_CURRENT_VALUE("value-field-of-"), //value-field-of-oam_volume_name_0 - parameter name ENV_DEFAULT_VALUE("default-value-of-"); // default-value-of-vnf_name - private String value; - - public String getValue() { - return value; - } + private final String value; - EnvParameterView(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum ComplexServiceAmdocs { CREATE_BUTTON("Create"), DELETE_COMPONENT("deleteInstance"), @@ -961,18 +761,13 @@ public final class DataTestIdEnum { SUBMIT_NEW_VSP_VERSION_DESCRIPTION("form-submit-button"), EXTEND_BUTTON("extendPathlnk"); - private String value; + private final String value; - public String getValue() { - return value; - } - - ComplexServiceAmdocs(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum PortMirroring { COLLECTOR_NODE("collector_node"), EQUIP_MODEL("equip_model"), @@ -980,17 +775,12 @@ public final class DataTestIdEnum { PMC_NAME_IN_PALLETE("Port Mirroring Configuration"), PMCP_NAME_IN_PALLETE("Port Mirroring Configuration By Policy"); - private String value; - - public String getValue() { - return value; - } + private final String value; - PortMirroring(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum CompositionRightPanelGeneralInfo { TYPE("rightTab_componentType"), RESOURCE_TYPE("rightTab_resourceType"), @@ -998,19 +788,13 @@ public final class DataTestIdEnum { CATEGORY("rightTab_category"), SUB_CATEGORY("rightTab_subCategory"); - private String value; - - public String getValue() { - return value; - } + private final String value; - CompositionRightPanelGeneralInfo(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum CompositionRightPanel { - COMPONENT_TITLE("selectedCompTitle"), REQS_AND_CAPS_TAB("requirements-and-capabilities"), EDIT_PENCIL("editPencil"), @@ -1018,19 +802,13 @@ public final class DataTestIdEnum { DELETE_ITEM("deleteInstance"), REQS_AND_CAPS_TAB_XPATH("//button[@tooltip-content='Requirements and Capabilities']"); - private String value; - - public String getValue() { - return value; - } + private final String value; - CompositionRightPanel(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum VspValidationPage { - VSP_VALIDATION_PAGE_NAVBAR("navbar-group-item-SOFTWARE_PRODUCT_VALIDATION"), VSP_VALIDATION_PAGE_BREADCRUMBS("sub-menu-button-validation"), VSP_VALIDATION_PAGE_PROCEED_TO_INPUTS_BUTTON("go-to-vsp-validation-inputs"), @@ -1040,31 +818,18 @@ public final class DataTestIdEnum { VSP_VALIDATION_PAGE_COMPLIANCE_CHECKBOX_TREE("vsp-validation-compliance-checks-checkbox-tree"), VSP_VALIDATION_PAGE_CERTIFICATION_CHECKBOX_TREE("vsp-validation-certifications-query-checkbox-tree"); - private String value; + private final String value; - public String getValue() { - return value; - } - - VspValidationPage(String value) { - this.value = value; - } } + @AllArgsConstructor + @Getter public enum VspValidationResultsPage { - VSP_VALIDATION_RESULTS_PAGE_NAVBAR("navbar-group-item-SOFTWARE_PRODUCT_VALIDATION_RESULTS"), VSP_VALIDATION_RESULTS_PAGE_BREADCRUMBS("sub-menu-button-validation results"); - private String value; - - public String getValue() { - return value; - } + private final String value; - VspValidationResultsPage(String value) { - this.value = value; - } } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceContainer.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceContainer.java index 90d9661717..8181ae90d2 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceContainer.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceContainer.java @@ -28,13 +28,13 @@ public class ServiceContainer { private Service service; private Resource resource; private VendorSoftwareProductObject vendorSoftwareProductObject; - private AmdocsLicenseMembers amdocsLicenseMembers; + private VendorLicenseModel vendorLicenseModel; - public ServiceContainer(Service service, Resource resource, VendorSoftwareProductObject vendorSoftwareProductObject, AmdocsLicenseMembers amdocsLicenseMembers) { + public ServiceContainer(Service service, Resource resource, VendorSoftwareProductObject vendorSoftwareProductObject, VendorLicenseModel vendorLicenseModel) { this.service = service; this.resource = resource; this.vendorSoftwareProductObject = vendorSoftwareProductObject; - this.amdocsLicenseMembers = amdocsLicenseMembers; + this.vendorLicenseModel = vendorLicenseModel; } public Service getService() { @@ -61,11 +61,11 @@ public class ServiceContainer { this.vendorSoftwareProductObject = vendorSoftwareProductObject; } - public AmdocsLicenseMembers getAmdocsLicenseMembers() { - return amdocsLicenseMembers; + public VendorLicenseModel getVendorLicenseModel() { + return vendorLicenseModel; } - public void setAmdocsLicenseMembers(AmdocsLicenseMembers amdocsLicenseMembers) { - this.amdocsLicenseMembers = amdocsLicenseMembers; + public void setVendorLicenseModel(VendorLicenseModel vendorLicenseModel) { + this.vendorLicenseModel = vendorLicenseModel; } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/exception/GeneralUiRuntimeException.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/exception/GeneralUiRuntimeException.java new file mode 100644 index 0000000000..9a4e0d15b7 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/exception/GeneralUiRuntimeException.java @@ -0,0 +1,27 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.exception; + +public class GeneralUiRuntimeException extends RuntimeException { + + public GeneralUiRuntimeException(final String s, final Throwable throwable) { + super(s, throwable); + } +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/exception/HomePageRuntimeException.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/exception/HomePageRuntimeException.java new file mode 100644 index 0000000000..39bf6485c4 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/exception/HomePageRuntimeException.java @@ -0,0 +1,27 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.exception; + +public class HomePageRuntimeException extends RuntimeException { + + public HomePageRuntimeException(final String s, final Throwable throwable) { + super(s, throwable); + } +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/exception/PropertiesAssignmentPageException.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/exception/PropertiesAssignmentPageException.java new file mode 100644 index 0000000000..f0fbfeb3e8 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/exception/PropertiesAssignmentPageException.java @@ -0,0 +1,27 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.exception; + +public class PropertiesAssignmentPageException extends Exception { + + public PropertiesAssignmentPageException(final String s, final Throwable throwable) { + super(s, throwable); + } +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/exception/WebDriverThreadRuntimeException.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/exception/WebDriverThreadRuntimeException.java new file mode 100644 index 0000000000..8ba4689022 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/exception/WebDriverThreadRuntimeException.java @@ -0,0 +1,28 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.exception; + +public class WebDriverThreadRuntimeException extends RuntimeException { + + public WebDriverThreadRuntimeException(final String s, final Throwable throwable) { + super(s, throwable); + } + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/CreatePath.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/CreatePath.java index 57d709261f..485b069f15 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/CreatePath.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/CreatePath.java @@ -229,9 +229,9 @@ public class CreatePath extends SetupCDTest { //governor reloginWithNewRole(UserRoleEnum.GOVERNOR); GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName()); - GovernorOperationPage.approveSerivce(serviceMetadata1.getName()); + GovernorOperationPage.approveService(serviceMetadata1.getName()); GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName()); - GovernorOperationPage.approveSerivce(serviceMetadata2.getName()); + GovernorOperationPage.approveService(serviceMetadata2.getName()); //create service for complex service reloginWithNewRole(UserRoleEnum.DESIGNER); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/ElementsChanges.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/ElementsChanges.java index 828c37d40c..67d3f3df56 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/ElementsChanges.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/ElementsChanges.java @@ -544,9 +544,9 @@ ElementsChanges extends SetupCDTest { // governor reloginWithNewRole(UserRoleEnum.GOVERNOR); GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName()); - GovernorOperationPage.approveSerivce(serviceMetadata1.getName()); + GovernorOperationPage.approveService(serviceMetadata1.getName()); GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName()); - GovernorOperationPage.approveSerivce(serviceMetadata2.getName()); + GovernorOperationPage.approveService(serviceMetadata2.getName()); // create service for complex service reloginWithNewRole(UserRoleEnum.DESIGNER); @@ -626,7 +626,7 @@ ElementsChanges extends SetupCDTest { //governor reloginWithNewRole(UserRoleEnum.GOVERNOR); GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName()); - GovernorOperationPage.approveSerivce(serviceMetadata1.getName()); + GovernorOperationPage.approveService(serviceMetadata1.getName()); return serviceMetadata1; } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/PathUtilities.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/PathUtilities.java index f181b4f868..3ee26d3f2e 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/PathUtilities.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/PathUtilities.java @@ -39,6 +39,7 @@ import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.pages.CompositionPage; +import org.openecomp.sdc.ci.tests.pages.GeneralPageElements; import org.openecomp.sdc.ci.tests.pages.HomePage; import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; @@ -72,7 +73,7 @@ public class PathUtilities { public static ServiceReqDetails createService(User user) throws Exception { ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, user); + ServiceUIUtils.createService(serviceMetadata); ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); GeneralUIUtils.ultimateWait(); return serviceMetadata; @@ -201,7 +202,7 @@ public class PathUtilities { public static void updateVF(String vspName, VendorSoftwareProductObject vendorSoftwareProduct) throws Exception { boolean vspFound = HomePage.searchForVSP(vspName); if (vspFound) { - List<WebElement> elementsFromTable = HomePage.getElemenetsFromTable(); + final List<WebElement> elementsFromTable = GeneralPageElements.getElementsFromTable(); elementsFromTable.get(1).click(); GeneralUIUtils.waitForLoader(); GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.UPDATE_VSP.getValue()); 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 f17d1860f4..0e6bfc9dfc 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,7 +27,7 @@ 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.AmdocsLicenseMembers; +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; @@ -69,11 +69,13 @@ public class ArchiveRestoreTest extends SetupCDTest { // 1. Import VSP v1.0 String filePath = org.openecomp.sdc.ci.tests.utilities.FileHandling.getUpdateVSPVnfRepositoryPath(); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails); - getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName())); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails); + getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", vendorLicenseModel + .getVendorLicenseName())); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile1)); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, this.sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, this.sdncDesignerDetails, + vendorLicenseModel, null); // 2. Create VF from VSP, certify - v1.0 is created resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); @@ -117,11 +119,13 @@ public class ArchiveRestoreTest extends SetupCDTest { // 1. Import VSP v1.0 String filePath = org.openecomp.sdc.ci.tests.utilities.FileHandling.getUpdateVSPVnfRepositoryPath(); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails); - getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName())); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails); + getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", vendorLicenseModel + .getVendorLicenseName())); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile1)); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, this.sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, this.sdncDesignerDetails, + vendorLicenseModel, null); // 2. Create VF from VSP, certify - v1.0 is created resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); @@ -163,11 +167,13 @@ public class ArchiveRestoreTest extends SetupCDTest { String vnfFile1 = "1-2017-404_vUSP_vCCF_AIC3.0-(VOIP)_v6.0.zip"; // 1. Import VSP v1.0 String filePath = org.openecomp.sdc.ci.tests.utilities.FileHandling.getUpdateVSPVnfRepositoryPath(); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails); - getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName())); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails); + getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", vendorLicenseModel + .getVendorLicenseName())); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile1)); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, this.sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, this.sdncDesignerDetails, + vendorLicenseModel, null); // 2. Create VF from VSP, certify - v1.0 is created resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); getExtendTest().log(Status.INFO, String.format("Creating Virtual Function (VF): %s v1.0", resourceReqDetails.getName())); @@ -185,7 +191,7 @@ public class ArchiveRestoreTest extends SetupCDTest { reloginWithNewRole(UserRoleEnum.GOVERNOR); GeneralUIUtils.findComponentAndClick(service.getName()); - GovernorOperationPage.approveSerivce(service.getName()); + GovernorOperationPage.approveService(service.getName()); // 4. archive VF(1.0) reloginWithNewRole(UserRoleEnum.DESIGNER); GeneralPageElements.clickArchivedButtonFromCatalog(resource.getName()); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java index 76483a3e88..f939dda60a 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java @@ -183,7 +183,7 @@ public class CatalogLeftPanelTest extends SetupCDTest { public void lastUpdatedService() throws Exception { // create service ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); ResourceGeneralPage.clickCheckinButton(serviceMetadata.getName()); CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTestWithTime.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTestWithTime.java index 87c10688a8..b38b54d80e 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTestWithTime.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTestWithTime.java @@ -233,7 +233,7 @@ public class CatalogLeftPanelTestWithTime extends SetupCDTest { public void lastUpdatedService() throws Exception { // create service ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); ResourceGeneralPage.clickCheckinButton(serviceMetadata.getName()); CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Categories.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Categories.java index 57b6baa5f5..844552c58b 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Categories.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Categories.java @@ -158,7 +158,7 @@ public class Categories extends SetupCDTest { List<CategoryDefinition> categories = serviceMetadata.getCategories(); categories.get(0).setName(newserviceCategory); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CustomizationUUID.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CustomizationUUID.java index f41b32e5f6..9bd14ebd11 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CustomizationUUID.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CustomizationUUID.java @@ -82,7 +82,7 @@ public class CustomizationUUID extends SetupCDTest { List customizationUUIDs = new ArrayList<String>(); ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); @@ -125,7 +125,7 @@ public class CustomizationUUID extends SetupCDTest { List customizationUUIDs = new ArrayList<>(); ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); CanvasManager canvasManager = CanvasManager.getCanvasManager(); @@ -181,7 +181,7 @@ public class CustomizationUUID extends SetupCDTest { List customizationUUIDs = new ArrayList<>(); ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); CanvasManager canvasManager = CanvasManager.getCanvasManager(); @@ -221,7 +221,7 @@ public class CustomizationUUID extends SetupCDTest { List customizationUUIDs = new ArrayList<>(); ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); CanvasManager canvasManager = CanvasManager.getCanvasManager(); 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 b595642b02..83e64ef570 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,7 +28,7 @@ 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.AmdocsLicenseMembers; +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.VendorSoftwareProductObject; @@ -95,9 +95,10 @@ public class OnboardViaApis { public void updateVSPFullScenario(String filepath, String vnfFile) throws Exception { //CREATE DATA REQUIRED FOR TEST boolean skipReport = true; - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, sdncDesignerDetails1, amdocsLicenseMembers); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, sdncDesignerDetails1, + vendorLicenseModel); resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); @@ -108,11 +109,12 @@ public class OnboardViaApis { service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); // TEST START - VendorLicenseModelRestUtils.updateVendorLicense(amdocsLicenseMembers, sdncDesignerDetails1, false); - VendorLicenseModelRestUtils.validateVlmExist(amdocsLicenseMembers.getVendorId(), amdocsLicenseMembers.getVersion(), sdncDesignerDetails1); + VendorLicenseModelRestUtils.updateVendorLicense(vendorLicenseModel, sdncDesignerDetails1, false); + VendorLicenseModelRestUtils.validateVlmExist(vendorLicenseModel.getVendorId(), vendorLicenseModel.getVersion(), sdncDesignerDetails1); // Update the VSP With the VLM new version and submit the VSP - vendorSoftwareProductObject = VendorSoftwareProductRestUtils.updateVSPWithNewVLMParameters(vendorSoftwareProductObject, amdocsLicenseMembers, sdncDesignerDetails1); + vendorSoftwareProductObject = VendorSoftwareProductRestUtils.updateVSPWithNewVLMParameters(vendorSoftwareProductObject, + vendorLicenseModel, sdncDesignerDetails1); VendorSoftwareProductRestUtils.validateVspExist(vendorSoftwareProductObject, sdncDesignerDetails1); Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService); 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 125023c926..136fcb5c07 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 @@ -27,8 +27,8 @@ 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.dataProviders.OnbordingDataProviders; -import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; +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; @@ -83,9 +83,10 @@ public class OnboardingFlowsThroughAPI extends SetupCDTest { cvfcArtifacts.put(CvfcTypeEnum.VES_EVENTS, vesArtifactFileLocation); getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, cvfcArtifacts); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, + vendorLicenseModel, cvfcArtifacts); resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); List<ComponentInstance> componentInstances = resource.getComponentInstances(); @@ -119,16 +120,17 @@ public class OnboardingFlowsThroughAPI extends SetupCDTest { @Test public void VlmReuse() throws Exception { List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); - List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(2, fileNamesFromFolder); + List<String> newRandomFileNamesFromFolder = OnboardingDataProviders.getRandomElements(2, fileNamesFromFolder); String filePath = FileHandling.getVnfRepositoryPath(); String vnfFile = newRandomFileNamesFromFolder.get(0); getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); // setLog(vnfFile); getExtendTest().log(Status.INFO, "Create Vendor License"); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); getExtendTest().log(Status.INFO, "Create Vendor Software Product: " + resourceReqDetails.getName()); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, + vendorLicenseModel, null); resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); getExtendTest().log(Status.INFO, "Create Resource: " + resourceReqDetails.getName()); Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); @@ -152,8 +154,9 @@ public class OnboardingFlowsThroughAPI extends SetupCDTest { // update vnfFile = newRandomFileNamesFromFolder.get(1); getExtendTest().log(Status.INFO, "Going to update VLM with new file " + vnfFile); - VendorLicenseModelRestUtils.updateVendorLicense(amdocsLicenseMembers, sdncDesignerDetails, false); - vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorLicenseModelRestUtils.updateVendorLicense(vendorLicenseModel, sdncDesignerDetails, false); + vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, + vendorLicenseModel, null); getExtendTest().log(Status.INFO, "Create new VSP: " + vendorSoftwareProductObject.getName()); resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); getExtendTest().log(Status.INFO, "Create new resource: " + resourceReqDetails.getName()); @@ -181,13 +184,14 @@ public class OnboardingFlowsThroughAPI extends SetupCDTest { @Test public void updateVfiVersionOnServiceLevel() throws Throwable { List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); - List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(2, fileNamesFromFolder); + List<String> newRandomFileNamesFromFolder = OnboardingDataProviders.getRandomElements(2, fileNamesFromFolder); String filePath = FileHandling.getVnfRepositoryPath(); String vnfFile = newRandomFileNamesFromFolder.get(0); getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, + vendorLicenseModel, null); resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); @@ -243,16 +247,17 @@ public class OnboardingFlowsThroughAPI extends SetupCDTest { // External Defect: 430425 // Import VSP v1.0 List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); - List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(1, fileNamesFromFolder); + List<String> newRandomFileNamesFromFolder = OnboardingDataProviders.getRandomElements(1, fileNamesFromFolder); String filePath = FileHandling.getVnfRepositoryPath(); String vnfFile = newRandomFileNamesFromFolder.get(0); getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); - getExtendTest().log(Status.INFO, "Create Vendor License Model " + amdocsLicenseMembers.getVendorLicenseName()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); + getExtendTest().log(Status.INFO, "Create Vendor License Model " + vendorLicenseModel.getVendorLicenseName()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); getExtendTest().log(Status.INFO, "Create Vendor Software Product " + resourceReqDetails.getName()); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, + vendorLicenseModel, null); // Create VF, certify - v1.0 is created resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); @@ -265,7 +270,8 @@ public class OnboardingFlowsThroughAPI extends SetupCDTest { getExtendTest().log(Status.INFO, "Update VSP to version 2.0"); String origVspName = vendorSoftwareProductObject.getName(); vendorSoftwareProductObject.setName("Upd" + ElementFactory.generateUUIDforSufix()); - vendorSoftwareProductObject = VendorSoftwareProductRestUtils.updateVSPWithNewVLMParameters(vendorSoftwareProductObject, amdocsLicenseMembers, sdncDesignerDetails1); + vendorSoftwareProductObject = VendorSoftwareProductRestUtils.updateVSPWithNewVLMParameters(vendorSoftwareProductObject, + vendorLicenseModel, sdncDesignerDetails1); VendorSoftwareProductRestUtils.validateVspExist(vendorSoftwareProductObject, sdncDesignerDetails1); //Validate that VF cannot be found by the updated VSP name @@ -294,16 +300,17 @@ public class OnboardingFlowsThroughAPI extends SetupCDTest { // Test Case: 745821 // 1. Import VSP v1.0 List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); - List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(1, fileNamesFromFolder); + List<String> newRandomFileNamesFromFolder = OnboardingDataProviders.getRandomElements(1, fileNamesFromFolder); String filePath = FileHandling.getVnfRepositoryPath(); String vnfFile = newRandomFileNamesFromFolder.get(0); getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); - getExtendTest().log(Status.INFO, "Create Vendor License Model " + amdocsLicenseMembers.getVendorLicenseName()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); + getExtendTest().log(Status.INFO, "Create Vendor License Model " + vendorLicenseModel.getVendorLicenseName()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); getExtendTest().log(Status.INFO, "Create Vendor Software Product " + resourceReqDetails.getName()); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, + vendorLicenseModel, null); // 2. Create VF, certify - v1.0 is created resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); getExtendTest().log(Status.INFO, "Create VF " + resourceReqDetails.getName()); @@ -358,11 +365,13 @@ public class OnboardingFlowsThroughAPI extends SetupCDTest { // 1. Import VSP v1.0 String filePath = org.openecomp.sdc.ci.tests.utilities.FileHandling.getUpdateVSPVnfRepositoryPath(); User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); - getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName())); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); + getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", vendorLicenseModel + .getVendorLicenseName())); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile1)); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, sdncDesignerDetails, + vendorLicenseModel, null); // 2. Create VF, certify - v1.0 is created resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); @@ -418,11 +427,13 @@ public class OnboardingFlowsThroughAPI extends SetupCDTest { // 1. Import VSP v1.0 //String filePath = FileHandling.getVnfRepositoryPath(); User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); - getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName())); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); + getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", vendorLicenseModel + .getVendorLicenseName())); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile)); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails1, amdocsLicenseMembers); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails1, + vendorLicenseModel); // VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile, createVendorSoftwareProduct); // 2. Create VF, certify - v1.0 is created resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); @@ -451,11 +462,13 @@ public class OnboardingFlowsThroughAPI extends SetupCDTest { String filePath = FileHandling.getVnfRepositoryPath(); String vnfFile1 = "1-VF-vCSCF-StateDB-new-update_v3.0.zip"; User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); - getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName())); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); + getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", vendorLicenseModel + .getVendorLicenseName())); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile1)); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, sdncDesignerDetails1, amdocsLicenseMembers); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, sdncDesignerDetails1, + vendorLicenseModel); // VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile1, createVendorSoftwareProduct); // 2. Create VF, certify - v1.0 is created resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); 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 d883420942..595c43801c 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,14 +20,27 @@ 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.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.ci.tests.data.providers.OnboardingDataProviders; import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders; -import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; 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.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; @@ -38,6 +51,7 @@ 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.ResourceGeneralPage; import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage; @@ -55,76 +69,70 @@ import org.openecomp.sdc.ci.tests.utils.general.VendorLicenseModelRestUtils; import org.openecomp.sdc.ci.tests.utils.general.VendorSoftwareProductRestUtils; import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator; import org.openqa.selenium.WebElement; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; 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; +public class OnboardingFlowsUi extends SetupCDTest { -import static org.testng.AssertJUnit.assertNotNull; -import static org.testng.AssertJUnit.assertTrue; - -public class OnboardingFlowsUI extends SetupCDTest { + private static final Logger LOGGER = LoggerFactory.getLogger(OnboardingFlowsUi.class); protected static String filePath = FileHandling.getVnfRepositoryPath(); - private String makeDistributionValue; + private Boolean makeDistributionValue; @Parameters({"makeDistribution"}) @BeforeMethod public void beforeTestReadParams(@Optional("true") String makeDistributionReadValue) { - makeDistributionValue = makeDistributionReadValue; + LOGGER.debug("makeDistribution parameter is '{}'", makeDistributionReadValue); + makeDistributionValue = Boolean.valueOf(makeDistributionReadValue); } @Test - public void onboardVNFTestSanityOneFile() throws Throwable { + public void onboardVNFTestSanityOneFile() throws Exception { String vnfFile = "1-VF-vUSP-vCCF-DB_v11.1.zip"; - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService(); //getServiceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); + ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService(); runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile); } @Test - public void performanceTest() throws Throwable { - System.out.println("Start test"); + public void performanceTest() throws Exception { + LOGGER.debug("Start test"); Long actualTestRunTime = Utils.getActionDuration(() -> { try { onboardVNFTestSanityOneFile(); - } catch (Throwable throwable) { - throwable.printStackTrace(); + } catch (final Exception e) { + LOGGER.debug("An error has occurred during the performance test", e); } }); - Long regularTestRunTime = 400L; + long regularTestRunTime = 400L; double factor = 1.5; assertTrue("Expected test run time should be less from " + regularTestRunTime * factor + ", actual time is " + actualTestRunTime, regularTestRunTime * factor > actualTestRunTime); } @Test - public void onboardVNFTestSanity() throws Throwable { + public void onboardVNFTestSanity() throws Exception { List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.VNF); - String vnfFile = fileNamesFromFolder.get(0).toString(); - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService(); //getServiceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + String vnfFile = fileNamesFromFolder.get(0); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); + ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService(); runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile); } - @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders.class, dataProvider = "Single_VNF") - public void onapOnboardVNFflow(String filePath, String vnfFile) throws Exception, Throwable { + @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF") + public void onapOnboardVNFflow(String filePath, String vnfFile) throws Exception { setLog(vnfFile); - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService(); //getServiceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - System.out.println("print - >" + makeDistributionValue); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); + ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService(); runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile); } - @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders.class, dataProvider = "Single_VNF") - public void onapOnboardVSPValidationsSanityFlow(String filePath, String vnfFile) throws Exception, Throwable { + @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF") + public void onapOnboardVSPValidationsSanityFlow(String filePath, String vnfFile) throws Exception { setLog(vnfFile); String vspName = createNewVSP(filePath, vnfFile); if (OnboardingUiUtils.getVspValidationCongiguration()) { @@ -146,9 +154,8 @@ public class OnboardingFlowsUI extends SetupCDTest { } } - - @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders.class, dataProvider = "Single_VNF") - public void onapOnboardVSPValidationsConfigurationChangeCheck(String filePath, String vnfFile) throws Exception, Throwable { + @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF") + public void onapOnboardVSPValidationsConfigurationChangeCheck(String filePath, String vnfFile) throws Exception { setLog(vnfFile); String vspName = createNewVSP(filePath, vnfFile); if (OnboardingUiUtils.getVspValidationCongiguration()) { @@ -173,8 +180,8 @@ public class OnboardingFlowsUI extends SetupCDTest { } } - @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders.class, dataProvider = "Single_VNF") - public void onapOnboardVSPCertificationQueryFlow(String filePath, String vnfFile) throws Exception, Throwable { + @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF") + public void onapOnboardVSPCertificationQueryFlow(String filePath, String vnfFile) throws Exception { setLog(vnfFile); String vspName = createNewVSP(filePath, vnfFile); if (!OnboardingUiUtils.getVspValidationCongiguration()) { @@ -201,8 +208,8 @@ public class OnboardingFlowsUI extends SetupCDTest { } - @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders.class, dataProvider = "Single_VNF") - public void onapOnboardVSPComplianceCheckFlow(String filePath, String vnfFile) throws Exception, Throwable { + @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF") + public void onapOnboardVSPComplianceCheckFlow(String filePath, String vnfFile) throws Exception { setLog(vnfFile); String vspName = createNewVSP(filePath, vnfFile); final String complianceNotAvailableLabel = "No Compliance Checks are Available"; @@ -218,7 +225,8 @@ public class OnboardingFlowsUI extends SetupCDTest { if (VspValidationPage.checkComplianceCheckExists()) { VspValidationPage.clickComplianceChecksAll(); GeneralUIUtils.ultimateWait(); - assertTrue("Next Button is disabled, it should have been enabled", !VspValidationPage.checkNextButtonDisabled()); + assertFalse("Next Button is disabled, it should have been enabled", + VspValidationPage.checkNextButtonDisabled()); VspValidationPage.clickOnNextButton(); GeneralUIUtils.ultimateWait(); VspValidationPage.clickOnSubmitButton(); @@ -230,7 +238,7 @@ public class OnboardingFlowsUI extends SetupCDTest { } - @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders.class, dataProvider = "Single_VNF") + @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF") public void onapOnboardVSPComplianceCheckOperations(String filePath, String vnfFile) throws Exception { setLog(vnfFile); String vspName = createNewVSP(filePath, vnfFile); @@ -244,20 +252,22 @@ public class OnboardingFlowsUI extends SetupCDTest { VspValidationPage.navigateToVspValidationPageUsingNavbar(); assertTrue("Next Button is enabled, it should have been enabled", VspValidationPage.checkNextButtonDisabled()); if (VspValidationPage.checkComplianceCheckExists()) { - assertTrue("The tests are already selected, the list should initially be empty", !VspValidationPage.checkSelectedComplianceCheckExists()); + assertFalse("The tests are already selected, the list should initially be empty", + VspValidationPage.checkSelectedComplianceCheckExists()); VspValidationPage.clickComplianceChecksAll(); GeneralUIUtils.ultimateWait(); assertTrue("The selected tests are not populated in the list", VspValidationPage.checkSelectedComplianceCheckExists()); VspValidationPage.clickComplianceChecksAll(); GeneralUIUtils.ultimateWait(); - assertTrue("The selected tests are not deleted from the list", !VspValidationPage.checkSelectedComplianceCheckExists()); + assertFalse("The selected tests are not deleted from the list", + VspValidationPage.checkSelectedComplianceCheckExists()); } else { assertNotNull(GeneralUIUtils.findByText("No Compliance Checks are Available")); } } - @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders.class, dataProvider = "Single_VNF") + @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF") public void onapOnboardVSPCertificationQueryOperations(String filePath, String vnfFile) throws Exception { setLog(vnfFile); String vspName = createNewVSP(filePath, vnfFile); @@ -271,13 +281,15 @@ public class OnboardingFlowsUI extends SetupCDTest { VspValidationPage.navigateToVspValidationPageUsingNavbar(); assertTrue("Next Button is enabled, it should have been enabled", VspValidationPage.checkNextButtonDisabled()); if (VspValidationPage.checkCertificationQueryExists()) { - assertTrue("The tests are already selected, the list should initially be empty", !VspValidationPage.checkSelectedCertificationQueryExists()); + assertFalse("The tests are already selected, the list should initially be empty", + VspValidationPage.checkSelectedCertificationQueryExists()); VspValidationPage.clickCertificationQueryAll(); GeneralUIUtils.ultimateWait(); assertTrue("The selected tests are not populated in the list", VspValidationPage.checkSelectedCertificationQueryExists()); VspValidationPage.clickCertificationQueryAll(); GeneralUIUtils.ultimateWait(); - assertTrue("The selected tests are not deleted from the list", !VspValidationPage.checkSelectedCertificationQueryExists()); + assertFalse("The selected tests are not deleted from the list", + VspValidationPage.checkSelectedCertificationQueryExists()); } else { assertNotNull(GeneralUIUtils.findByText("No Compliance Checks are Available")); } @@ -310,10 +322,11 @@ public class OnboardingFlowsUI extends SetupCDTest { //revert the config OnboardingUiUtils.putVspValidationCongiguration(vspConfig); - assertTrue(String.format("Failed to revert Congiguration to %s", vspConfig), OnboardingUiUtils.getVspValidationCongiguration() == vspConfig); + assertEquals(String.format("Failed to revert Configuration to %s", vspConfig), vspConfig, + OnboardingUiUtils.getVspValidationCongiguration()); } - private void goToVspScreen(boolean isCurrentScreenCatalogPage, String vspName) throws Exception { + private void goToVspScreen(boolean isCurrentScreenCatalogPage, String vspName) { if (isCurrentScreenCatalogPage) { GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.MainMenuButtons.ONBOARD_BUTTON.getValue()); } @@ -326,22 +339,18 @@ public class OnboardingFlowsUI extends SetupCDTest { return OnboardingUiUtils.createVSP(resourceReqDetails, vnfFile, filePath, getUser()).getName(); } - public void runOnboardToDistributionFlow(ResourceReqDetails resourceReqDetails, ServiceReqDetails serviceMetadata, String filePath, String vnfFile) throws Exception { + private void runOnboardToDistributionFlow(ResourceReqDetails resourceReqDetails, ServiceReqDetails serviceMetadata, String filePath, String vnfFile) throws Exception { getExtendTest().log(Status.INFO, "Going to create resource with category: " + resourceReqDetails.getCategories().get(0).getName() + " subCategory: " + resourceReqDetails.getCategories().get(0).getSubcategories().get(0).getName() + " and service category: " + serviceMetadata.getCategory()); - String vspName = onboardAndCertify(resourceReqDetails, filePath, vnfFile); + final String vspName = onboardAndCertify(resourceReqDetails, filePath, vnfFile); - //TODO Andrey check return window after certification - /*reloginWithNewRole(UserRoleEnum.DESIGNER);*/ - // create service -// ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); CompositionPage.searchForElement(vspName); - CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager(); - CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName); + final CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager(); + final CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName); ArtifactsCorrelationManager.addVNFtoServiceArtifactCorrelation(serviceMetadata.getName(), vspName); assertNotNull(vfElement); @@ -355,30 +364,30 @@ public class OnboardingFlowsUI extends SetupCDTest { TesterOperationPage.certifyComponent(serviceMetadata.getName()); reloginWithNewRole(UserRoleEnum.GOVERNOR); - GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); - GovernorOperationPage.approveSerivce(serviceMetadata.getName()); + HomePage.waitForElement(PageElement.COMPONENT_PANEL); + HomePage.findComponentAndClick(serviceMetadata.getName()); + GovernorOperationPage.approveService(serviceMetadata.getName()); - if (makeDistributionValue.equals("true")) { + runDistributionFlow(serviceMetadata); + getExtendTest().log(Status.INFO, String.format("Successfully onboarded the package '%s'", vnfFile)); + } + private void runDistributionFlow(final ServiceReqDetails serviceMetadata) throws Exception { + if (makeDistributionValue) { reloginWithNewRole(UserRoleEnum.OPS); GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); OpsOperationPage.distributeService(); OpsOperationPage.displayMonitor(); - List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable(); + final List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable(); AssertJUnit.assertEquals(1, rowsFromMonitorTable.size()); OpsOperationPage.waitUntilArtifactsDistributed(0); - -// validateInputArtsVSouput(serviceMetadata.getName()); - } - - getExtendTest().log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile)); } - public String onboardAndCertify(ResourceReqDetails resourceReqDetails, String filePath, String vnfFile) throws Exception { + private String onboardAndCertify(ResourceReqDetails resourceReqDetails, String filePath, String vnfFile) throws Exception { VendorSoftwareProductObject onboardAndValidate = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser()); String vspName = onboardAndValidate.getName(); @@ -391,27 +400,24 @@ public class OnboardingFlowsUI extends SetupCDTest { @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List") - public void onboardVNFTest(String filePath, String vnfFile) throws Throwable { + public void onboardVNFTest(String filePath, String vnfFile) throws Exception { setLog(vnfFile); - System.out.println("printttttttttttttt - >" + makeDistributionValue); ResourceReqDetails resourceReqDetails = ElementFactory.getRandomCategoryResource(); ServiceReqDetails serviceReqDetails = ElementFactory.getRandomCategoryService(); runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile); } @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List") - public void onboardVNFShotFlow(String filePath, String vnfFile) throws Throwable { + public void onboardVNFShotFlow(String filePath, String vnfFile) throws Exception { setLog(vnfFile); - System.out.println("printttttttttttttt - >" + makeDistributionValue); - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); onboardAndCertify(resourceReqDetails, filePath, vnfFile); } @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "randomVNF_List") - public void onboardRandomVNFsTest(String filePath, String vnfFile) throws Throwable { + public void onboardRandomVNFsTest(String filePath, String vnfFile) throws Exception { setLog(vnfFile); - System.out.println("printttttttttttttt - >" + makeDistributionValue); - System.out.println("Vnf File name is: " + vnfFile); + LOGGER.debug("Vnf File name is: {}", vnfFile); ResourceReqDetails resourceReqDetails = ElementFactory.getRandomCategoryResource(); ServiceReqDetails serviceReqDetails = ElementFactory.getRandomCategoryService(); runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile); @@ -419,17 +425,17 @@ public class OnboardingFlowsUI extends SetupCDTest { @Test - public void onboardUpdateVNFTest() throws Throwable { + public void onboardUpdateVNFTest() throws Exception { List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filePath); String vnfFile = fileNamesFromFolder.get(0); - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); VendorSoftwareProductObject vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser()); String vspName = vsp.getName(); ResourceGeneralPage.clickCertifyButton(vspName); // create service ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); CompositionPage.searchForElement(vspName); @@ -438,7 +444,9 @@ public class OnboardingFlowsUI extends SetupCDTest { assertNotNull(vfElement); ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser()); - HomePage.navigateToHomePage(); + if (!HomePage.navigateToHomePage()) { + fail("Could not go to the home page"); + } ///update flow String updatedVnfFile = fileNamesFromFolder.get(1); @@ -464,7 +472,7 @@ public class OnboardingFlowsUI extends SetupCDTest { reloginWithNewRole(UserRoleEnum.GOVERNOR); GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); - GovernorOperationPage.approveSerivce(serviceMetadata.getName()); + GovernorOperationPage.approveService(serviceMetadata.getName()); reloginWithNewRole(UserRoleEnum.OPS); @@ -482,19 +490,24 @@ public class OnboardingFlowsUI extends SetupCDTest { @Test public void threeVMMSCsInServiceTest() throws Exception { - String pathFile = FileHandling.getFilePath("VmmscArtifacts"); - List<String> vmmscList = Arrays.asList(new File(pathFile).list()).stream().filter(e -> e.contains("vmmsc") && e.endsWith(".zip")).collect(Collectors.toList()); - assertTrue("Did not find vMMSCs", vmmscList.size() > 0); + final String[] list = new File(pathFile).list(); + assertNotNull("Did not find vMMSCs", list); + assertFalse("Did not find vMMSCs", list.length == 0); + List<String> vmmscList = Arrays.stream(list).filter(e -> e.contains("vmmsc") && e.endsWith(".zip")) + .collect(Collectors.toList()); + assertFalse("Did not find vMMSCs", vmmscList.isEmpty()); Map<String, String> vspNames = new HashMap<>(); for (String vnfFile : vmmscList) { - getExtendTest().log(Status.INFO, String.format("Going to onboard the VNF %s......", vnfFile)); - System.out.println(String.format("Going to onboard the VNF %s......", vnfFile)); + String msg = String.format("Going to onboard the VNF %s", vnfFile); + getExtendTest().log(Status.INFO, msg); + LOGGER.info(msg); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject createVendorSoftwareProduct = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, pathFile, getUser(), amdocsLicenseMembers); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); + VendorSoftwareProductObject createVendorSoftwareProduct = VendorSoftwareProductRestUtils + .createVendorSoftwareProduct(resourceReqDetails, vnfFile, pathFile, getUser(), vendorLicenseModel); getExtendTest().log(Status.INFO, String.format("Searching for onboarded %s", vnfFile)); HomePage.showVspRepository(); @@ -508,17 +521,10 @@ public class OnboardingFlowsUI extends SetupCDTest { DeploymentArtifactPage.clickCertifyButton(vspName); vspNames.put(vnfFile, vspName); } - - /* reloginWithNewRole(UserRoleEnum.TESTER); - for (String vsp : vspNames.values()){ - GeneralUIUtils.findComponentAndClick(vsp); - TesterOperationPage.certifyComponent(vsp); - } - - reloginWithNewRole(UserRoleEnum.DESIGNER);*/ + // create service ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager(); @@ -540,7 +546,7 @@ public class OnboardingFlowsUI extends SetupCDTest { reloginWithNewRole(UserRoleEnum.GOVERNOR); GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); - GovernorOperationPage.approveSerivce(serviceMetadata.getName()); + GovernorOperationPage.approveService(serviceMetadata.getName()); reloginWithNewRole(UserRoleEnum.OPS); GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); @@ -551,7 +557,6 @@ public class OnboardingFlowsUI extends SetupCDTest { AssertJUnit.assertEquals(1, rowsFromMonitorTable.size()); OpsOperationPage.waitUntilArtifactsDistributed(0); - } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PNF.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PNF.java index 97a70100a3..a39e4f2f91 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PNF.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PNF.java @@ -378,7 +378,7 @@ public class PNF extends SetupCDTest { /*reloginWithNewRole(UserRoleEnum.DESIGNER);*/ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); CanvasManager canvasManager = CanvasManager.getCanvasManager(); CompositionPage.searchForElement(pnfName); @@ -394,7 +394,7 @@ public class PNF extends SetupCDTest { reloginWithNewRole(UserRoleEnum.GOVERNOR); GeneralUIUtils.findComponentAndClick(serviceName); - GovernorOperationPage.approveSerivce(serviceName); + GovernorOperationPage.approveService(serviceName); reloginWithNewRole(UserRoleEnum.OPS); GeneralUIUtils.findComponentAndClick(serviceName); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Product.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Product.java index 877858bece..15f0456086 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Product.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Product.java @@ -48,7 +48,7 @@ public class Product extends SetupCDTest { ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); ProductReqDetails productReqDetails = ElementFactory.getDefaultProduct(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); GeneralPageElements.clickSubmitForTestingButton(serviceMetadata.getName()); reloginWithNewRole(UserRoleEnum.TESTER); GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); 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 8610924daa..ec2b88dbf9 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,7 +27,7 @@ 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.AmdocsLicenseMembers; +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; @@ -70,9 +70,6 @@ import java.util.List; import static org.testng.Assert.assertTrue; -//import com.sun.xml.internal.bind.v2.TODO; - - public class PropertiesAssignmentUpdateFlow extends SetupCDTest { private static String filePath; @@ -238,9 +235,10 @@ public class PropertiesAssignmentUpdateFlow extends SetupCDTest { //Import VSP, create VF - v0.1 String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath(); getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, + vendorLicenseModel, null); resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); @@ -320,9 +318,10 @@ public class PropertiesAssignmentUpdateFlow extends SetupCDTest { //Import VSP, create VF - v0.1 String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath(); getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, + vendorLicenseModel, null); resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); @@ -393,9 +392,10 @@ public class PropertiesAssignmentUpdateFlow extends SetupCDTest { //Import VSP, create VF - v0.1 String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath(); getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, + vendorLicenseModel, null); resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); @@ -603,9 +603,10 @@ public class PropertiesAssignmentUpdateFlow extends SetupCDTest { //Import VSP, create VF - v0.1 String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath(); getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, + vendorLicenseModel, null); resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); 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 17a936f0ee..92123f66d6 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,7 +26,7 @@ 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.AmdocsLicenseMembers; +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; @@ -69,9 +69,6 @@ import java.util.List; import static org.testng.Assert.assertTrue; -//import com.sun.xml.internal.bind.v2.TODO; - - public class PropertiesAssignmentUpdateFlow_New extends SetupCDTest { private static String filePath; @@ -259,9 +256,10 @@ public class PropertiesAssignmentUpdateFlow_New extends SetupCDTest { //Import VSP, create VF - v0.1 String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath(); getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, + vendorLicenseModel, null); resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); @@ -305,9 +303,10 @@ public class PropertiesAssignmentUpdateFlow_New extends SetupCDTest { //Import VSP, create VF - v0.1 String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath(); getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, + vendorLicenseModel, null); resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); @@ -349,9 +348,10 @@ public class PropertiesAssignmentUpdateFlow_New extends SetupCDTest { //Import VSP, create VF - v0.1 String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath(); getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, + vendorLicenseModel, null); resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); @@ -396,9 +396,10 @@ public class PropertiesAssignmentUpdateFlow_New extends SetupCDTest { //Import VSP, create VF - v0.1 String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath(); getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, + vendorLicenseModel, null); resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); @@ -461,9 +462,10 @@ public class PropertiesAssignmentUpdateFlow_New extends SetupCDTest { //Import VSP, create VF - v0.1 String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath(); getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, + vendorLicenseModel, null); resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); @@ -519,9 +521,10 @@ public class PropertiesAssignmentUpdateFlow_New extends SetupCDTest { //Import VSP, create VF - v0.1 String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath(); getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, + vendorLicenseModel, null); resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); @@ -583,9 +586,10 @@ public class PropertiesAssignmentUpdateFlow_New extends SetupCDTest { //Import VSP, create VF - v0.1 String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath(); getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, + vendorLicenseModel, null); resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); @@ -644,9 +648,10 @@ public class PropertiesAssignmentUpdateFlow_New extends SetupCDTest { //Import VSP, create VF - v0.1 String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath(); getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, + vendorLicenseModel, null); resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); @@ -796,9 +801,10 @@ public class PropertiesAssignmentUpdateFlow_New extends SetupCDTest { //Import VSP, create VF - v0.1 String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath(); getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, + vendorLicenseModel, null); resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); 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 831e81131c..530c3fba96 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 @@ -105,7 +105,7 @@ public class Service extends SetupCDTest { @Test public void createService() throws Exception { ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); } @Test @@ -123,7 +123,7 @@ public class Service extends SetupCDTest { public void updateService() throws Exception { // Create Service ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); // Update Service ServiceGeneralPage.deleteOldTags(serviceMetadata); @@ -133,7 +133,7 @@ public class Service extends SetupCDTest { serviceMetadata.setContactId("cs6543"); serviceMetadata.getTags().addAll(Arrays.asList("updatedTag", "oneMoreUpdatedTag", "lastOne UpdatedTag")); ServiceUIUtils.setServiceCategory(serviceMetadata, ServiceCategoriesEnum.VOIP); - ServiceUIUtils.fillServiceGeneralPage(serviceMetadata, getUser()); + ServiceUIUtils.fillServiceGeneralPage(serviceMetadata); GeneralPageElements.clickCreateButton(); ServiceVerificator.verifyServiceUpdatedInUI(serviceMetadata); @@ -144,7 +144,7 @@ public class Service extends SetupCDTest { // create service ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); // Delete service //GeneralUIUtils.HighlightMyElement(GeneralUIUtils.getWebButton("delete_version")); @@ -159,7 +159,7 @@ public class Service extends SetupCDTest { @Test public void checkoutServiceTest() throws Exception { ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); @@ -203,7 +203,7 @@ public class Service extends SetupCDTest { ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName()); ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); CanvasManager canvasManager = CanvasManager.getCanvasManager(); CompositionPage.searchForElement(atomicResourceMetaData.getName()); @@ -230,7 +230,7 @@ public class Service extends SetupCDTest { ResourceGeneralPage.clickCheckinButton(resourceMetaData.getName()); ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); CanvasManager canvasManager = CanvasManager.getCanvasManager(); CompositionPage.searchForElement(resourceMetaData.getName()); @@ -242,7 +242,7 @@ public class Service extends SetupCDTest { @Test public void addDeploymentArtifactInCompositionScreenTest() throws Exception { ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL, "OTHER"); @@ -265,7 +265,7 @@ public class Service extends SetupCDTest { List<String> artifactFileNames = new ArrayList<>(); ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); ArtifactInfo artifactInfo = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, descriptionText, ARTIFACT_LABEL, "OTHER"); @@ -302,7 +302,7 @@ public class Service extends SetupCDTest { descriptionText = DESCRIPTION, url = "http://kuku.com"; ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); new ArtifactInfo(filePath, fileName, descriptionText, ARTIFACT_LABEL, "OTHER"); @@ -326,7 +326,7 @@ public class Service extends SetupCDTest { descriptionTextEdit = "kuku2"; ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); ServiceGeneralPage.getServiceLeftMenu().moveToManagmentWorkflow(); ServiceGeneralPage.fillAndAddNewWorkflow(descriptionText, descriptionText); @@ -339,7 +339,7 @@ public class Service extends SetupCDTest { @Test public void deleteChangeVersionTest() throws Exception { ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); @@ -372,7 +372,7 @@ public class Service extends SetupCDTest { public void compositionScreenRightSideButtonsTest() throws Exception { ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); @@ -529,7 +529,7 @@ public class Service extends SetupCDTest { //TODO Andrey should click on certify button ResourceGeneralPage.clickCertifyButton(atomicResourceMetaData.getName()); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); CanvasManager canvasManager = CanvasManager.getCanvasManager(); @@ -551,7 +551,7 @@ public class Service extends SetupCDTest { @Test public void isDisabledAndReadOnlyInCheckin() throws Exception { ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); GeneralPageElements.clickCheckinButton(serviceMetadata.getName()); GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); @@ -578,7 +578,7 @@ public class Service extends SetupCDTest { GeneralPageElements.clickCheckinButton(resourceMetaData.getName()); ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); String selectedInstanceName = addResourceToServiceInCanvas(resourceMetaData); @@ -625,7 +625,7 @@ public class Service extends SetupCDTest { ResourceGeneralPage.clickCheckinButton(resourceMetaData.getName()); ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); addResourceToServiceInCanvas(resourceMetaData); GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1"); DeploymentArtifactPage.getLeftMenu().moveToDeploymentViewScreen(); @@ -657,7 +657,7 @@ public class Service extends SetupCDTest { ResourceGeneralPage.clickCheckinButton(resourceMetaData.getName()); ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); addResourceToServiceInCanvas(resourceMetaData); @@ -680,7 +680,7 @@ public class Service extends SetupCDTest { reloginWithNewRole(UserRoleEnum.DESIGNER);*/ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); + ServiceUIUtils.createService(serviceMetadata); addResourceToServiceInCanvas(resourceMetaData); 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 3023c9bea8..9fc4cd7243 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,7 @@ 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.AmdocsLicenseMembers; +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; @@ -427,9 +427,10 @@ public class UpgradeServices extends SetupCDTest { private Resource createAndCertifyVFfromVSP(String vnfFile) throws Exception { String filePath = FileHandling.getPortMirroringRepositoryPath(); getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, + vendorLicenseModel, null); resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); Resource vfResource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); vfResource = (Resource) AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); 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 d0ca864ae0..56b6fb7f17 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,7 +23,7 @@ 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.AmdocsLicenseMembers; +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.VendorSoftwareProductObject; @@ -218,8 +218,9 @@ public class VFCArtifacts extends SetupCDTest { String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip"; String snmpFile = "Fault-alarms-ASDC-vprobes-vLB.zip"; - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); - VendorSoftwareProductObject createVSP = VendorSoftwareProductRestUtils.createVSP(resourceMetaData, vnfFile, filePath, getUser(), amdocsLicenseMembers); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorSoftwareProductObject createVSP = VendorSoftwareProductRestUtils.createVSP(resourceMetaData, vnfFile, filePath, getUser(), + vendorLicenseModel); String vspName = createVSP.getName(); resourceMetaData.setName(vspName); // VendorSoftwareProductObject resourceMeta = createVSP.right; @@ -252,8 +253,9 @@ public class VFCArtifacts extends SetupCDTest { String snmpPollFile = "vprobes-vLB.zip"; String updatedSnmpPollFile = "vprobes-vLBAgent.zip"; - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); - VendorSoftwareProductObject createVSP = VendorSoftwareProductRestUtils.createVSP(resourceMetaData, vnfFile, filePath, getUser(), amdocsLicenseMembers); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorSoftwareProductObject createVSP = VendorSoftwareProductRestUtils.createVSP(resourceMetaData, vnfFile, filePath, getUser(), + vendorLicenseModel); String vspName = createVSP.getName(); resourceMetaData.setName(vspName); String vspid = createVSP.getVspId(); @@ -291,8 +293,9 @@ public class VFCArtifacts extends SetupCDTest { String snmpFile = "vprobes-vLB.zip"; String updatedSnmpFile = "vprobes-vLB-Modified.zip"; - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); - VendorSoftwareProductObject createVSP = VendorSoftwareProductRestUtils.createVSP(resourceMetaData, vnfFile, filePath, getUser(), amdocsLicenseMembers); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + VendorSoftwareProductObject createVSP = VendorSoftwareProductRestUtils.createVSP(resourceMetaData, vnfFile, filePath, getUser(), + vendorLicenseModel); String vspName = createVSP.getName(); resourceMetaData.setName(vspName); String vspid = createVSP.getVspId(); 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 859d6285cf..1a5cace690 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,7 +20,13 @@ 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.LifecycleStateEnum; @@ -40,6 +46,7 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.pages.CompositionPage; import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; @@ -62,18 +69,17 @@ import org.openecomp.sdc.ci.tests.verificator.VfModuleVerificator; import org.openecomp.sdc.ci.tests.verificator.VfVerificator; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.AssertJUnit; 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; - - public class Vf extends SetupCDTest { + private static final Logger LOGGER = LoggerFactory.getLogger(Vf.class); + private String filePath; @BeforeClass @@ -420,22 +426,24 @@ public class Vf extends SetupCDTest { } @Test - public void changeInstanceNameInVfTest() throws Exception { - ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); - ResourceUIUtils.createVF(vfMetaData, getUser()); - - ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); - CanvasManager vfCanvasManager = CanvasManager.getCanvasManager(); - CanvasElement computeElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE); - - String updatedInstanceName = "updatedName"; - vfCanvasManager.updateElementNameInCanvas(computeElement, updatedInstanceName); - - String actualSelectedInstanceName = CompositionPage.getSelectedInstanceName(); - AssertJUnit.assertTrue(updatedInstanceName.equals(actualSelectedInstanceName)); + public void changeInstanceNameInVfTest() { + final ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); + final String updatedInstanceName = "updatedName"; + try { + ResourceUIUtils.createVF(vfMetaData, getUser()); + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + final CanvasManager vfCanvasManager = CanvasManager.getCanvasManager(); + final CanvasElement computeElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE); + vfCanvasManager.updateElementNameInCanvas(computeElement, updatedInstanceName); + } catch (final Exception e) { + final String errorMsg = "An unexpected error has occurred during the changeInstanceNameInVfTest"; + takeScreenshot("ChangeInstanceNameInVf" + vfMetaData.getToscaResourceName(), errorMsg); + LOGGER.error(errorMsg, e); + fail(errorMsg); + } + assertEquals(CompositionPage.getSelectedInstanceName(), updatedInstanceName); } - @Test public void submitVfForTestingWithNonCertifiedAsset() throws Exception { String fileName = "vFW_VFC4.yml"; @@ -535,6 +543,13 @@ public class Vf extends SetupCDTest { AssertJUnit.assertEquals(expectedHeaderAndRowSize, rows.size()); } + private void takeScreenshot(final String screenshotName, final String errorMsg) { + try { + ExtentTestActions.addScreenshot(Status.ERROR, screenshotName, errorMsg); + } catch (final IOException e) { + LOGGER.warn("Could not take screenshot", e); + } + } @Override protected UserRoleEnum getRole() { diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java index 7ba689cd95..8cfe5bdba0 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java @@ -83,7 +83,7 @@ public class DriverFactory { }; } - public static WebDriver getDriver() throws Exception { + public static WebDriver getDriver() { return driverThread.get().getDriver(); } 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 9ebcb9b0c2..c3a1d13684 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 @@ -35,7 +35,11 @@ import java.util.UUID; public class ExtentTestActions { - private static SomeInterface testManager = new ExtentTestManager(); + private static final SomeInterface testManager = ExtentTestManager.getInstance(); + + private ExtentTestActions() { + + } public static void log(Status logStatus, Markup mark) { ExtentTest test = testManager.getTest(); @@ -80,20 +84,15 @@ public class ExtentTestActions { } } - public static String addScreenshot(Status logStatus, String screenshotName, String message) throws IOException { - String imageFilePath = null; - String uuid = UUID.randomUUID().toString(); - String[] stringArray = uuid.split("-"); - screenshotName = screenshotName + "-" + stringArray[stringArray.length - 1]; - try { - File imageFile = GeneralUIUtils.takeScreenshot(screenshotName, SetupCDTest.getScreenshotFolder()); - imageFilePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFile.toURI()).getPath(); - } catch (IOException e) { - e.printStackTrace(); - } - - ExtentTest test = testManager.getTest(); - test.log(logStatus, message, MediaEntityBuilder.createScreenCaptureFromPath(imageFilePath).build()); + public static String addScreenshot(final Status logStatus, String screenshotName, + final String message) throws IOException { + final String[] splitUuid = UUID.randomUUID().toString().split("-"); + screenshotName = screenshotName + "-" + splitUuid[splitUuid.length - 1]; + final File imageFile = GeneralUIUtils.takeScreenshot(screenshotName, SetupCDTest.getScreenshotFolder()); + final String imageFilePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFile.toURI()) + .getPath(); + testManager.getTest() + .log(logStatus, message, MediaEntityBuilder.createScreenCaptureFromPath(imageFilePath).build()); return imageFilePath; } 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 295abbe8ac..1effea93b8 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,44 +22,48 @@ package org.openecomp.sdc.ci.tests.execute.setup; import com.aventstack.extentreports.ExtentReports; import com.aventstack.extentreports.ExtentTest; -import org.openecomp.sdc.ci.tests.api.SomeInterface; - import java.util.HashMap; +import org.openecomp.sdc.ci.tests.api.SomeInterface; public class ExtentTestManager implements SomeInterface { - private static HashMap<Long, ExtentTest> extentTestMap = new HashMap<Long, ExtentTest>(); - private static ExtentReports extent = ExtentManager.getReporter(); + private final HashMap<Long, ExtentTest> extentTestByThreadIdMap = new HashMap<>(); + private final ExtentReports extent = ExtentManager.getReporter(); + private static final ExtentTestManager INSTANCE = new ExtentTestManager(); - public ExtentTestManager() { + private ExtentTestManager() { + + } + public static ExtentTestManager getInstance() { + return INSTANCE; } @Override public synchronized ExtentTest getTest() { - return extentTestMap.get(Thread.currentThread().getId()); + return extentTestByThreadIdMap.get(Thread.currentThread().getId()); } - public static synchronized void endTest() { + public synchronized void endTest() { extent.flush(); } - public static synchronized ExtentTest startTest(String testName) { + public synchronized ExtentTest startTest(final String testName) { return startTest(testName, ""); } - public static synchronized ExtentTest startTest(String testName, String desc) { - ExtentTest test = extent.createTest(testName, desc); - extentTestMap.put(Thread.currentThread().getId(), test); + public synchronized ExtentTest startTest(final String testName, final String desc) { + final ExtentTest test = extent.createTest(testName, desc); + extentTestByThreadIdMap.put(Thread.currentThread().getId(), test); return test; } - public static synchronized <T> void assignCategory(Class<T> clazz) { + public synchronized <T> void assignCategory(Class<T> clazz) { String[] parts = clazz.getName().split("\\."); String lastOne1 = parts[parts.length - 1]; String lastOne2 = parts[parts.length - 2]; - extentTestMap.get(Thread.currentThread().getId()).assignCategory(lastOne2 + "-" + lastOne1); + extentTestByThreadIdMap.get(Thread.currentThread().getId()).assignCategory(lastOne2 + "-" + lastOne1); } } 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 fcbbaefaac..50b6dafe1a 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,99 +20,43 @@ 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; +import org.slf4j.LoggerFactory; import org.testng.ITestContext; import org.testng.ITestResult; -import java.io.IOException; - -public class ReportAfterTestManager extends ExtentTestActions { +public class ReportAfterTestManager { + private static final Logger LOGGER = LoggerFactory.getLogger(ReportAfterTestManager.class); private static String testName; private static Throwable throwable; - private static int status; - - private static void logSuccessAfterTest() { - final Status logStatus = Status.PASS; - addTag(logStatus, "Success"); - try { - String message = "Finished the test with the following screenshot : "; - addScreenshotToReport(logStatus, testName, message); - } catch (Exception e) { - log(logStatus, "SUCCESS - The following exepction occured : " + e.getMessage()); - } - } - - private static void logFailAfterTest() { - addTag(Status.FAIL, "Failure"); - try { - log(Status.ERROR, "ERROR - The following exepction occured : "); - log(Status.ERROR, throwable); - String message = "Failure is described in the following screenshot : "; - addScreenshotToReport(Status.FAIL, testName, message); - } catch (Exception e) { - log(Status.ERROR, "ERROR - The following exepction occured : " + e.getMessage()); - } - } - - private static void logSkipAfterTest() { - final Status logStatus = Status.SKIP; - addTag(logStatus, "Skipped"); - try { - log(logStatus, "SKIP - The following exepction occured : "); - log(logStatus, throwable); - String message = "Skip is described in the following screenshot : "; - addScreenshotToReport(logStatus, testName, message); - } catch (Exception e) { - log(logStatus, "SKIP - The following exepction occured : " + e.getMessage()); - } - } - - private static void logFatalAfterTest() { - final Status logStatus = Status.FATAL; - addTag(logStatus, "Fatal"); - try { - log(logStatus, "FATAL - The following exepction occured : "); - log(logStatus, throwable); - String message = "Fatal is described in the following screenshot : "; - addScreenshotToReport(logStatus, testName, message); - } catch (Exception e) { - log(logStatus, "FATAL - The following exepction occured : " + e.getMessage()); - } - } + private static String exceptionMsgFormat = "%s - The following exception occurred:"; - private static String addScreenshotToReport(Status logStatus, String testName, String message) throws IOException { + private ReportAfterTestManager() { - String addedValueFromDataProvider = WindowTestManager.getWindowMap().getAddedValueFromDataProvider(); - if (addedValueFromDataProvider != null) { - addedValueFromDataProvider = addedValueFromDataProvider.replace(":", "-"); - testName = testName + "...." + addedValueFromDataProvider; - } - - return addScreenshot(logStatus, testName, message); } - public static void report(ITestResult result, ITestContext context) { - + public static void report(final ITestResult result, final ITestContext context) { testName = result.getName(); throwable = result.getThrowable(); - status = result.getStatus(); - String suiteName = ExtentManager.getSuiteName(context); + final String suiteName = ExtentManager.getSuiteName(context); - switch (status) { + switch (result.getStatus()) { case ITestResult.SUCCESS: logSuccessAfterTest(); break; case ITestResult.FAILURE: - - if (suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())) { - logFatalAfterTest(); - } else { - logFailAfterTest(); - } + logFailure(suiteName); break; case ITestResult.SKIP: @@ -125,5 +69,55 @@ public class ReportAfterTestManager extends ExtentTestActions { } + private static void logSuccessAfterTest() { + addTag(Status.PASS, "Success"); + takeScreenshot(Status.PASS); + } + + private static void logFailAfterTest() { + addTag(Status.FAIL, "Failure"); + log(Status.ERROR, String.format(exceptionMsgFormat, Status.ERROR)); + log(Status.ERROR, throwable); + takeScreenshot(Status.FAIL); + } + + private static void logSkipAfterTest() { + addTag(Status.SKIP, "Skipped"); + log(Status.SKIP, String.format(exceptionMsgFormat, Status.SKIP)); + log(Status.SKIP, throwable); + takeScreenshot(Status.SKIP); + } + + private static void logFatalAfterTest() { + addTag(Status.FATAL, "Fatal"); + log(Status.FATAL, String.format(exceptionMsgFormat, Status.FATAL)); + log(Status.FATAL, throwable); + takeScreenshot(Status.FATAL); + } + + private static void takeScreenshot(final Status status) { + String adjustedTestName = testName; + String infoFromDataProvider = WindowTestManager.getWindowMap().getAddedValueFromDataProvider(); + if (StringUtils.isNotEmpty(infoFromDataProvider)) { + infoFromDataProvider = infoFromDataProvider.replace(":", "-"); + adjustedTestName = String.format("%s | %s", testName, infoFromDataProvider); + } + try { + addScreenshot(status, adjustedTestName, "Finished the test with the following screenshot:"); + } catch (final IOException e) { + final String warnMsg = "Could not take screenshot of the final screen"; + LOGGER.warn(warnMsg, e); + log(Status.WARNING, String.format("%s: %s", warnMsg, e.getMessage())); + } + } + + private static void logFailure(final String suiteName) { + if (suiteNameXml.TESTNG_FAILED_XML_NAME.getValue().equals(suiteName)) { + logFatalAfterTest(); + } else { + logFailAfterTest(); + } + } + } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java index ad2071ad12..a700a0d4b6 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java @@ -27,12 +27,11 @@ import com.aventstack.extentreports.Status; import net.lightbody.bmp.core.har.Har; import org.json.simple.JSONObject; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.api.SomeInterface; import org.openecomp.sdc.ci.tests.config.UserCredentialsFromFile; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.datatypes.UserCredentials; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.sanity.OnboardingFlowsUI; +import org.openecomp.sdc.ci.tests.execute.sanity.OnboardingFlowsUi; import org.openecomp.sdc.ci.tests.execute.setup.ExtentManager.suiteNameXml; import org.openecomp.sdc.ci.tests.pages.HomePage; import org.openecomp.sdc.ci.tests.run.StartTest; @@ -46,6 +45,7 @@ import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; +import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.ITestContext; @@ -66,45 +66,43 @@ import java.util.UUID; public abstract class SetupCDTest extends DriverFactory { - // private static final String RE_RUN = "ReRun - "; + private static final Logger LOGGER = LoggerFactory.getLogger(SetupCDTest.class); + private static final String RE_RUN = "<html><font color=\"red\">ReRun - </font></html>"; private static final String WEB_SEAL_PASSWORD = "123123a"; protected static final String HEAT_FILE_YAML_NAME_PREFIX = "Heat-File"; protected static final String HEAT_FILE_YAML_NAME_SUFFIX = ".yaml"; private static final int BASIC_SLEEP_DURATION = 1000; - public SetupCDTest() { - LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); - lc.getLogger("org.apache").setLevel(Level.INFO); - } - /**************** CONSTANTS ****************/ private static final String CREDENTIALS_FILE = "credentials.yaml"; + private static final String REPORT_FILE_NAME = "SDC_UI_Extent_Report.html"; private static final String REPORT_FOLDER = "." + File.separator + "ExtentReport" + File.separator; private static final String SCREENSHOT_FOLDER = REPORT_FOLDER + "screenshots" + File.separator; private static final String HAR_FILES_FOLDER_NAME = "har_files"; private static final String HAR_FILES_FOLDER = REPORT_FOLDER + HAR_FILES_FOLDER_NAME + File.separator; - private static final String SHORT_CSV_REPORT_FILE_NAME = "ShortReport.csv"; - private static final int NUM_OF_ATTEMPTS_TO_REFTRESH = 2; + private static final int NUM_OF_ATTEMPTS_TO_REFTRESH = 2; /**************** PRIVATES ****************/ private static String url; + private static boolean uiSimulator; private static boolean localEnv = true; private static OnboardCSVReport csvReport; private final UserCredentialsFromFile credentialsIns = UserCredentialsFromFile.getInstance(); - private static ITestContext myContext; + public SetupCDTest() { + LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); + lc.getLogger("org.apache").setLevel(Level.INFO); + } - /**************** METHODS ****************/ public static ExtentTest getExtendTest() { - SomeInterface testManager = new ExtentTestManager(); - return testManager.getTest(); + return ExtentTestManager.getInstance().getTest(); } public static WindowTest getWindowTest() { @@ -162,12 +160,12 @@ public abstract class SetupCDTest extends DriverFactory { System.out.println("ExtentReport instance started from BeforeMethod..."); String suiteName = ExtentManager.getSuiteName(context); if (suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())) { - ExtentTestManager.startTest(RE_RUN + method.getName()); + ExtentTestManager.getInstance().startTest(RE_RUN + method.getName()); } else { - ExtentTestManager.startTest(method.getName()); + ExtentTestManager.getInstance().startTest(method.getName()); } - ExtentTestManager.assignCategory(this.getClass()); + ExtentTestManager.getInstance().assignCategory(this.getClass()); setBrowserBeforeTest(getRole()); } else { System.out.println("ExtentReport instance started from Test..."); @@ -186,8 +184,7 @@ public abstract class SetupCDTest extends DriverFactory { /**************** AFTER ****************/ @AfterMethod(alwaysRun = true) - public void quitAfterTest(ITestResult result, ITestContext context) throws Exception { - + public void quitAfterTest(final ITestResult result, final ITestContext context) throws Exception { try { ReportAfterTestManager.report(result, context); GeneralUIUtils.closeErrorMessage(); @@ -197,35 +194,36 @@ public abstract class SetupCDTest extends DriverFactory { addTrafficFileToReport(result); } - if (result.getInstanceName().equals(OnboardingFlowsUI.class.getName()) && result.getStatus() == ITestResult.FAILURE) { - System.out.println("Onboarding test failed, closign browser...."); - getExtendTest().log(Status.INFO, "Onboarding test failed, closing browser...."); + if (result.getInstanceName().equals(OnboardingFlowsUi.class.getName()) && result.getStatus() == ITestResult.FAILURE) { + final String msg = "Onboarding test failed, closing browser"; + LOGGER.info(msg); + getExtendTest().log(Status.INFO, msg); quitDriver(); } else if (!getUser().getRole().toLowerCase().equals(UserRoleEnum.ADMIN.name().toLowerCase())) { boolean navigateToHomePageSuccess = HomePage.navigateToHomePage(); if (!navigateToHomePageSuccess) { - System.out.println("Navigating to homepage failed, reopening driver...."); - getExtendTest().log(Status.INFO, "Navigating to homepage failed, reopening driver...."); + final String msg = "Navigating to homepage failed, reopening driver"; + LOGGER.info(msg); + getExtendTest().log(Status.INFO, msg); quitDriver(); } } - } catch (Exception e) { - e.printStackTrace(); + } catch (final Exception e) { + LOGGER.error("An unexpected error has occurred", e); getExtendTest().log(Status.ERROR, "Exception:" + e.toString()); } - ExtentTestManager.endTest(); - String suiteName = ExtentManager.getSuiteName(context); + ExtentTestManager.getInstance().endTest(); + final String suiteName = ExtentManager.getSuiteName(context); // write result to csv file - if ((!suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())) && (result.getStatus() == ITestResult.SKIP)) { + if ((!suiteNameXml.TESTNG_FAILED_XML_NAME.getValue().equals(suiteName)) && (result.getStatus() == ITestResult.SKIP)) { addResultToCSV(result, context); } - if (suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue()) && !(result.getStatus() == ITestResult.SUCCESS)) { + if (suiteNameXml.TESTNG_FAILED_XML_NAME.getValue().equals(suiteName) && !(result.getStatus() == ITestResult.SUCCESS)) { addResultToCSV(result, context); } -// ExtentManager.closeReporter(); FileHandling.cleanCurrentDownloadDir(); } @@ -240,11 +238,11 @@ public abstract class SetupCDTest extends DriverFactory { } private void generateReport4Jenkins(ITestContext context) { - String suiteName = ExtentManager.getSuiteName(context); - JSONObject obj = new JSONObject(); - String success = Integer.toString(context.getPassedTests().size()); - String failed = Integer.toString(context.getFailedTests().size()); - String total = Integer.toString(context.getFailedTests().size() + context.getPassedTests().size()); + final String suiteName = ExtentManager.getSuiteName(context); + final JSONObject obj = new JSONObject(); + final String success = Integer.toString(context.getPassedTests().size()); + final String failed = Integer.toString(context.getFailedTests().size()); + final String total = Integer.toString(context.getFailedTests().size() + context.getPassedTests().size()); obj.put("projectName", "SDC-ONAP-UI-Automation-" + suiteName); obj.put("projectVersion", AutomationUtils.getOSVersion()); obj.put("platform", "Linux"); @@ -253,17 +251,13 @@ public abstract class SetupCDTest extends DriverFactory { obj.put("failed", failed); try (FileWriter file = new FileWriter(getReportFolder() + "jenkinsResults.json")) { - file.write(obj.toJSONString()); file.flush(); - - } catch (IOException e) { - e.printStackTrace(); + } catch (final IOException e) { + LOGGER.debug("An error has occurred while writing 'jenkinsResults.json' file", e); } - System.out.print(obj); - - + LOGGER.debug(obj.toJSONString()); } @@ -299,23 +293,20 @@ public abstract class SetupCDTest extends DriverFactory { } - private static void navigateToUrl(String url) throws Exception { + private static void navigateToUrl(final String url) { try { - System.out.println("Deleting cookies..."); + LOGGER.info("Deleting cookies"); deleteCookies(); - - System.out.println("Navigating to URL : " + url); + LOGGER.info("Navigating to URL : " + url); getDriver().navigate().to(url); GeneralUIUtils.waitForLoader(); - - System.out.println("Zooming out..."); + LOGGER.info("Zooming out"); GeneralUIUtils.windowZoomOutUltimate(); - } catch (Exception e) { - String msg = "Browser is unreachable"; - System.out.println(msg); - getExtendTest().log(Status.ERROR, msg); - Assert.fail(msg); + final String errorMsg = String.format("Could not navigate to '%s'", url); + LOGGER.error(errorMsg, e); + getExtendTest().log(Status.ERROR, errorMsg); + Assert.fail(errorMsg); } } @@ -415,12 +406,16 @@ public abstract class SetupCDTest extends DriverFactory { passwordTextbox.sendKeys(userId.getPassword()); } - private void loginWithUser(UserRoleEnum role) { + private void loginWithUser(final UserRoleEnum role) { try { - getExtendTest().log(Status.INFO, String.format("Login as user %s", role.name().toUpperCase())); + final String msg = String + .format("Login as user '%s', role '%s'", role.getUserId(), role.getUserRole()); + getExtendTest().log(Status.INFO, msg); + LOGGER.info(msg); loginToSystem(role); + LOGGER.debug("Going to home page"); goToHomePage(role); - } catch (Exception e) { + } catch (final Exception e) { throw new RuntimeException(e); } finally { getWindowTest().setPreviousRole(getWindowTest().getUser().getRole()); @@ -441,21 +436,17 @@ public abstract class SetupCDTest extends DriverFactory { return getWindowTest().getUser(); } - private void setBrowserBeforeTest(UserRoleEnum role) { - System.out.println(String.format("Setup before test as %s.", role.toString().toUpperCase())); - try { - System.out.println("Previous role is : " + getWindowTest().getPreviousRole() + " ; Current role is : " + role.name()); - if (!getWindowTest().getPreviousRole().toLowerCase().equals(role.name().toLowerCase())) { - System.out.println("Roles are different, navigate and login"); - navigateAndLogin(role); - } - } catch (Exception e) { - e.printStackTrace(); + private void setBrowserBeforeTest(final UserRoleEnum role) { + LOGGER.info(String.format("Setup before test for role '%s'", role.name())); + if (!getWindowTest().getPreviousRole().equalsIgnoreCase(role.name())) { + LOGGER.info(String.format("Logging in with new role '%s'. Previous role was: '%s'.", role.name(), + getWindowTest().getPreviousRole())); + navigateAndLogin(role); } } - private void navigateAndLogin(UserRoleEnum role) throws Exception { - getWindowTest().setRefreshAttempts(getWindowTest().getRefreshAttempts() != 0 ? getWindowTest().getRefreshAttempts() : 0); + private void navigateAndLogin(final UserRoleEnum role) { + getWindowTest().setRefreshAttempts(getWindowTest().getRefreshAttempts()); setUser(role); navigateToUrl(url); loginWithUser(role); @@ -471,8 +462,7 @@ public abstract class SetupCDTest extends DriverFactory { return user; } - protected void reloginWithNewRole(UserRoleEnum role) throws Exception { - System.out.println(String.format("Setup before relogin as %s", role.toString().toUpperCase())); + protected void reloginWithNewRole(final UserRoleEnum role) { navigateAndLogin(role); } @@ -500,15 +490,15 @@ public abstract class SetupCDTest extends DriverFactory { public void setLog(String fromDataProvider) { String suiteName = ExtentManager.getSuiteName(myContext); - if (suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())) { - ExtentTestManager.startTest(RE_RUN + Thread.currentThread().getStackTrace()[2].getMethodName() + " " + fromDataProvider); + if (suiteNameXml.TESTNG_FAILED_XML_NAME.getValue().equals(suiteName)) { + ExtentTestManager.getInstance().startTest(RE_RUN + Thread.currentThread().getStackTrace()[2].getMethodName() + " " + fromDataProvider); } else { - ExtentTestManager.startTest(Thread.currentThread().getStackTrace()[2].getMethodName() + " " + fromDataProvider); + ExtentTestManager.getInstance().startTest(Thread.currentThread().getStackTrace()[2].getMethodName() + " " + fromDataProvider); } getWindowTest().setAddedValueFromDataProvider(fromDataProvider); - ExtentTestManager.assignCategory(this.getClass()); + ExtentTestManager.getInstance().assignCategory(this.getClass()); setBrowserBeforeTest(getRole()); } 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 bc9fd7eb67..8fdad16497 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 @@ -24,6 +24,7 @@ import net.lightbody.bmp.BrowserMobProxyServer; import net.lightbody.bmp.client.ClientUtil; import net.lightbody.bmp.proxy.CaptureType; import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.exception.WebDriverThreadRuntimeException; import org.openecomp.sdc.ci.tests.utilities.FileHandling; import org.openqa.selenium.Platform; import org.openqa.selenium.UnexpectedAlertBehaviour; @@ -39,11 +40,13 @@ import java.io.File; import java.net.MalformedURLException; import java.net.URL; import java.util.UUID; - -//import org.openqa.selenium.firefox.FirefoxOptions; // Selenium 3.4.0 change +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class WebDriverThread { + private final static Logger LOGGER = LoggerFactory.getLogger(SetupCDTest.class); + static final String AUTOMATION_DOWNLOAD_DIR = "automationDownloadDir"; private WebDriver webdriver; private FirefoxProfile firefoxProfile; @@ -54,7 +57,7 @@ public class WebDriverThread { webdriver.manage().window().maximize(); } - public WebDriver getDriver() throws Exception { + public WebDriver getDriver() { return webdriver; } @@ -66,49 +69,45 @@ public class WebDriverThread { } - private void initDriver(Config config) { - try { - boolean remoteTesting = config.isRemoteTesting(); - if (!remoteTesting) { - boolean mobProxyStatus = config.getUseBrowserMobProxy(); - if (mobProxyStatus) { - setWebDriverWithMobProxy(); - } else { - - System.out.println("Opening LOCAL browser"); - DesiredCapabilities cap = new DesiredCapabilities(); - - cap = DesiredCapabilities.firefox(); - cap.setBrowserName("firefox"); - cap.setCapability(FirefoxDriver.PROFILE, initFirefoxProfile()); - //unexpected model dialog fix. - cap.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.ACCEPT); - - firefoxProfile.setPreference("network.proxy.type", 2); - firefoxProfile.setPreference("network.proxy.autoconfig_url", "http://autoproxy.sbc.com/autoproxy.cgi"); - firefoxProfile.setPreference("network.proxy.no_proxies_on", "localhost"); - - webdriver = new FirefoxDriver(cap); - } - } else { - System.out.println("Opening REMOTE browser"); - String remoteEnvIP = config.getRemoteTestingMachineIP(); - String remoteEnvPort = config.getRemoteTestingMachinePort(); - - DesiredCapabilities cap = new DesiredCapabilities(); - cap = DesiredCapabilities.firefox(); - cap.setPlatform(Platform.ANY); - cap.setBrowserName("firefox"); - - String remoteNodeUrl = String.format(SELENIUM_NODE_URL, remoteEnvIP, remoteEnvPort); - RemoteWebDriver remoteWebDriver = new RemoteWebDriver(new URL(remoteNodeUrl), cap); - remoteWebDriver.setFileDetector(new LocalFileDetector()); - webdriver = remoteWebDriver; + private void initDriver(final Config config) { + if (config.isRemoteTesting()) { + LOGGER.info("Opening REMOTE browser"); + final String remoteEnvIP = config.getRemoteTestingMachineIP(); + final String remoteEnvPort = config.getRemoteTestingMachinePort(); + + final DesiredCapabilities cap = DesiredCapabilities.firefox(); + cap.setPlatform(Platform.ANY); + cap.setBrowserName("firefox"); + + final String remoteUrlString = String.format(SELENIUM_NODE_URL, remoteEnvIP, remoteEnvPort); + final URL remoteUrl; + try { + remoteUrl = new URL(remoteUrlString); + } catch (MalformedURLException e) { + throw new WebDriverThreadRuntimeException(String.format("Malformed URL '%s'", remoteUrlString), e); } + final RemoteWebDriver remoteWebDriver = new RemoteWebDriver(remoteUrl, cap); + remoteWebDriver.setFileDetector(new LocalFileDetector()); + webdriver = remoteWebDriver; + } else { + if (config.getUseBrowserMobProxy()) { + setWebDriverWithMobProxy(); + return; + } + + LOGGER.info("Opening LOCAL browser"); + + final DesiredCapabilities cap = DesiredCapabilities.firefox(); + cap.setBrowserName("firefox"); + cap.setCapability(FirefoxDriver.PROFILE, initFirefoxProfile()); + //unexpected model dialog fix. + cap.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.ACCEPT); + firefoxProfile.setPreference("network.proxy.type", 2); + firefoxProfile.setPreference("network.proxy.autoconfig_url", "http://autoproxy.sbc.com/autoproxy.cgi"); + firefoxProfile.setPreference("network.proxy.no_proxies_on", "localhost"); - } catch (MalformedURLException e) { - throw new RuntimeException(e); + webdriver = new FirefoxDriver(cap); } } 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 d4051d772a..611c24a2a5 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 @@ -40,7 +40,7 @@ public class GeneralPageElements { private static final int WAIT_FOR_ELEMENT_TIME_OUT_DIVIDER = 10; protected GeneralPageElements() { - super(); + } public static ResourceLeftMenu getLeftMenu() { @@ -229,13 +229,13 @@ public class GeneralPageElements { GeneralUIUtils.ultimateWait(); } - public static List<WebElement> getElemenetsFromTable() { + public static List<WebElement> getElementsFromTable() { GeneralUIUtils.ultimateWait(); - return GeneralUIUtils.getElemenetsFromTable(By.className("flex-container")); + return GeneralUIUtils.getElementsByLocator(By.className("flex-container")); } public static boolean checkElementsCountInTable(int expectedElementsCount) { - return checkElementsCountInTable(expectedElementsCount, () -> getElemenetsFromTable()); + return checkElementsCountInTable(expectedElementsCount, () -> getElementsFromTable()); } 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 72f5bc72eb..5ffd6c80a7 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,23 +21,41 @@ 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; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class GovernorOperationPage { + private static final Logger LOGGER = LoggerFactory.getLogger(GovernorOperationPage.class); + private GovernorOperationPage() { super(); } - public static void approveSerivce(String serviceName) { - SetupCDTest.getExtendTest().log(Status.INFO, "Approving the distrbution of the service " + serviceName); + public static void approveService(final String serviceName) { + SetupCDTest.getExtendTest() + .log(Status.INFO, String.format("Approving the distribution of the service '%s'", serviceName)); GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DistributionChangeButtons.APPROVE.getValue()).click(); GeneralUIUtils.waitForLoader(); GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DistributionChangeButtons.APPROVE_MESSAGE.getValue()) .sendKeys("service " + serviceName + " tested successfully"); GeneralPageElements.clickOKButton(); + final String distributionApprovedMsg = String.format("The distribution of the service '%s' was approved", serviceName); + try { + ExtentTestActions + .addScreenshot(Status.INFO, + String.format("governor-distribution-approved-%s", serviceName), + distributionApprovedMsg + ); + } catch (final IOException e) { + LOGGER.error("Could not take screenshot of governor distribution approval", e); + SetupCDTest.getExtendTest().log(Status.INFO, distributionApprovedMsg); + } GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue()); } 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 d6485fd5c2..c5cd347e88 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,7 +20,15 @@ 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.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.utilities.DownloadManager; import org.openecomp.sdc.ci.tests.utilities.FileHandling; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; @@ -28,17 +36,18 @@ import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import java.io.File; -import java.util.List; +public class HomePage { -public class HomePage extends GeneralPageElements { + private static final Logger LOGGER = LoggerFactory.getLogger(HomePage.class); private static final int WAIT_FOR_ELEMENT_TIME_OUT = 30; private static final int WAIT_FOR_LOADER_TIME_OUT = 600; - public HomePage() { - super(); + private HomePage() { + } public static void showVspRepository() { @@ -56,9 +65,9 @@ public class HomePage extends GeneralPageElements { HomePage.showVspRepository(); boolean vspFound = HomePage.searchForVSP(vspName); if (vspFound) { - List<WebElement> elemenetsFromTable = getElemenetsFromTable(); + List<WebElement> elementsFromTable = GeneralPageElements.getElementsFromTable(); WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), WAIT_FOR_ELEMENT_TIME_OUT); - WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elemenetsFromTable.get(1))); + WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elementsFromTable.get(1))); findElement.click(); GeneralUIUtils.waitForLoader(); GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.IMPORT_VSP.getValue()); @@ -68,42 +77,138 @@ public class HomePage extends GeneralPageElements { } } - public static boolean navigateToHomePage() { try { - System.out.println("Searching for reporsitory icon."); - WebElement repositoryIcon = GeneralUIUtils.getInputElement("repository-icon"); + LOGGER.debug("Searching for repository icon"); + final WebElement repositoryIcon = GeneralUIUtils.getInputElement(REPOSITORY_ICON.getTestId()); if (repositoryIcon != null) { return true; - } else { - GeneralUIUtils.ultimateWait(); - List<WebElement> homeButtons = GeneralUIUtils.getElemenetsFromTable(By.xpath("//a[contains(.,'HOME')]")); - if (homeButtons.size() != 0) { - for (WebElement home : homeButtons) { - if (home.isDisplayed()) { - home.click(); - System.out.println("Clicked on home button"); - break; - } - } - GeneralUIUtils.closeErrorMessage(); - WebElement homeButton = GeneralUIUtils.getInputElement(DataTestIdEnum.MainMenuButtons.HOME_BUTTON.getValue()); - return homeButton.isDisplayed(); - } - } - } catch (Exception innerException) { - System.out.println("Can't click on home button."); + GeneralUIUtils.ultimateWait(); + final List<WebElement> homeButtons = GeneralUIUtils + .getElementsByLocator(By.xpath("//a[contains(.,'HOME')]")); + if (!homeButtons.isEmpty()) { + homeButtons.stream().filter(WebElement::isDisplayed).findFirst().ifPresent(webElement -> { + webElement.click(); + LOGGER.debug("Clicked on home button"); + }); + } + + GeneralUIUtils.closeErrorMessage(); + WebElement homeButton = GeneralUIUtils + .getInputElement(DataTestIdEnum.MainMenuButtons.HOME_BUTTON.getValue()); + return homeButton != null && homeButton.isDisplayed(); + + } catch (final Exception e) { + final String msg = "Could not click on home button"; + getExtendTest() + .log(Status.WARNING, msg); + LOGGER.warn(msg, e); return false; } - return false; } public static File downloadVspCsarToDefaultDirectory(String vspName) throws Exception { GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click(); DownloadManager.downloadCsarByNameFromVSPRepository(vspName, ""); - File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir(); - return latestFilefromDir; + return FileHandling.getLastModifiedFileNameFromDir(); + } + + public static void findComponentAndClick(final String resourceName) { + findComponent(resourceName); + clickComponent(resourceName); + } + + public static void findComponent(final String resourceName) { + LOGGER.debug("Searching for component '{}'", resourceName); + getExtendTest().log(Status.INFO, "Searching for " + resourceName + " in home tab"); + clearSearchResults(getSearchInput()); + searchForComponent(resourceName); + } + + private static WebElement getSearchInput() { + WebElement searchTextbox; + try { + searchTextbox = TopSearchComponent.getComponentInput(); + LOGGER.debug("Search textbox '{}' selected", TopSearchComponent.SEARCH_INPUT_TEST_ID); + } catch (final Exception e) { + final String errorMsg = "Top Search bar was not visible"; + getExtendTest().log(Status.ERROR, errorMsg); + throw new HomePageRuntimeException(errorMsg, e); + } + return searchTextbox; + } + + private static void clearSearchResults(final WebElement searchTextbox) { + try { + LOGGER.debug("Clearing search results before searching"); + TopSearchComponent.replaceSearchValue(searchTextbox, UUID.randomUUID().toString()); + MainRightContainer.isEmptyResult(); + } catch (final Exception e) { + final String errorMsg = "Could not clean up the search result"; + getExtendTest().log(Status.ERROR, errorMsg); + throw new HomePageRuntimeException(errorMsg, e); + } + } + + private static void searchForComponent(final String resourceName) { + try { + LOGGER.debug("Searching for '{}'", resourceName); + TopSearchComponent.replaceSearchValue(resourceName); + MainRightContainer.isResultVisible(resourceName); + } catch (final Exception e) { + final String errorMsg = String.format("Could not find the component '%s' after search", resourceName); + getExtendTest().log(Status.ERROR, errorMsg); + throw new HomePageRuntimeException(errorMsg, e); + } + } + + public static void clickComponent(final String resourceName) { + LOGGER.debug("Clicking on the component " + resourceName); + try { + getExtendTest() + .log(Status.INFO, String.format("Clicking on the '%s' component from home tab", resourceName)); + GeneralUIUtils.clickOnElementByTestId(resourceName); + } catch (final Exception e) { + final String errorMsg = String.format("Could not click on home tab component '%s' ", resourceName); + getExtendTest().log(Status.ERROR, e.getMessage()); + throw new HomePageRuntimeException(errorMsg, e); + } + try { + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()); + } catch (final Exception e) { + final String errorMsg = String.format("Expecting to be inside component '%s' screen", resourceName); + getExtendTest().log(Status.ERROR, e.getMessage()); + throw new HomePageRuntimeException(errorMsg, e); + } + } + + public static void waitForElement(PageElement homePageElement) { + final String cssClass = homePageElement.getCssClass(); + LOGGER.debug("Waiting for{} visibility", cssClass); + GeneralUIUtils.getWebElementByClassName(cssClass); + LOGGER.debug("{} is visible", cssClass); + } + + public enum PageElement { + COMPONENT_PANEL("w-sdc-main-right-container", null), + REPOSITORY_ICON(null, "repository-icon"); + + private final String cssClass; + private final String testId; + + PageElement(String cssClass, String testId) { + this.cssClass = cssClass; + this.testId = testId; + } + + public String getCssClass() { + return cssClass; + } + + public String getTestId() { + return testId; + } } } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/MainRightContainer.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/MainRightContainer.java new file mode 100644 index 0000000000..1bbda648b5 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/MainRightContainer.java @@ -0,0 +1,54 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.pages; + +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; + +/** + * Represents the "w-sdc-main-right-container" panel that shows the list of resources/components. + */ +public class MainRightContainer { + + public static final String CSS_CLASS = "w-sdc-main-right-container"; + + private MainRightContainer() { + + } + + /** + * Checks if the resource is visible in the panel/container. + * + * @param resourceName the resource name to search in the panel/container + * @return {@code true} if the resource is visible, {@code false} otherwise. + */ + public static boolean isResultVisible(final String resourceName) { + return GeneralUIUtils.isElementVisibleByTestId(resourceName); + } + + /** + * Checks if the panel/container is showing no resources. + * + * @return {@code true} if the panel/container is empty, {@code false} otherwise. + */ + public static boolean isEmptyResult() { + return GeneralUIUtils.isElementInvisibleByTestId("dashboard-Elements"); + } + +} 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 72622f4e76..a90f4632c3 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 @@ -24,131 +24,127 @@ package org.openecomp.sdc.ci.tests.pages; import com.aventstack.extentreports.Status; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.PropertiesAssignmentScreen; +import org.openecomp.sdc.ci.tests.exception.PropertiesAssignmentPageException; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.Keys; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class PropertiesAssignmentPage { + private static final Logger LOGGER = LoggerFactory.getLogger(PropertiesAssignmentPage.class); + private PropertiesAssignmentPage() { } public static void clickOnInputTab() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Input Tab")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Input Tab"); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.INPUTS_TAB.getValue()); - //GeneralUIUtils.ultimateWait(); } public static void clickOnPropertiesTab() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Properties Tab")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Properties Tab"); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.PROPERTIES_TAB.getValue()); - //GeneralUIUtils.ultimateWait(); } public static void clickOnCompositionRightTab() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Composition Right Tab")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Composition Right Tab"); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.COMPOSITION_TAB.getValue()); - //GeneralUIUtils.ultimateWait(); } public static void clickOnPropertyStructureRightTab() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Property Structure Right Tab")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Property Structure Right Tab"); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.PROPERTY_STRUCTURE_TAB.getValue()); - //GeneralUIUtils.ultimateWait(); } public static void clickOnDeclareButton() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Declare Button")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Declare Button"); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.DECLARE_BUTTON.getValue()); - //GeneralUIUtils.ultimateWait(); } public static void clickOnSaveButton() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Save Button")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Save Button"); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.SAVE_BUTTON.getValue()); - //GeneralUIUtils.ultimateWait(); } public static void clickOnDiscardButton() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Discard Button")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Discard Button"); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.DISCARD_BUTTON.getValue()); - //GeneralUIUtils.ultimateWait(); } public static void clickOnDialogSaveButton() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Save Button in Dialog Popup")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Save Button in Dialog Popup"); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.SAVE_DIALOG_SAVE.getValue()); - //GeneralUIUtils.ultimateWait(); } public static void clickOnDialogDiscardButton() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Discard Button in Dialog Popup")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Discard Button in Dialog Popup"); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.SAVE_DIALOG_DISCARD.getValue()); - //GeneralUIUtils.ultimateWait(); } public static void clickOnDialogCancelButton() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Cancel Button in Dialog Popup")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Cancel Button in Dialog Popup"); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.SAVE_DIALOG_CANCEL.getValue()); -// GeneralUIUtils.ultimateWait(); } public static void clickOnEditButton(String propertyName) { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Edit button ")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Edit button "); GeneralUIUtils.clickOnElementByTestId(PropertyNameBuilder.buildPopupField(propertyName)); - //GeneralUIUtils.ultimateWait(); } public static void clickOnSetButton() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Set button in a property popup ")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Set button in a property popup "); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.FILTER_SET_BUTTON.getValue()); -// GeneralUIUtils.ultimateWait(); } public static void clickOnExpandButton(String propertyName, int index) { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Expand Complex Property Button")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Expand Complex Property Button"); GeneralUIUtils.clickOnElementByTestId(PropertyNameBuilder.buildIExpandButton(propertyName, index)); -// GeneralUIUtils.ultimateWait(); } - public static void findSearchBoxAndClick(String resourceName) throws Exception { + public static void findSearchBoxAndClick(final String resourceName) throws PropertiesAssignmentPageException { SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + resourceName + " in Properties"); - WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesAssignmentScreen.SEARCH_BOX.getValue()); try { + final WebElement searchTextbox = GeneralUIUtils + .getWebElementByTestID(DataTestIdEnum.PropertiesAssignmentScreen.SEARCH_BOX.getValue()); searchTextbox.clear(); searchTextbox.sendKeys(resourceName); GeneralUIUtils.ultimateWait(); - } catch (Exception e) { - SetupCDTest.getExtendTest().log(Status.INFO, "Can't interact with search bar"); - e.printStackTrace(); + } catch (final Exception e) { + final String errorMsg = String.format("Could not interact with search bar, test id '%s'", + PropertiesAssignmentScreen.SEARCH_BOX.getValue()); + LOGGER.error(errorMsg, e); + SetupCDTest.getExtendTest().log(Status.ERROR, errorMsg); + throw new PropertiesAssignmentPageException(errorMsg, e); } try { SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on the %s component in Properties", resourceName)); - GeneralUIUtils.clickOnElementByInputTestIdWithoutWait(resourceName); + GeneralUIUtils.clickOnElementChildByTestIdWithoutWait(resourceName); GeneralUIUtils.ultimateWait(); GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()); - } catch (Exception e) { - SetupCDTest.getExtendTest().log(Status.INFO, "Can't click on component named " + resourceName); - e.printStackTrace(); + } catch (final Exception e) { + final String errorMsg = String.format("Could not click on component named '%s'", resourceName); + LOGGER.error(errorMsg, e); + SetupCDTest.getExtendTest().log(Status.ERROR, errorMsg); + throw new PropertiesAssignmentPageException(errorMsg, e); } } - public static void clickOnProperty(String propertyName) throws Exception { - + private static void clickOnProperty(String propertyName) { SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on the %s component in Properties", propertyName)); GeneralUIUtils.clickOnElementByTestId(propertyName); - //GeneralUIUtils.ultimateWait(); GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()); } public static void clickOnAddValueToList(String propertyName) throws Exception { try { SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on the Add To List button of %s component in Properties", propertyName)); - GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.ADD_TO_LIST_BUTTON.getValue() + propertyName); //GeneralUIUtils.ultimateWait(); + GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.ADD_TO_LIST_BUTTON.getValue() + propertyName); GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()); } catch (Exception e) { SetupCDTest.getExtendTest().log(Status.INFO, "Can't click on Add To List button of component named " + propertyName); @@ -159,8 +155,7 @@ public class PropertiesAssignmentPage { public static void clickODeleteValueFromList(String propertyName, int index) throws Exception { try { SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on the Delete From List button of %s component in Properties", propertyName)); - GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.DELETE_FROM_LIST_BUTTON.getValue() + propertyName + "." + String.valueOf(index)); - //GeneralUIUtils.ultimateWait(); + GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.DELETE_FROM_LIST_BUTTON.getValue() + propertyName + "." + index); GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()); } catch (Exception e) { SetupCDTest.getExtendTest().log(Status.INFO, "Can't click on Delete From List button of component named " + propertyName); @@ -169,25 +164,23 @@ public class PropertiesAssignmentPage { } public static void clickOnDeleteInputButton() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Delete Input Button")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Delete Input Button"); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.INPUT_DELETE_BUTTON.getValue()); - //GeneralUIUtils.ultimateWait(); } public static void clickOnDeleteInputDialogConfirmationButton() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Delete Input Dialog Confirmation Button")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Delete Input Dialog Confirmation Button"); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.INPUT_DELETE_DIALOG_DELETE.getValue()); - //GeneralUIUtils.ultimateWait(); } - public static void clickOnComponentInComposition(String resourceName) throws Exception { + public static void clickOnComponentInComposition(final String resourceName) throws Exception { + SetupCDTest.getExtendTest() + .log(Status.INFO, String.format("Clicking on the %s component on Properties screen", resourceName)); try { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on the %s component on Properties screen", resourceName)); - GeneralUIUtils.clickOnElementByTestId(resourceName); //GeneralUIUtils.ultimateWait(); - //GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()); - } catch (Exception e) { + GeneralUIUtils.clickOnElementByTestId(resourceName); + } catch (final Exception e) { SetupCDTest.getExtendTest().log(Status.INFO, "Can't click on component named " + resourceName); - e.printStackTrace(); + throw e; } } @@ -267,51 +260,43 @@ public class PropertiesAssignmentPage { //Filter Actions public static void clickOnFilterButton() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Filter button ")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Filter button "); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.FILTER_BUTTON.getValue()); - //GeneralUIUtils.ultimateWait(); } public static void clickOnFilterAllCheckbox() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Filter All Checkbox ")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Filter All Checkbox "); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.FILTER_CHECKBOX_ALL.getValue()); - //GeneralUIUtils.ultimateWait(); } public static void clickOnFilterCPCheckbox() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Filter CP Checkbox ")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Filter CP Checkbox "); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.FILTER_CHECKBOX_CP.getValue()); - //GeneralUIUtils.ultimateWait(); } public static void clickOnFilterVfcCheckbox() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Filter VFC Checkbox ")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Filter VFC Checkbox "); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.FILTER_CHECKBOX_VFC.getValue()); - //GeneralUIUtils.ultimateWait(); } public static void clickOnFilterVlCheckbox() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Filter VL Checkbox ")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Filter VL Checkbox "); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.FILTER_CHECKBOX_VL.getValue()); - //GeneralUIUtils.ultimateWait(); } public static void clickOnFilterApplyButton() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Filter Apply Button")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Filter Apply Button"); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.FILTER_APPLY_BUTTON.getValue()); - //GeneralUIUtils.ultimateWait(); } public static void clickOnFilterCloseButton() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Filter Close Button")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Filter Close Button"); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.FILTER_CLOSE_BUTTON.getValue()); - //GeneralUIUtils.ultimateWait(); } public static void clickOnFilterClearAllButton() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Filter Clear All Button")); + SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Filter Clear All Button"); GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.CLEAR_FILTER_BUTTON.getValue()); - //GeneralUIUtils.ultimateWait(); } public static void findFilterBoxAndClick(String resourceName) throws Exception { diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java index 6d92a03e42..02c077a599 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java @@ -25,11 +25,11 @@ import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; public class ResourceLeftMenu implements ComponentLeftMenu { - public void moveToGeneralScreen() throws Exception { + public void moveToGeneralScreen() { GeneralUIUtils.moveToStep(StepsEnum.GENERAL); } - public void moveToIconScreen() throws Exception { + public void moveToIconScreen() { GeneralUIUtils.moveToStep(StepsEnum.ICON); } @@ -41,19 +41,19 @@ public class ResourceLeftMenu implements ComponentLeftMenu { GeneralUIUtils.moveToStep(StepsEnum.INFORMATION_ARTIFACT); } - public void moveToPropertiesScreen() throws Exception { + public void moveToPropertiesScreen() { GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES); } - public void moveToCompositionScreen() throws Exception { + public void moveToCompositionScreen() { GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION); } - public void moveToActivityLogScreen() throws Exception { + public void moveToActivityLogScreen() { GeneralUIUtils.moveToStep(StepsEnum.ACTIVITY_LOG); } - public void moveToDeploymentViewScreen() throws Exception { + public void moveToDeploymentViewScreen() { GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_VIEW); } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TesterOperationPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TesterOperationPage.java index 32526812fd..08a797e675 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TesterOperationPage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TesterOperationPage.java @@ -28,7 +28,7 @@ import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; public class TesterOperationPage { private TesterOperationPage() { - super(); + } public static void certifyComponent(String componentName) throws Exception { @@ -37,7 +37,7 @@ public class TesterOperationPage { } public static void clickAcceptCertificationButton(String componentName) throws Exception { - ExtentTestActions.log(Status.INFO, "Accepting certifiction of " + componentName); + ExtentTestActions.log(Status.INFO, "Accepting certification of " + componentName); String actionDuration = GeneralUIUtils.getActionDuration(() -> { try { @@ -46,7 +46,7 @@ public class TesterOperationPage { e.printStackTrace(); } }); - ExtentTestActions.log(Status.INFO, componentName + " is certifed", actionDuration); + ExtentTestActions.log(Status.INFO, componentName + " is certified", actionDuration); } @@ -66,10 +66,8 @@ public class TesterOperationPage { private static void clickAcceptCertificationButtonWithoutDuration(String componentName) throws Exception { try { GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.LifeCyleChangeButtons.ACCEPT.getValue()); - //GeneralUIUtils.ultimateWait(); GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.ACCEPT_TESTING_MESSAGE.getValue()).sendKeys(componentName + " tested successfuly"); GeneralPageElements.clickOKButton(); - //GeneralUIUtils.sleep(2000); GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue()); } catch (Exception e) { throw new Exception("Accepting certification of " + componentName + " failed"); @@ -79,10 +77,7 @@ public class TesterOperationPage { private static void clickStartTestingButtonWithoutDuration() throws Exception { try { GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.LifeCyleChangeButtons.START_TESTING.getValue()); - //GeneralUIUtils.ultimateWait(); GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.LifeCyleChangeButtons.ACCEPT.getValue()); - //GeneralUIUtils.ultimateWait(); - //GeneralUIUtils.sleep(1000); } catch (Exception e) { throw new Exception("Start testing failed"); } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TopSearchComponent.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TopSearchComponent.java new file mode 100644 index 0000000000..a919bb0246 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TopSearchComponent.java @@ -0,0 +1,69 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.pages; + +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebElement; + +/** + * Represents the "top-search" search component in the main upper toolbar. + */ +public class TopSearchComponent { + + public static final String CSS_CLASS = "top-search"; + public static final String SEARCH_INPUT_TEST_ID = "main-menu-input-search"; + + private TopSearchComponent() { + + } + + /** + * Gets the search component input, waiting for it's visibility. + * + * @return search component input with test id {@link #SEARCH_INPUT_TEST_ID} + */ + public static WebElement getComponentInput() { + return GeneralUIUtils.getWebElementByTestID(SEARCH_INPUT_TEST_ID); + } + + /** + * Replaces the current search input value by the given value. This prevents to trigger the search twice by cleaning + * the input (triggers the search) and then pasting the value (triggers the search again). + * + * @param value the value to search + */ + public static void replaceSearchValue(final String value) { + replaceSearchValue(getComponentInput(), value); + } + + /** + * Replaces the current search input value by selecting it with Ctrl+A shortcut and pasting the given value. This + * prevents to trigger the search twice by cleaning the input (triggers the search) and then pasting the value + * (triggers the search again). + * + * @param searchTextInput input web element + * @param value the value to search + */ + public static void replaceSearchValue(final WebElement searchTextInput, final String value) { + searchTextInput.sendKeys(Keys.chord(Keys.CONTROL, "a"), value); + } + +} 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 1d8d514676..a88f7267d8 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 @@ -24,6 +24,7 @@ import com.aventstack.extentreports.Status; 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; +import org.openecomp.sdc.ci.tests.pages.GeneralPageElements; import org.openecomp.sdc.ci.tests.pages.HomePage; import org.openqa.selenium.WebElement; @@ -50,8 +51,8 @@ public class DownloadManager { boolean vspFound = HomePage.searchForVSP(vspName); if (vspFound) { ExtentTestActions.log(Status.INFO, String.format("Going to downloading VSP %s", vspName)); - List<WebElement> elemenetsFromTable = HomePage.getElemenetsFromTable(); - elemenetsFromTable.get(1).click(); + final List<WebElement> elementsFromTable = GeneralPageElements.getElementsFromTable(); + elementsFromTable.get(1).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 153b14e175..a41632473f 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 @@ -23,8 +23,9 @@ package org.openecomp.sdc.ci.tests.utilities; import com.aventstack.extentreports.Status; 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.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.HomePage; import org.openecomp.sdc.ci.tests.utils.Utils; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; @@ -50,12 +51,17 @@ 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; 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 COLOR_YELLOW_BORDER_4PX_SOLID_YELLOW = "color: yellow; border: 4px solid yellow;"; @@ -66,24 +72,19 @@ public final class GeneralUIUtils { private static final int NAP_PERIOD = 100; private static final int DURATION_FORMATIN = 60; + private GeneralUIUtils () { + + } + public static int getTimeOut() { return TIME_OUT; } - /**************** DRIVER ****************/ - public static WebDriver getDriver() { - try { - return DriverFactory.getDriver(); - } catch (Exception e) { - e.printStackTrace(); - } - return null; + return DriverFactory.getDriver(); } - /****************************************/ - - public static List<WebElement> getElemenetsFromTable(By by) { + public static List<WebElement> getElementsByLocator(By by) { return getDriver().findElements(by); } @@ -115,9 +116,10 @@ public final class GeneralUIUtils { return getWebElementByTestID(dataTestId, TIME_OUT); } - public static WebElement getWebElementByTestID(String dataTestId, int timeout) { - WebDriverWait wait = new WebDriverWait(getDriver(), timeout); - return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(String.format(DATA_TESTS_ID, dataTestId)))); + 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)))); } public static boolean isWebElementExistByTestId(String dataTestId) { @@ -224,16 +226,25 @@ public final class GeneralUIUtils { } 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)); } - public static void clickOnElementByTestIdWithoutWait(String dataTestId) { - WebDriverWait wait = new WebDriverWait(getDriver(), TIME_OUT); - wait.until(ExpectedConditions.elementToBeClickable(By.xpath(String.format(DATA_TESTS_ID, dataTestId)))).click(); + public static void clickOnElementChildByTestId(String dataTestId) { + clickOnElementChildByTestIdWithoutWait(dataTestId); + ultimateWait(); + } + + 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 clickOnElementByInputTestIdWithoutWait(String dataTestId) { + public static void clickOnElementChildByTestIdWithoutWait(String dataTestId) { WebDriverWait wait = new WebDriverWait(getDriver(), TIME_OUT); wait.until(ExpectedConditions.elementToBeClickable(By.xpath(String.format(DATA_TESTS_ID, dataTestId) + "//*"))).click(); } @@ -308,31 +319,15 @@ public final class GeneralUIUtils { } public static void waitForLoader(int timeOut) { + final String loaderClass = "tlv-loader"; final int sleepDuration = 500; sleep(sleepDuration); - waitForElementInVisibilityBy(By.className("tlv-loader"), timeOut); + LOGGER.debug("Waiting {}s for '.{}'", timeOut, loaderClass); + waitForElementInVisibilityBy(By.className(loaderClass), timeOut); } - public static void findComponentAndClick(String resourceName) throws Exception { - SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + resourceName + " in homepage"); - WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue()); - try { - searchTextbox.clear(); - searchTextbox.sendKeys(resourceName); - ultimateWait(); - } catch (Exception e) { - SetupCDTest.getExtendTest().log(Status.INFO, "Can't interact with search bar"); - e.printStackTrace(); - } - - try { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on the %s component from home screen", resourceName)); - clickOnElementByTestId(resourceName); - getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()); - } catch (Exception e) { - SetupCDTest.getExtendTest().log(Status.INFO, "Can't click on component named " + resourceName); - e.printStackTrace(); - } + public static void findComponentAndClick(final String resourceName) { + HomePage.findComponentAndClick(resourceName); } public static void windowZoomOut() { @@ -356,18 +351,19 @@ public final class GeneralUIUtils { public static void sleep(int duration) { try { Thread.sleep(duration); - } catch (InterruptedException e) { - throw new RuntimeException(e); + } catch (final InterruptedException e) { + Thread.currentThread().interrupt(); + throw new GeneralUiRuntimeException("The thread was interrupted during a sleep", e); } } - public static void moveToStep(DataTestIdEnum.StepsEnum stepName) { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Going to %s page ", stepName.toString())); + public static void moveToStep(final DataTestIdEnum.StepsEnum stepName) { + getExtendTest().log(Status.INFO, String.format("Going to %s page ", stepName.toString())); moveToStep(stepName.getValue()); } - public static void moveToStep(String dataTestId) { - clickOnElementByTestId(dataTestId); + public static void moveToStep(final String dataTestId) { + clickOnElementChildByTestId(dataTestId); } @@ -436,7 +432,6 @@ public final class GeneralUIUtils { ultimateWait(); WebElement area = getWebElementByTestID(areaId); JavascriptExecutor javascript = (JavascriptExecutor) getDriver(); - //highlightMyElement(area); Object executeScript = javascript.executeScript("arguments[0].click();", area, COLOR_YELLOW_BORDER_4PX_SOLID_YELLOW); waitForLoader(timeout); ultimateWait(); @@ -450,7 +445,6 @@ public final class GeneralUIUtils { public static WebElement clickOnAreaJS(WebElement areaId) throws InterruptedException { JavascriptExecutor javascript = (JavascriptExecutor) getDriver(); - //highlightMyElement(area); javascript.executeScript("arguments[0].click();", areaId, COLOR_YELLOW_BORDER_4PX_SOLID_YELLOW); return areaId; } @@ -479,10 +473,12 @@ public final class GeneralUIUtils { } public static void waitForAngular() { + LOGGER.debug("Waiting for angular"); final int webDriverWaitingTime = 90; WebDriverWait wait = new WebDriverWait(getDriver(), webDriverWaitingTime, NAP_PERIOD); wait.until(AdditionalConditions.pageLoadWait()); wait.until(AdditionalConditions.angularHasFinishedProcessing()); + LOGGER.debug("Waiting for angular finished"); } public static Object getAllElementAttributes(WebElement element) { @@ -523,7 +519,7 @@ public final class GeneralUIUtils { long estimateTime = System.nanoTime(); long duration = TimeUnit.NANOSECONDS.toSeconds(estimateTime - startTime); if (duration > TIME_OUT) { - SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Delays on page, %d seconds", duration)); + getExtendTest().log(Status.WARNING, String.format("Delays on page, %d seconds", duration)); } } @@ -604,7 +600,9 @@ public final class GeneralUIUtils { public static void waitForBackLoader(int timeOut) { sleep(NAP_PERIOD); - waitForElementInVisibilityBy(By.className("tlv-loader-back"), timeOut); + final String backLoaderClass = "tlv-loader-back"; + LOGGER.debug("Waiting {}s for '.{}'", timeOut, backLoaderClass); + waitForElementInVisibilityBy(By.className(backLoaderClass), timeOut); } public static void addStringtoClipboard(String text) { @@ -669,23 +667,23 @@ public final class GeneralUIUtils { } public static void clickOnBrowserBackButton() throws Exception { - SetupCDTest.getExtendTest().log(Status.INFO, "Going to press on back browser button."); + getExtendTest().log(Status.INFO, "Going to press on back browser button."); getDriver().navigate().back(); ultimateWait(); } public static String copyCurrentURL() throws Exception { - SetupCDTest.getExtendTest().log(Status.INFO, "Copying current URL"); + getExtendTest().log(Status.INFO, "Copying current URL"); return getDriver().getCurrentUrl(); } public static void navigateToURL(String url) throws Exception { - SetupCDTest.getExtendTest().log(Status.INFO, "Navigating to URL " + url); + getExtendTest().log(Status.INFO, "Navigating to URL " + url); getDriver().navigate().to(url); } public static void refreshWebpage() throws Exception { - SetupCDTest.getExtendTest().log(Status.INFO, "Refreshing Webpage"); + getExtendTest().log(Status.INFO, "Refreshing Webpage"); getDriver().navigate().refresh(); ultimateWait(); } 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 bbcfffd22b..d4d2731c1e 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,7 +22,7 @@ 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.AmdocsLicenseMembers; +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; @@ -58,7 +58,7 @@ public class OnboardingUiUtils { boolean vspFound = HomePage.searchForVSP(vspName); if (vspFound) { - List<WebElement> elementsFromTable = HomePage.getElemenetsFromTable(); + List<WebElement> elementsFromTable = GeneralPageElements.getElementsFromTable(); elementsFromTable.get(1).click(); GeneralUIUtils.waitForLoader(); @@ -135,7 +135,7 @@ public class OnboardingUiUtils { importUpdateVSP(vsp, false, false); } - public static void updateVnfAndValidate(String filePath, VendorSoftwareProductObject vsp, String updatedVnfFile, User user) throws Throwable { + public static void updateVnfAndValidate(String filePath, VendorSoftwareProductObject vsp, String updatedVnfFile, User user) throws Exception { ExtentTestActions.log(Status.INFO, String.format("Going to update the VNF with %s......", updatedVnfFile)); System.out.println(String.format("Going to update the VNF with %s......", updatedVnfFile)); @@ -147,11 +147,9 @@ public class OnboardingUiUtils { } public static VendorSoftwareProductObject createVSP(ResourceReqDetails resourceReqDetails, String vnfFile, String filepath, User user) throws Exception { - ExtentTestActions.log(Status.INFO, String.format("Going to onboard the VNF %s", vnfFile)); - System.out.println(String.format("Going to onboard the VNF %s", vnfFile)); - - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(user); - return VendorSoftwareProductRestUtils.createVSP(resourceReqDetails, vnfFile, filepath, user, amdocsLicenseMembers); + ExtentTestActions.log(Status.INFO, String.format("Creating VSP from package '%s'", vnfFile)); + final VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(user); + return VendorSoftwareProductRestUtils.createVSP(resourceReqDetails, vnfFile, filepath, user, vendorLicenseModel); } @@ -159,8 +157,9 @@ public class OnboardingUiUtils { ExtentTestActions.log(Status.INFO, String.format("Going to onboard the VNF %s", vnfFile)); System.out.println(String.format("Going to onboard the VNF %s", vnfFile)); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(user); - VendorSoftwareProductObject createVendorSoftwareProduct = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, user, amdocsLicenseMembers); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(user); + VendorSoftwareProductObject createVendorSoftwareProduct = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, user, + vendorLicenseModel); String vspName = createVendorSoftwareProduct.getName(); DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.getVspId()); 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 a3f8a5c2c1..e26e5f3219 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,7 @@ 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.AmdocsLicenseMembers; +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; @@ -71,11 +71,13 @@ public class PortMirroringUtils { public static ServiceContainer createServiceFromHeatFile(String filePath, String vnfFile) throws Throwable { //1. Import VSP v1.0 User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName())); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", vendorLicenseModel + .getVendorLicenseName())); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile)); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails1, amdocsLicenseMembers); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails1, + vendorLicenseModel); // VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile, createVendorSoftwareProduct); //2. Create VF, certify - v1.0 is created resourceReqDetails = org.openecomp.sdc.ci.tests.utils.general.OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); @@ -93,7 +95,7 @@ public class PortMirroringUtils { service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); SetupCDTest.getExtendTest().log(Status.INFO, String.format("Certify the Service")); - return new ServiceContainer(service, resource, vendorSoftwareProductObject, amdocsLicenseMembers); + return new ServiceContainer(service, resource, vendorSoftwareProductObject, vendorLicenseModel); } public static Resource generatePNFAndUpdateInput(String resourceName, String vendorModelNumber, User user) throws Exception { 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 367dd3b68d..2e5ba74f91 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,7 +21,8 @@ package org.openecomp.sdc.ci.tests.utilities; import com.aventstack.extentreports.Status; -import org.junit.rules.TestName; +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; @@ -29,20 +30,15 @@ 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.WebDriver; import org.openqa.selenium.WebElement; -import java.util.ArrayList; -import java.util.List; - public class ServiceUIUtils { - protected static WebDriver driver; + private ServiceUIUtils() { - public ServiceUIUtils(TestName name, String className) { - super(); } private static void defineTagsList2(List<String> serviceTags) { @@ -55,20 +51,20 @@ public class ServiceUIUtils { } } - public static void fillServiceGeneralPage(ServiceReqDetails service, User user) throws Exception { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Fill in metadata values in general page")); + public static void fillServiceGeneralPage(final ServiceReqDetails service) { + SetupCDTest.getExtendTest().log(Status.INFO, "Fill in metadata values in general page"); ServiceGeneralPage.defineName(service.getName()); - ServiceGeneralPage.defineDescription(service.getDescription()); - ServiceGeneralPage.defineCategory(service.getCategories().get(0).getName()); + ResourceGeneralPage.defineDescription(service.getDescription()); + ResourceGeneralPage.defineCategory(service.getCategories().get(0).getName()); ServiceGeneralPage.defineProjectCode(service.getProjectCode()); defineTagsList2(service.getTags()); - ServiceGeneralPage.defineContactId(service.getContactId()); + ResourceGeneralPage.defineContactId(service.getContactId()); GeneralUIUtils.clickSomewhereOnPage(); } - public static void createService(ServiceReqDetails service, User user) throws Exception { + public static void createService(ServiceReqDetails service) { clickAddService(); - fillServiceGeneralPage(service, user); + fillServiceGeneralPage(service); GeneralPageElements.clickCreateButton(); SetupCDTest.getExtendTest().log(Status.INFO, String.format("The service %s was created", service.getName())); } diff --git a/ui-ci/src/main/resources/ci/testSuites/devOnboardE2EOneFileSanity.xml b/ui-ci/src/main/resources/ci/testSuites/devOnboardE2EOneFileSanity.xml index 8802e9f8ef..acf4be4be3 100644 --- a/ui-ci/src/main/resources/ci/testSuites/devOnboardE2EOneFileSanity.xml +++ b/ui-ci/src/main/resources/ci/testSuites/devOnboardE2EOneFileSanity.xml @@ -4,7 +4,7 @@ <test name="uitests"> <classes> <!--onboard--> - <class name="org.openecomp.sdc.ci.tests.execute.sanity.OnboardingFlowsUI"> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.OnboardingFlowsUi"> <methods> <include name="onboardVNFTestSanityOneFile"/> </methods> diff --git a/ui-ci/src/main/resources/ci/testSuites/extendedSanity.xml b/ui-ci/src/main/resources/ci/testSuites/extendedSanity.xml index 1e295a2793..00b98c9f23 100644 --- a/ui-ci/src/main/resources/ci/testSuites/extendedSanity.xml +++ b/ui-ci/src/main/resources/ci/testSuites/extendedSanity.xml @@ -7,7 +7,7 @@ <classes> <class name="org.openecomp.sdc.ci.tests.execute.sanity.ToscaValidationTest"/> - <class name="org.openecomp.sdc.ci.tests.execute.sanity.OnboardingFlowsUI"> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.OnboardingFlowsUi"> <methods> <exclude name="onboardVNFTestSanity"/> <exclude name="onboardVNFShotFlow"/> diff --git a/ui-ci/src/main/resources/ci/testSuites/onapUiSanity.xml b/ui-ci/src/main/resources/ci/testSuites/onapUiSanity.xml index 3945088218..245524d0e8 100644 --- a/ui-ci/src/main/resources/ci/testSuites/onapUiSanity.xml +++ b/ui-ci/src/main/resources/ci/testSuites/onapUiSanity.xml @@ -1,34 +1,33 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> -<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="1" data-provider-thread-count="1"> +<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="1" + data-provider-thread-count="1"> - <parameter name="makeDistribution" value="false"/> + <parameter name="makeDistribution" value="false"/> <test name="uiSanity"> <classes> - <class name="org.openecomp.sdc.ci.tests.execute.sanity.Vf"> - <methods> - <include name="changeInstanceNameInVfTest"/> - </methods> - </class> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.Vf"> + <methods> + <include name="changeInstanceNameInVfTest"/> + </methods> + </class> - <class name="org.openecomp.sdc.ci.tests.execute.sanity.Service"> - <methods> - <include name="updateService"/> - </methods> - </class> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.Service"> + <methods> + <include name="updateService"/> + </methods> + </class> - <class name="org.openecomp.sdc.ci.tests.execute.sanity.OnboardingFlowsUI"> - <methods> - <include name="onapOnboardVNFflow"/> - <include name="onapOnboardVSPValidationsSanityFlow"/> - </methods> - </class> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.OnboardingFlowsUi"> + <methods> + <include name="onapOnboardVNFflow"/> + <include name="onapOnboardVSPValidationsSanityFlow"/> + </methods> + </class> - - </classes> - </test> <!-- uitests --> -</suite> <!-- uisuite -->
\ No newline at end of file + </test> +</suite> diff --git a/ui-ci/src/main/resources/ci/testSuites/vspValidationAllFlows.xml b/ui-ci/src/main/resources/ci/testSuites/vspValidationAllFlows.xml index f159548fc2..71677a95a5 100644 --- a/ui-ci/src/main/resources/ci/testSuites/vspValidationAllFlows.xml +++ b/ui-ci/src/main/resources/ci/testSuites/vspValidationAllFlows.xml @@ -1,23 +1,23 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
-<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="1" data-provider-thread-count="1">
-
- <parameter name="makeDistribution" value="false"/>
-
- <test name="vspValidationAllFlows">
- <classes>
-
- <class name="org.openecomp.sdc.ci.tests.execute.sanity.OnboardingFlowsUI">
- <methods>
- <include name="onapOnboardVSPValidationsSanityFlow"/>
- <include name="onapOnboardVSPValidationsConfigurationChangeCheck"/>
- <include name="onapOnboardVSPCertificationQueryFlow"/>
- <include name="onapOnboardVSPComplianceCheckFlow"/>
- <include name="onapOnboardVSPComplianceCheckOperations"/>
- <include name="onapOnboardVSPCertificationQueryOperations"/>
- </methods>
- </class>
-
- </classes>
- </test> <!-- uitests -->
+<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> +<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="1" data-provider-thread-count="1"> + + <parameter name="makeDistribution" value="false"/> + + <test name="vspValidationAllFlows"> + <classes> + + <class name="org.openecomp.sdc.ci.tests.execute.sanity.OnboardingFlowsUi"> + <methods> + <include name="onapOnboardVSPValidationsSanityFlow"/> + <include name="onapOnboardVSPValidationsConfigurationChangeCheck"/> + <include name="onapOnboardVSPCertificationQueryFlow"/> + <include name="onapOnboardVSPComplianceCheckFlow"/> + <include name="onapOnboardVSPComplianceCheckOperations"/> + <include name="onapOnboardVSPCertificationQueryOperations"/> + </methods> + </class> + + </classes> + </test> <!-- uitests --> </suite> <!-- uisuite -->
\ No newline at end of file |