diff options
Diffstat (limited to 'vid-automation/src/main/java/vid')
67 files changed, 2795 insertions, 1335 deletions
diff --git a/vid-automation/src/main/java/vid/automation/test/Constants.java b/vid-automation/src/main/java/vid/automation/test/Constants.java index e10a9675b..3df26f6ab 100644 --- a/vid-automation/src/main/java/vid/automation/test/Constants.java +++ b/vid-automation/src/main/java/vid/automation/test/Constants.java @@ -27,6 +27,7 @@ public class Constants { public static final String DROPDOWN_PERMITTED_ASSERT_FAIL_MESSAGE = "Dropdown permitted options are not according to user permissions."; public static final String CONFIRM_BUTTON_TESTS_ID = "confirmButton"; public static final String CONFIRM_RESUME_DELETE_TESTS_ID = "confirmResumeDeleteButton"; + public static final String SOFT_DELETE_TESTS_ID = "softDeleteButton"; public static final String CLOSE_BUTTON_TEXT = "Close"; public static final String CANCEL_BUTTON_TEST_ID = "cancelButton"; public static final String COMMIT_CLOSE_BUTTON_ID = "msoCommitDialogCloseButton"; @@ -59,8 +60,10 @@ public class Constants { public static final String DELETE_CONFIGURATION_BUTTON = "deleteConfigurationButton"; public static final String ACTIVATE_DEACTIVATE_BUTTON = "activateDeactivateButton"; public static final String ENABLE_DISABLE_BUTTON = "enableDisableButton"; + public static final String SUBSCRIBER_SELECT_ID= "subscriber-name-select"; public static final String PNF_SERVICE_TYPE = "pnf"; + public static final String GR_API = "GR_API"; public class bugFixes{ public static final String HEADER_CONTAINER = "headerContainer"; @@ -96,11 +99,11 @@ public class Constants { public static final String newModalWorkFlowInputId = "workflow"; public static final String newModalConfigUpdateInputId = "config-update-input"; public static final String newModalTargetVersionInputsClass = "vnf-versions-select-as-text"; - public static final String newModalSubscriberText = "FIREWALL/MISC"; - public static final String newModalServiceTypeText = "vFlowLogic"; + public static final String newModalSubscriberText = "CRAIG/ROBERTS"; + public static final String newModalServiceTypeText = "vRichardson"; public static final String newModalVnfTypeText = "vMobileDNS"; public static final String newModalSourceVersionText = "1.0"; - public static final String newModalVnfNameText = "zrdm3amdns02test2"; + public static final String newModalVnfNameText = "zolson3amdns02test2"; public static final String newModalWorkflowText = "VNF Config Update"; @@ -168,11 +171,11 @@ public class Constants { public static final String AVAILABLE_MODELS_TREE = "available-models-tree"; public static final String DRAWING_BOARD_TREE = "drawing-board-tree"; public static final String NODE_PREFIX = "node-"; - public static final String SEARCH_LEFT_TREE = "search-left-tree"; + public static final String SEARCH_LEFT_TREE = "search-left-tree-input"; public static final String ADD_BUTTON = "-add-btn"; public static final String CONTEXT_MENU_BUTTON = "-menu-btn"; public static final String ALERT_ICON = "-alert-icon"; - public static final String CONTEXT_MENU_ITEM = "context-menu-item"; + public static final String CONTEXT_MENU_EDIT = "context-menu-edit"; public static final String TOGGLE_CHILDREN = "toggle-children"; public static final String TREE_NODE_LEAF = "tree-node-leaf"; public static final String HIGHLIGHTED_COLOR = "rgb(0, 159, 219)"; @@ -182,6 +185,8 @@ public class Constants { public static final String CONTEXT_MENU_HEADER_DELETE_ITEM = "context-menu-header-delete-item"; public static final String SERVICE_QUANTITY = "servicesQuantity"; public static final String BACK_BUTTON = "backBtn"; + public static final String STOP_INSTANTIATION_BUTTON = "button-stop-instantiation"; + public static final String CANCEL_BUTTON = "button-cancel"; public static final String DEPLOY_BUTTON = "deployBtn"; public static final String DEFAULT_SERVICE_NAME = "<Automatically Assigned>"; public static final String SERVICE_NAME = "serviceName"; @@ -190,16 +195,20 @@ public class Constants { public static final String SERVICE_INSTANCE_TEST_ID = "serviceInstance"; public static final String QUANTITY_LABEL_TEST_ID = "quantityLabel"; public static final String QUANTITY_LABEL_VALUE = "Scale Times:"; + public static final String CONTEXT_MENU_SHOW_AUDIT = "context-menu-showAuditInfo"; } public class InstantiationStatus { + public static final String CONTEXT_MENU_REMOVE = "context-menu-remove"; public static final String CONTEXT_MENU_DELETE = "context-menu-delete"; public static final String CONTEXT_MENU_HIDE = "context-menu-hide"; public static final String CONTEXT_MENU_HEADER_OPEN_ITEM = "context-menu-open"; + public static final String CONTEXT_MENU_RETRY = "context-menu-retry"; public static final String CONTEXT_MENU_HEADER_AUDIT_INFO_ITEM = "context-menu-audit-info"; + public static final String CONTEXT_MENU_DUPLICATE = "context-menu-duplicate"; public static final String TD_JOB_STATUS_ICON = "jobStatusIcon"; } @@ -270,7 +279,7 @@ public class Constants { public static final String CREATE_SERVICE_INSTANCE = "Create Service Instance"; public static final String AIC_OPTION_CLASS = "aicZoneOption"; public static class NewServicePopup { - public static final String SET_BUTTON = "service-form-set"; + public static final String SET_BUTTON = "form-set"; public static final String CANCEL_BUTTON = "cancelButton"; public static final String INSTANCE_NAME = "instanceName"; public static final String SERVICE_UUID = "1a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"; @@ -287,7 +296,7 @@ public class Constants { }}; } - public static final String CREATE_SERVICE_INSTANCE_MACRO_MODAL = "create a new service instance"; + public static final String CREATE_SERVICE_INSTANCE_MACRO_MODAL = "Set a new service instance"; } @@ -366,6 +375,7 @@ public class Constants { public static final String DELETE_VF_MODULE_BUTTON_TEST_ID = "deleteVFModuleButton-"; public static final String DELETE_VNF_VOLUME_GROUP_BUTTON_TEST_ID = "deleteVNFVolumeGroupButton"; public static final String ACTIVATE_BUTTON_TEST_ID = "activateButton"; + public static final String ACTIVATE_FABRIC_CONFIGURATION_BUTTON_TEST_ID = "activateFabricConfigurationButton"; public static final String SHOW_ASSIGNMENTS_BUTTON_TEST_ID = "showAssignmentsButton"; public static final String OPTION_IN_DROPDOWN_NOT_EXISTS = "the option %s in dropdown %s not exists"; public static final String DISSOCIATE_BTN_CLASS = "dissociate-pnf"; @@ -445,6 +455,7 @@ public class Constants { public static final String INFO_TEST_ID_PREFIX = "info-test-data-id-"; public static final String SERVIICE_NAME_KEY = "ServiceName"; public static final String ROLLBACK_ON_FAILURE_ID = "rollbackOnFailure"; + public static final String ROLLBACK_ON_FAILURE_TEST_ID = "rollback"; public static final String SUBSCRIBER_NAME_KEY = "SubscriberName"; public static final String SERVICE_INSTANCE_NAME = "ServiceInstanceName"; public static final String MODEL_NAME = "ModelName"; @@ -491,10 +502,10 @@ public class Constants { public class Users { public static final String READONLY = "readonly"; - public static final String USP_VOICE_VIRTUAL_USP = "uspVoiceVirtualUsp"; - public static final String MOBILITY_MOBILITY = "mobilityMobility"; - public static final String FIREWALL_MISC_AIM_TRANSPORT = "FIREWALL_AIM_Trans"; - public static final String MOBILITY_VMMSC = "mobilityVMMSC"; + public static final String SILVIA_ROBBINS_TYLER_SILVIA = "uspVoiceVirtualUsp"; + public static final String EMANUEL_EMANUEL = "emanuelEmanuel"; + public static final String CRAIG_ROBERTS_AIM_TRANSPORT = "FIREWALL_AIM_Trans"; + public static final String EMANUEL_vWINIFRED = "emanuelvWINIFRED"; public static final String SUPRE_USER = "su"; } @@ -502,18 +513,17 @@ public class Constants { //separated simulated json files according to pages public class SearchForServiceInstance { - public static final String GET_FULL_SUBSCRIBERS = "search_for_service_instance/aai_get_full_subscribers.json"; public static final String GET_SERVICES = "search_for_service_instance/aai_get_services.json"; public static final String FILTER_SERVICE_INSTANCE_BY_ID = "search_for_service_instance/aai_filter_service_instance_by_id.json"; public static final String FILTER_CR_SERVICE_INSTANCE_BY_ID = "search_for_service_instance/aai_filter_cr_service_instance_by_id.json"; public static final String FILTER_SERVICE_INSTANCE_BY_ID_2 = "search_for_service_instance/aai_filter_service_instance_by_id_2.json"; public static final String FILTER_SERVICE_INSTANCE_BY_ID_PM = "search_for_service_instance/aai_filter_service_instance_by_id_test_sssdad.json"; public static final String FILTER_SERVICE_INSTANCE_BY_ID_NO_MODEL_VER_ID = "search_for_service_instance/aai_filter_service_instance_by_id_test_without_model_ver_id.json"; - public static final String GET_SUBSCRIBERS_FOR_CUSTOMER_USP_VOICE = "search_for_service_instance/aai_get_subscribers_for_customer_USP-VOICE.json"; - public static final String GET_SUBSCRIBERS_FOR_CUSTOMER_USP_VOICE_CR = "search_for_service_instance/aai_get_subscribers_for_customer_USP-VOICE_cr.json"; + public static final String GET_SUBSCRIBERS_FOR_CUSTOMER_SILVIA_ROBBINS = "search_for_service_instance/aai_get_subscribers_for_customer_SILVIA-ROBBINS.json"; + public static final String GET_SUBSCRIBERS_FOR_CUSTOMER_SILVIA_ROBBINS_CR = "search_for_service_instance/aai_get_subscribers_for_customer_SILVIA-ROBBINS_cr.json"; public static final String GET_MSO_INSTANCE_ORCH_STATUS_REQ = "search_for_service_instance/mso_instance_orch_status_req.json"; - public static final String GET_SUBSCRIBERS_FOR_CUSTOMER_Mobility = "search_for_service_instance/aai_get_subscribers_for_customer_Mobility.json"; - public static final String GET_SUBSCRIBERS_FOR_CUSTOMER_FIREWALL_MISC = "search_for_service_instance/aai_get_subscribers_for_customer_FIREWALL-MISC.json"; + public static final String GET_SUBSCRIBERS_FOR_CUSTOMER_Emanuel = "search_for_service_instance/aai_get_subscribers_for_customer_Emanuel.json"; + public static final String GET_SUBSCRIBERS_FOR_CUSTOMER_CRAIG_ROBERTS = "search_for_service_instance/aai_get_subscribers_for_customer_CRAIG-ROBERTS.json"; public static final String NAMED_QUERY_VIEW_EDIT = "search_for_service_instance/aai_named_query_for_view_edit.json"; public static final String NAMED_QUERY_CR_VIEW_EDIT = "search_for_service_instance/aai_named_query_for_cr_view_edit.json"; public static final String NAMED_QUERY_VIEW_EDIT_2 = "search_for_service_instance/aai_named_query_for_view_edit_2.json"; @@ -525,7 +535,7 @@ public class Constants { public class AddSubinterface { public static final String FILTER_VFC_IG_SERVICE_INSTANCE_BY_ID = "add_subinterface/aai_filter_vfc_ig_service_instance_by_id.json"; - public static final String GET_SUBSCRIBERS_FOR_CUSTOMER_USP_VOICE_VFC_IG = "add_subinterface/aai_get_subscribers_for_customer_USP-VOICE_vfc_ig.json"; + public static final String GET_SUBSCRIBERS_FOR_CUSTOMER_SILVIA_ROBBINS_VFC_IG = "add_subinterface/aai_get_subscribers_for_customer_SILVIA-ROBBINS_vfc_ig.json"; public static final String GET_MSO_VFC_IG_INSTANCE_ORCH_STATUS_REQ = "add_subinterface/mso_vfc_ig_instance_orch_status_req.json"; public static final String NAMED_QUERY_VFC_IG_VIEW_EDIT = "add_subinterface/aai_named_query_for_vfc_ig_view_edit.json"; public static final String GET_SDC_CATALOG_SERVICE_VID_TEST_444 = "add_subinterface/get_sdc_catalog_services_vid-test-333.json"; @@ -555,16 +565,6 @@ public class Constants { public static final String GET_PNF_INSTANCES = "create_configuration/aai_get_pnf_instances_by_region.json"; public static final String GET_MODEL_BY_ONE_INVARIANT_ID = "create_configuration/aai_get_model_by_one_invariant_id.json"; public static final String GET_MODEL_BY_2_INVARIANT_IDS = "create_configuration/aai_get_model_by_2_invariant_ids.json"; - public static final String MSO_CREATE_CONFIGURATION = "create_configuration/mso_create_configuration_pProbe.json"; - public static final String MSO_CREATE_CONFIGURATION_ORCH_REQ = "create_configuration/mso_create_configuration_orch_req.json"; - public static final String MSO_CREATE_CONFIGURATION_ERROR = "create_configuration/mso_create_configuration_pProbe_error.json"; - public static final String MSO_UNASSIGN_ACTIVE_SERVICE = "mso_unassign_service.json"; - public static final String MSO_DELETE_CONFIGURATION = "create_configuration/mso_delete_configuration.json"; - public static final String MSO_ACTIVATE_CONFIGURATION = "create_configuration/mso_activate_configuration.json"; - public static final String MSO_ENABLE_DISABLE_PORT = "create_configuration/mso_enable_disable_port.json"; - - - public static final String MSO_DEACTIVATE_CONFIGURATION = "create_configuration/mso_activate_configuration.json"; } public class addNetwork{ @@ -574,17 +574,14 @@ public class Constants { public static final String AAI_NAMED_QUERY_FOR_VIEW_EDIT ="add_network/aai_named_query_for_view_edit_test_network-vl.json"; public static final String AAI_GET_TENANTS = "add_network/aai_get_tenants.json"; public static final String MSO_ADD_NETWORK_ERROR = "add_network/mso_add_network_error.json"; - public static final String MSO_ADD_NETWORK = "add_network/mso_add_network.json"; - public static final String MSO_ADD_NETWORK_ORCH_REQ = "add_network/mso_add_network_orch_req.json"; } public class CreateNewServiceInstance { - public static final String GET_FULL_SUBSCRIBES = "create_new_instance/aai_get_full_subscribers.json"; public static final String GET_SERVICES = "create_new_instance/aai_get_services.json"; - public static final String GET_SUBSCRIBERS_FOR_CUSTOMER_MSO_1610_ST = "create_new_instance/aai_get_subscribers_for_customer_MSO_1610_ST.json"; - public static final String GET_MODELS_BY_SERVICE_TYPE_MSO_1610_ST = "create_new_instance/aai_get_models_by_service_type_MSO_1610_ST.json"; - public static final String GET_SUBSCRIBERS_FOR_CUSTOMER_USP_VOICE = "create_new_instance/aai_get_subscribers_for_customer_USP_VOICE.json"; - public static final String GET_MODELS_BY_SERVICE_TYPE_USP_VOICE= "create_new_instance/aai_get_models_by_service_type_USP_VOICE.json"; + public static final String GET_SUBSCRIBERS_FOR_CUSTOMER_CAR_2020_ER = "create_new_instance/aai_get_subscribers_for_customer_CAR_2020_ER.json"; + public static final String GET_MODELS_BY_SERVICE_TYPE_CAR_2020_ER = "create_new_instance/aai_get_models_by_service_type_CAR_2020_ER.json"; + public static final String GET_SUBSCRIBERS_FOR_CUSTOMER_SILVIA_ROBBINS = "create_new_instance/aai_get_subscribers_for_customer_SILVIA_ROBBINS.json"; + public static final String GET_MODELS_BY_SERVICE_TYPE_SILVIA_ROBBINS= "create_new_instance/aai_get_models_by_service_type_SILVIA_ROBBINS.json"; public class deploy { public static final String SDC_GET_CATALOG = "create_new_instance/deploy/get_sdc_catalog_services_1707vidnf.json"; diff --git a/vid-automation/src/main/java/vid/automation/test/infra/Click.java b/vid-automation/src/main/java/vid/automation/test/infra/Click.java index 8c6bf4831..0b5f40b84 100644 --- a/vid-automation/src/main/java/vid/automation/test/infra/Click.java +++ b/vid-automation/src/main/java/vid/automation/test/infra/Click.java @@ -1,10 +1,8 @@ package vid.automation.test.infra; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.Alert; -import org.openqa.selenium.By; -import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.Select; @@ -12,38 +10,40 @@ import org.openqa.selenium.support.ui.WebDriverWait; import java.util.List; +import static org.onap.sdc.ci.tests.utilities.GeneralUIUtils.getDriver; + public class Click { public static void byText(String text) { WebElement element = GeneralUIUtils.findByText(text); Assert.assertTrue(element != null); - element.click(); + clickWhenClickable(element); } public static void byId(String id) { WebElement element = Get.byId(id); Assert.assertTrue(element != null); - element.click(); + clickWhenClickable(element); } public static void byTestId(String testId) { WebElement element = Get.byTestId(testId); Assert.assertTrue(element != null); - element.click(); + clickWhenClickable(element); } public static void byClass(String className) { List<WebElement> elements = Get.byClass(className); Assert.assertTrue(elements != null && elements.size() > 0); - elements.get(0).click(); + clickWhenClickable(elements.get(0)); } public static void byXpath(String xpath) { WebElement element = Get.byXpath(xpath); Assert.assertNotNull(element); - element.click(); + clickWhenClickable(element); } @@ -73,7 +73,7 @@ public class Click { public static void byClassAndVisibleText(String className, String text ) { WebElement element = Get.byClassAndText(className, text); - element.click(); + clickWhenClickable(element); } @@ -83,4 +83,11 @@ public class Click { Assert.assertTrue(alert != null); alert.accept(); } + + private static void clickWhenClickable(WebElement element) { + new WebDriverWait(getDriver(), 1) + .until(ExpectedConditions.elementToBeClickable(element)) + .click(); + } + } diff --git a/vid-automation/src/main/java/vid/automation/test/infra/Features.java b/vid-automation/src/main/java/vid/automation/test/infra/Features.java index 37698fe36..cd632ff12 100644 --- a/vid-automation/src/main/java/vid/automation/test/infra/Features.java +++ b/vid-automation/src/main/java/vid/automation/test/infra/Features.java @@ -7,7 +7,6 @@ public enum Features implements Feature { CREATE_INSTANCE_TEST, EMPTY_DRAWING_BOARD_TEST, - FLAG_REGION_ID_FROM_REMOTE, FLAG_ASYNC_JOBS, FLAG_ADD_MSO_TESTAPI_FIELD, FLAG_ASYNC_INSTANTIATION, @@ -16,8 +15,32 @@ public enum Features implements Feature { FLAG_NETWORK_TO_ASYNC_INSTANTIATION, FLAG_COLLECTION_RESOURCE_SUPPORT, FLAG_SHOW_ASSIGNMENTS, + FLAG_FABRIC_CONFIGURATION_ASSIGNMENTS, FLAG_SHOW_VERIFY_SERVICE, - FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD; + FLAG_DUPLICATE_VNF, + FLAG_DEFAULT_VNF, + FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD, + FLAG_RESTRICTED_SELECT, + FLAG_5G_IN_NEW_INSTANTIATION_UI, + FLAG_ASYNC_ALACARTE_VNF, + FLAG_A_LA_CARTE_AUDIT_INFO, + FLAG_PRESENT_PROVIDER_NETWORKS_ASSOCIATIONS, + FLAG_ASYNC_ALACARTE_VFMODULE, + FLAG_SUPPLEMENTARY_FILE, + FLAG_SHIFT_VFMODULE_PARAMS_TO_VNF, + FLAG_EXP_ANY_ALACARTE_NEW_INSTANTIATION_UI, + FLAG_1810_CR_LET_SELECTING_COLLECTOR_TYPE_UNCONDITIONALLY, + FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST, + FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE, + FLAG_1810_IDENTIFY_SERVICE_FOR_NEW_UI, + FLAG_1902_NEW_VIEW_EDIT, + FLAG_EXP_USE_DEFAULT_HOST_NAME_VERIFIER, + FLAG_1902_VNF_GROUPING, + FLAG_1902_RETRY_JOB, + FLAG_VF_MODULE_RESUME_STATUS_CREATE, + FLAG_EXP_CREATE_RESOURCES_IN_PARALLEL, + FLAG_1906_INSTANTIATION_API_USER_VALIDATION, + ; public boolean isActive() { return FeatureContext.getFeatureManager().isActive(this); diff --git a/vid-automation/src/main/java/vid/automation/test/infra/Get.java b/vid-automation/src/main/java/vid/automation/test/infra/Get.java index fc1d06070..9bcad7b64 100644 --- a/vid-automation/src/main/java/vid/automation/test/infra/Get.java +++ b/vid-automation/src/main/java/vid/automation/test/infra/Get.java @@ -1,7 +1,7 @@ package vid.automation.test.infra; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.*; import org.openqa.selenium.support.ui.WebDriverWait; @@ -20,7 +20,7 @@ public class Get { public static WebElement byTestId(String dataTestId) { try { - return GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']")); + return GeneralUIUtils.getDriver().findElement(getXpathForDataTestId(dataTestId)); } catch (Exception var2) { return null; } @@ -34,6 +34,14 @@ public class Get { } } + public static WebElement byXpath(WebElement context, String xpath) { + try { + return context.findElement(By.xpath(xpath)); + } catch (Exception var2) { + return null; + } + } + public static WebElement byXpath(String xpath, int timeout) { try { return GeneralUIUtils.getWebElementBy(By.xpath(xpath), timeout); @@ -152,4 +160,16 @@ public class Get { } }; } + + public static List<WebElement> listByTestId(String dataTestId) { + try { + return GeneralUIUtils.getDriver().findElements(getXpathForDataTestId(dataTestId)); + } catch (Exception var2) { + return null; + } + } + + public static By getXpathForDataTestId(String dataTestId) { + return By.xpath("//*[@data-tests-id='" + dataTestId + "']"); + } } diff --git a/vid-automation/src/main/java/vid/automation/test/infra/Input.java b/vid-automation/src/main/java/vid/automation/test/infra/Input.java index 896ceae56..b937a9d42 100644 --- a/vid-automation/src/main/java/vid/automation/test/infra/Input.java +++ b/vid-automation/src/main/java/vid/automation/test/infra/Input.java @@ -1,6 +1,6 @@ package vid.automation.test.infra; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import vid.automation.test.utils.ReadFile; diff --git a/vid-automation/src/main/java/vid/automation/test/infra/ModelInfo.java b/vid-automation/src/main/java/vid/automation/test/infra/ModelInfo.java new file mode 100644 index 000000000..1284a8b42 --- /dev/null +++ b/vid-automation/src/main/java/vid/automation/test/infra/ModelInfo.java @@ -0,0 +1,81 @@ +package vid.automation.test.infra; + +import com.google.common.collect.ImmutableList; + +public class ModelInfo { + public final String modelVersionId; //aka model uuid + public final String modelInvariantId; + public final String zipFileName; + + public static class ModelInfoWithMultipleVersions { + public final String modelInvariantId; + public final String modelVersionId1; + public final String modelVersionId2; + public final String modelVersionId3; + public final String modelName; + + + ModelInfoWithMultipleVersions(String modelInvariantId, String modelVersionId1, String modelVersionId2, String modelVersionId3, String modelName) { + this.modelInvariantId = modelInvariantId; + this.modelVersionId1 = modelVersionId1; + this.modelVersionId2 = modelVersionId2; + this.modelVersionId3 = modelVersionId3; + this.modelName = modelName; + } + + public static final ModelInfoWithMultipleVersions modelInfoWithMultipleVersions = new ModelInfoWithMultipleVersions( + "5d353b28-e5b7-419b-98e8-cad5d258be13", + "5e7970bc-a292-4955-8a1b-8a44f586f527", + "04743c62-ab58-41a0-bc53-1052ef1c094a", + "d2415de6-dde3-4737-b9b0-4f9fa02fab68", + "serviceWithGreatNameForMultiple"); + } + + public ModelInfo(String modelVersionId, String modelInvariantId, String zipFileName) { + this.modelVersionId = modelVersionId; + this.modelInvariantId = modelInvariantId; + this.zipFileName = zipFileName; + } + + public ModelInfo(String modelVersionId, String modelInvariantId) { + this(modelVersionId, modelInvariantId, "fakeCsarName.zip"); + } + + public static final ModelInfo macroForBrowseSdc = new ModelInfo("4d71990b-d8ad-4510-ac61-496288d9078e","d27e42cf-087e-4d31-88ac-6c4b7585f800"); + public static final ModelInfo aLaCarteForBrowseSdc = new ModelInfo("4d71990b-d8ad-4510-ac61-496288d9078e","a8dcd72d-d44d-44f2-aa85-53aa9ca99cba"); + public static final ModelInfo serviceWithOneVersion = new ModelInfo("16a3133f-cd29-44df-aa3c-79a75e40802a", "a313c1fb-b8ce-4e5f-abfa-ad6611203350"); + + public static final ModelInfo instantiationTypeAlacarte_vidNotionsInstantiationUIByUUID = new ModelInfo ("95eb2c44-bff2-4e8b-ad5d-8266870b7717", "31a229a2-71d0-48e1-9003-850c2696d6d4", "csar15782222_instantiationTypeAlacarte_vidNotionsInstantiationUIByUUID.zip"); + public static final ModelInfo macroSriovWithDynamicFieldsEcompNamingTruePartialModelDetails = new ModelInfo ("2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd", "45aee87d-883b-4644-9006-e0ca48d33cbf", "csar-withDynamicFields-ecompNamingTrue-partialModelDetails.zip"); + public static final ModelInfo macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails = new ModelInfo ("1a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd", "cdb90b57-ed78-4d44-a5b4-7f43a02ec632", "csar-noDynamicFields-ecompNamingFalse-fullModelDetails-1a80c596.zip"); + public static final ModelInfo macroSriovWithDynamicFieldsEcompNamingFalsePartialModelDetailsVnfEcompNamingFalse = new ModelInfo("6b528779-44a3-4472-bdff-9cd15ec93450", "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0" , "csar-withDynamicFields-ecompNamingFalse-partialModelDetails-vnfEcompNamingFalse.zip"); + public static final ModelInfo macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetailsVnfEcompNamingFalse = new ModelInfo("4a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd", "4140a873-00bb-4f57-ac46-0494cc9e674a", "csar-noDynamicFields-ecompNamingFalse-fullModelDetails-1a80c596-vnfEcompNamingFalse.zip"); + public static final ModelInfo aLaCarteNetworkProvider5G = new ModelInfo("4659e8bd-0920-4eed-8ec5-550b4c8dceeb", "16e56d12-40b3-4db1-a40e-d48c36679e2e", "service-SrIovProvider1-csar.zip"); + public static final ModelInfo PASQUALEVmxVpeBvService488Annotations = new ModelInfo("f4d84bb4-a416-4b4e-997e-0059973630b9", "598e3f9e-3244-4d8f-a8e0-0e5d7a29eda9", "service-PASQUALEVmxVpeBvService488-csar-annotations.zip"); + public static final ModelInfo macroDrawingBoardComplexService = new ModelInfo("6e59c5de-f052-46fa-aa7e-2fca9d674c44","cfef8302-d90f-475f-87cc-3f49a62ef14c", "service-Complexservice-csar.zip" ); + public static final ModelInfo aLaCarteServiceCreationTest = new ModelInfo("f913c5d0-206e-45c2-9284-1c68f4e67dc7", "45e61192-876c-4e28-9139-5a0c47410379", "serviceCreationTest.zip"); + public static final ModelInfo aLaCarteVnfGroupingService = new ModelInfo("4117a0b6-e234-467d-b5b9-fe2f68c8b0fc", "7ee41ce4-4827-44b0-a48e-2707a59905d2", "csar15782222_instantiationTypeAlacarte_VnfGrouping.zip"); + public static final ModelInfo serviceFabricSriovService = new ModelInfo("253f1467-fe68-4e80-ba71-308000caec31", "c15fe228-7d40-4f99-afa7-10abeedf9aac", "service-fabric-SriovService-csar.zip"); + + public static final ImmutableList<ModelInfo> superSetOfModelInfos = buildModelInfos(); + + public static ImmutableList<ModelInfo> buildModelInfos() { + return new ImmutableList.Builder<ModelInfo>() + .add(macroForBrowseSdc) + .add(aLaCarteForBrowseSdc) + .add(serviceWithOneVersion) + .add(instantiationTypeAlacarte_vidNotionsInstantiationUIByUUID) + .add(macroSriovWithDynamicFieldsEcompNamingTruePartialModelDetails) + .add(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails) + .add(macroSriovWithDynamicFieldsEcompNamingFalsePartialModelDetailsVnfEcompNamingFalse) + .add(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetailsVnfEcompNamingFalse) + .add(aLaCarteNetworkProvider5G) + .add(PASQUALEVmxVpeBvService488Annotations) + .add(macroDrawingBoardComplexService) + .add(aLaCarteServiceCreationTest) + .add(aLaCarteVnfGroupingService) + .build(); + } +} + + diff --git a/vid-automation/src/main/java/vid/automation/test/infra/SelectOption.java b/vid-automation/src/main/java/vid/automation/test/infra/SelectOption.java index dc792cfc3..cd766c5bf 100644 --- a/vid-automation/src/main/java/vid/automation/test/infra/SelectOption.java +++ b/vid-automation/src/main/java/vid/automation/test/infra/SelectOption.java @@ -1,11 +1,14 @@ package vid.automation.test.infra; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import com.google.common.collect.ImmutableList; +import org.apache.commons.lang3.ObjectUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.Select; import vid.automation.test.Constants; import java.util.List; +import java.util.concurrent.TimeUnit; /** * Created by itzikliderman on 18/07/2017. @@ -56,6 +59,13 @@ public class SelectOption { } + public static void waitForOptionInSelect(String option, String selectTestId) { + Wait.waitFor(foo -> + ObjectUtils.defaultIfNull(SelectOption.getList(selectTestId), ImmutableList.<WebElement>of()) + .stream().map(o -> o.getText()).filter(o -> option.equals(o)).findAny().isPresent(), + "", 10, 200, TimeUnit.MILLISECONDS); + } + public static void selectOptionsFromMultiselectById(String multiSelectId, List<String> options) { Click.byId(multiSelectId); try { diff --git a/vid-automation/src/main/java/vid/automation/test/infra/Wait.java b/vid-automation/src/main/java/vid/automation/test/infra/Wait.java index 848107c83..cab3a2d5b 100644 --- a/vid-automation/src/main/java/vid/automation/test/infra/Wait.java +++ b/vid-automation/src/main/java/vid/automation/test/infra/Wait.java @@ -1,7 +1,7 @@ package vid.automation.test.infra; import org.apache.commons.collections.CollectionUtils; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.NoSuchElementException; import vid.automation.test.Constants; @@ -58,6 +58,10 @@ public class Wait { return waitFor((x->Get.byTestId(dataTestId)!=null),null, timeoutInSeconds, 1); } + public static boolean waitByIdAndText(String id, String text, int timeoutInSeconds) { + return waitFor((x->Get.byId(id).getText().equals(text)),null, timeoutInSeconds, 1); + } + public static void angularHttpRequestsLoaded() { JavascriptExecutor js = (JavascriptExecutor) GeneralUIUtils.getDriver(); for (int i=0; i<Constants.generalRetries; i++) { diff --git a/vid-automation/src/main/java/vid/automation/test/model/Credentials.java b/vid-automation/src/main/java/vid/automation/test/model/Credentials.java index 0dc26aefd..46d44b296 100644 --- a/vid-automation/src/main/java/vid/automation/test/model/Credentials.java +++ b/vid-automation/src/main/java/vid/automation/test/model/Credentials.java @@ -1,8 +1,5 @@ package vid.automation.test.model; -/** - * Created by itzikliderman on 26/06/2017. - */ public class Credentials { public String userId; public String password; diff --git a/vid-automation/src/main/java/vid/automation/test/model/JobBulk.java b/vid-automation/src/main/java/vid/automation/test/model/JobBulk.java deleted file mode 100644 index 80d4109a6..000000000 --- a/vid-automation/src/main/java/vid/automation/test/model/JobBulk.java +++ /dev/null @@ -1,23 +0,0 @@ -package vid.automation.test.model; - -import java.util.List; - -public class JobBulk { - - private List<JobModel> jobs; - - public JobBulk() { - } - - public JobBulk(List<JobModel> jobs) { - this.jobs = jobs; - } - - public List<JobModel> getJobs() { - return jobs; - } - - public void setJobs(List<JobModel> jobs) { - this.jobs = jobs; - } -} diff --git a/vid-automation/src/main/java/vid/automation/test/model/JobStatus.java b/vid-automation/src/main/java/vid/automation/test/model/JobStatus.java index 0e92a1f35..a51336ec6 100644 --- a/vid-automation/src/main/java/vid/automation/test/model/JobStatus.java +++ b/vid-automation/src/main/java/vid/automation/test/model/JobStatus.java @@ -2,9 +2,11 @@ package vid.automation.test.model; public enum JobStatus { COMPLETED, + COMPLETED_WITH_NO_ACTION, FAILED, IN_PROGRESS, PAUSE, PENDING, - STOPPED; + STOPPED, + COMPLETED_WITH_ERRORS; } diff --git a/vid-automation/src/main/java/vid/automation/test/model/Service.java b/vid-automation/src/main/java/vid/automation/test/model/Service.java index 4ed51eeb1..4aa4a7f9e 100644 --- a/vid-automation/src/main/java/vid/automation/test/model/Service.java +++ b/vid-automation/src/main/java/vid/automation/test/model/Service.java @@ -1,5 +1,7 @@ package vid.automation.test.model; +import com.google.common.base.MoreObjects; + /** * Created by itzikliderman on 19/06/2017. */ @@ -33,4 +35,18 @@ public class Service { this.description = description; this.serviceRole = serviceRole; } + + @Override + public String toString() { + return MoreObjects.toStringHelper(this) + .add("type", type) + .add("uuid", uuid) + .add("invariantUuid", invariantUuid) + .add("name", name) + .add("version", version) + .add("category", category) + .add("description", description) + .add("serviceRole", serviceRole) + .toString(); + } } diff --git a/vid-automation/src/main/java/vid/automation/test/model/ServiceAction.java b/vid-automation/src/main/java/vid/automation/test/model/ServiceAction.java new file mode 100644 index 000000000..a155c6c72 --- /dev/null +++ b/vid-automation/src/main/java/vid/automation/test/model/ServiceAction.java @@ -0,0 +1,7 @@ +package vid.automation.test.model; + +public enum ServiceAction { + INSTANTIATE, + DELETE, + UPDATE +}
\ No newline at end of file diff --git a/vid-automation/src/main/java/vid/automation/test/sections/BrowseASDCPage.java b/vid-automation/src/main/java/vid/automation/test/sections/BrowseASDCPage.java index 53a67821d..febbe6e83 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/BrowseASDCPage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/BrowseASDCPage.java @@ -1,7 +1,7 @@ package vid.automation.test.sections; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import vid.automation.test.Constants; import vid.automation.test.infra.Get; diff --git a/vid-automation/src/main/java/vid/automation/test/sections/ChangeManagementPage.java b/vid-automation/src/main/java/vid/automation/test/sections/ChangeManagementPage.java index ca0b55b36..953219547 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/ChangeManagementPage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/ChangeManagementPage.java @@ -1,6 +1,6 @@ package vid.automation.test.sections; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import vid.automation.test.Constants; import vid.automation.test.infra.Click; diff --git a/vid-automation/src/main/java/vid/automation/test/sections/CreateConfigurationPage.java b/vid-automation/src/main/java/vid/automation/test/sections/CreateConfigurationPage.java index bb68d9b9e..4b837a0ac 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/CreateConfigurationPage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/CreateConfigurationPage.java @@ -1,7 +1,7 @@ package vid.automation.test.sections; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import vid.automation.test.Constants; import vid.automation.test.infra.SelectOption; diff --git a/vid-automation/src/main/java/vid/automation/test/sections/CreateNewInstancePage.java b/vid-automation/src/main/java/vid/automation/test/sections/CreateNewInstancePage.java index d63b8a191..68e673b68 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/CreateNewInstancePage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/CreateNewInstancePage.java @@ -1,6 +1,6 @@ package vid.automation.test.sections; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import vid.automation.test.Constants; import vid.automation.test.model.Service; diff --git a/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialog.java b/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialog.java index ae7573333..e7288ea79 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialog.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialog.java @@ -1,6 +1,6 @@ package vid.automation.test.sections; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import vid.automation.test.Constants; @@ -13,7 +13,7 @@ public class DeployMacroDialog extends DeployMacroDialogBase { public void assertTitle(){ WebElement modalTitle = GeneralUIUtils.getWebElementByTestID(Constants.CREATE_MODAL_TITLE_ID, 30); - assertThat(modalTitle.getText().toLowerCase(), containsString(dialogTitle)); + assertThat(modalTitle.getText(), containsString(dialogTitle)); } @Override public void closeDialog(){ diff --git a/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialogOld.java b/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialogOld.java index 032852099..e0e391b4d 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialogOld.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialogOld.java @@ -1,7 +1,7 @@ package vid.automation.test.sections; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import vid.automation.test.Constants; diff --git a/vid-automation/src/main/java/vid/automation/test/sections/DrawingBoardPage.java b/vid-automation/src/main/java/vid/automation/test/sections/DrawingBoardPage.java index 7cffd37b9..acbb4d991 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/DrawingBoardPage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/DrawingBoardPage.java @@ -1,7 +1,8 @@ package vid.automation.test.sections; import com.google.common.collect.ImmutableList; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import com.google.common.collect.Sets; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.NoSuchElementException; @@ -12,9 +13,9 @@ import vid.automation.test.infra.Click; import vid.automation.test.infra.Get; import vid.automation.test.infra.Wait; -import java.util.Collection; -import java.util.Map; +import java.util.*; import java.util.function.Function; +import java.util.function.Predicate; import java.util.stream.Collectors; import static org.hamcrest.CoreMatchers.equalTo; @@ -189,7 +190,7 @@ public class DrawingBoardPage extends VidBasePage { public void checkContextMenu(String node){ String contextMenuButton = Constants.DrawingBoard.NODE_PREFIX + node + Constants.DrawingBoard.CONTEXT_MENU_BUTTON; - final String contextMenu = Constants.DrawingBoard.CONTEXT_MENU_ITEM; + final String contextMenu = Constants.DrawingBoard.CONTEXT_MENU_EDIT; checkThatPseudoElementNotExist(contextMenuButton); checkThatContextMenuNotExist(contextMenu); @@ -254,4 +255,33 @@ public class DrawingBoardPage extends VidBasePage { Assert.assertEquals(Get.byTestId(SERVICE_QUANTITY).getText(), (String.valueOf(expectedQuantity))); } + public static class ServiceStatusChecker implements Predicate<Boolean> { + private String actualInstanceName; + private Set<String> expectedStatuses; + private Set<String> columnClassesSet; + + public ServiceStatusChecker(String actualInstanceName, Set<String> expectedStatuses) { + this.actualInstanceName = actualInstanceName; + this.expectedStatuses = expectedStatuses; + } + + @Override + public boolean test(Boolean noMeaning) { + InstantiationStatusPage.clickRefreshButton(); + final WebElement row = InstantiationStatusPage.getInstantiationStatusRow(actualInstanceName); + if (row == null) { + System.err.println("**********************" + actualInstanceName + "************************************************"); + columnClassesSet = Collections.singleton(actualInstanceName + " NOT FOUND"); + return false; // treat missing row as if test condition not fulfilled + } else { + columnClassesSet = new HashSet<>(Arrays.asList( + row.findElements(By.xpath(".//*[@id='" + "jobStatus" + "']")).get(0).getAttribute("class").split(" "))); + return !(Sets.intersection(expectedStatuses, columnClassesSet).isEmpty()); + } + } + + public Set<String> getColumnClassesSet() { + return columnClassesSet; + } + } } diff --git a/vid-automation/src/main/java/vid/automation/test/sections/InstantiationStatusPage.java b/vid-automation/src/main/java/vid/automation/test/sections/InstantiationStatusPage.java index e5dd1bb39..1bb095fda 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/InstantiationStatusPage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/InstantiationStatusPage.java @@ -1,22 +1,36 @@ package vid.automation.test.sections; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.apache.http.NameValuePair; +import org.apache.http.client.utils.URLEncodedUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; +import vid.automation.test.Constants; +import vid.automation.test.infra.Click; import vid.automation.test.infra.Get; +import vid.automation.test.infra.Wait; +import java.nio.charset.Charset; +import java.util.List; import java.util.Map; +import java.util.function.Consumer; import java.util.stream.Collectors; +import static java.util.stream.Collectors.toMap; +import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; +import static org.testng.Assert.assertEquals; public abstract class InstantiationStatusPage extends VidBasePage { public static final String refreshButtonId = "refresh-btn"; + private static final String NEW_VIEW_EDIT_RELATIVE_URL = "serviceModels.htm#/servicePlanning"; + + public static String getWebTrTdSpanElementByParentID(WebElement tr, String id, int timeout) { return tr.findElements(By.xpath(".//*[@id='" + id + "']//span")).get(0).getText(); } @@ -55,5 +69,78 @@ public abstract class InstantiationStatusPage extends VidBasePage { GeneralUIUtils.ultimateWait(); } + public static void checkMenuItem(String actualInstanceName, String contextMenuItem, boolean shouldBeEnabled, Consumer<String> doIfEnabled) { + Wait.waitFor(name -> { + if (null == getInstantiationStatusRow(name)) { + clickRefreshButton(); + return false; + } else { + return true; + } + }, actualInstanceName, 8, 1); + final WebElement row = getInstantiationStatusRow(actualInstanceName); + row.findElement(By.className("menu-div")).click(); + String clazz = Get.byXpath("//div[@data-tests-id='" + contextMenuItem + "']/ancestor::li").getAttribute("class"); + assertThat("item " + contextMenuItem + " of " + actualInstanceName + + " should be " + (shouldBeEnabled ? "enabled" : "disabled"), !clazz.equals("disabled"), is(shouldBeEnabled)); + if (shouldBeEnabled) { + doIfEnabled.accept(contextMenuItem); + } else { + // dismiss menu + Get.byTestId("instantiation-status-title").click(); + } + } + public void showTooltipByHoverAboveStatusIcon(String elementTestId){ + WebElement selectedElement = GeneralUIUtils.getWebElementByTestID(elementTestId, 30); + } + + public static void openDrawingBoardForRetry(String serviceInstanceName) { + InstantiationStatusPage.checkMenuItem(serviceInstanceName, Constants.InstantiationStatus.CONTEXT_MENU_RETRY, true, contextMenuRetry -> { + Click.byTestId(contextMenuRetry); + VidBasePage.goOutFromIframe(); + verifyUrlPrefixMatchNewViewEdit("RETRY_EDIT"); + }); + } + + public static void verifyOpenNewViewEdit(String serviceInstanceName, String serviceInstanceId, String serviceModelId, String serviceType, String subscriberId, String mode) { + InstantiationStatusPage.checkMenuItem(serviceInstanceName, Constants.InstantiationStatus.CONTEXT_MENU_HEADER_OPEN_ITEM, true, contextMenuOpen -> { + Click.byTestId(contextMenuOpen); + VidBasePage.goOutFromIframe(); + verifyUrlMatchNewViewEdit(serviceInstanceId, serviceModelId, serviceType, subscriberId, mode); + SideMenu.navigateToMacroInstantiationStatus(); + }); + } + + public static void verifyOpenNewViewEdit(String serviceInstanceName, boolean openShouldBeEnabled, String expectedMode) { + InstantiationStatusPage.checkMenuItem(serviceInstanceName, Constants.InstantiationStatus.CONTEXT_MENU_HEADER_OPEN_ITEM, openShouldBeEnabled, contextMenuOpen -> { + Click.byTestId(contextMenuOpen); + VidBasePage.goOutFromIframe(); + verifyUrlPrefixMatchNewViewEdit(expectedMode); + SideMenu.navigateToMacroInstantiationStatus(); + }); + } + + public static void verifyUrlMatchNewViewEdit(String serviceInstanceId, String serviceModelId, String serviceType, String subscriberId, String expectedMode) { + verifyUrlPrefixMatchNewViewEdit(expectedMode); + Map<String, String> paramsMap = extractQueryParamsFromCurrentURL(NEW_VIEW_EDIT_RELATIVE_URL + "/" + expectedMode + "?"); + //assertEquals(paramsMap.get("mode"), expectedMode); + assertEquals(paramsMap.get("serviceInstanceId"), serviceInstanceId); + assertEquals(paramsMap.get("serviceModelId"), serviceModelId); + assertEquals(paramsMap.get("serviceType"), serviceType); + assertEquals(paramsMap.get("subscriberId"), subscriberId); + } + + protected static Map<String, String> extractQueryParamsFromCurrentURL(String relativePath) { + String currentUrl = GeneralUIUtils.getDriver().getCurrentUrl(); + //unfortunately parse(final URI uri, final String charset) can't handle with the #/ part of the uri + String urlSuffix = currentUrl.substring(currentUrl.indexOf(relativePath)+relativePath.length()); + List<NameValuePair> params = URLEncodedUtils.parse(urlSuffix, Charset.forName("UTF-8")); + return params.stream().collect(toMap(NameValuePair::getName, NameValuePair::getValue)); + } + + public static void verifyUrlPrefixMatchNewViewEdit(String expectedMode) { + String currentUrl = GeneralUIUtils.getDriver().getCurrentUrl(); + assertThat(currentUrl, containsString(NEW_VIEW_EDIT_RELATIVE_URL + "/" + expectedMode)); + } } diff --git a/vid-automation/src/main/java/vid/automation/test/sections/LoginExternalPage.java b/vid-automation/src/main/java/vid/automation/test/sections/LoginExternalPage.java index c1053d2a5..7a13e4d1b 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/LoginExternalPage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/LoginExternalPage.java @@ -1,7 +1,7 @@ package vid.automation.test.sections; -import org.openecomp.sdc.ci.tests.datatypes.UserCredentials; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.datatypes.UserCredentials; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import static org.junit.Assert.*; diff --git a/vid-automation/src/main/java/vid/automation/test/sections/PnfSearchAssociationPage.java b/vid-automation/src/main/java/vid/automation/test/sections/PnfSearchAssociationPage.java index 3f8061a78..2efb9f3c8 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/PnfSearchAssociationPage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/PnfSearchAssociationPage.java @@ -1,7 +1,7 @@ package vid.automation.test.sections; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import vid.automation.test.Constants; diff --git a/vid-automation/src/main/java/vid/automation/test/sections/PreviousVersionDialog.java b/vid-automation/src/main/java/vid/automation/test/sections/PreviousVersionDialog.java index d5f39d959..cfbf025a6 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/PreviousVersionDialog.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/PreviousVersionDialog.java @@ -1,7 +1,7 @@ package vid.automation.test.sections; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.RemoteWebElement; import vid.automation.test.infra.Get; diff --git a/vid-automation/src/main/java/vid/automation/test/sections/SearchExistingPage.java b/vid-automation/src/main/java/vid/automation/test/sections/SearchExistingPage.java index edfcd0e56..aa9675b76 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/SearchExistingPage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/SearchExistingPage.java @@ -1,7 +1,7 @@ package vid.automation.test.sections; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import vid.automation.test.Constants; import vid.automation.test.infra.Click; diff --git a/vid-automation/src/main/java/vid/automation/test/sections/ServiceProxyPage.java b/vid-automation/src/main/java/vid/automation/test/sections/ServiceProxyPage.java index a47870290..82f45ce7f 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/ServiceProxyPage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/ServiceProxyPage.java @@ -1,7 +1,7 @@ package vid.automation.test.sections; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import vid.automation.test.Constants; import vid.automation.test.infra.SelectOption; @@ -24,6 +24,11 @@ public class ServiceProxyPage extends VidBasePage { GeneralUIUtils.ultimateWait(); return this; } + public void assertCollectorServiceType(String collectorServiceType) { + String displayedCollectorServiceType = SelectOption.getSelectedOption("collectorServiceType"); + Assert.assertEquals("The displayed collector service type is incorrect", collectorServiceType, displayedCollectorServiceType); + } + public ServiceProxyPage chooseCollector(String collector){ GeneralUIUtils.ultimateWait(); SelectOption.byTestIdAndVisibleText(collector, Constants.ConfigurationCreation.COLLECTOR_DROPDOWN_TEST_ID); diff --git a/vid-automation/src/main/java/vid/automation/test/sections/SideMenu.java b/vid-automation/src/main/java/vid/automation/test/sections/SideMenu.java index 0ba49f2d8..dc3de78dd 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/SideMenu.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/SideMenu.java @@ -1,12 +1,16 @@ package vid.automation.test.sections; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.ElementClickInterceptedException; import org.openqa.selenium.UnhandledAlertException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import vid.automation.test.Constants; public class SideMenu { + static final Logger logger = LoggerFactory.getLogger(SideMenu.class); + public static void navigateToBrowseASDCPage() { navigateToPage(Constants.SideMenu.BROWSE_ASDC_SERVICE_MODELS); } @@ -24,7 +28,7 @@ public class SideMenu { } public static void navigateToMacroInstantiationStatus() { - navigateToPage("Macro Instantiation Status"); + navigateToPage("Instantiation Status"); new VidBasePage().goToIframe(); } @@ -47,6 +51,7 @@ public class SideMenu { } }); GeneralUIUtils.ultimateWait(); + logger.info("navigated to {}", PageName); } public static void navigateToWelcomePage() { diff --git a/vid-automation/src/main/java/vid/automation/test/sections/TestEnvironmentPage.java b/vid-automation/src/main/java/vid/automation/test/sections/TestEnvironmentPage.java index f63906323..71c6e0bd4 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/TestEnvironmentPage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/TestEnvironmentPage.java @@ -1,6 +1,6 @@ package vid.automation.test.sections; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.testng.Assert; diff --git a/vid-automation/src/main/java/vid/automation/test/sections/VidBasePage.java b/vid-automation/src/main/java/vid/automation/test/sections/VidBasePage.java index 69aee494a..f749df02b 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/VidBasePage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/VidBasePage.java @@ -1,17 +1,10 @@ package vid.automation.test.sections; -import com.aventstack.extentreports.Status; -import org.junit.Assert; -import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openqa.selenium.By; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import vid.automation.test.Constants; -import vid.automation.test.infra.*; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.onap.sdc.ci.tests.utilities.GeneralUIUtils.getDriver; +import com.aventstack.extentreports.Status; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; @@ -20,11 +13,25 @@ import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.function.Function; - -import static org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils.getDriver; +import org.junit.Assert; +import org.onap.sdc.ci.tests.execute.setup.ExtentTestActions; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; +import vid.automation.test.Constants; +import vid.automation.test.infra.Click; +import vid.automation.test.infra.Exists; +import vid.automation.test.infra.Get; +import vid.automation.test.infra.Input; +import vid.automation.test.infra.SelectOption; +import vid.automation.test.infra.Wait; public class VidBasePage { + public VidBasePage setInstanceName(String name) { setInputText(Constants.INSTANCE_NAME_SELECT_TESTS_ID, name); return this; @@ -97,6 +104,7 @@ public class VidBasePage { public VidBasePage clickDeployServiceButtonByServiceUUID(String serviceUUID) { Input.replaceText(serviceUUID, Constants.BROWSE_SEARCH); + GeneralUIUtils.ultimateWait(); String elementTestId = Constants.DEPLOY_BUTTON_TESTS_ID_PREFIX + serviceUUID; GeneralUIUtils.clickOnElementByTestId(elementTestId, 30); GeneralUIUtils.ultimateWait(); @@ -158,6 +166,11 @@ public class VidBasePage { return this; } + public VidBasePage clickButtonByTestId(String testId) { + GeneralUIUtils.clickOnElementByTestId(testId); + return this; + } + public VidBasePage clickCommitCloseButton() { GeneralUIUtils.clickOnElementByTestId(Constants.COMMIT_CLOSE_BUTTON_ID, 30); return this; @@ -174,11 +187,13 @@ public class VidBasePage { public VidBasePage selectLcpRegion(String lcpRegion) { + GeneralUIUtils.ultimateWait(); SelectOption.byValue(lcpRegion, Constants.ViewEdit.LCP_REGION_SELECT_TESTS_ID); return this; } public VidBasePage selectTenant(String tenant) { + GeneralUIUtils.ultimateWait(); SelectOption.byValue(tenant, Constants.ViewEdit.TENANT_SELECT_TESTS_ID); return this; } @@ -263,12 +278,12 @@ public class VidBasePage { Assert.assertEquals(expectedText, alertText); Click.acceptAlert(); } - public void goToIframe() { + public static void goToIframe() { final long start = System.currentTimeMillis(); goOutFromIframe(); GeneralUIUtils.ultimateWait(); System.out.println("ultimateWait waited " + (System.currentTimeMillis() - start)); - final WebDriver iframeReady = new WebDriverWait(getDriver(), 10).until( + final WebDriver iframeReady = new WebDriverWait(getDriver(), 20).until( ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.tagName("iframe")) ); Assert.assertNotNull("failed going into iframe", iframeReady); @@ -278,12 +293,41 @@ public class VidBasePage { System.out.println("ultimateWait waited " + (System.currentTimeMillis() - start2)); } - public void goOutFromIframe(){ + public static void goOutFromIframe(){ getDriver().switchTo().defaultContent(); } + public void verifyOpenOldViewEdit(String serviceInstanceName, String serviceInstanceId, boolean openShouldBeEnabled, boolean checkPortMirroring, boolean checkAddVnf) { + InstantiationStatusPage.checkMenuItem(serviceInstanceName, Constants.InstantiationStatus.CONTEXT_MENU_HEADER_OPEN_ITEM, openShouldBeEnabled, contextMenuOpen -> { + Click.byTestId(contextMenuOpen); + VidBasePage.goOutFromIframe(); + GeneralUIUtils.ultimateWait(); + Wait.byText("View/Edit Service Instance"); + if (serviceInstanceId != null) { + Wait.byText(serviceInstanceId); + } + Wait.byText(serviceInstanceName); + + if (checkPortMirroring) { + Wait.byText("Add node instance"); + Wait.byText("i'm a port"); + } + + if (checkAddVnf) { + // Validate bug fix - we open old popup in view/edit + Click.byTestId("addVNFButton"); + Click.byTestId("addVNFOption-2017-488_PASQUALE-vPE 0"); + assertThat(Get.byTestId("create-modal-title").getText(), containsString("a la carte")); + Click.byTestId("cancelButton"); + //end of bug fix validation + } + + screenshotDeployDialog("view-edit-" + serviceInstanceName); + SideMenu.navigateToMacroInstantiationStatus(); + }); + } public static WebDriverWait waitUntilDriverIsReady(int time) { diff --git a/vid-automation/src/main/java/vid/automation/test/sections/ViewEditPage.java b/vid-automation/src/main/java/vid/automation/test/sections/ViewEditPage.java index 633feb83d..e10c872ee 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/ViewEditPage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/ViewEditPage.java @@ -1,19 +1,16 @@ package vid.automation.test.sections; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import vid.automation.test.Constants; +import vid.automation.test.infra.Features; import vid.automation.test.infra.Get; import vid.automation.test.infra.SelectOption; -import vid.automation.test.infra.Wait; -import org.hamcrest.core.Is; import static org.hamcrest.core.Is.is; -import java.util.List; - /** * Created by itzikliderman on 13/06/2017. */ @@ -70,8 +67,12 @@ public class ViewEditPage extends VidBasePage { return this; } - public ViewEditPage selectLCPRegion(String lcpRegion){ - SelectOption.byValue(lcpRegion, Constants.ViewEdit.LCP_REGION_SELECT_TESTS_ID); + public ViewEditPage selectLcpRegion(String lcpRegion, String cloudOwner){ + selectLcpRegion(lcpRegion); + if (Features.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST.isActive()) { + String selectedOption = SelectOption.getSelectedOption(Constants.ViewEdit.LCP_REGION_SELECT_TESTS_ID); + Assert.assertEquals(lcpRegion + " (" + cloudOwner.toUpperCase() + ")", selectedOption); + } return this; } @@ -91,6 +92,10 @@ public class ViewEditPage extends VidBasePage { return this; } + public VidBasePage clickActivateFabricConfigurationButton() { + GeneralUIUtils.clickOnElementByTestId(Constants.ViewEdit.ACTIVATE_FABRIC_CONFIGURATION_BUTTON_TEST_ID, 60); + return this; + } public VidBasePage clickInfoButton() { GeneralUIUtils.clickOnElementByTestId(Constants.ViewEdit.INFOSERVICEBUTTON, 30); return this; diff --git a/vid-automation/src/main/java/vid/automation/test/services/AsyncJobsService.java b/vid-automation/src/main/java/vid/automation/test/services/AsyncJobsService.java index 01158fa66..35849b481 100644 --- a/vid-automation/src/main/java/vid/automation/test/services/AsyncJobsService.java +++ b/vid-automation/src/main/java/vid/automation/test/services/AsyncJobsService.java @@ -1,44 +1,54 @@ package vid.automation.test.services; +import com.google.common.collect.ImmutableList; import vid.automation.test.utils.DB_CONFIG; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; +import java.util.List; public class AsyncJobsService { public void dropAllAsyncJobs() { + runStatementsInDb(ImmutableList.of( + "DELETE FROM `vid_service_info`", + "DELETE FROM `vid_job`", + "DELETE FROM `vid_job_audit_status`", + "DELETE FROM `vid_name_counter`" + )); + } + + public void runStatementsInDb(List<String> sqlStatements) { System.out.println("Connecting database..."); try (Connection connection = DriverManager.getConnection(DB_CONFIG.url, DB_CONFIG.username, DB_CONFIG.password)) { System.out.println("Database connected!"); - Statement stmt = connection.createStatement(); - stmt.addBatch("DELETE FROM `vid_service_info`"); - stmt.addBatch("DELETE FROM `vid_job`"); - stmt.addBatch("DELETE FROM `vid_job_audit_status`"); - int[] executeBatch = stmt.executeBatch(); + try (Statement stmt = connection.createStatement()) { + for (String sql: sqlStatements) { + stmt.addBatch(sql); + } + stmt.executeBatch(); + } } catch (SQLException e) { throw new IllegalStateException("Cannot connect the database!", e); } } - public void muteAllAsyncJobs() { - System.out.println("Connecting database..."); + public void runStatementInDb(String sqlStatement) { + runStatementsInDb(ImmutableList.of(sqlStatement)); + } - try (Connection connection = DriverManager.getConnection(DB_CONFIG.url, DB_CONFIG.username, DB_CONFIG.password)) { - System.out.println("Database connected!"); - Statement stmt = connection.createStatement(); - stmt.addBatch("UPDATE `vid_job` set `TAKEN_BY`='muteAllAsyncJobs', `AGE`=`AGE`+5"); - int[] executeBatch = stmt.executeBatch(); + public void muteAllAsyncJobs() { + runStatementInDb("UPDATE `vid_job` SET `TAKEN_BY`='muteAllAsyncJobs', `JOB_STATUS`=CONCAT('MUTED_', `JOB_STATUS`), `AGE`=`AGE`+5 WHERE `TAKEN_BY` is NULL or `TAKEN_BY`<>'muteAllAsyncJobs'"); + } - } catch (SQLException e) { - throw new IllegalStateException("Cannot connect the database!", e); - } + public void dropAllFromNameCounter() { + runStatementInDb("DELETE FROM `vid_name_counter`"); } } diff --git a/vid-automation/src/main/java/vid/automation/test/services/BulkRegistration.java b/vid-automation/src/main/java/vid/automation/test/services/BulkRegistration.java index c6de040ea..0f0839537 100644 --- a/vid-automation/src/main/java/vid/automation/test/services/BulkRegistration.java +++ b/vid-automation/src/main/java/vid/automation/test/services/BulkRegistration.java @@ -1,14 +1,28 @@ package vid.automation.test.services; +import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId.ATT_NC; +import static vid.automation.test.infra.ModelInfo.serviceFabricSriovService; +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import org.onap.simulator.presetGenerator.presets.aai.PresetAAICloudRegionAndSourceFromConfigurationPut; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIFilterServiceInstanceById; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetHomingForVfModule; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetModelsByOwningEntity; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetModelsByProject; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetNetworkZones; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetPortMirroringSourcePorts; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubDetailsGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubDetailsWithoutInstancesGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetTenants; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIPostNamedQueryForViewEdit; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVfModuleInstancePost; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOActivateFabricConfiguration; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVfModule; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeactivateAndCloudDelete; import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteInstanceOrchestrationRequestGet; import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteNetwork; import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteService; @@ -16,33 +30,57 @@ import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteVfModule; import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteVnf; import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteVolumeGroup; import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet; +import org.onap.simulator.presetGenerator.presets.mso.configuration.PresetMSOActOnConfiguration; +import org.onap.simulator.presetGenerator.presets.mso.configuration.PresetMSOCreateConfiguration; +import org.onap.simulator.presetGenerator.presets.mso.configuration.PresetMSODeleteConfiguration; +import org.onap.simulator.presetGenerator.presets.mso.configuration.PresetMsoEnableDisablePort; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceMetadataGet; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaModelGet; import vid.automation.test.Constants; -import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; - public class BulkRegistration { public static void searchExistingServiceInstance() { searchExistingServiceInstance("Active"); } - public static void searchExistingServiceInstance(String orchStatus) { + public static void searchExistingServiceInstance(String orchStatus) { + searchExistingServiceInstance(orchStatus, "pending-delete"); + } + + public static void searchExistingServiceInstance(String orchStatus, String vfModuleOrchStatus) { genericSearchExistingServiceInstance(); SimulatorApi.registerExpectation( new String [] { - Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_USP_VOICE, + Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_SILVIA_ROBBINS, Constants.RegisterToSimulator.SearchForServiceInstance.FILTER_SERVICE_INSTANCE_BY_ID, Constants.RegisterToSimulator.SearchForServiceInstance.NAMED_QUERY_VIEW_EDIT, Constants.RegisterToSimulator.SearchForServiceInstance.GET_SDC_CATALOG_SERVICE_VID_TEST_444, Constants.RegisterToSimulator.CreateNewServiceInstance.deploy.GET_AIC_ZONES - }, ImmutableMap.<String, Object>of("<ORCH_STATUS>", orchStatus), SimulatorApi.RegistrationStrategy.APPEND); + }, ImmutableMap.<String, Object>of("<ORCH_STATUS>", orchStatus, "<VF_MODULE_ORCH_STATUS>", vfModuleOrchStatus), SimulatorApi.RegistrationStrategy.APPEND); + } + + public static void searchExistingServiceInstanceWithFabric(String orchStatus) { + genericSearchExistingServiceInstance(); + SimulatorApi.registerExpectationFromPresets( + ImmutableList.of( + new PresetAAIFilterServiceInstanceById("e433710f-9217-458d-a79d-1c7aff376d89", + "TYLER SILVIA", + "c187e9fe-40c3-4862-b73e-84ff056205f61234"), + new PresetAAIGetSubDetailsGet("e433710f-9217-458d-a79d-1c7aff376d89", orchStatus), + new PresetAAIGetSubDetailsWithoutInstancesGet("e433710f-9217-458d-a79d-1c7aff376d89", true), + new PresetAAIPostNamedQueryForViewEdit("c187e9fe-40c3-4862-b73e-84ff056205f61234", false, true), + new PresetSDCGetServiceMetadataGet(serviceFabricSriovService), + new PresetSDCGetServiceToscaModelGet(serviceFabricSriovService), + new PresetAAIGetNetworkZones(), + new PresetMSOActivateFabricConfiguration("c187e9fe-40c3-4862-b73e-84ff056205f61234"), + new PresetMSOOrchestrationRequestGet("COMPLETE", "318cc766-b673-4a50-b9c5-471f68914584", "Success")), + SimulatorApi.RegistrationStrategy.APPEND); } public static void searchExistingServiceInstanceByOEAndProject(){ SimulatorApi.registerExpectationFromPresets(ImmutableList.of( - new PresetAAIGetModelsByOwningEntity("Wireline"), + new PresetAAIGetModelsByOwningEntity("Melissa"), new PresetAAIGetModelsByProject("x1"), new PresetAAIGetModelsByProject("yyy1") ), APPEND); @@ -52,7 +90,7 @@ public class BulkRegistration { genericSearchExistingServiceInstance(); SimulatorApi.registerExpectation( new String [] { - Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_USP_VOICE_CR, + Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_SILVIA_ROBBINS_CR, Constants.RegisterToSimulator.SearchForServiceInstance.FILTER_CR_SERVICE_INSTANCE_BY_ID, Constants.RegisterToSimulator.SearchForServiceInstance.NAMED_QUERY_CR_VIEW_EDIT, Constants.RegisterToSimulator.SearchForServiceInstance.GET_SDC_CATALOG_SERVICE_VID_TEST_CR, @@ -65,7 +103,7 @@ public class BulkRegistration { genericSearchExistingServiceInstance(); SimulatorApi.registerExpectation( new String [] { - Constants.RegisterToSimulator.AddSubinterface.GET_SUBSCRIBERS_FOR_CUSTOMER_USP_VOICE_VFC_IG, + Constants.RegisterToSimulator.AddSubinterface.GET_SUBSCRIBERS_FOR_CUSTOMER_SILVIA_ROBBINS_VFC_IG, Constants.RegisterToSimulator.AddSubinterface.FILTER_VFC_IG_SERVICE_INSTANCE_BY_ID, Constants.RegisterToSimulator.AddSubinterface.NAMED_QUERY_VFC_IG_VIEW_EDIT, Constants.RegisterToSimulator.AddSubinterface.GET_SDC_CATALOG_SERVICE_VID_TEST_444, @@ -77,17 +115,16 @@ public class BulkRegistration { SimulatorApi.registerExpectation( new String [] { Constants.RegisterToSimulator.genericRequest.ECOMP_PORTAL_GET_SESSION_SLOT_CHECK_INTERVAL, - Constants.RegisterToSimulator.SearchForServiceInstance.GET_FULL_SUBSCRIBERS, Constants.RegisterToSimulator.SearchForServiceInstance.GET_SERVICES - }, ImmutableMap.<String, Object>of(), SimulatorApi.RegistrationStrategy.APPEND); + SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(),SimulatorApi.RegistrationStrategy.APPEND); } public static void searchExistingServiceInstance2(String orchStatus) { genericSearchExistingServiceInstance(); SimulatorApi.registerExpectation( new String [] { - Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_FIREWALL_MISC, + Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_CRAIG_ROBERTS, Constants.RegisterToSimulator.SearchForServiceInstance.FILTER_SERVICE_INSTANCE_BY_ID_2, Constants.RegisterToSimulator.SearchForServiceInstance.NAMED_QUERY_VIEW_EDIT_2 }, ImmutableMap.<String, Object>of("<ORCH_STATUS>", orchStatus), SimulatorApi.RegistrationStrategy.APPEND); @@ -105,9 +142,10 @@ public class BulkRegistration { SimulatorApi.registerExpectationFromPreset(new PresetAAICloudRegionAndSourceFromConfigurationPut(configurationId, desiredCloudRegionId), APPEND); SimulatorApi.registerExpectationFromPreset(new PresetAAIGetPortMirroringSourcePorts(configurationId, portInterfaceId, "i'm a port", isMirrored), APPEND); + SimulatorApi.registerExpectationFromPreset(PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MDT1_TO_ATT_NC, APPEND); SimulatorApi.registerExpectation( new String [] { - Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_USP_VOICE, + Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_SILVIA_ROBBINS, Constants.RegisterToSimulator.SearchForServiceInstance.FILTER_SERVICE_INSTANCE_BY_ID_PM, Constants.RegisterToSimulator.SearchForServiceInstance.NAMED_QUERY_VIEW_EDIT_PM, Constants.RegisterToSimulator.SearchForServiceInstance.GET_SDC_CATALOG_SERVICE_PM, @@ -170,33 +208,24 @@ public class BulkRegistration { } - public static void activateDeactivateConfiguration(String orchStatus, String action, String desiredCloudRegionId) { - SimulatorApi.registerExpectation( - new String [] { - Constants.RegisterToSimulator.createConfiguration.MSO_ACTIVATE_CONFIGURATION, - }, ImmutableMap.<String, Object>of("<ACTION>",action,"mdt1", desiredCloudRegionId), SimulatorApi.RegistrationStrategy.APPEND); + public static void activateDeactivateConfiguration(String action) { + appendWithGetStatus(new PresetMSOActOnConfiguration(action), PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MDT1_TO_ATT_NC); } - public static void deleteConfiguration(String desiredCloudRegionId) { - SimulatorApi.registerExpectation( - new String [] { - Constants.RegisterToSimulator.createConfiguration.MSO_DELETE_CONFIGURATION, - Constants.RegisterToSimulator.createConfiguration.MSO_CREATE_CONFIGURATION_ORCH_REQ - }, ImmutableMap.of("mdt1", desiredCloudRegionId), SimulatorApi.RegistrationStrategy.APPEND); + public static void deleteConfiguration() { + appendWithGetStatus(new PresetMSODeleteConfiguration(), PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MDT1_TO_ATT_NC); } - public static void enableDisablePort(String action, String desiredCloudRegionId){ - SimulatorApi.registerExpectation( - new String [] { - Constants.RegisterToSimulator.createConfiguration.MSO_ACTIVATE_CONFIGURATION, - Constants.RegisterToSimulator.createConfiguration.MSO_ENABLE_DISABLE_PORT, - }, ImmutableMap.<String, Object>of("<ACTION>", action,"mdt1", desiredCloudRegionId), SimulatorApi.RegistrationStrategy.APPEND); + public static void enableDisablePort(String action){ + appendWithGetStatus(new PresetMsoEnableDisablePort( + "c187e9fe-40c3-4862-b73e-84ff056205f6", + "9533-config-LB1113", action), PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MDT1_TO_ATT_NC); } public static void addNetwork() { SimulatorApi.registerExpectation( new String [] { - Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_Mobility, + Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_Emanuel, Constants.RegisterToSimulator.addNetwork.AAI_GET_TENANTS, Constants.RegisterToSimulator.addNetwork.AAI_NAMED_QUERY_FOR_VIEW_EDIT, Constants.RegisterToSimulator.addNetwork.FILTER_SERVICE_INSTANCE_BY_ID, @@ -205,13 +234,7 @@ public class BulkRegistration { }, ImmutableMap.<String, Object>of(), SimulatorApi.RegistrationStrategy.APPEND); } - public static void msoAddNetwork(String instanceName){ - SimulatorApi.registerExpectation( - new String [] { - Constants.RegisterToSimulator.addNetwork.MSO_ADD_NETWORK_ORCH_REQ, - Constants.RegisterToSimulator.addNetwork.MSO_ADD_NETWORK - }, ImmutableMap.<String, Object>of("<SERVICE_INSTANCE_NAME>",instanceName), SimulatorApi.RegistrationStrategy.APPEND); - } + public static void msoAddNetworkError(String instanceName){ SimulatorApi.registerExpectation( new String [] { @@ -227,13 +250,15 @@ public class BulkRegistration { } - public static void createPolicyConfiguration(boolean isSuccessFlow, String desiredCloudRegionId) { + public static void createPolicyConfiguration(boolean isSuccessFlow, String serviceType) { createConfiguration(); - SimulatorApi.registerExpectation( - new String []{ - Constants.RegisterToSimulator.createConfiguration.GET_PNF_INSTANCES, - Constants.RegisterToSimulator.createConfiguration.GET_MODEL_BY_ONE_INVARIANT_ID - } , ImmutableMap.<String, Object>of("mdt1", desiredCloudRegionId), SimulatorApi.RegistrationStrategy.APPEND); + + SimulatorApi.registerExpectation(SimulatorApi.RegistrationStrategy.APPEND, + Constants.RegisterToSimulator.createConfiguration.GET_MODEL_BY_ONE_INVARIANT_ID); + + SimulatorApi.registerExpectation(Constants.RegisterToSimulator.createConfiguration.GET_PNF_INSTANCES, + ImmutableMap.of("<SERVICE-TYPE>", serviceType), SimulatorApi.RegistrationStrategy.APPEND); + if (isSuccessFlow) { msoCreatePProbeConfiguration(); } else { @@ -241,38 +266,33 @@ public class BulkRegistration { } } - public static void deletePolicyConfiguration(boolean isSuccessFlow, String desiredCloudRegionId) { + public static void deletePolicyConfiguration(boolean isSuccessFlow) { createConfiguration(); - SimulatorApi.registerExpectation( - new String []{ - Constants.RegisterToSimulator.createConfiguration.GET_PNF_INSTANCES, - Constants.RegisterToSimulator.createConfiguration.GET_MODEL_BY_ONE_INVARIANT_ID, - Constants.RegisterToSimulator.createConfiguration.MSO_DELETE_CONFIGURATION, - - } , ImmutableMap.<String, Object>of("mdt1", desiredCloudRegionId), SimulatorApi.RegistrationStrategy.APPEND); - if (isSuccessFlow) { - msoCreatePProbeConfiguration(); - } else { - msoCreatePProbeConfigurationError(); - } + SimulatorApi.registerExpectation(SimulatorApi.RegistrationStrategy.APPEND, + Constants.RegisterToSimulator.createConfiguration.GET_MODEL_BY_ONE_INVARIANT_ID); + appendWithGetStatus(new PresetMSODeleteConfiguration(), PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MDT1_TO_ATT_NC); } private static void msoCreatePProbeConfiguration() { - SimulatorApi.registerExpectation( - new String []{ - Constants.RegisterToSimulator.createConfiguration.MSO_CREATE_CONFIGURATION, - Constants.RegisterToSimulator.createConfiguration.MSO_CREATE_CONFIGURATION_ORCH_REQ - } , ImmutableMap.<String, Object>of(), SimulatorApi.RegistrationStrategy.APPEND); + appendWithGetStatus(new PresetMSOCreateConfiguration("c187e9fe-40c3-4862-b73e-84ff056205f6"), PresetAAIGetCloudOwnersByCloudRegionId.PRESET_AAIAIC25_TO_ATT_AIC); + } + + private static void appendWithGetStatus(PresetMSOBaseCreateInstancePost createInstancePreset, PresetAAIGetCloudOwnersByCloudRegionId cloudOwnerPreset) { + SimulatorApi.registerExpectationFromPresets(ImmutableList.of( + createInstancePreset, + cloudOwnerPreset, + new PresetMSOOrchestrationRequestGet(PresetMSOOrchestrationRequestGet.COMPLETE, createInstancePreset.getRequestId(), "Success")), + SimulatorApi.RegistrationStrategy.APPEND); } private static void msoCreatePProbeConfigurationError() { - SimulatorApi.registerExpectation( - new String []{ - Constants.RegisterToSimulator.createConfiguration.MSO_CREATE_CONFIGURATION_ERROR - } , ImmutableMap.<String, Object>of(), SimulatorApi.RegistrationStrategy.APPEND); + SimulatorApi.registerExpectationFromPresets(ImmutableList.of( + new PresetMSOCreateConfiguration("c187e9fe-40c3-4862-b73e-84ff056205f6", 500, null), + PresetAAIGetCloudOwnersByCloudRegionId.PRESET_AAIAIC25_TO_ATT_AIC), + SimulatorApi.RegistrationStrategy.APPEND); } public static void createConfiguration() { @@ -295,31 +315,28 @@ public class BulkRegistration { } public static void createNewServiceInstance(String subscriber) { - SimulatorApi.registerExpectation( - new String []{ - Constants.RegisterToSimulator.CreateNewServiceInstance.GET_FULL_SUBSCRIBES, - Constants.RegisterToSimulator.CreateNewServiceInstance.GET_SERVICES - } , ImmutableMap.<String, Object>of(), SimulatorApi.RegistrationStrategy.APPEND); + SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(),SimulatorApi.RegistrationStrategy.APPEND); + SimulatorApi.registerExpectation(Constants.RegisterToSimulator.CreateNewServiceInstance.GET_SERVICES, SimulatorApi.RegistrationStrategy.APPEND); switch (subscriber) { - case "USP VOICE": createNewServiceInstanceUspVoice(); break; - case "MSO_1610_ST": createNewServiceInstanceMso1610ST(); break; + case "SILVIA ROBBINS": createNewServiceInstanceUspVoice(); break; + case "CAR_2020_ER": createNewServiceInstanceMso1610ST(); break; } } private static void createNewServiceInstanceMso1610ST() { SimulatorApi.registerExpectation( new String []{ - Constants.RegisterToSimulator.CreateNewServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_MSO_1610_ST, - Constants.RegisterToSimulator.CreateNewServiceInstance.GET_MODELS_BY_SERVICE_TYPE_MSO_1610_ST + Constants.RegisterToSimulator.CreateNewServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_CAR_2020_ER, + Constants.RegisterToSimulator.CreateNewServiceInstance.GET_MODELS_BY_SERVICE_TYPE_CAR_2020_ER } , ImmutableMap.<String, Object>of(), SimulatorApi.RegistrationStrategy.APPEND); } private static void createNewServiceInstanceUspVoice() { SimulatorApi.registerExpectation( new String []{ - Constants.RegisterToSimulator.CreateNewServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_USP_VOICE, - Constants.RegisterToSimulator.CreateNewServiceInstance.GET_MODELS_BY_SERVICE_TYPE_USP_VOICE + Constants.RegisterToSimulator.CreateNewServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_SILVIA_ROBBINS, + Constants.RegisterToSimulator.CreateNewServiceInstance.GET_MODELS_BY_SERVICE_TYPE_SILVIA_ROBBINS } , ImmutableMap.<String, Object>of(), SimulatorApi.RegistrationStrategy.APPEND); } @@ -336,26 +353,34 @@ public class BulkRegistration { public static void searchExistingServiceInstanceWithoutModelVerId() { SimulatorApi.registerExpectation( new String []{ - Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_FIREWALL_MISC, + Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_CRAIG_ROBERTS, Constants.RegisterToSimulator.SearchForServiceInstance.FILTER_SERVICE_INSTANCE_BY_ID_NO_MODEL_VER_ID, // Constants.RegisterToSimulator.SearchForServiceInstance.NAMED_QUERY_VIEW_EDIT_NO_MODEL_VER_ID } , ImmutableMap.<String, Object>of(), SimulatorApi.RegistrationStrategy.APPEND); } - public static void deleteExistingInstance(String orchStatus, String type) { + public static void deleteExistingInstance(String orchStatus, String type) { + deleteExistingInstance(orchStatus, type, "pending-delete"); + } + + public static void deleteExistingInstance(String orchStatus, String type, String vfModuleOrchStatus) { genericSearchExistingServiceInstance(); SimulatorApi.registerExpectation( new String [] { - Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_USP_VOICE, + Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_SILVIA_ROBBINS, Constants.RegisterToSimulator.SearchForServiceInstance.NAMED_QUERY_VIEW_EDIT, Constants.RegisterToSimulator.CreateNewServiceInstance.deploy.GET_AIC_ZONES - }, ImmutableMap.<String, Object>of("<ORCH_STATUS>", orchStatus), SimulatorApi.RegistrationStrategy.APPEND); + }, ImmutableMap.<String, Object>of("<ORCH_STATUS>", orchStatus, "<VF_MODULE_ORCH_STATUS>", vfModuleOrchStatus), SimulatorApi.RegistrationStrategy.APPEND); SimulatorApi.registerExpectationFromPresets( ImmutableList.of( new PresetAAIGetTenants(), new PresetMSODeleteInstanceOrchestrationRequestGet(type), new PresetSDCGetServiceMetadataGet("7a6ee536-f052-46fa-aa7e-2fca9d674c44", "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0", "service-Complexservice-aLaCarte-csar.zip"), - new PresetSDCGetServiceToscaModelGet("7a6ee536-f052-46fa-aa7e-2fca9d674c44", "service-Complexservice-aLaCarte-csar.zip")), + new PresetSDCGetServiceToscaModelGet("7a6ee536-f052-46fa-aa7e-2fca9d674c44", "service-Complexservice-aLaCarte-csar.zip"), + new PresetMSODeactivateAndCloudDelete("3f93c7cb-2fd0-4557-9514-e189b7b04f9d", "c015cc0f-0f37-4488-aabf-53795fd93cd3", + "a231a99c-7e75-4d6d-a0fb-5c7d26f30f77", "c0011670-0e1a-4b74-945d-8bf5aede1d9c", "irma-aic"), + PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MTN6_TO_ATT_AIC + ), SimulatorApi.RegistrationStrategy.APPEND); } @@ -383,7 +408,23 @@ public class BulkRegistration { deleteExistingInstance(orchStatus, "Service"); SimulatorApi.registerExpectationFromPresets(ImmutableList.of( new PresetMSODeleteService(), - new PresetAAIPostNamedQueryForViewEdit("3f93c7cb-2fd0-4557-9514-e189b7b04f9d", false)), SimulatorApi.RegistrationStrategy.APPEND); + new PresetAAIPostNamedQueryForViewEdit("3f93c7cb-2fd0-4557-9514-e189b7b04f9d", false, false)), SimulatorApi.RegistrationStrategy.APPEND); + } + + public static void resumeWithHomingDataVfModule(String serviceOrchStatus, String vfModuleOrchStatus, String vfModuleName) { + SimulatorApi.registerExpectation(Constants.RegisterToSimulator.SearchForServiceInstance.NAMED_QUERY_VIEW_EDIT, + ImmutableMap.<String, Object>of("<ORCH_STATUS>", serviceOrchStatus, "<VF_MODULE_ORCH_STATUS>", vfModuleOrchStatus), + SimulatorApi.RegistrationStrategy.APPEND); + + SimulatorApi.registerExpectationFromPresets( + ImmutableList.of ( + PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MDT1_TO_ATT_NC, + new PresetAAIGetHomingForVfModule("c015cc0f-0f37-4488-aabf-53795fd93cd3", "a231a99c-7e75-4d6d-a0fb-5c7d26f30f77", "092eb9e8e4b7412e8787dd091bc58e86", "mdt1"), + new PresetMSOCreateVfModule("3f93c7cb-2fd0-4557-9514-e189b7b04f9d", + "c015cc0f-0f37-4488-aabf-53795fd93cd3", ATT_NC, vfModuleName, + "7a6ee536-f052-46fa-aa7e-2fca9d674c44", "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0", "ComplexService"), + new PresetMSOOrchestrationRequestGet("COMPLETE","c0011670-0e1a-4b74-945d-8bf5aede1d9c",Constants.ViewEdit.VF_MODULE_CREATED_SUCCESSFULLY_TEXT)), + SimulatorApi.RegistrationStrategy.APPEND); } public static void resumeVfModule(String serviceInstanceId, String vnfInstanceId ){ @@ -391,7 +432,8 @@ public class BulkRegistration { SimulatorApi.registerExpectationFromPresets( ImmutableList.of ( new PresetAAIGetTenants(), - new PresetMSOCreateVfModuleInstancePost(serviceInstanceId,vnfInstanceId), + PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MDT1_TO_ATT_NC, + new PresetMSOCreateVfModule(serviceInstanceId,vnfInstanceId, ATT_NC), new PresetMSOOrchestrationRequestGet("COMPLETE","c0011670-0e1a-4b74-945d-8bf5aede1d9c",Constants.ViewEdit.VF_MODULE_CREATED_SUCCESSFULLY_TEXT)), SimulatorApi.RegistrationStrategy.APPEND); diff --git a/vid-automation/src/main/java/vid/automation/test/services/DropTestApiField.java b/vid-automation/src/main/java/vid/automation/test/services/DropTestApiField.java index e175b88b1..bb50438ca 100644 --- a/vid-automation/src/main/java/vid/automation/test/services/DropTestApiField.java +++ b/vid-automation/src/main/java/vid/automation/test/services/DropTestApiField.java @@ -1,64 +1,73 @@ -package vid.automation.test.services; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; -import vid.automation.test.infra.Features; - -import java.io.IOException; -import java.util.Arrays; -import java.util.function.UnaryOperator; - -public class DropTestApiField { - - public static UnaryOperator<String> dropTestApiFieldFromString() { - if (Features.FLAG_ADD_MSO_TESTAPI_FIELD.isActive()) { - // do nothing - return in -> in; - } else { - final ObjectMapper objectMapper = new ObjectMapper(); - return in -> { - if (!in.contains("testApi")) { - // short circuit - return in; - } - - try { - final JsonNode tree = objectMapper.readTree(in); - final JsonNode node = tree.path("simulatorRequest"); - if (removePath(node, "body", "requestDetails", "requestParameters", "testApi") != null) { - // tree modified, write back to string - return objectMapper.writeValueAsString(tree); - } else { - // else... - return in; - } - } catch (IOException e) { - return in; - } - }; - } - } - - private static JsonNode removePath(JsonNode tree, String... nodes) { - // remove the nodes; remove also the parent, if an empty object was left - // returns the removed node - // returns null if no modification to tree - if (nodes.length > 1) { - final JsonNode node = tree.path(nodes[0]); - final JsonNode removed = removePath(node, Arrays.copyOfRange(nodes, 1, nodes.length)); - if (removed != null && node.size() == 0) { - return removePath(tree, nodes[0]); - } else { - return removed; // non-null if node.size() != 0 - } - } else { - if (tree instanceof ObjectNode) { - return ((ObjectNode) tree).remove(nodes[0]); - } else { - return null; - } - } - } - -} +package vid.automation.test.services;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import vid.automation.test.infra.Features;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.function.UnaryOperator;
+
+public class DropTestApiField {
+
+ public static UnaryOperator<String> dropTestApiFieldFromString() {
+ return dropFieldFromString("testApi", Features.FLAG_ADD_MSO_TESTAPI_FIELD,
+ "simulatorRequest", "body", "requestDetails", "requestParameters", "testApi");
+ }
+
+ public static UnaryOperator<String> dropFieldCloudOwnerFromString() {
+ return dropFieldFromString("cloudOwner", Features.FLAG_ADD_MSO_TESTAPI_FIELD,
+ "simulatorRequest", "body", "requestDetails", "cloudConfiguration", "cloudOwner");
+ }
+ private static UnaryOperator<String> dropFieldFromString(String text, Features featureFlag, String basePath, String... nodes){
+ if (featureFlag.isActive()) {
+ // do nothing
+ return in -> in;
+ } else {
+ final ObjectMapper objectMapper = new ObjectMapper();
+ return in -> {
+ if (!in.contains(text)) {
+ // short circuit
+ return in;
+ }
+
+ try {
+ final JsonNode tree = objectMapper.readTree(in);
+ final JsonNode node = tree.path(basePath);
+ if (removePath(node, nodes) != null) {
+ // tree modified, write back to string
+ return objectMapper.writeValueAsString(tree);
+ } else {
+ // else...
+ return in;
+ }
+ } catch (IOException e) {
+ return in;
+ }
+ };
+ }
+ }
+
+ private static JsonNode removePath(JsonNode tree, String... nodes) {
+ // remove the nodes; remove also the parent, if an empty object was left
+ // returns the removed node
+ // returns null if no modification to tree
+ if (nodes.length > 1) {
+ final JsonNode node = tree.path(nodes[0]);
+ final JsonNode removed = removePath(node, Arrays.copyOfRange(nodes, 1, nodes.length));
+ if (removed != null && node.size() == 0) {
+ return removePath(tree, nodes[0]);
+ } else {
+ return removed; // non-null if node.size() != 0
+ }
+ } else {
+ if (tree instanceof ObjectNode) {
+ return ((ObjectNode) tree).remove(nodes[0]);
+ } else {
+ return null;
+ }
+ }
+ }
+
+}
diff --git a/vid-automation/src/main/java/vid/automation/test/services/ServicesService.java b/vid-automation/src/main/java/vid/automation/test/services/ServicesService.java index 34303a972..264b2c16d 100644 --- a/vid-automation/src/main/java/vid/automation/test/services/ServicesService.java +++ b/vid-automation/src/main/java/vid/automation/test/services/ServicesService.java @@ -1,7 +1,7 @@ package vid.automation.test.services; import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.onap.sdc.ci.tests.utilities.FileHandling; import vid.automation.test.model.Service; import vid.automation.test.model.ServiceModel; import vid.automation.test.model.ServiceModelsList; diff --git a/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java b/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java index 29f6eae7c..65ef3679c 100644 --- a/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java +++ b/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java @@ -1,30 +1,36 @@ package vid.automation.test.services; -import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; -import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; +import static org.testng.Assert.assertEquals; +import static vid.automation.test.services.DropTestApiField.dropFieldCloudOwnerFromString; +import static vid.automation.test.services.DropTestApiField.dropTestApiFieldFromString; + +import com.fasterxml.jackson.databind.DeserializationFeature; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import org.glassfish.jersey.client.ClientProperties; -import org.glassfish.jersey.uri.internal.JerseyUriBuilder; -import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; -import org.onap.simulator.presetGenerator.presets.model.RegistrationRequest; -import org.springframework.http.HttpStatus; -import vid.automation.test.utils.ReadFile; - +import java.net.URI; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.function.UnaryOperator; +import java.util.stream.Collectors; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Entity; import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.GenericType; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import java.net.URI; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.function.UnaryOperator; - -import static org.testng.Assert.assertEquals; -import static vid.automation.test.services.DropTestApiField.dropTestApiFieldFromString; +import org.glassfish.jersey.client.ClientProperties; +import org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonProvider; +import org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJsonProvider; +import org.glassfish.jersey.uri.internal.JerseyUriBuilder; +import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; +import org.onap.simulator.presetGenerator.presets.model.RegistrationRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import vid.automation.test.utils.ReadFile; public class SimulatorApi { @@ -32,15 +38,31 @@ public class SimulatorApi { APPEND, CLEAR_THEN_SET } + private static final Logger logger = LoggerFactory.getLogger(SimulatorApi.class); + + /* + these classes are partial representation of org.mockserver.model.HttpRequest. + We can not use HttpRequest since it contains Map with NottableString and jackson throw the following error : + com.fasterxml.jackson.databind.JsonMappingException: Can not find a (Map) Key deserializer for type + [simple type, class org.mockserver.model.NottableString] + */ + public static class Path { + public String value; + } + + public static class HttpRequest{ + public Path path; + } + private static final URI uri; //uri for registration private static final URI simulationUri; //uri for getting simulated responses private static final Client client; private static final List<UnaryOperator<String>> presetStringPostProccessors = - ImmutableList.of(dropTestApiFieldFromString()); + ImmutableList.of(dropTestApiFieldFromString(), dropFieldCloudOwnerFromString()); static { - String host = System.getProperty("VID_HOST", "127.0.0.1" ); + String host = System.getProperty("VID_HOST", "10.0.0.10" ); Integer port = Integer.valueOf(System.getProperty("SIM_PORT", System.getProperty("VID_PORT", "8080"))); //port for registration uri = new JerseyUriBuilder().host(host).port(port).scheme("http").path("vidSimulator").build(); client = ClientBuilder.newClient(); @@ -49,6 +71,7 @@ public class SimulatorApi { // org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: // MessageBodyWriter not found for media type=application/json JacksonJsonProvider jacksonJsonProvider = new JacksonJaxbJsonProvider(); + jacksonJsonProvider.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); client.register(jacksonJsonProvider); Integer simulationPort = Integer.valueOf(System.getProperty("SIMULATION_PORT", "1080")); //port getting simulated responses @@ -84,13 +107,13 @@ public class SimulatorApi { content = content.replaceAll(templateParam.getKey(), templateParam.getValue().toString()); } - registerToSimulatorAndAssertSuccess(content, registrationStrategy); + registerToSimulatorAndAssertSuccess(expectationTemplateFilename, content, registrationStrategy); } public static void registerExpectationFromPreset(BasePreset preset, RegistrationStrategy registrationStrategy) { RegistrationRequest content = preset.generateScenario(); - registerToSimulatorAndAssertSuccess(content, registrationStrategy); + registerToSimulatorAndAssertSuccess(preset.getClass().getCanonicalName(), content, registrationStrategy); } public static void registerExpectationFromPresets(Collection<BasePreset> presets, RegistrationStrategy registrationStrategy) { @@ -99,7 +122,7 @@ public class SimulatorApi { } presets.forEach( preset-> { - try {registerToSimulatorAndAssertSuccess(preset.generateScenario());} + try {registerToSimulatorAndAssertSuccess(preset.getClass().getCanonicalName(), preset.generateScenario());} catch (RuntimeException e) { throw new RuntimeException("Failed to register preset "+preset.getClass().getName(), e); } @@ -107,14 +130,31 @@ public class SimulatorApi { ); } - private static void registerToSimulatorAndAssertSuccess(Object content, RegistrationStrategy registrationStrategy) { +// public static List<HttpRequest> retrieveRecordedRequests() { +// Response response = client.target(uri).path("retrieveRecordedRequests").request().get(); +// return response.readEntity(new GenericType<List<HttpRequest>>(){}); +// } + + /* + This method return counter of requests that has been sent to simulator. + The key of the map is a path, and the value is counter + */ + public static Map<String, Long> retrieveRecordedRequestsPathCounter() { + Response response = client.target(uri).path("retrieveRecordedRequests").request().get(); + List<HttpRequest> httpRequests = response.readEntity(new GenericType<List<HttpRequest>>(){}); + return httpRequests.stream().map(x->x.path.value).collect( + Collectors.groupingBy(Function.identity(), Collectors.counting())); + } + + private static void registerToSimulatorAndAssertSuccess(String name, Object content, RegistrationStrategy registrationStrategy) { if (registrationStrategy == RegistrationStrategy.CLEAR_THEN_SET) { clearRegistrations(); } - registerToSimulatorAndAssertSuccess(content); + registerToSimulatorAndAssertSuccess(name, content); } - private static void registerToSimulatorAndAssertSuccess(Object content) { + private static void registerToSimulatorAndAssertSuccess(String name, Object content) { + logger.info("Setting {}", name); content = postProccessContent(content); @@ -137,6 +177,7 @@ public class SimulatorApi { } private static void clearRegistrations() { + logger.info("Clearing Registrations"); Response response = createSimulatorRegistrationWebTarget().request().delete(); assertEquals(response.getStatus(), HttpStatus.OK.value()); } diff --git a/vid-automation/src/main/java/vid/automation/test/services/UsersService.java b/vid-automation/src/main/java/vid/automation/test/services/UsersService.java index ac8af4511..aae7917f7 100644 --- a/vid-automation/src/main/java/vid/automation/test/services/UsersService.java +++ b/vid-automation/src/main/java/vid/automation/test/services/UsersService.java @@ -1,12 +1,10 @@ package vid.automation.test.services; -import com.google.common.primitives.Ints; -import org.apache.commons.lang3.StringUtils; -import vid.automation.test.model.User; -import vid.automation.test.model.UsersObject; -import vid.automation.test.utils.DB_CONFIG; -import vid.automation.test.utils.ReadFile; +import static org.hamcrest.CoreMatchers.everyItem; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.greaterThan; +import com.google.common.primitives.Ints; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; @@ -15,10 +13,11 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; - -import static org.hamcrest.CoreMatchers.everyItem; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.greaterThan; +import org.apache.commons.lang3.StringUtils; +import vid.automation.test.model.User; +import vid.automation.test.model.UsersObject; +import vid.automation.test.utils.DB_CONFIG; +import vid.automation.test.utils.ReadFile; /** * Created by itzikliderman on 08/09/2017. @@ -53,7 +52,7 @@ public class UsersService { /* Creates a user in the DB, were: - Login user name is a deterministic number, hashed from the userId string, with 3 trailing zeroes, - and two leading letters from the userId itself; e.g. "mo26063000" for mobility. + and two leading letters from the userId itself; e.g. "mo26063000" for emanuel. - Login user name == user password - 'user.credentials.userId' and 'user.credentials.password' input fields are overridden with the generated values. - Roles are "read" (roleId==16) and all other roles in object (like subscriberName___serviceType___tenant). @@ -77,7 +76,7 @@ public class UsersService { user.credentials.password = getLoginId(userId); stmt.addBatch("INSERT INTO `fn_user` (`USER_ID`, `ORG_USER_ID`, `FIRST_NAME`, `LOGIN_ID`, `LOGIN_PWD`) " + - "VALUES (" + userNumber + ", '" + userId + "', '" + userId + "', '" + user.credentials.userId + "', '" + user.credentials.password + "')"); + "VALUES (" + userNumber + ", '" + user.credentials.userId + "', '" + userId + "', '" + user.credentials.userId + "', '" + user.credentials.password + "')"); List<String> roles = user.roles != null ? user.roles : new LinkedList<>(); roles.add("Standard User"); diff --git a/vid-automation/src/main/java/vid/automation/test/test/ALaCarteflowTest.java b/vid-automation/src/main/java/vid/automation/test/test/ALaCarteflowTest.java index 7f641d303..69c619b2a 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/ALaCarteflowTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/ALaCarteflowTest.java @@ -1,9 +1,26 @@ package vid.automation.test.test; +import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId.ATT_NC; +import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId.MDT_1; +import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MDT1_TO_ATT_NC; +import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId.PRESET_SOME_LEGACY_REGION_TO_ATT_AIC; +import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId.SOME_LEGACY_REGION; +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; + +import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.datatypes.UserCredentials; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.datatypes.UserCredentials; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVfModuleOldViewEdit; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVnfALaCarteOldViewEdit; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVolumeGroupOldViewEdit; import org.openqa.selenium.WebElement; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; @@ -19,32 +36,26 @@ import vid.automation.test.sections.ViewEditPage; import vid.automation.test.services.ServicesService; import vid.automation.test.services.SimulatorApi; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; - public class ALaCarteflowTest extends CreateInstanceDialogBaseTest { - static final String SUBSCRIBER = "Mobility"; + static final String SUBSCRIBER = "Emanuel"; static final String SERVICE_NAME = "ggghhh"; static final String SERVICE_ID = "537d3eb0-b7ab-4fe8-a438-6166ab6af49b"; static final String VNF_ID = "0eb38f69-d96b-4d5e-b8c9-3736c292f0f7"; - static final String DEFAULT_TEST_API_VALUE = "GR_API"; + static final String DEFAULT_TEST_API_VALUE = "VNF_API"; public static final String SERVICE_INSTANCE_ID = "SERVICE_INSTANCE_ID"; public static final String A_LACARTE_FLOW_GET_ORCHESTRATION = "aLacarteFlow/get_orchestration_request_status.json"; public static final String ORCHESTRATION_REQUEST_ID = "orchestrationRequestId"; public static final String STATUS_MESSAGE = "status_message"; public static final String REQUEST_TYPE = "REQUEST-TYPE"; public static final String CREATE = "Create"; - public static final String AAIAIC_25 = "AAIAIC25"; + public static final String AAIAIC_25 = "JANET25"; + public static final String AIC = "AIC"; public static final String TENANT = "092eb9e8e4b7412e8787dd091bc58e86"; public static final String FALSE = "false"; - public static final String NODE_INSTANCE = "VSP1710PID298109_vMMSC 0"; + public static final String NODE_INSTANCE = "VSP1710PID298109_vWINIFRED 0"; public static final String MODEL = "959a7ba0-89ee-4984-9af6-65d5bdda4b0e"; - public static final String LEGACY_REGION = "some legacy region"; + private static final String CREATE_VNF_REQUEST_ID = "dbe54591-c8ed-46d3-abc7-d3a24873dfbd"; @BeforeClass @@ -54,12 +65,11 @@ public class ALaCarteflowTest extends CreateInstanceDialogBaseTest { "ecompportal_getSessionSlotCheckInterval.json", "search_for_service_instance/aai_get_services.json" , "create_configuration/aai_get_tenants.json" - , "sanity/get_aai_get_subscribers.json" , "sanity/get_aai_sub_details.json" , "aLacarteFlow/get_aai_search_named_query.json" , "aLacarteFlow/get_sdc_catalog_services_ggghhh.json" ); - + SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(), SimulatorApi.RegistrationStrategy.APPEND); } @@ -68,15 +78,30 @@ public class ALaCarteflowTest extends CreateInstanceDialogBaseTest { withMsoTestApiConfiguration(msoTestApiOption, msoTestApiValue, () -> { final String REQUEST_ID = "dbe54591-c8ed-46d3-abc7-d3a24873bddd"; final String MODEL_UUID = "d205e01d-e5da-4e68-8c52-f95cb0607959"; - SimulatorApi.registerExpectation("aLacarteFlow/mso_create_vf_module.json", ImmutableMap.of(SERVICE_INSTANCE_ID, SERVICE_ID, "VNF_INSTANCE_ID", VNF_ID, "REQUEST_ID", REQUEST_ID, DEFAULT_TEST_API_VALUE, msoTestApiValue), APPEND); + + String vfModuleName = viewEditPage.generateInstanceName(Constants.ViewEdit.VF_MODULE_INSTANCE_NAME_PREFIX); + + SimulatorApi.registerExpectationFromPresets(ImmutableList.of( + PRESET_MDT1_TO_ATT_NC, + new PresetMSOCreateVfModuleOldViewEdit( + REQUEST_ID, + BaseMSOPreset.DEFAULT_INSTANCE_ID, + SERVICE_ID, + VNF_ID, + vfModuleName, + msoTestApiValue, + ATT_NC)), + SimulatorApi.RegistrationStrategy.APPEND); + + SimulatorApi.registerExpectation(A_LACARTE_FLOW_GET_ORCHESTRATION, ImmutableMap.of(ORCHESTRATION_REQUEST_ID, REQUEST_ID, STATUS_MESSAGE, Constants.ViewEdit.VF_MODULE_CREATED_SUCCESSFULLY_TEXT, REQUEST_TYPE, CREATE), APPEND); GeneralUIUtils.ultimateWait(); goToInstance(); ServiceModel serviceInstance = new ServicesService().getServiceModel(MODEL_UUID); - addVFModule("Vsp1710pid298109Vmmsc..mmsc_mod1_ltm..module-8", AAIAIC_25, - TENANT, FALSE, "mdt1", getCurrentUser().tenants, serviceInstance); + addVFModule("Vsp1710pid298109Vmmsc..mmsc_mod1_ltm..module-8", vfModuleName, AAIAIC_25, AIC, + TENANT, FALSE, MDT_1, getCurrentUser().tenants, serviceInstance); }); } @@ -84,17 +109,17 @@ public class ALaCarteflowTest extends CreateInstanceDialogBaseTest { @Test private void testTenant() throws Exception { ViewEditPage viewEditPage = new ViewEditPage(); - User user = usersService.getUser("Mobility_with_tenant"); + User user = usersService.getUser("Emanuel_with_tenant"); relogin(user.credentials); goToInstance(); viewEditPage.selectNodeInstanceToAdd(NODE_INSTANCE); viewEditPage.setInstanceName("New and fun instance"); viewEditPage.selectProductFamily("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - viewEditPage.selectLCPRegion("mtn6"); + viewEditPage.selectLcpRegion("hvf6", AIC); List<WebElement> tenantOptions = Get.byClass(Constants.ViewEdit.TENANT_OPTION_CLASS); List<WebElement> enabledTenantOption = tenantOptions.stream().filter(webElement -> webElement.isEnabled()).collect(Collectors.toList()); Assert.assertTrue(enabledTenantOption.size() == 1); - Assert.assertTrue(enabledTenantOption.get(0).getText().equals("test-mtn6-09")); + Assert.assertTrue(enabledTenantOption.get(0).getText().equals("test-hvf6-09")); // SimulatorApi.registerExpectation("aLacarteFlow/get_sdc_catalog_services_ggghhh.json",APPEND); } @@ -104,20 +129,23 @@ public class ALaCarteflowTest extends CreateInstanceDialogBaseTest { withMsoTestApiConfiguration(msoTestApiOption, msoTestApiValue, () -> { final String MODEL_UUID = MODEL; String instanceName = new VidBasePage().generateInstanceName(Constants.ViewEdit.VNF_INSTANCE_NAME_PREFIX); - SimulatorApi.registerExpectation("aLacarteFlow/mso_create_vnf.json", ImmutableMap.of( - SERVICE_INSTANCE_ID, SERVICE_ID, - "</?LOB>", "", - "INSTANCE_NAME", instanceName, - DEFAULT_TEST_API_VALUE, msoTestApiValue - ), APPEND); + SimulatorApi.registerExpectationFromPresets(ImmutableList.of( + PRESET_SOME_LEGACY_REGION_TO_ATT_AIC, + new PresetMSOCreateVnfALaCarteOldViewEdit( + CREATE_VNF_REQUEST_ID, + SERVICE_ID, + instanceName, + true, + msoTestApiValue)), + SimulatorApi.RegistrationStrategy.APPEND); SimulatorApi.registerExpectation(A_LACARTE_FLOW_GET_ORCHESTRATION, ImmutableMap.of(ORCHESTRATION_REQUEST_ID, "dbe54591-c8ed-46d3-abc7-d3a24873dfbd", STATUS_MESSAGE, Constants.ViewEdit.VNF_CREATED_SUCCESSFULLY_TEXT, REQUEST_TYPE, CREATE), APPEND); GeneralUIUtils.ultimateWait(); goToInstance(); ServiceModel serviceInstance = new ServicesService().getServiceModel(MODEL_UUID); - addVNF(NODE_INSTANCE, AAIAIC_25, TENANT, - FALSE, LEGACY_REGION, "ebc3bc3d-62fd-4a3f-a037-f619df4ff034", "platform", getCurrentUser().tenants, new ArrayList<>(Arrays.asList("ECOMP")), serviceInstance, instanceName); + addVNF(NODE_INSTANCE, AAIAIC_25, AIC, TENANT, + FALSE, SOME_LEGACY_REGION, "ebc3bc3d-62fd-4a3f-a037-f619df4ff034", "platform", getCurrentUser().tenants, new ArrayList<>(Arrays.asList("ONAP")), serviceInstance, instanceName); }); } @@ -126,19 +154,22 @@ public class ALaCarteflowTest extends CreateInstanceDialogBaseTest { withMsoTestApiConfiguration(msoTestApiOption, msoTestApiValue, () -> { goToInstance(); String instanceName = new VidBasePage().generateInstanceName(Constants.ViewEdit.VNF_INSTANCE_NAME_PREFIX); - SimulatorApi.registerExpectation("aLacarteFlow/mso_create_vnf.json", ImmutableMap.of( - SERVICE_INSTANCE_ID, SERVICE_ID, - "<LOB>.*</LOB>", "", - "INSTANCE_NAME", instanceName, - DEFAULT_TEST_API_VALUE, msoTestApiValue - ), APPEND); + SimulatorApi.registerExpectationFromPresets(ImmutableList.of( + PRESET_SOME_LEGACY_REGION_TO_ATT_AIC, + new PresetMSOCreateVnfALaCarteOldViewEdit( + CREATE_VNF_REQUEST_ID, + SERVICE_ID, + instanceName, + false, + msoTestApiValue)), + SimulatorApi.RegistrationStrategy.APPEND); SimulatorApi.registerExpectation(A_LACARTE_FLOW_GET_ORCHESTRATION, ImmutableMap.of( ORCHESTRATION_REQUEST_ID, "dbe54591-c8ed-46d3-abc7-d3a24873dfbd", STATUS_MESSAGE, Constants.ViewEdit.VNF_CREATED_SUCCESSFULLY_TEXT, REQUEST_TYPE, CREATE ), APPEND); - openAndFillVnfPopup(NODE_INSTANCE, AAIAIC_25, TENANT, - FALSE, LEGACY_REGION, "ebc3bc3d-62fd-4a3f-a037-f619df4ff034", "platform", getCurrentUser().tenants, null, null, instanceName); + openAndFillVnfPopup(NODE_INSTANCE, AAIAIC_25, AIC, TENANT, + FALSE, SOME_LEGACY_REGION, "ebc3bc3d-62fd-4a3f-a037-f619df4ff034", "platform", getCurrentUser().tenants, null, null, instanceName); assertConfirmShowMissingDataErrorOnCurrentPopup(Constants.ViewEdit.LINE_OF_BUSINESS_TEXT); successConfirmVnfAndClosePopup(); }); @@ -146,7 +177,7 @@ public class ALaCarteflowTest extends CreateInstanceDialogBaseTest { @Test private void emptyLobAfterReopenCreateVnfDialog() throws Exception { - final String lobToSelect = "ECOMP"; + final String lobToSelect = "ONAP"; goToInstance(); ViewEditPage viewEditPage = new ViewEditPage(); viewEditPage.selectNodeInstanceToAdd(NODE_INSTANCE); @@ -164,20 +195,30 @@ public class ALaCarteflowTest extends CreateInstanceDialogBaseTest { withMsoTestApiConfiguration(msoTestApiOption, msoTestApiValue, () -> { final String REQUEST_ID = "dbe54591-c8ed-46d3-abc7-d3a24873bdaa"; final String MODEL_UUID = "13f022c4-651e-4326-b8e1-61e9a8c7a7ad"; - SimulatorApi.registerExpectation("aLacarteFlow/mso_create_volume_group.json", ImmutableMap.of(SERVICE_INSTANCE_ID, SERVICE_ID, "VNF_INSTANCE_ID", VNF_ID, "REQUEST_ID", REQUEST_ID, DEFAULT_TEST_API_VALUE, msoTestApiValue), SimulatorApi.RegistrationStrategy.APPEND); + String vgName = viewEditPage.generateInstanceName(Constants.ViewEdit.VOLUME_GROUP_INSTANCE_NAME_PREFIX); + SimulatorApi.registerExpectationFromPresets(ImmutableList.of( + PRESET_SOME_LEGACY_REGION_TO_ATT_AIC, + new PresetMSOCreateVolumeGroupOldViewEdit( + REQUEST_ID, + BaseMSOPreset.DEFAULT_INSTANCE_ID, + SERVICE_ID, + VNF_ID, + vgName, + msoTestApiValue)), + SimulatorApi.RegistrationStrategy.APPEND); SimulatorApi.registerExpectation(A_LACARTE_FLOW_GET_ORCHESTRATION, ImmutableMap.of(ORCHESTRATION_REQUEST_ID, REQUEST_ID, STATUS_MESSAGE, Constants.ViewEdit.VOLUME_GROUP_CREATED_SUCCESSFULLY_TEXT, REQUEST_TYPE, CREATE), SimulatorApi.RegistrationStrategy.APPEND); GeneralUIUtils.ultimateWait(); goToInstance(); ServiceModel serviceInstance = new ServicesService().getServiceModel(MODEL_UUID); - addVolumeGroup("Vsp1710pid298109Vmmsc..mmsc_mod6_eca_oam..module-3", AAIAIC_25, TENANT, - FALSE, LEGACY_REGION, getCurrentUser().tenants, serviceInstance); + addVolumeGroup("Vsp1710pid298109Vmmsc..mmsc_mod6_eca_oam..module-3", vgName, AAIAIC_25, AIC, TENANT, + FALSE, SOME_LEGACY_REGION, getCurrentUser().tenants, serviceInstance); }); } private User getCurrentUser() { - return usersService.getUser(Constants.Users.MOBILITY_VMMSC); + return usersService.getUser(Constants.Users.EMANUEL_vWINIFRED); } private void goToInstance() { @@ -189,14 +230,14 @@ public class ALaCarteflowTest extends CreateInstanceDialogBaseTest { @Override protected UserCredentials getUserCredentials() { User user = getCurrentUser(); - return new UserCredentials(user.credentials.userId, user.credentials.password, Constants.Users.MOBILITY_VMMSC, "", ""); + return new UserCredentials(user.credentials.userId, user.credentials.password, Constants.Users.EMANUEL_vWINIFRED, "", ""); } @DataProvider public static Object[][] msoTestApiOptions() { return new Object[][]{ - {"GR_API (new)", DEFAULT_TEST_API_VALUE} - , {"VNF_API (old)", "VNF_API"} + {"VNF_API (old)", DEFAULT_TEST_API_VALUE} + , {"GR_API (new)", "GR_API"} }; } @@ -209,7 +250,7 @@ public class ALaCarteflowTest extends CreateInstanceDialogBaseTest { test.run(); } finally { // back to default - selectMsoTestApiOption("GR_API (new)"); + selectMsoTestApiOption("VNF_API (old)"); } } } diff --git a/vid-automation/src/main/java/vid/automation/test/test/AddNetworkTest.java b/vid-automation/src/main/java/vid/automation/test/test/AddNetworkTest.java index 0251e365c..d53b5011a 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/AddNetworkTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/AddNetworkTest.java @@ -1,6 +1,13 @@ package vid.automation.test.test; -import org.openecomp.sdc.ci.tests.datatypes.UserCredentials; +import com.google.common.collect.ImmutableList; +import java.util.HashMap; +import java.util.Map; +import org.onap.sdc.ci.tests.datatypes.UserCredentials; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateNetworkALaCarteOldViewEdit; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet; import org.testng.annotations.Test; import vid.automation.test.Constants; import vid.automation.test.model.User; @@ -8,27 +15,37 @@ import vid.automation.test.sections.ViewEditPage; import vid.automation.test.services.BulkRegistration; import vid.automation.test.services.SimulatorApi; -import java.util.HashMap; -import java.util.Map; - public class AddNetworkTest extends VidBaseTestCase { private ViewEditPage viewEditPage = new ViewEditPage(); private String serviceInstanceIdWithNetwork = "d198cc45-158b-480e-8d2c-03943c51268e"; - private String currentUser; @Test - public void testAddNetworkFullFlow() throws Exception { - User user = usersService.getUser(Constants.Users.MOBILITY_MOBILITY); + public void testAddNetworkFullFlow() { + User user = usersService.getUser(Constants.Users.EMANUEL_EMANUEL); SimulatorApi.clearAll(); BulkRegistration.genericSearchExistingServiceInstance(); BulkRegistration.addNetwork(); String instanceName = viewEditPage.generateInstanceName(Constants.ViewEdit.NETWORK_INSTANCE_NAME_PREFIX); - BulkRegistration.msoAddNetwork(instanceName); + SimulatorApi.registerExpectationFromPresets( + ImmutableList.of( + PresetAAIGetCloudOwnersByCloudRegionId.PRESET_ONE_TO_ATT_AIC, + new PresetMSOCreateNetworkALaCarteOldViewEdit( + PresetMSOBaseCreateInstancePost.DEFAULT_REQUEST_ID, + "d198cc45-158b-480e-8d2c-03943c51268e", + "c187e9fe-40c3-4862-b73e-84ff056205f6", + instanceName + ), + new PresetMSOOrchestrationRequestGet( + PresetMSOOrchestrationRequestGet.COMPLETE, + PresetMSOOrchestrationRequestGet.DEFAULT_REQUEST_ID, + "Success")), + SimulatorApi.RegistrationStrategy.APPEND); + goToExistingInstanceById(serviceInstanceIdWithNetwork); Map<String, String> networkMetadata= getNetworkExpectedMetadata(); - addNetwork(networkMetadata,instanceName, "AIC30_CONTRAIL_BASIC 0", "One","a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb","xxx1", "y1","c630e297a3ae486497d63eacec1d7c14", + addNetwork(networkMetadata,instanceName, "AIC30_CONTRAIL_BASIC 0", "One", "FUSION", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb","xxx1", "y1","c630e297a3ae486497d63eacec1d7c14", "false", "some legacy region",user.tenants); } @@ -36,7 +53,7 @@ public class AddNetworkTest extends VidBaseTestCase { return new HashMap<String, String>(){ { put(Constants.NetworkModelInfo.SERVICE_NAME, "Using VID for VoIP Network Instantiations Shani"); - put(Constants.NetworkModelInfo.SUBSCRIBER_NAME, "Mobility"); + put(Constants.NetworkModelInfo.SUBSCRIBER_NAME, "Emanuel"); put(Constants.NetworkModelInfo.SERVICE_INSTANCE_NAME, "service_with_network_shani"); put(Constants.NetworkModelInfo.MODEL_NAME, "AIC30_CONTRAIL_BASIC"); put(Constants.NetworkModelInfo.MODEL_INVARIANT_UUID, "de01afb5-532b-451d-aac4-ff9ff0644060"); @@ -49,7 +66,7 @@ public class AddNetworkTest extends VidBaseTestCase { @Override protected UserCredentials getUserCredentials() { - User user = usersService.getUser(Constants.Users.MOBILITY_MOBILITY); - return new UserCredentials(user.credentials.userId, user.credentials.password, Constants.Users.MOBILITY_MOBILITY, "", ""); + User user = usersService.getUser(Constants.Users.EMANUEL_EMANUEL); + return new UserCredentials(user.credentials.userId, user.credentials.password, Constants.Users.EMANUEL_EMANUEL, "", ""); } } diff --git a/vid-automation/src/main/java/vid/automation/test/test/AssociatePnfTest.java b/vid-automation/src/main/java/vid/automation/test/test/AssociatePnfTest.java index 5ee961215..7bec56013 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/AssociatePnfTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/AssociatePnfTest.java @@ -1,12 +1,14 @@ package vid.automation.test.test; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import vid.automation.test.Constants; import vid.automation.test.infra.Wait; import vid.automation.test.sections.PnfSearchAssociationPage; +import vid.automation.test.sections.SideMenu; import vid.automation.test.sections.VidBasePage; import vid.automation.test.sections.ViewEditPage; import vid.automation.test.services.BulkRegistration; @@ -21,6 +23,11 @@ public class AssociatePnfTest extends VidBaseTestCase { private String pnfInstanceName = "MX_960-F722"; private String pnfModelName = "pnf 0"; + @BeforeMethod + public void navigateToWelcomePage() { + SideMenu.navigateToWelcomePage(); + } + @Test public void testAssociatePnf() throws Exception { SimulatorApi.clearAll(); @@ -132,7 +139,7 @@ public class AssociatePnfTest extends VidBaseTestCase { //ubscriber NameModel Invariant UUID elementTestId = Constants.ServiceModelInfo.INFO_TEST_ID_PREFIX + Constants.ServiceModelInfo.SUBSCRIBER_NAME_KEY; infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText(); - Assert.assertEquals(String.format(Constants.ServiceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"USP VOICE"); + Assert.assertEquals(String.format(Constants.ServiceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"SILVIA ROBBINS"); //Model Version elementTestId = Constants.ServiceModelInfo.INFO_TEST_ID_PREFIX + Constants.ServiceModelInfo.MODEL_VERSION; infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText(); diff --git a/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java b/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java index 4f055fe29..2b5a09823 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java @@ -1,83 +1,82 @@ package vid.automation.test.test; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; +import static vid.automation.test.infra.Features.FLAG_5G_IN_NEW_INSTANTIATION_UI; +import static vid.automation.test.infra.ModelInfo.aLaCarteForBrowseSdc; +import static vid.automation.test.infra.ModelInfo.aLaCarteServiceCreationTest; +import static vid.automation.test.infra.ModelInfo.instantiationTypeAlacarte_vidNotionsInstantiationUIByUUID; +import static vid.automation.test.infra.ModelInfo.macroForBrowseSdc; + import com.google.common.collect.ImmutableList; -import org.glassfish.jersey.uri.internal.JerseyUriBuilder; +import java.util.List; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.hamcrest.Matchers; +import org.onap.sdc.ci.tests.datatypes.UserCredentials; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetServiceModelList; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetServicesGet; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIServiceDesignAndCreationPut; import org.onap.simulator.presetGenerator.presets.ecompportal_att.PresetGetSessionSlotCheckIntervalGet; -import org.openecomp.sdc.ci.tests.datatypes.UserCredentials; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import org.springframework.http.client.ClientHttpRequestInterceptor; -import org.springframework.web.client.RestTemplate; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import vid.automation.test.Constants; -import vid.automation.test.infra.*; +import vid.automation.test.infra.Click; +import vid.automation.test.infra.Exists; +import vid.automation.test.infra.FeatureTogglingTest; +import vid.automation.test.infra.Features; +import vid.automation.test.infra.Get; +import vid.automation.test.infra.ModelInfo; +import vid.automation.test.infra.SelectOption; import vid.automation.test.model.Service; import vid.automation.test.model.User; -import vid.automation.test.sections.*; +import vid.automation.test.sections.BrowseASDCPage; +import vid.automation.test.sections.DeployMacroDialogBase; +import vid.automation.test.sections.DeployMacroDialogOld; +import vid.automation.test.sections.SideMenu; +import vid.automation.test.sections.ViewEditPage; import vid.automation.test.services.ServicesService; import vid.automation.test.services.SimulatorApi; -import vid.automation.test.utils.CookieAndJsonHttpHeadersInterceptor; - -import java.net.URI; -import java.net.URISyntaxException; -import java.util.List; - -import static java.util.Collections.singletonList; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; public class BrowseASDCTest extends CreateInstanceDialogBaseTest { - private final String invariantUUIDAlacarte = "a8dcd72d-d44d-44f2-aa85-53aa9ca99cba"; - private final String invariantUUIDMacro = "d27e42cf-087e-4d31-88ac-6c4b7585f800"; + private final String invariantUUIDAlacarte = aLaCarteForBrowseSdc.modelInvariantId; + private final String invariantUUIDMacro = macroForBrowseSdc.modelInvariantId; private final String instantiationTypeNameAlacarte = "a la carte"; private final String instantiationTypeNameMacro = "macro"; private final String oldMacro = "old macro"; - private String modelInvariantUUID1 = "aeababbc-010b-4a60-8df7-e64c07389466"; - private String modelInvariantUUID2 = "aa2f8e9c-9e47-4b15-a95c-4a9385599abc"; - private String modelInvariantUUID3 = "d849c57d-b6fe-4843-8349-4ab8bbb08d71"; - private String modelUuid = "a8dcd72d-d44d-44f2-aa85-53aa9ca99cba"; - protected final RestTemplate restTemplate = new RestTemplate(); + private final String newAlacarte = "new a la carte"; + public static final String modelInvariantUUID1 = "aeababbc-010b-4a60-8df7-e64c07389466"; + public static final String modelInvariantUUID2 = "aa2f8e9c-9e47-4b15-a95c-4a9385599abc"; + public static final String modelInvariantUUID3 = "d849c57d-b6fe-4843-8349-4ab8bbb08d71"; + public static final String modelUuid = "a8dcd72d-d44d-44f2-aa85-53aa9ca99cba"; private ServicesService servicesService = new ServicesService(); - final URI envUrI; - protected final URI uri; - public BrowseASDCTest() throws URISyntaxException { - this.envUrI = new URI(System.getProperty("ENV_URL")); - this.uri = new JerseyUriBuilder().host(envUrI.getHost()).port(envUrI.getPort()).scheme("http").path("vid").build(); - } + private final Logger logger = LogManager.getLogger(BrowseASDCTest.class); @BeforeClass - public void login() { - UserCredentials userCredentials = getUserCredentials(); - final List<ClientHttpRequestInterceptor> interceptors = singletonList(new CookieAndJsonHttpHeadersInterceptor(uri, userCredentials)); - restTemplate.setInterceptors(interceptors); + public void beforeClass() { + resetGetServicesCache(); } @BeforeMethod - public void invalidateTheCacheSelenium() { - if (Features.FLAG_SERVICE_MODEL_CACHE.isActive()) { - restTemplate.postForObject(uri + "/rest/models/reset", "", Object.class); - } + public void resetSdcModelCaches() { + invalidateSdcModelsCache(); } @Override protected UserCredentials getUserCredentials() { - User user = usersService.getUser(Constants.Users.MOBILITY_MOBILITY); - return new UserCredentials(user.credentials.userId, user.credentials.password, Constants.Users.MOBILITY_MOBILITY, "", ""); + User user = usersService.getUser(Constants.Users.EMANUEL_EMANUEL); + return new UserCredentials(user.credentials.userId, user.credentials.password, Constants.Users.EMANUEL_EMANUEL, "", ""); } @Test(groups = {"shouldBeMigratedToWorkWithSimulator"}) @@ -87,7 +86,7 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { SideMenu.navigateToBrowseASDCPage(); browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid); assertThatServiceCreationDialogIsVisible(); - validatePNFCreationDialog(service, "Mobility", "pnf"); + validatePNFCreationDialog(service, "Emanuel", "pnf"); } private void validatePNFCreationDialog(Service service, String serviceType, String serviceRole) { @@ -103,7 +102,7 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { @Test(groups = {"shouldBeMigratedToWorkWithSimulator"}) private void testPNFMacroInstantation() throws Exception { - User user = usersService.getUser(Constants.Users.MOBILITY_MOBILITY); + User user = usersService.getUser(Constants.Users.EMANUEL_EMANUEL); relogin(user.credentials); BrowseASDCPage browseASDCPage = new BrowseASDCPage(); @@ -115,9 +114,9 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { browseASDCPage.selectProductFamily("ebc3bc3d-62fd-4a3f-a037-f619df4ff034"); GeneralUIUtils.ultimateWait(); - browseASDCPage.selectServiceTypeByName("Mobility"); + browseASDCPage.selectServiceTypeByName("Emanuel"); GeneralUIUtils.ultimateWait(); - browseASDCPage.selectLcpRegion("mtn16"); + browseASDCPage.selectLcpRegion("hvf16"); browseASDCPage.selectTenant("a259ae7b7c3f493cb3d91f95a7c18149"); assertAllIsPermitted(Constants.BrowseASDC.AIC_OPTION_CLASS); @@ -136,15 +135,6 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { viewEditPage.clickActivateButton(); } -// @Test -// private void browseServiceModel_deployServiceUnexpectedDeploymentMode_creationPopupIsMacro() throws Exception { -// deployServiceAndAssertInstantiationType( -// "don't know.zip", -// "a8dcd72d-d44d-44f2-aa85-53aa9ca99cba", -// "macro" -// ); -// } - @Test private void browseServiceModel_deployServiceALaCarteByBackendInput_creationPopupIsALaCarte() throws Exception { // model uuid should be of macro @@ -156,6 +146,15 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { } @Test + @FeatureTogglingTest(FLAG_5G_IN_NEW_INSTANTIATION_UI) + private void browseServiceModel_deployServiceALaCarteByBackendInputHintNewUI_creationPopupIsAngular2() throws Exception { + deployServiceAndAssertInstantiationType( + instantiationTypeAlacarte_vidNotionsInstantiationUIByUUID, + newAlacarte + ); + } + + @Test private void browseServiceModel_deployServiceALaCarteBecauseNotOnMACRO_SERVICESConfig_creationPopupIsALaCarte() throws Exception { deployServiceAndAssertInstantiationType( "csar15782222_instantiationTypeEmpty_invariantUUIDAlacarte.zip", @@ -167,7 +166,7 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { @Test private void browseServiceModel_deployServiceMacroByBackendInput_creationPopupIsMacro() throws Exception { deployServiceAndAssertInstantiationType( - "csar15782222_instantiationTypeMacro_invariantUUIDAlacarte.zip", + "csar15782222_instantiationTypeMacro_invariantUUIDAlacarte_withoutNetworks.zip", invariantUUIDAlacarte, instantiationTypeNameMacro ); @@ -215,17 +214,20 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { private void deployServiceAndAssertInstantiationType(String modelZipFileName, String modelInvariantId, String expectedInstantiationType) throws Exception { - String modelVersionId = "4d71990b-d8ad-4510-ac61-496288d9078e"; + deployServiceAndAssertInstantiationType(new ModelInfo("4d71990b-d8ad-4510-ac61-496288d9078e", modelInvariantId, modelZipFileName), expectedInstantiationType); + } - registerExpectationForLegacyServiceDeployment(modelVersionId, modelInvariantId, modelZipFileName, null); - User user = usersService.getUser(Constants.Users.MOBILITY_MOBILITY); + private void deployServiceAndAssertInstantiationType(ModelInfo modelInfo, String expectedInstantiationType) throws Exception { + + registerExpectationForLegacyServiceDeployment(modelInfo, "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); + User user = usersService.getUser(Constants.Users.EMANUEL_EMANUEL); relogin(user.credentials); BrowseASDCPage browseASDCPage = new BrowseASDCPage(); SideMenu.navigateToBrowseASDCPage(); GeneralUIUtils.ultimateWait(); - browseASDCPage.clickDeployServiceButtonByServiceUUID(modelVersionId); + browseASDCPage.clickDeployServiceButtonByServiceUUID(modelInfo.modelVersionId); DeployMacroDialogBase macroDialog = null; if (expectedInstantiationType.equals(instantiationTypeNameAlacarte)) { GeneralUIUtils.ultimateWait(); @@ -239,28 +241,26 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { @Test private void testServiceInstantiationAlaCarte() throws Exception { - User user = usersService.getUser(Constants.Users.MOBILITY_MOBILITY); + User user = usersService.getUser(Constants.Users.EMANUEL_EMANUEL); relogin(user.credentials); - String zipFileName = "serviceCreationTest.zip"; - String modelVersionId = "aa2f8e9c-9e47-4b15-a95c-4a9385599abc"; //uuid of model. must be same as in serviceCreationTest.zip - String modelInvariantId = invariantUUIDAlacarte; //must be same as in serviceCreationTest.zip - - registerExpectationForLegacyServiceDeployment(modelVersionId, modelInvariantId, zipFileName, null); + registerExpectationForLegacyServiceDeployment(aLaCarteServiceCreationTest, "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); BrowseASDCPage browseASDCPage = new BrowseASDCPage(); SideMenu.navigateToBrowseASDCPage(); Service service = new Service( "pnf", - modelVersionId, - modelInvariantId, + aLaCarteServiceCreationTest.modelVersionId, + aLaCarteServiceCreationTest.modelInvariantId, "action-data", "1.0", "Network L1-3", - "ADIOD vMX vPE based on Juniper 17.2 release. Updated with updated VF for v8.0 of VLM", + "PASQUALE vMX vPE based on Juniper 17.2 release. Updated with updated VF for v8.0 of VLM", null); + + logger.info("Expected service model properties: "+service.toString()); browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid); validateServiceCreationDialog(service); @@ -269,7 +269,7 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { assertDropdownPermittedItemsByLabel(user.subscriberNames, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS); browseASDCPage.selectSubscriberById("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - String serviceType = "Mobility"; + String serviceType = "Emanuel"; GeneralUIUtils.findAndWaitByText(serviceType, 30); assertDropdownPermittedItemsByValue(user.serviceTypes, Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS); @@ -297,14 +297,7 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { @Test(dataProvider = "filterTexts") public void testFilterOptionsInBrowseSdc(String filterText){ - SimulatorApi.registerExpectation(SimulatorApi.RegistrationStrategy.APPEND, - "ecompportal_getSessionSlotCheckInterval.json", - "browseASDC/aai_get_services.json", - "browseASDC/get_aai_get_subscribers.json", - "browseASDC/get_sdc_catalog_services_2f80c596.json", - "browseASDC/service_design_and_creation.json"); - SideMenu.navigateToBrowseASDCPage(); - BrowseASDCPage browseAsdcPage = new BrowseASDCPage(); + BrowseASDCPage browseAsdcPage = registerSimulatorAndGoToBrowseSDC(); GeneralUIUtils.ultimateWait(); assertThat(browseAsdcPage.countCurrentRowsInTable(),(Matchers.greaterThan(1))); browseAsdcPage.fillFilterText(filterText); @@ -316,16 +309,7 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { @Test private void testCategoryParamsDropdownsExistsInCreationDialog() throws Exception { - SimulatorApi.registerExpectation(SimulatorApi.RegistrationStrategy.APPEND, - "ecompportal_getSessionSlotCheckInterval.json", - "browseASDC/aai_get_services.json", - "browseASDC/get_aai_get_subscribers.json", - "browseASDC/get_sdc_catalog_services_2f80c596.json", - "browseASDC/service_design_and_creation.json"); - User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP); - relogin(user.credentials); - BrowseASDCPage browseASDCPage = new BrowseASDCPage(); - SideMenu.navigateToBrowseASDCPage(); + BrowseASDCPage browseASDCPage = registerSimulatorAndGoToBrowseSDC(); Service service = servicesService.getService("2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"); browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid); DeployMacroDialogBase deployMacroDialog = getMacroDialog(); @@ -334,9 +318,24 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { deployMacroDialog.clickOwningEntitySelect(); } + private BrowseASDCPage registerSimulatorAndGoToBrowseSDC() { + SimulatorApi.registerExpectation(SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET, + "ecompportal_getSessionSlotCheckInterval.json", + "browseASDC/aai_get_services.json", + "browseASDC/get_sdc_catalog_services_2f80c596.json" + ); + SimulatorApi.registerExpectationFromPresets(ImmutableList.of( + new PresetAAIGetSubscribersGet(), + new PresetAAIServiceDesignAndCreationPut() + ), + SimulatorApi.RegistrationStrategy.APPEND); + SideMenu.navigateToBrowseASDCPage(); + return new BrowseASDCPage(); + } + @Test(groups = {"shouldBeMigratedToWorkWithSimulator"}) private void testOwningEntityRequiredAndProjectOptional() throws Exception { - User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP); + User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA); relogin(user.credentials); BrowseASDCPage browseASDCPage = new BrowseASDCPage(); @@ -352,7 +351,7 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { assertDropdownPermittedItemsByLabel(user.subscriberNames, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS); browseASDCPage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89"); - String serviceType = "VIRTUAL USP"; + String serviceType = "TYLER SILVIA"; GeneralUIUtils.findAndWaitByText(serviceType, 30); assertDropdownPermittedItemsByValue(user.serviceTypes, Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS); @@ -371,7 +370,7 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { @Test(groups = {"shouldBeMigratedToWorkWithSimulator"}) protected void testLineOfBusinessOptionalAndPlatformRequired() throws Exception { - User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP); + User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA); relogin(user.credentials); BrowseASDCPage browseASDCPage = new BrowseASDCPage(); @@ -387,7 +386,7 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { assertDropdownPermittedItemsByLabel(user.subscriberNames, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS); browseASDCPage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89"); - String serviceType = "VIRTUAL USP"; + String serviceType = "TYLER SILVIA"; GeneralUIUtils.findAndWaitByText(serviceType, 30); assertDropdownPermittedItemsByValue(user.serviceTypes, Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS); @@ -404,10 +403,10 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { //now add the VNF ViewEditPage viewEditPage = new ViewEditPage(); - viewEditPage.selectNodeInstanceToAdd("VID-PCRF-05-15-17 0"); + viewEditPage.selectNodeInstanceToAdd("VID-RODERICK-05-15-17 0"); viewEditPage.generateAndSetInstanceName(Constants.ViewEdit.VNF_INSTANCE_NAME_PREFIX); viewEditPage.selectProductFamily("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - viewEditPage.selectLCPRegion("AAIAIC25"); + viewEditPage.selectLcpRegion("JANET25", "AIC"); viewEditPage.selectTenant("092eb9e8e4b7412e8787dd091bc58e86"); viewEditPage.setLegacyRegion("llkjhlkjhlkjh"); @@ -427,7 +426,7 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { ImmutableList<BasePreset> presets = ImmutableList.of( new PresetGetSessionSlotCheckIntervalGet(), new PresetAAIGetSubscribersGet(), - new PresetAAIGetServiceModelList(modelUuid, modelInvariantUUID1, modelInvariantUUID2, modelInvariantUUID3), + new PresetAAIServiceDesignAndCreationPut(), new PresetAAIGetServicesGet()); SimulatorApi.registerExpectationFromPresets(presets, SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET); @@ -437,6 +436,8 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { private void browseSDCServiceModelListCheckAAIResponse(){ prepareSimulatorWithServiceModelListBeforeBrowseASDCService(); SideMenu.navigateToBrowseASDCPage(); + BrowseASDCPage browseASDCPage = new BrowseASDCPage(); + browseASDCPage.fillFilterText("CheckAAIResponse"); GeneralUIUtils.ultimateWait(); WebElement sdcTableElement = Get.byId("sdcModelsTable"); @@ -460,9 +461,9 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { //Check Names By name = By.className("name"); - assertEquals("AAAvIRC_mm779p_Service" , sdcFirstModel.findElement(name).getText()); - assertEquals("BBBvIRC_mm779p_Service" , sdcSecondModel.findElement(name).getText()); - assertEquals("CCCvIRC_mm779p_Service" , sdcThirdModel.findElement(name).getText()); + assertEquals("CheckAAIResponse_AAAvIRC_mm779p_Service" , sdcFirstModel.findElement(name).getText()); + assertEquals("CheckAAIResponse_BBBvIRC_mm779p_Service" , sdcSecondModel.findElement(name).getText()); + assertEquals("CheckAAIResponse_CCCvIRC_mm779p_Service" , sdcThirdModel.findElement(name).getText()); //Check distribution Status By distributionStatus = By.className("distributionStatus"); @@ -474,8 +475,10 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { assertEquals("service" , sdcFirstModel.findElement(By.className("category")).getText()); assertEquals("1.0" , sdcFirstModel.findElement(By.className("version")).getText()); } + @Test - public void browseSdcModel_getEmptyList_noModelsMessageIsShown() throws Exception { + public void browseSdcModel_getEmptyList_noModelsMessageIsShown() { + resetGetServicesCache(); SimulatorApi.clearAll(); SimulatorApi.registerExpectationFromPresets(ImmutableList.of( new PresetAAIServiceDesignAndCreationPut(true), @@ -484,5 +487,6 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { GeneralUIUtils.ultimateWait(); WebElement serviceModelsTbody = Get.byXpath("//table[@data-tests-id='serviceModelsTable']/tbody"); assertFalse(Exists.tagNameInAnotherElement(serviceModelsTbody, "tr"), "Table should be empty on empty results"); + resetGetServicesCache(); } } diff --git a/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java b/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java index eadf38f4f..179eb968c 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java @@ -1,42 +1,54 @@ package vid.automation.test.test; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.everyItem; +import static org.hamcrest.CoreMatchers.hasItem; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.collection.IsEmptyCollection.empty; +import static org.hamcrest.core.IsNot.not; + import com.google.common.collect.ImmutableMap; import com.google.common.primitives.Ints; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.json.JSONException; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.datatypes.UserCredentials; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.datatypes.UserCredentials; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebElement; -import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.remote.RemoteWebElement; import org.openqa.selenium.support.ui.Select; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; -import org.testng.annotations.*; +import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; import vid.automation.test.Constants; -import vid.automation.test.infra.*; +import vid.automation.test.infra.Click; +import vid.automation.test.infra.Exists; +import vid.automation.test.infra.Get; +import vid.automation.test.infra.Input; +import vid.automation.test.infra.SelectOption; +import vid.automation.test.infra.Wait; import vid.automation.test.model.User; import vid.automation.test.sections.ChangeManagementPage; import vid.automation.test.services.SimulatorApi; import vid.automation.test.utils.DB_CONFIG; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static org.hamcrest.CoreMatchers.*; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.collection.IsEmptyCollection.empty; -import static org.hamcrest.core.IsNot.not; - public class ChangeManagementTest extends VidBaseTestCase { public static final String SCHEDULED_ID = "0b87fe60-50b0-4bac-a0a7-49e951b0ba9e"; @@ -119,16 +131,19 @@ public class ChangeManagementTest extends VidBaseTestCase { static final int vnfZrdm3amdns02test2Id = 11822; static final int vnfHarrisonKrisId = 12822; static String subscriberId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"; - static String serviceType = "vFlowLogic"; + static String serviceType = "vRichardson"; static String vnfType = "vMobileDNS"; static String vnfSourceVersion = "1.0"; - static String vnfName = "zrdm3amdns02test2"; + static String vnfName = "zolson3amdns02test2"; static String vnfTargetVersion = "5.0"; static String workflowName = "VNF In Place Software Update"; } @AfterClass protected void dropSpecialVNFs() { + + resetGetServicesCache(); + System.out.println("Connecting database..."); try (Connection connection = DriverManager.getConnection(DB_CONFIG.url, DB_CONFIG.username, DB_CONFIG.password)) { @@ -154,7 +169,6 @@ public class ChangeManagementTest extends VidBaseTestCase { SimulatorApi.clearAll(); SimulatorApi.registerExpectation(SimulatorApi.RegistrationStrategy.APPEND, "changeManagement/ecompportal_getSessionSlotCheckInterval.json" - , "changeManagement/get_aai_get_subscribers.json" , "changeManagement/get_aai_sub_details.json" , "changeManagement/get_sdc_catalog_services_2f80c596.json" , "changeManagement/get_service-design-and-creation.json" @@ -163,8 +177,10 @@ public class ChangeManagementTest extends VidBaseTestCase { , "changeManagement/mso_get_manual_task.json" , "changeManagement/mso_post_manual_task.json" ); + SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(),SimulatorApi.RegistrationStrategy.APPEND); registerDefaultTablesData(); + resetGetServicesCache(); } private void registerDefaultTablesData() { @@ -217,7 +233,7 @@ public class ChangeManagementTest extends VidBaseTestCase { @Override protected UserCredentials getUserCredentials() { - String userName = Constants.Users.MOBILITY_VMMSC; + String userName = Constants.Users.EMANUEL_vWINIFRED; User user = usersService.getUser(userName); return new UserCredentials(user.credentials.userId, user.credentials.password, userName, "", ""); } @@ -520,11 +536,24 @@ public class ChangeManagementTest extends VidBaseTestCase { Click.byId(Constants.ChangeManagement.dashboardFinishedTabId); Assert.assertTrue(Exists.byId(Constants.ChangeManagement.dashboardFinishedTableId)); Assert.assertTrue(Exists.byId(Constants.ChangeManagement.dashboardFinishedTheadId)); + Click.byId(Constants.ChangeManagement.dashboardActiveTabId); } @Test - public void testMainDashboardTableContent() { + public void testFinishedSectionIncludeUnlockedItem() { + ChangeManagementPage.openChangeManagementPage(); + Click.byId(Constants.ChangeManagement.dashboardFinishedTabId); + Assert.assertThat(Get.byClassAndText("vnf-name","Unlocked instance"),is(notNullValue())); + + } + + + + + + @Test + public void testMainDashboardTableContent () { ChangeManagementPage.openChangeManagementPage(); GeneralUIUtils.ultimateWait(); List<WebElement> webElements = Get.multipleElementsByTestId(Constants.ChangeManagement.activeTableRowId); diff --git a/vid-automation/src/main/java/vid/automation/test/test/CreateInstanceDialogBaseTest.java b/vid-automation/src/main/java/vid/automation/test/test/CreateInstanceDialogBaseTest.java index b486d27df..0837f79ca 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/CreateInstanceDialogBaseTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/CreateInstanceDialogBaseTest.java @@ -1,7 +1,7 @@ package vid.automation.test.test; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import vid.automation.test.Constants; import vid.automation.test.infra.Click; @@ -17,7 +17,7 @@ import java.util.List; public class CreateInstanceDialogBaseTest extends VidBaseTestCase { - private ViewEditPage viewEditPage= new ViewEditPage(); + protected ViewEditPage viewEditPage= new ViewEditPage(); void assertServiceMetadata(String expectedMetadata, String actualMetadata) { WebElement serviceNameElem = GeneralUIUtils.getWebElementByTestID(actualMetadata); @@ -67,18 +67,11 @@ public class CreateInstanceDialogBaseTest extends VidBaseTestCase { assertServiceMetadata(expectedServiceInstance.modelCustomizationUuid, Constants.CreateNewInstance.MODEL_CUSTOMIZATION_UUID); } - private String fillDetailsInDialogWithGeneratedName(String name, String lcpRegion, String tenant, String suppressRollback, - String legacyRegion, ArrayList<String> permittedTenants) - { - String generatedInstanceName = viewEditPage.generateInstanceName(name); - return fillDetailsInDialog(generatedInstanceName, lcpRegion, tenant, suppressRollback, legacyRegion, permittedTenants); - } - - private String fillDetailsInDialog(String name, String lcpRegion, String tenant, String suppressRollback, + private String fillDetailsInDialog(String name, String lcpRegion, String cloudOwner, String tenant, String suppressRollback, String legacyRegion, ArrayList<String> permittedTenants) { viewEditPage.setInstanceName(name); - viewEditPage.selectLCPRegion(lcpRegion); + viewEditPage.selectLcpRegion(lcpRegion, cloudOwner); assertDropdownPermittedItemsByValue(permittedTenants, Constants.ViewEdit.TENANT_OPTION_CLASS); viewEditPage.selectTenant(tenant); viewEditPage.selectSuppressRollback(suppressRollback); @@ -87,13 +80,13 @@ public class CreateInstanceDialogBaseTest extends VidBaseTestCase { } - protected String addVFModule(String name, String lcpRegion, String tenant, String suppressRollback, + protected String addVFModule(String modelName, String instanceName, String lcpRegion, String cloudOwner, String tenant, String suppressRollback, String legacyRegion, ArrayList<String> permittedTenants,ServiceModel expectedServiceInstance) { - viewEditPage.selectVfModuleToAdd(name); + viewEditPage.selectVfModuleToAdd(modelName); if(expectedServiceInstance != null) { validateNodeTemplateCreationDialog(expectedServiceInstance); } - String instanceName = fillDetailsInDialogWithGeneratedName(Constants.INSTANCE_NAME_SELECT_TESTS_ID, lcpRegion, tenant, suppressRollback, legacyRegion, permittedTenants); + fillDetailsInDialog(instanceName, lcpRegion, cloudOwner, tenant, suppressRollback, legacyRegion, permittedTenants); viewEditPage.clickConfirmButton(); assertSuccessfulVFModuleCreation(); viewEditPage.clickCloseButton(); @@ -101,28 +94,28 @@ public class CreateInstanceDialogBaseTest extends VidBaseTestCase { return instanceName; } - protected void addVolumeGroup (String name, String lcpRegion, String tenant, String suppressRollback, + protected void addVolumeGroup (String modelName, String instanceName, String lcpRegion, String cloudOwner, String tenant, String suppressRollback, String legacyRegion, ArrayList<String> permittedTenants, ServiceModel expectedServiceInstance) { - viewEditPage.selectVolumeGroupToAdd(name); + viewEditPage.selectVolumeGroupToAdd(modelName); if(expectedServiceInstance != null) { validateNodeTemplateCreationDialog(expectedServiceInstance); } - fillDetailsInDialogWithGeneratedName(Constants.ViewEdit.VOLUME_GROUP_INSTANCE_NAME_PREFIX, lcpRegion, tenant, suppressRollback, legacyRegion, permittedTenants); + fillDetailsInDialog(instanceName, lcpRegion, cloudOwner, tenant, suppressRollback, legacyRegion, permittedTenants); viewEditPage.clickConfirmButton(); assertSuccessfulVolumeGroupCreation(); viewEditPage.clickCloseButton(); GeneralUIUtils.ultimateWait(); } - protected void addVNF(String name, String lcpRegion, String tenant, String suppressRollback, + protected void addVNF(String name, String lcpRegion, String cloudOwner, String tenant, String suppressRollback, String legacyRegion, String productFamily, String platform, ArrayList<String> permittedTenants, List<String> lobs, ServiceModel serviceModel, String instanceName) { - openAndFillVnfPopup(name, lcpRegion, tenant, suppressRollback, legacyRegion, productFamily, platform,permittedTenants, lobs, serviceModel, instanceName); + openAndFillVnfPopup(name, lcpRegion, cloudOwner, tenant, suppressRollback, legacyRegion, productFamily, platform,permittedTenants, lobs, serviceModel, instanceName); viewEditPage.clickConfirmButton(); successConfirmVnfAndClosePopup(); } - protected void openAndFillVnfPopup(String name, String lcpRegion, String tenant, String suppressRollback, + protected void openAndFillVnfPopup(String name, String lcpRegion, String cloudOwner, String tenant, String suppressRollback, String legacyRegion, String productFamily, String platform, ArrayList<String> permittedTenants, List<String> lobs, ServiceModel serviceModel, String instanceName) { viewEditPage.selectNodeInstanceToAdd(name); GeneralUIUtils.ultimateWait(); @@ -139,7 +132,7 @@ public class CreateInstanceDialogBaseTest extends VidBaseTestCase { if(lobs != null) { SelectOption.selectOptionsFromMultiselectById(Constants.OwningEntity.LOB_SELECT_TEST_ID, lobs); } - fillDetailsInDialog(instanceName, lcpRegion, tenant, suppressRollback, legacyRegion, permittedTenants); + fillDetailsInDialog(instanceName, lcpRegion, cloudOwner, tenant, suppressRollback, legacyRegion, permittedTenants); } protected void successConfirmVnfAndClosePopup() { diff --git a/vid-automation/src/main/java/vid/automation/test/test/CreateNewInstanceTest.java b/vid-automation/src/main/java/vid/automation/test/test/CreateNewInstanceTest.java index 55a1e22ce..bb13514bf 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/CreateNewInstanceTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/CreateNewInstanceTest.java @@ -1,6 +1,8 @@ package vid.automation.test.test; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import java.io.IOException; +import java.util.List; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import org.testng.Assert; import org.testng.annotations.Test; @@ -16,11 +18,6 @@ import vid.automation.test.services.BulkRegistration; import vid.automation.test.services.ServicesService; import vid.automation.test.services.SimulatorApi; -import java.io.IOException; -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; -import java.util.List; - public class CreateNewInstanceTest extends CreateInstanceDialogBaseTest { private ServicesService servicesService = new ServicesService(); @@ -37,22 +34,22 @@ public class CreateNewInstanceTest extends CreateInstanceDialogBaseTest { } SimulatorApi.clearAll(); - BulkRegistration.createNewServiceInstance("USP VOICE"); + BulkRegistration.createNewServiceInstance("SILVIA ROBBINS"); - User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP); + User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA); relogin(user.credentials); SideMenu.navigateToCreateNewServicePage(); CreateNewInstancePage createNewInstancePage = new CreateNewInstancePage(); - String subscriberName = "USP VOICE"; + String subscriberName = "SILVIA ROBBINS"; assertDropdownPermittedItemsByLabel(user.subscriberNames, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS); createNewInstancePage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89"); createNewInstancePage.clickSubmitButton(); assertSuccessfulSelection(Constants.CreateNewInstance.SELECTED_SUBSCRIBER_NAME_TEST_ID, subscriberName); - String serviceType = "VIRTUAL USP"; + String serviceType = "TYLER SILVIA"; assertDropdownPermittedItemsByName(user.serviceTypes, Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS); createNewInstancePage.selectServiceTypeByName(serviceType); createNewInstancePage.clickSubmitButton(); @@ -68,7 +65,7 @@ public class CreateNewInstanceTest extends CreateInstanceDialogBaseTest { validateServiceCreationDialog(service, subscriberName, serviceType); createNewInstancePage.setInstanceName(instanceName); - SelectOption.byTestIdAndVisibleText("MetroPacketCore", Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID); + SelectOption.byTestIdAndVisibleText("WayneHolland", Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID); SelectOption.byTestIdAndVisibleText("x1", Constants.OwningEntity.PROJECT_SELECT_TEST_ID); createNewInstancePage.selectSuppressRollback("false"); createNewInstancePage.clickConfirmButton(); @@ -79,20 +76,20 @@ public class CreateNewInstanceTest extends CreateInstanceDialogBaseTest { } @Test - public void testSearchServicesWithSubscriberMSO_1610_ST() throws Exception { + public void testSearchServicesWithSubscriberCAR_2020_ER() throws Exception { SimulatorApi.clearAll(); - BulkRegistration.createNewServiceInstance("MSO_1610_ST"); + BulkRegistration.createNewServiceInstance("CAR_2020_ER"); - User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP); + User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA); relogin(user.credentials); SideMenu.navigateToCreateNewServicePage(); CreateNewInstancePage createNewInstancePage = new CreateNewInstancePage(); - String subscriberName = "MSO_1610_ST"; + String subscriberName = "CAR_2020_ER"; assertDropdownPermittedItemsByLabel(user.subscriberNames, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS); - createNewInstancePage.selectSubscriberById("MSO_1610_ST"); + createNewInstancePage.selectSubscriberById("CAR_2020_ER"); createNewInstancePage.clickSubmitButton(); assertSuccessfulSelection(Constants.CreateNewInstance.SELECTED_SUBSCRIBER_NAME_TEST_ID, subscriberName); diff --git a/vid-automation/src/main/java/vid/automation/test/test/CreatePortMirroringConfigurationTest.java b/vid-automation/src/main/java/vid/automation/test/test/CreatePortMirroringConfigurationTest.java index f4ba8c6dc..89e28d7a6 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/CreatePortMirroringConfigurationTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/CreatePortMirroringConfigurationTest.java @@ -1,22 +1,23 @@ package vid.automation.test.test; import com.google.common.collect.ImmutableMap; +import java.util.HashMap; +import java.util.Map; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import vid.automation.test.Constants; -import vid.automation.test.infra.*; +import vid.automation.test.infra.Exists; +import vid.automation.test.infra.Features; +import vid.automation.test.infra.Get; +import vid.automation.test.infra.Wait; import vid.automation.test.sections.CreateConfigurationPage; import vid.automation.test.sections.ServiceProxyPage; import vid.automation.test.sections.ViewEditPage; import vid.automation.test.services.BulkRegistration; import vid.automation.test.services.SimulatorApi; -import java.util.HashMap; -import java.util.Map; - public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { private ViewEditPage viewEditPage = new ViewEditPage(); @@ -27,29 +28,30 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { private String policyConfigurationModelName_0 = "Port Mirroring Configuration 0"; private String policyConfigurationModelName_1 = "Port Mirroring Configuration By Policy 1"; private String pnfInstanceName = "AS-pnf2-10219--as988q"; - private String vnfServiceType = "VIRTUAL USP"; - private String vnfInstanceName = "zmtn6aepdg01"; + private String pnfServiceType = "DARREN MCGEE"; + private String vnfServiceType = "TYLER SILVIA"; + private String defaultCollectorServiceType = "TYLER SILVIA"; + private String vnfInstanceName = "zhvf6aepdg01"; private String active = "Active"; - private String desiredCloudRegionId; - + private String desiredCloudRegionId = "mdt1"; - public CreatePortMirroringConfigurationTest() throws Exception {} + private boolean featureFlagLetsSelectingCollector() { + return Features.FLAG_1810_CR_LET_SELECTING_COLLECTOR_TYPE_UNCONDITIONALLY.isActive(); + } - @BeforeMethod - public void setupDesiredCloudRegionId() { - desiredCloudRegionId = Features.FLAG_REGION_ID_FROM_REMOTE.isActive() ? "someCloudRegionIdFromAai" : "mdt1"; + private String expectedPnfCollectorServiceType() { + return (featureFlagLetsSelectingCollector() ? pnfServiceType : defaultCollectorServiceType).replace(" ", "%20"); } @Test public void testCreatePolicyConfiguration() { SimulatorApi.clearAll(); - BulkRegistration.searchExistingServiceInstancePortMirroring("Active", desiredCloudRegionId); - BulkRegistration.searchExistingServiceInstance(); + BulkRegistration.searchExistingServiceInstancePortMirroring("Active", "mdt1"); BulkRegistration.getNetworkNodeFormData(); - BulkRegistration.createPolicyConfiguration(true, desiredCloudRegionId); + BulkRegistration.createPolicyConfiguration(true, expectedPnfCollectorServiceType()); - goToExistingInstanceById(serviceInstanceId);//test_sssdad + navigateToViewEditPageOf_test_sssdad(); selectConfigurationNode(policyConfigurationModelName_1, getConfigurationExpectedMetadata()); fillAllFormFields(); createConfigurationPage.clickNextButton(); @@ -60,7 +62,7 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { createConfigurationPage.clickNextButton(); //assert service proxy models (circles) names - serviceProxyPage.assertSourceModelName("vmmeService2 Service Proxy"); + serviceProxyPage.assertSourceModelName("vflorenceService2 Service Proxy"); serviceProxyPage.assertCollectorModelName("pProbeService Service Proxy"); //assert service proxy models metadata @@ -68,6 +70,10 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { assertMetadataModal(Constants.ConfigurationCreation.COLLECTOR_INFO_BUTTON_TEST_ID, getCollectorServiceProxyExpectedMetadata()); //select source & collector + if (featureFlagLetsSelectingCollector()) { + serviceProxyPage.assertCollectorServiceType(defaultCollectorServiceType); + serviceProxyPage.chooseCollectorServiceType(pnfServiceType); + } serviceProxyPage.chooseCollector(pnfInstanceName); serviceProxyPage.assertSelectedInstanceIcon(Constants.ConfigurationCreation.COLLECTOR_INSTANCE_SELECTED_ICON_TEST_ID); @@ -91,10 +97,9 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { public void testDeletePolicyConfiguration() { SimulatorApi.clearAll(); BulkRegistration.searchExistingServiceInstancePortMirroring("Created", desiredCloudRegionId); - BulkRegistration.searchExistingServiceInstance(); BulkRegistration.getNetworkNodeFormData(); - BulkRegistration.deletePolicyConfiguration(true, desiredCloudRegionId); - goToExistingInstanceById(serviceInstanceId);//test_sssdad + BulkRegistration.deletePolicyConfiguration(true); + navigateToViewEditPageOf_test_sssdad(); serviceProxyPage.clickDeleteConfigurationButton(); serviceProxyPage.assertMsoRequestModal(Constants.ViewEdit.MSO_SUCCESSFULLY_TEXT); } @@ -103,10 +108,9 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { public void testConfigurationCreatedPortEnabled(){ SimulatorApi.clearAll(); BulkRegistration.searchExistingServiceInstancePortMirroring("Created", desiredCloudRegionId); - BulkRegistration.searchExistingServiceInstance(); BulkRegistration.getNetworkNodeFormData(); - BulkRegistration.activateDeactivateConfiguration("deactivate","deactivate", desiredCloudRegionId); - goToExistingInstanceById(serviceInstanceId);//test_sssdad + BulkRegistration.activateDeactivateConfiguration("deactivate"); + navigateToViewEditPageOf_test_sssdad(); WebElement isPortEnableButtonExists = Get.byTestId("enableDisableButton"); Assert.assertNull(isPortEnableButtonExists); } @@ -114,8 +118,8 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { @Test public void testDisablePort() { enableDisablePortPresets(active, true); - BulkRegistration.enableDisablePort("disablePort", desiredCloudRegionId); - goToExistingInstanceById(serviceInstanceId);//test_sssdad + BulkRegistration.enableDisablePort("disablePort"); + navigateToViewEditPageOf_test_sssdad(); serviceProxyPage.clickEnableDisableButton(); serviceProxyPage.assertMsoRequestModal(Constants.ViewEdit.MSO_SUCCESSFULLY_TEXT); } @@ -123,8 +127,8 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { @Test public void testEnablePort() { enableDisablePortPresets(active, false); - BulkRegistration.enableDisablePort("enablePort", desiredCloudRegionId); - goToExistingInstanceById(serviceInstanceId);//test_sssdad + BulkRegistration.enableDisablePort("enablePort"); + navigateToViewEditPageOf_test_sssdad(); serviceProxyPage.clickEnableDisableButton(); serviceProxyPage.assertMsoRequestModal(Constants.ViewEdit.MSO_SUCCESSFULLY_TEXT); } @@ -135,7 +139,6 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { private void enableDisablePortPresets(String orchStatus, boolean isMirrored){ SimulatorApi.clearAll(); BulkRegistration.searchExistingServiceInstancePortMirroring(orchStatus, isMirrored, desiredCloudRegionId); - BulkRegistration.searchExistingServiceInstance(); BulkRegistration.getNetworkNodeFormData(); } @@ -145,10 +148,9 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { public void testActivateConfigurationTest(){ SimulatorApi.clearAll(); BulkRegistration.searchExistingServiceInstancePortMirroring("Created", desiredCloudRegionId); - BulkRegistration.searchExistingServiceInstance(); BulkRegistration.getNetworkNodeFormData(); - BulkRegistration.activateDeactivateConfiguration("activate","activate", desiredCloudRegionId); - goToExistingInstanceById(serviceInstanceId);//test_sssdad + BulkRegistration.activateDeactivateConfiguration("activate"); + navigateToViewEditPageOf_test_sssdad(); serviceProxyPage.assertDeleteConfigurationButtonExists(true); serviceProxyPage.clickActivateDeactivateButton(); serviceProxyPage.assertMsoRequestModal(Constants.ViewEdit.MSO_SUCCESSFULLY_TEXT); @@ -159,10 +161,9 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { public void testDeleteConfigurationTest(){ SimulatorApi.clearAll(); BulkRegistration.searchExistingServiceInstancePortMirroring("Created", desiredCloudRegionId); - BulkRegistration.searchExistingServiceInstance(); BulkRegistration.getNetworkNodeFormData(); - BulkRegistration.deleteConfiguration(desiredCloudRegionId); - goToExistingInstanceById(serviceInstanceId);//test_sssdad + BulkRegistration.deleteConfiguration(); + navigateToViewEditPageOf_test_sssdad(); serviceProxyPage.clickDeleteConfigurationButton(); serviceProxyPage.assertMsoRequestModal(Constants.ViewEdit.MSO_SUCCESSFULLY_TEXT); } @@ -172,10 +173,9 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { public void testDeactivateConfigurationTest(){ SimulatorApi.clearAll(); BulkRegistration.searchExistingServiceInstancePortMirroring("Active", desiredCloudRegionId); - BulkRegistration.searchExistingServiceInstance(); BulkRegistration.getNetworkNodeFormData(); - BulkRegistration.activateDeactivateConfiguration("deactivate","deactivate", desiredCloudRegionId); - goToExistingInstanceById(serviceInstanceId);//test_sssdad + BulkRegistration.activateDeactivateConfiguration("deactivate"); + navigateToViewEditPageOf_test_sssdad(); serviceProxyPage.assertDeleteConfigurationButtonExists(false); serviceProxyPage.clickActivateDeactivateButton(); serviceProxyPage.assertMsoRequestModal(Constants.ViewEdit.MSO_SUCCESSFULLY_TEXT); @@ -186,19 +186,18 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { @Test public void testCreatePortMirroringConfiguration() { SimulatorApi.clearAll(); -// BulkRegistration.searchExistingServiceInstancePortMirroring(); BulkRegistration.searchExistingServiceInstance(); BulkRegistration.getNetworkNodeFormData(); - BulkRegistration.createPolicyConfiguration(true, desiredCloudRegionId); + BulkRegistration.createPolicyConfiguration(true, expectedPnfCollectorServiceType()); BulkRegistration.createConfiguration("model-version-id=7482279e-5901-492f-a963-6331aa6b995e&model-invariant-id=f2ae9911-95c4-40d0-8908-0175c206ab2d"); - goToExistingInstanceById(serviceInstanceId_vidTest444);//test_sssdad + navigateToViewEditPageOfuspVoiceVidTest444("240376de-870e-48df-915a-31f140eedd2c"); selectConfigurationNode(policyConfigurationModelName_0, ImmutableMap.<String, String>builder() .put(Constants.ServiceModelInfo.SERVIICE_NAME_KEY, "Demo Service 1") .put(Constants.ServiceModelInfo.MODEL_NAME, "Port Mirroring Configuration") .put(Constants.ServiceModelInfo.SERVICE_INSTANCE_NAME, "vid-test-444") .put(Constants.ServiceModelInfo.MODEL_INVARIANT_UUID, "5dd839fa-5e09-47d4-aa5c-5ba62161b569") - .put(Constants.ServiceModelInfo.SUBSCRIBER_NAME_KEY, "USP VOICE") + .put(Constants.ServiceModelInfo.SUBSCRIBER_NAME_KEY, "SILVIA ROBBINS") .put(Constants.ServiceModelInfo.MODEL_VERSION, "1.0") .put(Constants.ServiceModelInfo.MODEL_UUID, "9d6b09b1-7527-49b1-b6cf-398cb67c5523") .put(Constants.ServiceModelInfo.MODEL_CUSTOMIZATION_UUID, "3db39baa-35bc-4b97-b199-44e758823502") @@ -224,7 +223,6 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { .put(Constants.ServiceProxyModelInfo.MODEL_TYPE, "Service Proxy") .put(Constants.ServiceProxyModelInfo.MODEL_INVARIANT_UUID, "0aaefad3-9409-4ab1-be00-a1571e8a0545") .put(Constants.ServiceProxyModelInfo.MODEL_UUID, "8685fd6a-c0b1-40f7-be94-ab232e4424c1") -// .put(Constants.ServiceProxyModelInfo.MODEL_CUSTOMIZATION_UUID, "2ac4bd62-dee8-452f-b799-b9c925ee1b9f") .put(Constants.ServiceProxyModelInfo.SOURCE_MODEL_UUID, "7482279e-5901-492f-a963-6331aa6b995e") .put(Constants.ServiceProxyModelInfo.SOURCE_MODEL_INVARIANT, "f2ae9911-95c4-40d0-8908-0175c206ab2d") .put(Constants.ServiceProxyModelInfo.SOURCE_MODEL_NAME, "Service 1") @@ -233,6 +231,7 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { assertMetadataModal(Constants.ConfigurationCreation.COLLECTOR_INFO_BUTTON_TEST_ID, expectedMetadata); //select source & collector + serviceProxyPage.assertCollectorServiceType(defaultCollectorServiceType); serviceProxyPage.chooseCollectorServiceType(vnfServiceType); serviceProxyPage.chooseCollector(vnfInstanceName); serviceProxyPage.assertSelectedInstanceIcon(Constants.ConfigurationCreation.COLLECTOR_INSTANCE_SELECTED_ICON_TEST_ID); @@ -242,14 +241,6 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { serviceProxyPage.assertSelectedInstanceIcon(Constants.ConfigurationCreation.SOURCE_INSTANCE_SELECTED_ICON_TEST_ID); serviceProxyPage.assertButtonState(Constants.ConfigurationCreation.CREATE_BUTTON_TEST_ID,true); -// serviceProxyPage.clickCreateButton(); -// serviceProxyPage.assertButtonState(Constants.ConfigurationCreation.CREATE_BUTTON_TEST_ID,false); -// serviceProxyPage.assertMsoRequestModal(Constants.ViewEdit.MSO_SUCCESSFULLY_TEXT); -// serviceProxyPage.clickCloseButton(); - - //assert redirect back to view/edit -// GeneralUIUtils.ultimateWait(); -// Assert.assertTrue(Exists.byTestId(Constants.ViewEdit.ADD_VNF_BUTTON_TEST_ID)); } @Test @@ -258,13 +249,19 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { SimulatorApi.clearAll(); BulkRegistration.searchExistingServiceInstancePortMirroring("Active", desiredCloudRegionId); BulkRegistration.getNetworkNodeFormData(); - BulkRegistration.createPolicyConfiguration(false, desiredCloudRegionId); + BulkRegistration.createPolicyConfiguration(false, expectedPnfCollectorServiceType()); - goToExistingInstanceById(serviceInstanceId);//test_sssdad + navigateToViewEditPageOf_test_sssdad(); selectConfigurationNode(policyConfigurationModelName_1, getConfigurationExpectedMetadata()); fillAllFormFields(); createConfigurationPage.clickNextButton(); - //select source & collector + serviceProxyPage.assertButtonState(Constants.ConfigurationCreation.CREATE_BUTTON_TEST_ID,false); + + //select source & collector + if (featureFlagLetsSelectingCollector()) { + serviceProxyPage.assertCollectorServiceType(defaultCollectorServiceType); + serviceProxyPage.chooseCollectorServiceType(pnfServiceType); + } serviceProxyPage.chooseCollector(pnfInstanceName); serviceProxyPage.chooseSourceServiceType(vnfServiceType); serviceProxyPage.chooseSource(vnfInstanceName); @@ -273,6 +270,7 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { serviceProxyPage.clickCloseButton(); serviceProxyPage.assertButtonState(Constants.ConfigurationCreation.CREATE_BUTTON_TEST_ID,true); } + @Test public void testRainyNoResultsInDropdowns(){ SimulatorApi.clearAll(); @@ -280,7 +278,7 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { BulkRegistration.getNetworkNodeFormData(); //not register createPolicyConfiguration for no results in DDLs - goToExistingInstanceById(serviceInstanceId);//test_sssdad + navigateToViewEditPageOf_test_sssdad(); selectConfigurationNode(policyConfigurationModelName_1, getConfigurationExpectedMetadata()); fillAllFormFields(); createConfigurationPage.clickNextButton(); @@ -313,7 +311,7 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { createConfigurationPage.assertButtonState(Constants.ConfigurationCreation.TENANT_DROPDOWN_TEST_ID,false); //WebElement tenantDDL= Get.byTestId(Constants.ConfigurationCreation.TENANT_DROPDOWN_TEST_ID); - createConfigurationPage.chooseRegion("AAIAIC25"); + createConfigurationPage.chooseRegion("JANET25"); GeneralUIUtils.ultimateWait(); // Wait.waitByTestId(Constants.ConfigurationCreation.TENANT_DROPDOWN_TEST_ID, 30); createConfigurationPage.chooseTenant("USP-SIP-IC-24335-T-01"); @@ -321,7 +319,7 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { } private void assertFormFields() { Assert.assertEquals("dummy_instance",createConfigurationPage.getInstanceName()); - Assert.assertEquals("AAIAIC25", createConfigurationPage.getRegion()); + Assert.assertEquals("JANET25", createConfigurationPage.getRegion()); Assert.assertEquals("USP-SIP-IC-24335-T-01",createConfigurationPage.getTenant()); createConfigurationPage.assertButtonState(Constants.ConfigurationCreation.NEXT_BUTTON_TEST_ID,true); @@ -334,7 +332,7 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { put(Constants.ServiceModelInfo.MODEL_NAME, "Port Mirroring Configuration By Policy"); put(Constants.ServiceModelInfo.SERVICE_INSTANCE_NAME, "test_sssdad"); put(Constants.ServiceModelInfo.MODEL_INVARIANT_UUID, "c30a024e-a6c6-4670-b73c-3df64eb57ff6"); - put(Constants.ServiceModelInfo.SUBSCRIBER_NAME_KEY, "USP VOICE"); + put(Constants.ServiceModelInfo.SUBSCRIBER_NAME_KEY, "SILVIA ROBBINS"); put(Constants.ServiceModelInfo.MODEL_VERSION, "1.0"); put(Constants.ServiceModelInfo.MODEL_UUID, "f58d039d-4cfc-40ec-bd75-1f05f0458a6c"); put(Constants.ServiceModelInfo.MODEL_CUSTOMIZATION_UUID, "4b7ebace-bad6-4526-9be6-bf248e20fc5f"); @@ -346,16 +344,16 @@ public class CreatePortMirroringConfigurationTest extends VidBaseTestCase { private Map<String, String> getSourceServiceProxyExpectedMetadata() { return new HashMap<String, String>(){ { - put(Constants.ServiceProxyModelInfo.MODEL_NAME, "vmmeService2 Service Proxy"); + put(Constants.ServiceProxyModelInfo.MODEL_NAME, "vflorenceService2 Service Proxy"); put(Constants.ServiceProxyModelInfo.MODEL_VERSION, "1.0"); - put(Constants.ServiceProxyModelInfo.MODEL_DESCRIPTION, "A Proxy for Service vmmeService2"); + put(Constants.ServiceProxyModelInfo.MODEL_DESCRIPTION, "A Proxy for Service vflorenceService2"); put(Constants.ServiceProxyModelInfo.MODEL_TYPE, "Service Proxy"); put(Constants.ServiceProxyModelInfo.MODEL_INVARIANT_UUID, "2933b574-d28d-45ea-bf22-4df2907e4a10"); put(Constants.ServiceProxyModelInfo.MODEL_UUID, "a32fee17-5b59-4c34-ba6f-6dd2f1c61fee"); put(Constants.ServiceProxyModelInfo.MODEL_CUSTOMIZATION_UUID, "060be63d-5f9c-4fd0-8ef7-830d5e8eca17"); put(Constants.ServiceProxyModelInfo.SOURCE_MODEL_UUID, "2a2ea15f-07c6-4b89-bfca-e8aba39a34d6"); put(Constants.ServiceProxyModelInfo.SOURCE_MODEL_INVARIANT, "a7eac2b3-8444-40ee-92e3-b3359b32445c"); - put(Constants.ServiceProxyModelInfo.SOURCE_MODEL_NAME, "vmmeService2"); + put(Constants.ServiceProxyModelInfo.SOURCE_MODEL_NAME, "vflorenceService2"); } }; } diff --git a/vid-automation/src/main/java/vid/automation/test/test/DeleteResumeTest.java b/vid-automation/src/main/java/vid/automation/test/test/DeleteResumeTest.java index 2e3580f0c..55ab567dc 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/DeleteResumeTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/DeleteResumeTest.java @@ -1,30 +1,22 @@ package vid.automation.test.test; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.testng.annotations.Test; import vid.automation.test.Constants; import vid.automation.test.model.User; import vid.automation.test.services.BulkRegistration; import vid.automation.test.services.SimulatorApi; -import vid.automation.test.services.UsersService; - -import java.io.IOException; public class DeleteResumeTest extends CreateInstanceDialogBaseTest { - private UsersService usersService = new UsersService(); - - public DeleteResumeTest() throws IOException { - } - @Test() - private void testResumePendingActivationVfModule() throws Exception { - User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP); + @Test + private void testResumePendingActivationVfModule() { + User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA); String serviceInstanceId = "3f93c7cb-2fd0-4557-9514-e189b7b04f9d"; String vnfInstanceId = "c015cc0f-0f37-4488-aabf-53795fd93cd3"; SimulatorApi.clearAll(); BulkRegistration.resumeVfModule(serviceInstanceId,vnfInstanceId); navigateToViewEditPageOfuspVoiceVidTest444("240376de-870e-48df-915a-31f140eedd2c"); - resumeVFModule("aa","AAIAIC25","092eb9e8e4b7412e8787dd091bc58e86","mdt1",user.tenants); + resumeVFModule("aa","JANET25", "AIC", "092eb9e8e4b7412e8787dd091bc58e86","mdt1",user.tenants); } }
\ No newline at end of file diff --git a/vid-automation/src/main/java/vid/automation/test/test/DrawingBoardTest.java b/vid-automation/src/main/java/vid/automation/test/test/DrawingBoardTest.java index d022f5c9b..bacd83155 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/DrawingBoardTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/DrawingBoardTest.java @@ -1,40 +1,51 @@ package vid.automation.test.test; -import org.openecomp.sdc.ci.tests.datatypes.UserCredentials; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import static org.testng.AssertJUnit.assertFalse; +import static vid.automation.test.Constants.DrawingBoard.AVAILABLE_MODELS_TREE; +import static vid.automation.test.Constants.DrawingBoard.BACK_BUTTON; +import static vid.automation.test.Constants.DrawingBoard.CONTEXT_MENU_BUTTON_HEADER; +import static vid.automation.test.Constants.DrawingBoard.CONTEXT_MENU_HEADER_EDIT_ITEM; +import static vid.automation.test.Constants.DrawingBoard.DEFAULT_SERVICE_NAME; +import static vid.automation.test.Constants.DrawingBoard.DRAWING_BOARD_TREE; +import static vid.automation.test.Constants.DrawingBoard.SEARCH_LEFT_TREE; +import static vid.automation.test.Constants.DrawingBoard.SERVICE_QUANTITY; +import static vid.automation.test.infra.Features.FLAG_ASYNC_INSTANTIATION; +import static vid.automation.test.infra.ModelInfo.macroDrawingBoardComplexService; +import static vid.automation.test.infra.ModelInfo.macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails; + +import com.google.common.collect.ImmutableList; +import org.onap.sdc.ci.tests.datatypes.UserCredentials; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2; import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import vid.automation.test.Constants; -import vid.automation.test.infra.*; +import vid.automation.test.infra.Click; +import vid.automation.test.infra.Exists; +import vid.automation.test.infra.FeatureTogglingTest; +import vid.automation.test.infra.Get; +import vid.automation.test.infra.Input; +import vid.automation.test.infra.ModelInfo; +import vid.automation.test.infra.SelectOption; +import vid.automation.test.infra.Wait; import vid.automation.test.model.User; import vid.automation.test.sections.BrowseASDCPage; import vid.automation.test.sections.DrawingBoardPage; import vid.automation.test.sections.VidBasePage; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.endsWith; -import static org.testng.Assert.assertNotNull; -import static org.testng.AssertJUnit.assertEquals; -import static vid.automation.test.Constants.DrawingBoard.*; -import static vid.automation.test.infra.Features.FLAG_ASYNC_INSTANTIATION; - @FeatureTogglingTest(FLAG_ASYNC_INSTANTIATION) public class DrawingBoardTest extends VidBaseTestCase { private DrawingBoardPage drawingBoardPage = new DrawingBoardPage(); - private String loadedServiceModelId = ""; - private final String defaultServiceModelForMostTests = "6e59c5de-f052-46fa-aa7e-2fca9d674c44"; - + private String loadedServiceModelId = macroDrawingBoardComplexService.modelVersionId; @Override protected UserCredentials getUserCredentials() { - String userName = Constants.Users.USP_VOICE_VIRTUAL_USP; + String userName = Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA; User user = usersService.getUser(userName); return new UserCredentials(user.credentials.userId, user.credentials.password, userName, "", ""); } @@ -44,7 +55,7 @@ public class DrawingBoardTest extends VidBaseTestCase { @AfterClass private void goOutFromIframe() { - new VidBasePage().goOutFromIframe(); + VidBasePage.goOutFromIframe(); } @@ -53,21 +64,22 @@ public class DrawingBoardTest extends VidBaseTestCase { final String currentUrl = getDriver().getCurrentUrl(); System.out.println("currentUrl in @BeforeMethod setNewServiceToDefault: " + currentUrl); - if (currentUrl.endsWith("/servicePlanning?serviceModelId=" + defaultServiceModelForMostTests)) { + if (currentUrl.endsWith("/servicePlanning?serviceModelId=" + macroDrawingBoardComplexService.modelVersionId)) { getDriver().navigate().refresh(); } else { - setNewService("service-Complexservice-csar.zip", defaultServiceModelForMostTests, null); + setNewService(macroDrawingBoardComplexService, null); } GeneralUIUtils.ultimateWait(); drawingBoardPage.goToIframe(); } - private void setNewService(String zipFileName, String serviceModelId, String instanceName) { + private void setNewService(ModelInfo modelInfo, String instanceName) { goOutFromIframe(); BrowseASDCPage browseASDCPage = new BrowseASDCPage(); - loadedServiceModelId = serviceModelId; - loadServicePopup(zipFileName, serviceModelId); + prepareServicePreset(modelInfo.zipFileName, modelInfo.modelVersionId); + + loadServicePopup(modelInfo.modelVersionId); if (instanceName != null) { Input.text(instanceName,Constants.BrowseASDC.NewServicePopup.INSTANCE_NAME); @@ -76,37 +88,50 @@ public class DrawingBoardTest extends VidBaseTestCase { Wait.waitByClassAndText("subscriber","",3); GeneralUIUtils.ultimateWait(); VidBasePage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89"); + + GeneralUIUtils.ultimateWait(); GeneralUIUtils.ultimateWait(); browseASDCPage.selectProductFamily("e433710f-9217-458d-a79d-1c7aff376d89"); - String serviceType = "VIRTUAL USP"; - Wait.waitByClassAndText(Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS, serviceType, 30); + GeneralUIUtils.ultimateWait(); + String serviceType = "TYLER SILVIA"; +// Wait.waitByClassAndText(Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS, serviceType, 30); browseASDCPage.selectServiceTypeByName(serviceType); GeneralUIUtils.ultimateWait(); GeneralUIUtils.ultimateWait(); - browseASDCPage.selectLcpRegion("mtn6"); + browseASDCPage.selectLcpRegion("hvf6"); browseASDCPage.selectTenant("3f21eeea6c2c486bba31dab816c05a32"); - Click.onFirstSelectOptionById(Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID); + Click.onFirstSelectOptionByTestId(Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID); browseASDCPage.selectAicZone("NFT1"); - Click.onFirstSelectOptionById(Constants.OwningEntity.PROJECT_SELECT_TEST_ID); + Click.onFirstSelectOptionByTestId(Constants.OwningEntity.PROJECT_SELECT_TEST_ID); // select mandatory field - Click.onFirstSelectOptionById(Constants.ServiceModelInfo.ROLLBACK_ON_FAILURE_ID); + Click.onFirstSelectOptionByTestId(Constants.ServiceModelInfo.ROLLBACK_ON_FAILURE_TEST_ID); + + Click.byTestId("form-set"); + VidBasePage.goOutFromIframe(); + } - Click.byTestId("service-form-set"); - browseASDCPage.goOutFromIframe(); + private void prepareServicePreset(String zipFileName, String serviceModelId) { + String modelInvariantId = "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0"; + String subscriberId = "e433710f-9217-458d-a79d-1c7aff376d89"; + registerExpectationForServiceDeployment( + ImmutableList.of( + new ModelInfo(serviceModelId, modelInvariantId, zipFileName) + ), + subscriberId, new PresetMSOCreateServiceInstanceGen2()); } - static final String leftTreeNodeName = "VF_vMee 0"; + static final String leftTreeNodeName = "VF_vGeraldine 0"; static final String leftTreeNodeNameWithoutChildren = "Port Mirroring Configuration By Policy 0"; - static final String[] leftTreeNodeChildren = {"vf_vmee0..VfVmee..vmme_vlc..module-1", "vf_vmee0..VfVmee..vmme_gpb..module-2", "vf_vmee0..VfVmee..base_vmme..module-0"}; - static final String[] leftTreeInitialElements = new String[]{"V", "VF_vMee 0", "C","Port Mirroring Configuration By Policy 0","N", "ExtVL 0"}; + static final String[] leftTreeNodeChildren = {"vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1", "vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2", "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0"}; + static final String[] leftTreeInitialElements = new String[]{"VNF", "VF_vGeraldine 0", "1", "C","Port Mirroring Configuration By Policy 0"}; - static final String rightTreeNodeName = "d6557200-ecf2-4641-8094-5393ae3aae60-VF_vMee 0"; + static final String rightTreeNodeName = "d6557200-ecf2-4641-8094-5393ae3aae60-VF_vGeraldine 0"; static final String rightTreeNodeNameWithoutChildren = "ddc3f20c-08b5-40fd-af72-c6d14636b986-ExtVL 0"; - static final String[] rightTreeNodeChildren = {"522159d5-d6e0-4c2a-aa44-5a542a12a830-vf_vmee0..VfVmee..vmme_vlc..module-1", "41708296-e443-4c71-953f-d9a010f059e1-vf_vmee0..VfVmee..vmme_gpb..module-2", "a27f5cfc-7f12-4f99-af08-0af9c3885c87-vf_vmee0..VfVmee..base_vmme..module-0"}; + static final String[] rightTreeNodeChildren = {"522159d5-d6e0-4c2a-aa44-5a542a12a830-vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1", "41708296-e443-4c71-953f-d9a010f059e1-vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2", "a27f5cfc-7f12-4f99-af08-0af9c3885c87-vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0"}; - private static final String EMPTY_BOARD_TITLE = "Please add objects (VNFs, network, modules etc.) from the left tree to design the service instance"; + private static final String EMPTY_BOARD_TITLE = "Please add objects (VNF a-la-carteVNFs, network, modules etc.) from the left tree to design the service instance"; private static final String EMPTY_BOARD_SUBTITLE = "Once done, click Deploy to start instantiation"; @@ -127,7 +152,7 @@ public class DrawingBoardTest extends VidBaseTestCase { private void expandCollapseLeftTreeByClickOnRow() { Wait.byText(leftTreeNodeName); drawingBoardPage.expandTreeByClickingNode(leftTreeNodeName, leftTreeNodeChildren); - //should checking with Golan if click also collapse + //should chec king with Golan if click also collapse //drawingBoardPage.collapseTreeByClickingNode(leftTreeNodeName, leftTreeNodeChildren))); drawingBoardPage.verifyNonCollapsableTreeByClickingNode(leftTreeNodeName, leftTreeNodeChildren); } @@ -178,17 +203,6 @@ public class DrawingBoardTest extends VidBaseTestCase { drawingBoardPage.checkLeafNodeHasNoExpander(rightTreeNodeNameWithoutChildren); } - @Test - public void testEmptyDrawingBoard() { - assertNotNull(Get.byClassAndText("text-title", EMPTY_BOARD_TITLE)); - assertNotNull(Get.byClassAndText("text-subtitle", EMPTY_BOARD_SUBTITLE)); - WebElement icon = Get.byTestId("no-content-icon"); - assertEquals("img", icon.getTagName()); - assertThat(icon.getAttribute("src"), endsWith("UPLOAD.svg")); - assertThat(icon.getAttribute("class"), containsString("no-content-icon")); - assertThat(icon.getAttribute("class"), containsString("upload-icon-service-planing")); - } - @Test(groups = { "underDevelopment" }) private void clickRightTreeNode_verifyLeftTreeNodeIsBlueAndExpanded() { @@ -259,12 +273,12 @@ public class DrawingBoardTest extends VidBaseTestCase { */ @Test private void insertTestInSerachBox_verifyMatchesMarkedAndVisible() { - Wait.byText("vf_vmee0..VfVmee..vmme_vlc..module-1"); + Wait.byText("vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1"); drawingBoardPage.checkSearch(); - final String searchTerm = "Vmee..vmme"; + final String searchTerm = "Vgeraldine..vflorence"; GeneralUIUtils.setWebElementByTestId(SEARCH_LEFT_TREE, searchTerm); - drawingBoardPage.checkNodesVisibleAndMatchIsHighlighted(searchTerm,"vf_vmee0..VfVmee..vmme_vlc..module-1", "vf_vmee0..VfVmee..vmme_gpb..module-2"); + drawingBoardPage.checkNodesVisibleAndMatchIsHighlighted(searchTerm,"vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1", "vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2"); } /* @@ -308,7 +322,7 @@ public class DrawingBoardTest extends VidBaseTestCase { private void setAndAssertServiceWithName(String instanceName){ goOutFromIframe(); - setNewService("csar-noDynamicFields-ecompNamingFalse-fullModelDetails-1a80c596.zip", "1a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd", instanceName); + setNewService(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails, instanceName); GeneralUIUtils.ultimateWait(); drawingBoardPage.goToIframe(); drawingBoardPage.checkServiceInstanceName(instanceName); @@ -324,7 +338,7 @@ public class DrawingBoardTest extends VidBaseTestCase { final int updatedQuantity = 10; Click.byTestId(CONTEXT_MENU_BUTTON_HEADER); Click.byTestId(CONTEXT_MENU_HEADER_EDIT_ITEM); - Assert.assertTrue(Exists.byId("service-popup"), "context menu should not appear"); + Assert.assertTrue(Exists.byId("instance-popup"), "context menu should not appear"); SelectOption.byIdAndVisibleText("quantity-select", String.valueOf(updatedQuantity)); Input.replaceText(updatedInstanceName,Constants.BrowseASDC.NewServicePopup.INSTANCE_NAME ); Click.byTestId(Constants.BrowseASDC.NewServicePopup.SET_BUTTON); @@ -342,7 +356,7 @@ public class DrawingBoardTest extends VidBaseTestCase { String initialQuantity = Get.byTestId(SERVICE_QUANTITY).getText(); Click.byTestId(CONTEXT_MENU_BUTTON_HEADER); Click.byTestId(CONTEXT_MENU_HEADER_EDIT_ITEM); - Assert.assertTrue(Exists.byId("service-popup"), "context menu should not appear"); + Assert.assertTrue(Exists.byId("instance-popup"), "context menu should not appear"); SelectOption.byIdAndVisibleText("quantity-select", String.valueOf(updatedQuantity)); Input.replaceText(updatedInstanceName,Constants.BrowseASDC.NewServicePopup.INSTANCE_NAME ); Click.byTestId(Constants.BrowseASDC.NewServicePopup.CANCEL_BUTTON); @@ -356,10 +370,10 @@ public class DrawingBoardTest extends VidBaseTestCase { private void checkHeader_verifyElementsExist(){ drawingBoardPage.checkExistsAndEnabled(BACK_BUTTON); drawingBoardPage.checkServiceInstanceName(DEFAULT_SERVICE_NAME); - drawingBoardPage.checkServiceStatus(); drawingBoardPage.checkQuantityNumberIsCorrect(1); drawingBoardPage.checkExistsAndEnabled(CONTEXT_MENU_BUTTON_HEADER); - //drawingBoardPage.checkDeployButtonDisabled(); + assertFalse(Get.byTestId("orchStatusLabel").isDisplayed()); + assertFalse(Get.byTestId("orchStatusValue").isDisplayed()); } private void assertResultsInBrowseAsdcPage(){ @@ -372,7 +386,7 @@ public class DrawingBoardTest extends VidBaseTestCase { private void BackButtonWithCancel_verifyStayInTheSamePage(){ String currentUrl = getCurrentUrl(); Click.byTestId(BACK_BUTTON); - Click.byText(Constants.Modals.CANCEL); + Click.byTestId(Constants.DrawingBoard.CANCEL_BUTTON); String newUrl = getCurrentUrl(); org.testng.Assert.assertEquals(currentUrl, newUrl); } @@ -385,22 +399,9 @@ public class DrawingBoardTest extends VidBaseTestCase { @Test private void BackButton_verifyReturnToSearchResults(){ Click.byTestId(BACK_BUTTON); - Click.byText(Constants.Modals.STOP_INSTANTIATION); - assertResultsInBrowseAsdcPage(); - } - - @Test - private void deleteButon_verifyReturnToSearchResults() { - Click.byTestId(CONTEXT_MENU_BUTTON_HEADER); - Click.byTestId(CONTEXT_MENU_HEADER_DELETE_ITEM); - Click.byText(Constants.Modals.STOP_INSTANTIATION); + Click.byTestId(Constants.DrawingBoard.STOP_INSTANTIATION_BUTTON); assertResultsInBrowseAsdcPage(); } - - - - - } diff --git a/vid-automation/src/main/java/vid/automation/test/test/EnvironmentsTest.java b/vid-automation/src/main/java/vid/automation/test/test/EnvironmentsTest.java index 01af276e5..f21a76d83 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/EnvironmentsTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/EnvironmentsTest.java @@ -2,7 +2,7 @@ package vid.automation.test.test; import com.google.common.collect.ImmutableMap; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import org.springframework.http.HttpStatus; import org.testng.annotations.BeforeClass; @@ -385,11 +385,12 @@ public class EnvironmentsTest extends VidBaseTestCase { assertTrue("Failed to find Activate button for test env with id: "+envId, activationButton.isDisplayed()); activationButton.click(); updateEnvManifestFile(inputFileName); - WebElement manifestFileName = Get.byId("manifestFileName"); - assertEquals("Manifest file name is wrong in test environment activation modal", inputFileName, manifestFileName.getText()); + assertTrue("Manifest file name is wrong in test environment activation modal", + Wait.waitByIdAndText("manifestFileName", inputFileName, 10)); } private void updateEnvManifestFile(String inputFileName) { + GeneralUIUtils.ultimateWait(); Input.file("applicationEnvironment/"+inputFileName, "testEnvManifestFileInput"); GeneralUIUtils.ultimateWait(); } diff --git a/vid-automation/src/main/java/vid/automation/test/test/HealthStatusTest.java b/vid-automation/src/main/java/vid/automation/test/test/HealthStatusTest.java index 184592188..2bb97aa2e 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/HealthStatusTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/HealthStatusTest.java @@ -5,6 +5,7 @@ import com.google.common.collect.ImmutableList; import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; import org.onap.simulator.presetGenerator.presets.ecompportal_att.PresetGetSessionSlotCheckIntervalGet; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.remote.RemoteWebElement; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -59,6 +60,7 @@ public class HealthStatusTest extends VidBaseTestCase { private void refreshStatus() { vidBasePage.navigateTo("app/ui/#/healthStatus"); + GeneralUIUtils.ultimateWait(); Click.byClass("icon-refresh"); } diff --git a/vid-automation/src/main/java/vid/automation/test/test/InstantiationStatusTest.java b/vid-automation/src/main/java/vid/automation/test/test/InstantiationStatusTest.java index 899eed9a1..a3480f8c2 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/InstantiationStatusTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/InstantiationStatusTest.java @@ -1,42 +1,60 @@ package vid.automation.test.test; +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.SERVICE_NAME; +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.VNF_NAME; +import static org.testng.Assert.assertEquals; +import static org.testng.AssertJUnit.assertTrue; +import static vid.automation.test.Constants.DrawingBoard.DEPLOY_BUTTON; +import static vid.automation.test.infra.Features.FLAG_ASYNC_INSTANTIATION; + import com.google.common.collect.ImmutableMap; +import java.util.Collections; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openqa.selenium.JavascriptExecutor; +import org.onap.sdc.ci.tests.datatypes.UserCredentials; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames; +import org.onap.vid.api.AsyncInstantiationBase; +import org.onap.vid.api.CreateServiceWithFailedVnf; +import org.onap.vid.api.TestUtils; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; +import vid.automation.test.Constants; +import vid.automation.test.infra.Click; import vid.automation.test.infra.FeatureTogglingTest; +import vid.automation.test.infra.Features; +import vid.automation.test.infra.Get; +import vid.automation.test.infra.Wait; +import vid.automation.test.sections.DrawingBoardPage; import vid.automation.test.sections.InstantiationStatusPage; import vid.automation.test.sections.SideMenu; +import vid.automation.test.sections.VidBasePage; import vid.automation.test.services.AsyncJobsService; -import java.util.UUID; - -import static vid.automation.test.infra.Features.FLAG_ASYNC_INSTANTIATION; -import static vid.automation.test.sections.InstantiationStatusPage.assertInstantiationStatusRow; -import static vid.automation.test.sections.InstantiationStatusPage.getNumberOfTableRows; - @FeatureTogglingTest(FLAG_ASYNC_INSTANTIATION) public class InstantiationStatusTest extends VidBaseTestCase { + private final String serviceModelVersion = "5.1"; + private final String regionId = "a93f8383-707e-43fa-8191-a6e69a1aab17"; + final static String owningEntityName = "Lucine Sarika"; + final static String subscriberName = "SILVIA ROBBINS"; + private static final String COMPLETED = "COMPLETED"; + private static final String CREATE_BULK_OF_ALACARTE_REQUEST = "asyncInstantiation/vidRequestCreateALaCarte.json"; + private final VidBasePage vidBasePage = new VidBasePage(); - private final String serviceModelVersion = "1.0"; - private final String subscriberId = "ac040e8a-b43a-441b-ab87-603f5b70be55"; - private final String regionId = "my-expected-region-id"; - private final String projectName = "a-project-name"; - final static String owningEntityName = "expected-owningEntityName"; - final static String subscriberName = "expected-subscriberName"; - - - private String currentUUI; + private AsyncInstantiationBase asyncInstantiationBase; @BeforeClass protected void dropAllAsyncJobs() { AsyncJobsService asyncJobsService = new AsyncJobsService(); asyncJobsService.dropAllAsyncJobs(); + asyncInstantiationBase = new AsyncInstantiationBase(); + asyncInstantiationBase.init(); + UserCredentials userCredentials = getUserCredentials(); + //login for API test (needed besides selenium test via browser) + asyncInstantiationBase.login(userCredentials); } @AfterClass @@ -45,58 +63,21 @@ public class InstantiationStatusTest extends VidBaseTestCase { asyncJobsService.muteAllAsyncJobs(); } - @BeforeMethod - protected void createJobsData() { - addOneJob(); - SideMenu.navigateToMacroInstantiationStatus(); - } - private String addOneJob() { - currentUUI = UUID.randomUUID().toString(); - final JavascriptExecutor javascriptExecutor = (JavascriptExecutor) GeneralUIUtils.getDriver(); - Object result = javascriptExecutor.executeScript( - "return (function postJob(){var xhttp = new XMLHttpRequest(); " + - " " + - " xhttp.onreadystatechange = function() { " + - " return this.responseText; " + - " }; " + - " " + - " xhttp.open(\"POST\", '/vid/asyncInstantiation/bulk', false); " + - " xhttp.setRequestHeader(\"Content-type\", \"application/json\"); " + - " xhttp.send(`{ " + - " \"modelInfo\": { " + - " \"modelType\": \"service\", " + - " \"modelInvariantId\": \"300adb1e-9b0c-4d52-bfb5-fa5393c4eabb\", " + - " \"modelVersionId\": \"5c9e863f-2716-467b-8799-4a67f378dcaa\", " + - " \"modelName\": \"AIM_TRANSPORT_00004\", " + - " \"modelVersion\": \"" + serviceModelVersion + "\" " + - " }, " + - " \"owningEntityId\" : \"someID\", " + - " \"owningEntityName\": \"" + owningEntityName + "\", " + - " \"projectName\" : \"" + projectName + currentUUI + "\", " + - " \"globalSubscriberId\": \"" + subscriberId + "\", " + - " \"subscriberName\": \"" + subscriberName + "\", " + - " \"productFamilyId\" : \"myProductFamilyId\", " + - " \"instanceName\" : \"MichaelJordan\", " + - " \"subscriptionServiceType\" : \"mySubType\", " + - " \"lcpCloudRegionId\" : \"" + regionId + "\", " + - " \"tenantId\" : \"greatTenant\", " + - " \"bulkSize\": 1, " + - " \"isUserProvidedNaming\": \"true\", " + - " \"vnfs\": {} " + - "} `); " + - " " + - "return JSON.parse(xhttp.responseText).entity;})()" - ); - - return result.toString(); + String serviceName = TestUtils.generateRandomAlphaNumeric(8); + final ImmutableMap<PresetMSOServiceInstanceGen2WithNames.Keys, String> names = + ImmutableMap.of(SERVICE_NAME, serviceName); + asyncInstantiationBase.createBulkOfInstances(false, 1, names, CREATE_BULK_OF_ALACARTE_REQUEST).get(0); + return serviceName; } @Test public void testServiceInfoIsPresentedInTable() { + String serviceName = addOneJob(); + SideMenu.navigateToMacroInstantiationStatus(); InstantiationStatusPage.clickRefreshButton(); - assertInstantiationStatusRow(projectName + currentUUI, ImmutableMap.of( + InstantiationStatusPage.assertInstantiationStatusRow(serviceName, ImmutableMap.of( "subscriberName", subscriberName, "regionId", regionId, "serviceModelVersion", serviceModelVersion, @@ -104,15 +85,84 @@ public class InstantiationStatusTest extends VidBaseTestCase { )); } - @Test public void testServiceInfoDataUpdatingAfterClickRefresh() { - long numberOfRows = getNumberOfTableRows(60); + addOneJob(); + SideMenu.navigateToMacroInstantiationStatus(); + InstantiationStatusPage.clickRefreshButton(); + long numberOfRows = InstantiationStatusPage.getNumberOfTableRows(60); addOneJob(); InstantiationStatusPage.clickRefreshButton(); - int numberOfRowsAfterRefresh = getNumberOfTableRows(60); + int numberOfRowsAfterRefresh = InstantiationStatusPage.getNumberOfTableRows(60); Assert.assertEquals(numberOfRows + 1 , numberOfRowsAfterRefresh); } + + @Test + @FeatureTogglingTest(Features.FLAG_1902_RETRY_JOB) + public void testRedeployFromDrawingBoardOfServiceWithFailedVnf() { + SideMenu.navigateToMacroInstantiationStatus(); + + CreateServiceWithFailedVnf createServiceWithFailedVnf = createServiceWithFailedVnfAssertStausAndSimulatorRegistration(); + String originalServiceName = createServiceWithFailedVnf.getNames().get(SERVICE_NAME); + + InstantiationStatusPage.clickRefreshButton(); + + //Open job + InstantiationStatusPage.openDrawingBoardForRetry(originalServiceName); + DrawingBoardPage.goToIframe(); + + Wait.waitByTestId("error-msg-wrapper", 10); + boolean isErrorShown = Wait.waitByClassAndText("sub-title", "Attention: You are currently viewing instances from the MSO. 1 of the instances failed, please try again.", 10); + assertTrue(isErrorShown); + + //validate audit info for failed vnf + String originalVnfName = createServiceWithFailedVnf.getNames().get(VNF_NAME); + hoverAndClickMenuByName(originalVnfName, "fe042c22-ba82-43c6-b2f6-8f1fc4164091-vSAMP12 1", Constants.DrawingBoard.CONTEXT_MENU_SHOW_AUDIT); + checkFailedAuditInfoOnRetry(originalVnfName, createServiceWithFailedVnf.getFirstIds().vnfReqId, "Vnf failed."); + + Click.byTestId(DEPLOY_BUTTON); + VidBasePage.goOutFromIframe(); + GeneralUIUtils.ultimateWait(); + vidBasePage.goToIframe(); + GeneralUIUtils.ultimateWait(); + + checkRetryRequestToBeComplete(createServiceWithFailedVnf, originalServiceName); + } + + private void checkFailedAuditInfoOnRetry(String instanceName, String requestId, String message) { + WebElement webElement = Get.byTestId("model-item-value-instance_name"); + assertEquals(webElement.getText(), instanceName, "Instance Name must be equal"); + + WebElement msoTableElement = Get.byId("service-instantiation-audit-info-mso"); + assertEquals(3, msoTableElement.findElement(By.tagName("thead")).findElements(By.tagName("th")).size(), "Audit info MSO table must contain 3 columns"); + assertEquals(requestId, msoTableElement.findElement(By.id("msoRequestId")).getText(), "Audit info Request Id is not equal"); + assertEquals("Failed", msoTableElement.findElement(By.id("msoJobStatus")).getText(), "Audit info Job Status is not equal"); + assertEquals(message, msoTableElement.findElement(By.id("msoAdditionalInfo")).getText(), "Audit info AdditionalInfo is not equal"); + + vidBasePage.screenshotDeployDialog("retry-audit-info-" + instanceName); + Click.byId(Constants.AuditInfoModal.CANCEL_BUTTON); + GeneralUIUtils.ultimateWait(); + } + + private CreateServiceWithFailedVnf createServiceWithFailedVnfAssertStausAndSimulatorRegistration() { + + //CreateServiceWithFailedVnf is common for API test and UI test, + //so if you change it, make sure both test are compatible with your changes + CreateServiceWithFailedVnf createServiceWithFailedVnf = new CreateServiceWithFailedVnf(asyncInstantiationBase); + createServiceWithFailedVnf.createServicesWithVnfCompletedWithError(); + createServiceWithFailedVnf.firstTimeAssertion(); + createServiceWithFailedVnf.secondRegistration(); + return createServiceWithFailedVnf; + } + + private void checkRetryRequestToBeComplete(CreateServiceWithFailedVnf createServiceWithFailedVnf, String originalServiceName) { + DrawingBoardPage.ServiceStatusChecker serviceStatusChecker = new DrawingBoardPage.ServiceStatusChecker(originalServiceName, Collections.singleton(COMPLETED)); + //there shall be 2 rows with same service name, one with completed with error and one completed + //so the following line might be buggy, and we need to improve it one day ... + boolean statusIsShown = Wait.waitFor(serviceStatusChecker, null, 30, 2); + assertTrue("service " + originalServiceName + " wasn't completed after in time", statusIsShown); + createServiceWithFailedVnf.simulatorCallsAssertion(); + } } diff --git a/vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java b/vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java index 173897095..42749c15f 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java @@ -1,51 +1,110 @@ package vid.automation.test.test; -import com.google.common.collect.*; -import org.apache.commons.lang3.RandomStringUtils; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateServiceInstancePost; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2; +import static junit.framework.TestCase.assertNull; +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.startsWith; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId.PRESET_SOME_LEGACY_REGION_TO_ATT_AIC; +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.COMPLETE; +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.DEFAULT_SERVICE_INSTANCE_ID; +import static org.testng.Assert.assertEquals; +import static org.testng.AssertJUnit.assertTrue; +import static vid.automation.test.infra.Features.FLAG_1902_VNF_GROUPING; +import static vid.automation.test.infra.Features.FLAG_5G_IN_NEW_INSTANTIATION_UI; +import static vid.automation.test.infra.Features.FLAG_ASYNC_INSTANTIATION; +import static vid.automation.test.infra.ModelInfo.PASQUALEVmxVpeBvService488Annotations; +import static vid.automation.test.infra.ModelInfo.aLaCarteNetworkProvider5G; +import static vid.automation.test.infra.ModelInfo.aLaCarteVnfGroupingService; +import static vid.automation.test.infra.ModelInfo.macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails; +import static vid.automation.test.infra.ModelInfo.macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetailsVnfEcompNamingFalse; +import static vid.automation.test.infra.ModelInfo.macroSriovWithDynamicFieldsEcompNamingFalsePartialModelDetailsVnfEcompNamingFalse; +import static vid.automation.test.infra.ModelInfo.macroSriovWithDynamicFieldsEcompNamingTruePartialModelDetails; +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; +import static vid.automation.test.services.SimulatorApi.registerExpectationFromPreset; +import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets; +import static vid.automation.test.test.ALaCarteflowTest.AIC; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; +import org.apache.commons.lang3.mutable.MutableInt; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.hamcrest.Matchers; +import org.onap.sdc.ci.tests.datatypes.UserCredentials; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetTenants; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIPostNamedQueryForViewEdit; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateNetworkALaCarte5G; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceAlacarte5GServiceWithNetwork; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2WithNamesAlacarteGroupingService; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2WithNamesEcompNamingFalse; import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet; -import org.openecomp.sdc.ci.tests.datatypes.UserCredentials; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestsGet5GServiceInstanceAndNetwork; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestsGet5GServiceInstanceAndNetwork.ResponseDetails; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; +import org.openqa.selenium.remote.RemoteWebElement; import org.testng.Assert; -import org.testng.annotations.*; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; import vid.automation.test.Constants; import vid.automation.test.Constants.BrowseASDC.NewServicePopup; -import vid.automation.test.infra.*; +import vid.automation.test.infra.Click; +import vid.automation.test.infra.FeatureTogglingTest; +import vid.automation.test.infra.Features; +import vid.automation.test.infra.Get; +import vid.automation.test.infra.Input; +import vid.automation.test.infra.ModelInfo; +import vid.automation.test.infra.SelectOption; +import vid.automation.test.infra.Wait; import vid.automation.test.model.Service; import vid.automation.test.model.User; -import vid.automation.test.sections.*; +import vid.automation.test.sections.BrowseASDCPage; +import vid.automation.test.sections.DrawingBoardPage; +import vid.automation.test.sections.InstantiationStatusPage; +import vid.automation.test.sections.SideMenu; +import vid.automation.test.sections.VidBasePage; import vid.automation.test.services.AsyncJobsService; import vid.automation.test.services.ServicesService; import vid.automation.test.services.SimulatorApi; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.function.Consumer; -import java.util.function.Predicate; -import java.util.stream.Collectors; - -import static junit.framework.TestCase.assertNull; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.testng.Assert.assertEquals; -import static org.testng.AssertJUnit.assertTrue; -import static vid.automation.test.infra.Features.FLAG_ASYNC_INSTANTIATION; -import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; +import vid.automation.test.utils.ReadFile; @FeatureTogglingTest(FLAG_ASYNC_INSTANTIATION) public class NewServiceInstanceTest extends CreateInstanceDialogBaseTest { + private static final String COMPLETED = "COMPLETED"; + private static final String IN_PROGRESS = "IN_PROGRESS"; + private static final String PENDING = "PENDING"; + private final String vfModule0Name = "2017488_PASQUALEvpe0..2017488PASQUALEVpe..PASQUALE_base_vPE_BV..module-0"; + private final String vfModule0UUID = "f8360508-3f17-4414-a2ed-6bc71161e8db"; private ServicesService servicesService = new ServicesService(); private DrawingBoardPage drawingBoardPage = new DrawingBoardPage(); List<String> serviceModelLabelList = Arrays.asList("Model version", "Description", "Category", "UUID", "Invariant UUID", "Service type", "Service role"); List<String> mandatoryServiceModelLabelList = Arrays.asList("Model version", "UUID", "Invariant UUID"); - private final String defaultServiceModelForMostTests = "6e59c5de-f052-46fa-aa7e-2fca9d674c44"; private final VidBasePage vidBasePage = new VidBasePage(); + public static final String VNF_SET_BUTTON_TEST_ID = "form-set"; + private static final Logger logger = LogManager.getLogger(NewServiceInstanceTest.class); @BeforeClass protected void dropAllAsyncJobs() { @@ -60,36 +119,77 @@ public class NewServiceInstanceTest extends CreateInstanceDialogBaseTest { } @BeforeMethod - protected void refreshPage() { - GeneralUIUtils.ultimateWait(); - - vidBasePage.refreshPage(); + protected void goToWelcome() { + SideMenu.navigateToWelcomePage(); } @Override protected UserCredentials getUserCredentials() { - String userName = Constants.Users.USP_VOICE_VIRTUAL_USP; + String userName = Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA; User user = usersService.getUser(userName); return new UserCredentials(user.credentials.userId, user.credentials.password, userName, "", ""); } @Test public void createNewServiceInstance_fullModelData_LeftPaneLabelsCorrect() throws Exception { - loadMacroServicePopup_noDynamicFields_fullModelDetails_ecompNamingFalse(); + prepareServicePreset(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails, false); + loadServicePopup(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails); assertServiceModelLabelsCorrect(serviceModelLabelList); } @Test public void createNewServiceInstance_partialModelData_LeftPaneLabelsCorrect() throws Exception { - loadMacroServicePopup_withDynamicFields_partialModelDetails_ecompNamingTrue(); + prepareServicePreset(macroSriovWithDynamicFieldsEcompNamingTruePartialModelDetails, false); + loadServicePopup(macroSriovWithDynamicFieldsEcompNamingTruePartialModelDetails); assertServiceModelLabelsCorrect(mandatoryServiceModelLabelList); } + @Test + public void createNewServiceInstance_setFieldValue_resetDependenciesListsAndValues() { + resetGetTenantsCache(); + try { + BrowseASDCPage browseASDCPage = new BrowseASDCPage(); + prepareServicePreset(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails, false); + SimulatorApi.registerExpectation(Constants.RegisterToSimulator.CreateNewServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_CAR_2020_ER, SimulatorApi.RegistrationStrategy.APPEND); + registerExpectationFromPreset( + new PresetAAIGetTenants( + "CAR_2020_ER", + "MSO-dev-service-type", + "registration_to_simulator/create_new_instance/aai_get_tenants_for_customer_CAR_2020_ER.json"), + SimulatorApi.RegistrationStrategy.APPEND); + + loadServicePopup(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails); + Wait.waitByClassAndText(Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS, "SILVIA ROBBINS", 30); + VidBasePage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89"); + GeneralUIUtils.ultimateWait(); + String serviceType = "TYLER SILVIA"; + Wait.waitByClassAndText(Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS, serviceType, 30); + browseASDCPage.selectServiceTypeByName(serviceType); + String lcpRegion = "hvf6"; + Wait.waitByClassAndText("lcpRegionOption", lcpRegion, 30); + viewEditPage.selectLcpRegion(lcpRegion, AIC); + browseASDCPage.selectTenant("bae71557c5bb4d5aac6743a4e5f1d054"); + + VidBasePage.selectSubscriberById("CAR_2020_ER"); + assertElementDisabled("lcpRegion-select"); + serviceType = "MSO-dev-service-type"; + Wait.waitByClassAndText(Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS, serviceType, 30); + browseASDCPage.selectServiceTypeByName(serviceType); + lcpRegion = "CAR_2020_ER"; + Wait.waitByClassAndText("lcpRegionOption", lcpRegion, 30); + viewEditPage.selectLcpRegion(lcpRegion, AIC); + browseASDCPage.selectTenant("092eb9e8e4b7412e8787dd091bc58e66"); + } finally { + resetGetTenantsCache(); + } + } + /** * asserts that the provided labels list is visible and that no other detail item appears in the model details panel. */ protected void assertServiceModelLabelsCorrect(List<String> serviceModelLabelList) throws Exception { - WebElement modelInformation = getDriver().findElement(By.id("model-information")); + WebElement genericPopup = getDriver().findElement(By.tagName("generic-form-popup")); + WebElement modelInformation = genericPopup.findElement(By.id("model-information")); List<WebElement> modelInformationItems = modelInformation.findElements(By.xpath("./div")); assertEquals(modelInformationItems.size(), serviceModelLabelList.size()); serviceModelLabelList.forEach(label -> { @@ -101,179 +201,456 @@ public class NewServiceInstanceTest extends CreateInstanceDialogBaseTest { @Test public void createNewServiceInstance_leftPane_serviceModelDataCorrect() { - Service service = servicesService.getService(NewServicePopup.SERVICE_UUID); + Service service = servicesService.getService(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails.modelVersionId); String prefix = NewServicePopup.SERVICE_MODEL_DATA_TEST_ID_VALUE_PREFIX; - loadMacroServicePopup_noDynamicFields_fullModelDetails_ecompNamingFalse(); - setNewInstance_leftPane_assertModelDataCorrect(NewServicePopup.SERVICE_MODEL_FIELD_TO_DATA_TESTS_ID, prefix, service); + prepareServicePreset(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails, false); + loadServicePopup(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails); + logger.info("Expected service model properties: "+service.toString()); + assertModelDataCorrect(NewServicePopup.SERVICE_MODEL_FIELD_TO_DATA_TESTS_ID, prefix, service); } @Test public void createNewServiceInstance_macro_validPopupDataAndUI__ecompNamingFalse() { - ServiceData serviceData = new ServiceData("csar-noDynamicFields-ecompNamingFalse-fullModelDetails-1a80c596.zip", - "1a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd", + ServiceData serviceData = new ServiceData( + macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails.modelVersionId, new ArrayList<>(), false, true, true, true, - "2017-488_ADIOD-vPE 0", - "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1", 0, 1, ImmutableList.of("Bandwidth", "Bandwidth units")); + "2017-488_PASQUALE-vPE 0", + "2017488_PASQUALEvpe0..2017488PASQUALEVpe..PASQUALE_vRE_BV..module-1", 0, 1, new ArrayList<>(), "25284168-24bb-4698-8cb4-3f509146eca5"); - String serviceInstanceName = deployServiceInstance(serviceData, false); - vidBasePage.screenshotDeployDialog(serviceInstanceName); - deployAndVerifyModuleInPendingTable(serviceInstanceName); - verifyOpenAuditInfo(serviceInstanceName); - verifyOpenViewEdit(serviceInstanceName); - verifyDeleteJob(serviceInstanceName); - verifyHideJob(serviceInstanceName); + prepareServicePreset(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails, false); + + final String serviceInstanceName = createSriovService(serviceData, true); + createVnf(serviceData, true, true, serviceInstanceName); + + createVfModule(serviceData, serviceInstanceName, false, false); + + } + + @Test(groups = "underDevelopment") + public void createNewServiceInstance_macro_validPopupDataAndUI__dynamicFieldsEcompNamingFalse_DEV() { + /* + Upon failure in test dynamicFieldsEcompNamingFalse_FLESH(), exception will provide + the needed data for this DEV method: + + 1. "Current step" when the failure occurred + 2. "Random alphabetic" that was randomized while test + 3. "Starting reduxState" that was on the step that failed. + + These data can be used for, accordingly, 1. startInStep param; 2, randomAlphabetic + param; 3. reduxForStep param. + */ + + // It should be easier to put `reduxForStep` in this file, to avoid Java's code-clutter and json escaping. + final String reduxForStep = ReadFile.loadResourceAsString( + "NewServiceInstanceTest/createNewServiceInstance_macro_validPopupDataAndUI__dynamicFieldsEcompNamingFalse.json"); + + createNewServiceInstance_macro_validPopupDataAndUI__dynamicFieldsEcompNamingFalse_FLESH("DEV", 5, reduxForStep, "mCaNk"); + } + + @Test + public void createNewServiceInstance_macro_validPopupDataAndUI__dynamicFieldsEcompNamingFalse() { + createNewServiceInstance_macro_validPopupDataAndUI__dynamicFieldsEcompNamingFalse_FLESH("RUNTIME", 0, null, randomAlphabetic(5)); + } + + private void createNewServiceInstance_macro_validPopupDataAndUI__dynamicFieldsEcompNamingFalse_FLESH(String mode, int startInStep, String reduxForStep, String randomAlphabetic) { + + MutableInt i = new MutableInt(); + Map<String, String> reduxStates = new HashMap<>(); + + ServiceData serviceData = new ServiceData( + macroSriovWithDynamicFieldsEcompNamingFalsePartialModelDetailsVnfEcompNamingFalse.modelVersionId, + Collections.singletonList("2017488 PASQUALEvpe0 asn:"), + false, false, true, false, + "2017-488_PASQUALE-vPE 0", + "2017488_PASQUALEvpe0..2017488PASQUALEVpe..PASQUALE_vRE_BV..module-1", 0, 1, ImmutableList.of("Bandwidth", "Bandwidth units"), + "25284168-24bb-4698-8cb4-3f509146eca5"); + + // this is the instance-name that createSriovService is going to use + String serviceInstanceName = randomAlphabetic + "instancename"; + + doReduxStep(reduxStates, randomAlphabetic, startInStep, reduxForStep, i, mode, () -> { + prepareServicePreset(macroSriovWithDynamicFieldsEcompNamingFalsePartialModelDetailsVnfEcompNamingFalse, + false); + createSriovService(serviceData, false, randomAlphabetic); + }); + + doReduxStep(reduxStates, randomAlphabetic, startInStep, reduxForStep, i, mode, () -> + createVnf(serviceData, false, true, serviceInstanceName) + ); + + final String vnfInstanceName2 = randomAlphabetic + "instanceName"; + final String vnfName2 = "2017-388_PASQUALE-vPE"; + + doReduxStep(reduxStates, randomAlphabetic, startInStep, reduxForStep, i, mode, () -> + createVnf(new VnfData(vnfName2 + " 0", "afacccf6-397d-45d6-b5ae-94c39734b168", vnfInstanceName2, false), + false, Features.FLAG_DEFAULT_VNF.isActive(), serviceInstanceName) + ); + + doReduxStep(reduxStates, randomAlphabetic, startInStep, reduxForStep, i, mode, () -> + createVfModule(serviceData, serviceInstanceName, false, true) + ); + + doReduxStep(reduxStates, randomAlphabetic, startInStep, reduxForStep, i, mode, () -> { + + editVfModuleAndJustSetName(vfModule0Name, vfModule0UUID); + if (Features.FLAG_DUPLICATE_VNF.isActive()) { + duplicateVnf(serviceData.vnfData, 2); + } + vidBasePage.screenshotDeployDialog(serviceInstanceName); + }); + + doReduxStep(reduxStates, randomAlphabetic, startInStep, reduxForStep, i, mode, () -> { + prepareServicePreset(macroSriovWithDynamicFieldsEcompNamingFalsePartialModelDetailsVnfEcompNamingFalse, + true); + + final String vfModuleName1 = "2017488PASQUALEVpe..PASQUALE_base_vPE_BV..module-0"; + final String vfModuleName2 = "2017488PASQUALEVpe..PASQUALE_vRE_BV..module-1"; + final String request1 = PresetMSOBaseCreateInstancePost.DEFAULT_REQUEST_ID; + final String request2 = "ce010256-3fdd-4cb5-aed7-37112a2c6e93"; + final ImmutableMap<Keys, String> vars = ImmutableMap.<Keys, String>builder() + .put(Keys.SERVICE_NAME, serviceInstanceName) + .put(Keys.VNF_NAME, cleanSeparators("2017-488_PASQUALE-vPE", serviceData.vnfData.vnfInstanceName)) + .put(Keys.VFM_NAME1, cleanSeparators(vfModuleName1 , "VF instance name ZERO")) + .put(Keys.VFM_NAME2, cleanSeparators(vfModuleName2 , "VF instance name")) + .put(Keys.VG_NAME, cleanSeparators(vfModuleName2 , "VF instance name") + "_vol_abc") + .put(Keys.VNF_NAME2, cleanSeparators(vnfName2, vnfInstanceName2)) + .build(); + registerExpectationFromPresets(ImmutableList.of( + // although "some legacy region" is provided for vnf, Service's region "hvf6" overrides it + PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MTN6_TO_ATT_AIC, + new PresetMSOCreateServiceInstanceGen2WithNamesEcompNamingFalse(vars, 0, request1), + new PresetMSOCreateServiceInstanceGen2WithNamesEcompNamingFalse(vars, 1, request2) + ), SimulatorApi.RegistrationStrategy.APPEND); + + deployAndVerifyModuleInPendingTableMacro(serviceInstanceName, request1, request2); + verifyOpenAuditInfo(serviceInstanceName); + verifyOpenViewEdit(serviceInstanceName); + verifyDeleteJob(serviceInstanceName); + verifyHideJob(serviceInstanceName); + }); + } + + @Test + @FeatureTogglingTest(FLAG_1902_VNF_GROUPING) + public void createNewServiceInstance_aLaCarte_VnfGrouping() { + + String randomAlphabetic = randomAlphabetic(5); + + ServiceData serviceData = new ServiceData( + aLaCarteVnfGroupingService.modelVersionId, + ImmutableList.of(), + false, false, true, false, + null, null, 0, 1, ImmutableList.of(), null); + prepareServicePreset(aLaCarteVnfGroupingService, false); + + createALaCarteService(serviceData, randomAlphabetic); + + // this is the instance-name that createALaCarteService is using + String serviceInstanceName = randomAlphabetic + "instancename"; + + final String requestId = PresetMSOBaseCreateInstancePost.DEFAULT_REQUEST_ID; + final String serviceInstanceId = "d2391436-8d55-4fde-b4d5-72dd2cf13cgh"; + final ImmutableMap<Keys, String> names = ImmutableMap.<Keys, String>builder() + .put(Keys.SERVICE_NAME, serviceInstanceName) + .build(); + SimulatorApi.registerExpectationFromPresets(ImmutableList.of( + new PresetMSOCreateServiceInstanceGen2WithNamesAlacarteGroupingService(names, 0, requestId, serviceInstanceId, "us16807000"), + new PresetAAIPostNamedQueryForViewEdit(serviceInstanceId, serviceInstanceName, false, false) + ), SimulatorApi.RegistrationStrategy.APPEND); + + deploy(); + verifyModuleInPendingTable(serviceInstanceName, requestId, null, ImmutableSet.of(IN_PROGRESS), false, false); + verifyModuleInPendingTable(serviceInstanceName, requestId, null, ImmutableSet.of(COMPLETED), false, true); + InstantiationStatusPage.verifyOpenNewViewEdit(serviceInstanceName, serviceInstanceId, aLaCarteVnfGroupingService.modelVersionId, "TYLER SILVIA", "e433710f-9217-458d-a79d-1c7aff376d89", "EDIT"); + } + + public interface Invoker{ + void invoke(); + } + + private void doReduxStep(Map<String, String> reduxStates, String randomAlphabetic, int startInStep, String reduxForStep, MutableInt currentStep, String mode, Invoker todo) { + try { + switch (mode) { + case "DEV": + if (currentStep.getValue() < startInStep) { + // skip up to startInStep + return; + } else if (currentStep.getValue() == startInStep) { + + setReduxState(reduxForStep); + + vidBasePage.navigateTo("serviceModels.htm#/servicePlanning?serviceModelId=6b528779-44a3-4472-bdff-9cd15ec93450"); + vidBasePage.goToIframe(); + } + + reduxStates.put(String.valueOf(currentStep), getReduxState()); + break; + + case "RUNTIME": + default: + // log current redux state, before invocation + reduxStates.put(String.valueOf(currentStep), getReduxState()); + logger.info("reduxGator runtime reduxState for step {}:\n{}", currentStep, getReduxState()); + break; + } + + try { + todo.invoke(); + } catch (AssertionError | Exception e) { + throw new AssertionError(String.join("\n", + "Current step: " + currentStep, + "Random alphabetic: " + randomAlphabetic, + "Starting reduxState: " + reduxStates.get(String.valueOf(currentStep)), + "Current reduxState: " + getReduxState() + ), e); + } + } finally { + logger.info("Cumulative reduxState: {}", reduxStates); + currentStep.increment(); + } + } + + private void duplicateVnf(VnfData vnfData, int count) { + hoverAndClickDuplicateButton(extractNodeToEdit(vnfData)); + vidBasePage.screenshotDeployDialog("duplicateVnf-" + vnfData.vnfName); + List<WebElement> options = ((RemoteWebElement)Get.byId("duplicate-select")).findElementsByTagName("option"); + assertThat(options.stream().map(x -> x.getText()).collect(Collectors.toList()), Matchers.contains("1","2")); + SelectOption.byIdAndVisibleText("duplicate-select", String.valueOf(count)); + Click.byClassAndVisibleText("sdc-button__primary", "DUPLICATE"); + } + + private String cleanSeparators(String... s) { + return String.join("", s).replace(" ", ""); + } + + private void editVfModuleAndJustSetName(String vfModuleName, String vfModuleUUID) { + if (Features.FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD.isActive()) { + hoverAndClickEditButton(vfModuleUUID + "-" + vfModuleName); + } else { + drawingBoardPage.clickAddButtonByNodeName(vfModuleName); + } + Input.text("VF instance name ZERO", "instanceName"); + Click.byTestId("form-set"); } @Test public void createNewServiceInstance_macro_validPopupDataAndUI__ecompNamingServiceFalseVnfTrue_vgNameFalse() { - ServiceData serviceData = new ServiceData("csar-noDynamicFields-ecompNamingFalse-fullModelDetails-1a80c596.zip", - "1a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd", + ServiceData serviceData = new ServiceData( + macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails.modelVersionId, new ArrayList<>(), false, true, false, true, - "2017-488_ADIOD-vPE 0", - "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0", 1, 1, new ArrayList<>()); + "2017-488_PASQUALE-vPE 0", + vfModule0Name, 1, 1, new ArrayList<>(), vfModule0UUID); + + prepareServicePreset(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails, false); + + final String serviceInstanceName = createSriovService(serviceData, true); + createVnf(serviceData, true, true, serviceInstanceName); + createVfModule(serviceData, serviceInstanceName, true, false); - deployServiceInstance(serviceData); } @Test public void createNewServiceInstance_macro_validPopupDataAndUI__ecompNamingServiceFalseVnfFalse_vgNameFalse() { - ServiceData serviceData = new ServiceData("csar-noDynamicFields-ecompNamingFalse-fullModelDetails-1a80c596-vnfEcompNamingFalse.zip", - "4a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd", + ServiceData serviceData = new ServiceData( + macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetailsVnfEcompNamingFalse.modelVersionId, new ArrayList<>(), false, false, false, false, - "2017-488_ADIOD-vPE 0", - "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0", 1, 1, new ArrayList<>()); + "2017-488_PASQUALE-vPE 0", + vfModule0Name, 1, 1, new ArrayList<>(), vfModule0UUID); + + prepareServicePreset(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetailsVnfEcompNamingFalse, false); + + final String serviceInstanceName = createSriovService(serviceData, true); + createVnf(serviceData, true, true, serviceInstanceName); + createVfModule(serviceData, serviceInstanceName, true, false); - deployServiceInstance(serviceData); } @Test - public void createNewServiceInstance_macro_validPopupDataAndUI__ecompNamingServiceFalseVnfFalse_vgNameTrue() { - ServiceData serviceData = new ServiceData("csar-noDynamicFields-ecompNamingFalse-fullModelDetails-1a80c596-vnfEcompNamingFalse.zip", - "4a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd", + public void createNewServiceInstance_macro_validPopupDataAndUI__ecompNamingServiceFalseVnfFalse_vgNameTrue() throws Exception { + ServiceData serviceData = new ServiceData( + macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetailsVnfEcompNamingFalse.modelVersionId, new ArrayList<>(), false, false, true, false, - "2017-488_ADIOD-vPE 0", - "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1", 0, 1, new ArrayList<>()); + "2017-488_PASQUALE-vPE 0", + "2017488_PASQUALEvpe0..2017488PASQUALEVpe..PASQUALE_vRE_BV..module-1", 0, 1, new ArrayList<>(), "25284168-24bb-4698-8cb4-3f509146eca5"); - deployServiceInstance(serviceData); - } + prepareServicePreset(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetailsVnfEcompNamingFalse, false); + + final String serviceInstanceName = createSriovService(serviceData, true); + createVnf(serviceData, true, true, serviceInstanceName); + clickRemoveVfModule(vfModule0UUID, vfModule0Name); + createVfModule(serviceData, serviceInstanceName, false, true); - private void deployServiceInstance(ServiceData serviceData) { - deployServiceInstance(serviceData, true); } - private String deployServiceInstance(ServiceData serviceData, boolean tryCancelsAndReentries) { - User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP); - final String serviceInstanceName = createSriovService( - user, serviceData.dynamicFields, serviceData.csarName, serviceData.modelUuid, - serviceData.isGeneratedNaming, serviceData.multiStageDesign, - tryCancelsAndReentries); + @Test + @FeatureTogglingTest(FLAG_5G_IN_NEW_INSTANTIATION_UI) + public void createNewServiceInstance_aLaCarte_validPopupDataAndUI() { + String serviceInstanceName = "NcService"+randomAlphabetic(5); + String networkInstanceName= "NcNetowrk"+randomAlphabetic(5); + String defactoNetworkInstanceName = "ExtVL"+networkInstanceName; + BrowseASDCPage browseASDCPage = new BrowseASDCPage(); + prepareServicePreset(aLaCarteNetworkProvider5G, true); + String serviceRequestId = UUID.randomUUID().toString(); + String networkRequestId = UUID.randomUUID().toString(); + String requestorID = getUserCredentials().getUserId(); + registerExpectationFromPresets( + ImmutableList.of( + new PresetMSOCreateServiceInstanceAlacarte5GServiceWithNetwork( + ImmutableMap.of(Keys.SERVICE_NAME, serviceInstanceName), + serviceRequestId, + requestorID), + new PresetMSOOrchestrationRequestGet(COMPLETE, serviceRequestId), + PRESET_SOME_LEGACY_REGION_TO_ATT_AIC, + new PresetMSOCreateNetworkALaCarte5G(networkRequestId, DEFAULT_SERVICE_INSTANCE_ID, defactoNetworkInstanceName, requestorID), + new PresetMSOOrchestrationRequestGet(COMPLETE, networkRequestId), + new PresetMSOOrchestrationRequestsGet5GServiceInstanceAndNetwork( + new ResponseDetails(serviceInstanceName, serviceRequestId, COMPLETE, "service"), + new ResponseDetails(defactoNetworkInstanceName, networkRequestId, COMPLETE, "network"), + DEFAULT_SERVICE_INSTANCE_ID) + ), + APPEND + ); + loadServicePopup(aLaCarteNetworkProvider5G.modelVersionId); + WebElement instanceNameInput = Get.byId("instanceName"); + instanceNameInput.sendKeys(serviceInstanceName); + VidBasePage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89"); + String serviceType = "TYLER SILVIA"; + Wait.waitByClassAndText(Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS, serviceType, 30); + browseASDCPage.selectServiceTypeByName(serviceType); + SelectOption.byTestIdAndVisibleText("WayneHolland", (Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID)); + SelectOption.byTestIdAndVisibleText("WATKINS", Constants.OwningEntity.PROJECT_SELECT_TEST_ID); + Click.byTestId("form-set"); + VidBasePage.goOutFromIframe(); + browseASDCPage.goToIframe(); + VnfData networkData = new VnfData("SR-IOV Provider-1", "840ffc47-e4cf-46de-8e23-525fd8c6fdc3", defactoNetworkInstanceName, false); + createNetwork(networkData, false, false, serviceInstanceName); + drawingBoardPage.clickDeployButton(); - createVnf(serviceData.vnfData.isGeneratedNaming, serviceData.vnfData.vnfName, serviceInstanceName, tryCancelsAndReentries); + VidBasePage.goOutFromIframe(); + GeneralUIUtils.ultimateWait(); + vidBasePage.goToIframe(); + GeneralUIUtils.ultimateWait(); - createVfModule( - serviceData.vfData.vfName, serviceData.vnfData.isGeneratedNaming, - serviceData.vfData.vgEnabled, serviceData.vfData.vfMin, serviceData.vfData.vfMax, - serviceData.vfData.dynamicFields, serviceInstanceName); + DrawingBoardPage.ServiceStatusChecker serviceStatusChecker = new DrawingBoardPage.ServiceStatusChecker(serviceInstanceName, Collections.singleton(COMPLETED)); + boolean statusIsShown = Wait.waitFor(serviceStatusChecker, null, 20, 2); + assertTrue("service "+serviceInstanceName+" wasnt completed after in time", statusIsShown); - return serviceInstanceName; + VidBasePage.goOutFromIframe(); } - @Test - public void createNewServiceInstance_macro_validPopupDataAndUI__ecompNamingTrue() { + public void createNewServiceInstance_macro_validPopupDataAndUI() { - List<String> serviceDynamicFields = Arrays.asList("2017488 adiodvpe0 asn:"); - ServiceData serviceData = new ServiceData("csar-withDynamicFields-ecompNamingTrue-partialModelDetails.zip", - "2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd", + List<String> serviceDynamicFields = Arrays.asList("2017488 PASQUALEvpe0 asn:"); + ServiceData serviceData = new ServiceData( + macroSriovWithDynamicFieldsEcompNamingTruePartialModelDetails.modelVersionId, serviceDynamicFields, - true, true, false, false, - "2017-488_ADIOD-vPE 0", - "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1", 0, 1, new ArrayList<>()); + true, true, true, false, + "2017-488_PASQUALE-vPE 0", + "2017488_PASQUALEvpe0..2017488PASQUALEVpe..PASQUALE_vRE_BV..module-1", 0, 1, new ArrayList<>(), "25284168-24bb-4698-8cb4-3f509146eca5"); - deployServiceInstance(serviceData); + prepareServicePreset(macroSriovWithDynamicFieldsEcompNamingTruePartialModelDetails, false); + + final String serviceInstanceName = createSriovService(serviceData, true); + createVnf(serviceData, true, true, serviceInstanceName); + clickRemoveVfModule(vfModule0UUID, vfModule0Name); + createVfModule(serviceData, serviceInstanceName, false, false); } - private void deployAndVerifyModuleInPendingTable(String serviceInstanceName) { - drawingBoardPage.clickDeployButton(); + private void deployAndVerifyModuleInPendingTableMacro(String serviceInstanceName, String requestId1, String requestId2) { + deploy(); boolean simulatorUpdated = false; - vidBasePage.goToIframe(); - GeneralUIUtils.ultimateWait(); - int[] ids = {1, 1, 2, 3}; - String[] statuses = {"IN_PROGRESS", "COMPLETED", "IN_PROGRESS", "PENDING"}; + int[] ids = {0, 0, 1, 2}; + String[] statuses = {IN_PROGRESS, COMPLETED, IN_PROGRESS, PENDING}; for (int i = 0; i < ids.length; i++) { String actualInstanceName = getActualInstanceName(serviceInstanceName, ids[i], statuses[i]); + verifyModuleInPendingTable(actualInstanceName, requestId1, requestId2, ImmutableSet.of(statuses[i]), true, simulatorUpdated); + simulatorUpdated = true; + } + vidBasePage.screenshotDeployDialog(serviceInstanceName); + } + + private void deploy() { + try { + logger.info("Redux state before deploy:"); + logger.info(getReduxState()); + } + catch (Exception e) { + //do nothing just logging + } + drawingBoardPage.clickDeployButton(); + + VidBasePage.goOutFromIframe(); + GeneralUIUtils.ultimateWait(); + vidBasePage.goToIframe(); + GeneralUIUtils.ultimateWait(); + } - final Set<String> expectedStatuses = ImmutableSet.of(statuses[i]); - ServiceStatusChecker serviceStatusChecker = new ServiceStatusChecker(actualInstanceName, expectedStatuses); - boolean statusIsShown = Wait.waitFor(serviceStatusChecker, null, 20, 2); - final String assertionMessage = String.format("service %s: none of rowClasses [%s] is in expectedStatuses: [%s] ", - actualInstanceName, - String.join(",", serviceStatusChecker.getColumnClassesSet()), - String.join(",", expectedStatuses)); + private void verifyModuleInPendingTable(String serviceInstanceName, String requestId1, String requestId2, Set<String> expectedStatuses, boolean isMacro, boolean simulatorUpdated) { + DrawingBoardPage.ServiceStatusChecker serviceStatusChecker = new DrawingBoardPage.ServiceStatusChecker(serviceInstanceName, expectedStatuses); + boolean statusIsShown = Wait.waitFor(serviceStatusChecker, null, 20, 2); + final String assertionMessage = String.format("service %s: none of rowClasses [%s] is in expectedStatuses: [%s] ", + serviceInstanceName, + String.join(",", serviceStatusChecker.getColumnClassesSet()), + String.join(",", expectedStatuses)); - assertTrue(assertionMessage, statusIsShown); + assertTrue(assertionMessage, statusIsShown); + if (isMacro) { InstantiationStatusPage.assertInstantiationStatusRow( - actualInstanceName, expectedRowFields(actualInstanceName)); - - if (!simulatorUpdated) { - simulatorUpdated = true; - final String request1 = PresetMSOBaseCreateServiceInstancePost.DEFAULT_REQUEST_ID; - final String request2 = "ce010256-3fdd-4cb5-aed7-37112a2c6e93"; - SimulatorApi.registerExpectationFromPreset(new PresetMSOCreateServiceInstanceGen2(request2), APPEND); - SimulatorApi.registerExpectationFromPreset(new PresetMSOOrchestrationRequestGet("IN_PROGRESS", request2), APPEND); - SimulatorApi.registerExpectationFromPreset(new PresetMSOOrchestrationRequestGet("COMPLETE", request1), APPEND); + serviceInstanceName, expectedRowFields(serviceInstanceName)); + } else { + InstantiationStatusPage.assertInstantiationStatusRow( + serviceInstanceName, expectedALaCarteRowFields(serviceInstanceName)); + } + + if (!simulatorUpdated) { + if (requestId2 != null) { + registerExpectationFromPreset(new PresetMSOOrchestrationRequestGet(IN_PROGRESS, requestId2), APPEND); } + registerExpectationFromPreset(new PresetMSOOrchestrationRequestGet("COMPLETE", requestId1), APPEND); } vidBasePage.screenshotDeployDialog(serviceInstanceName); } private String getActualInstanceName(String serviceInstanceName, Integer i, String status) { - return "PENDING".equals(status) ? serviceInstanceName : serviceInstanceName + "_00" + i; + return i==0 ? serviceInstanceName : serviceInstanceName + "_00" + i; } private void verifyOpenViewEdit(String serviceInstanceName) { boolean[] openEnabled = {true, false, false}; - String[] statuses = {"COMPLETED", "IN_PROGRESS", "PENDING"}; - ImmutableList.of(1, 2, 3).forEach(i -> { - String actualInstanceName = getActualInstanceName(serviceInstanceName, i, statuses[i - 1]); - checkMenuItem(actualInstanceName, Constants.InstantiationStatus.CONTEXT_MENU_HEADER_OPEN_ITEM, openEnabled[i - 1], contextMenuOpen -> { - Click.byTestId(contextMenuOpen); - vidBasePage.goOutFromIframe(); - GeneralUIUtils.ultimateWait(); - - Wait.byText("View/Edit Service Instance"); - Wait.byText("Add node instance"); - Wait.byText("i'm a port"); - Wait.byText("f8791436-8d55-4fde-b4d5-72dd2cf13cfb"); - - vidBasePage.screenshotDeployDialog("view-edit-" + actualInstanceName); - SideMenu.navigateToMacroInstantiationStatus(); - }); + String[] statuses = {COMPLETED, IN_PROGRESS, PENDING}; + ImmutableList.of(0, 1, 2).forEach(i -> { + String actualInstanceName = getActualInstanceName(serviceInstanceName, i, statuses[i]); + if (Features.FLAG_1902_NEW_VIEW_EDIT.isActive()) { + InstantiationStatusPage.verifyOpenNewViewEdit(actualInstanceName, openEnabled[i], "EDIT"); + } + else { + vidBasePage.verifyOpenOldViewEdit(actualInstanceName, null, openEnabled[i], true, true); + } }); } - private void verifyOpenAuditInfo(String serviceInstanceName) { boolean auditInfoEnabled = true; - String[] statuses = {"COMPLETED", "IN_PROGRESS", "PENDING"}; - for (Integer i : ImmutableList.of(1, 2, 3)) { - String actualInstanceName = getActualInstanceName(serviceInstanceName, i, statuses[i - 1]); - checkMenuItem(actualInstanceName, Constants.InstantiationStatus.CONTEXT_MENU_HEADER_AUDIT_INFO_ITEM, auditInfoEnabled, contextMenuOpen -> { + String[] statuses = {COMPLETED, IN_PROGRESS, PENDING}; + for (Integer i : ImmutableList.of(0, 1, 2)) { + String actualInstanceName = getActualInstanceName(serviceInstanceName, i, statuses[i]); + InstantiationStatusPage.checkMenuItem(actualInstanceName, Constants.InstantiationStatus.CONTEXT_MENU_HEADER_AUDIT_INFO_ITEM, auditInfoEnabled, contextMenuOpen -> { Click.byTestId(contextMenuOpen); checkAuditInfoModal(actualInstanceName, i, statuses); }); final WebElement row = InstantiationStatusPage.getInstantiationStatusRow(actualInstanceName); - row.findElement(By.id(Constants.InstantiationStatus.TD_JOB_STATUS_ICON + "-" + (i - 1))).click(); + row.findElement(By.id(Constants.InstantiationStatus.TD_JOB_STATUS_ICON + "-" + (i))).click(); checkAuditInfoModal(actualInstanceName, i, statuses); } } @@ -294,16 +671,16 @@ public class NewServiceInstanceTest extends CreateInstanceDialogBaseTest { convertUITextCapitalizeAndFormatPipe(s.getText())) .collect(Collectors.toList()); - List<String> serviceStatus = Arrays.asList(Arrays.copyOfRange(statuses, i - 1, statuses.length)); + List<String> serviceStatus = Arrays.asList(Arrays.copyOfRange(statuses, i, statuses.length)); assertThat("statuses for " + actualInstanceName + " must be as expected", vidStatuses, is(Lists.reverse(serviceStatus))); String dateString = vidTableElement.findElements(By.id("vidStatusTime")).get(0).getText(); assertTrue("vid Status Time column must contains valid date in format : MMM dd, yyyy HH:mm", isDateValid(dateString, "MMM dd, yyyy HH:mm")); WebElement MSOTableElement = Get.byId("service-instantiation-audit-info-mso"); - assertEquals(4, MSOTableElement.findElement(By.tagName("thead")).findElements(By.tagName("th")).size(), "MSO table must contain 4 columns"); + assertEquals(3, MSOTableElement.findElement(By.tagName("thead")).findElements(By.tagName("th")).size(), "MSO table must contain 3 columns"); - if (statuses[i - 1].equals("PENDING")) { + if (statuses[i].equals(PENDING)) { assertEquals(0, MSOTableElement.findElement(By.tagName("tbody")).findElements(By.tagName("tr")).size(), "When status is PENDING MSO table is empty"); } @@ -335,20 +712,20 @@ public class NewServiceInstanceTest extends CreateInstanceDialogBaseTest { private void verifyDeleteJob(String serviceInstanceName) { boolean[] deleteEnabled = {false, false, true}; - String[] statuses = {"COMPLETED", "IN_PROGRESS", "PENDING"}; - verifyDeleteOrHideOperation(serviceInstanceName, Constants.InstantiationStatus.CONTEXT_MENU_DELETE, statuses, deleteEnabled, "deleted"); + String[] statuses = {COMPLETED, IN_PROGRESS, PENDING}; + verifyDeleteOrHideOperation(serviceInstanceName, Constants.InstantiationStatus.CONTEXT_MENU_REMOVE, statuses, deleteEnabled, "deleted"); } private void verifyHideJob(String serviceInstanceName) { boolean[] hideEnabled = {true, false}; - String[] statuses = {"COMPLETED", "IN_PROGRESS"}; + String[] statuses = {COMPLETED, IN_PROGRESS}; verifyDeleteOrHideOperation(serviceInstanceName, Constants.InstantiationStatus.CONTEXT_MENU_HIDE, statuses, hideEnabled, "hidden"); } private void verifyDeleteOrHideOperation(String serviceInstanceName, String contextMenuItem, String[] statuses, boolean[] operationEnabled, String operationName) { - for (int i = 1; i <= statuses.length; i++) { - String actualInstanceName = getActualInstanceName(serviceInstanceName, i, statuses[i - 1]); - checkMenuItem(actualInstanceName, contextMenuItem, operationEnabled[i - 1], contextMenuDelete -> { + for (int i = 0; i < statuses.length; i++) { + String actualInstanceName = getActualInstanceName(serviceInstanceName, i, statuses[i]); + InstantiationStatusPage.checkMenuItem(actualInstanceName, contextMenuItem, operationEnabled[i], contextMenuDelete -> { Click.byTestId(contextMenuDelete); GeneralUIUtils.ultimateWait(); assertNull(actualInstanceName + " should be " + operationName, @@ -358,114 +735,117 @@ public class NewServiceInstanceTest extends CreateInstanceDialogBaseTest { vidBasePage.screenshotDeployDialog(serviceInstanceName); } - private void checkMenuItem(String actualInstanceName, String contextMenuItem, boolean shouldBeEnabled, Consumer<String> doIfEnabled) { - Wait.waitFor(name -> { - if (null == InstantiationStatusPage.getInstantiationStatusRow(name)) { - InstantiationStatusPage.clickRefreshButton(); - return false; - } else { - return true; - } - }, actualInstanceName, 8, 1); - final WebElement row = InstantiationStatusPage.getInstantiationStatusRow(actualInstanceName); - row.findElement(By.className("menu-div")).click(); - String clazz = Get.byXpath("//div[@data-tests-id='" + contextMenuItem + "']/ancestor::li").getAttribute("class"); - assertThat("item " + contextMenuItem + " of " + actualInstanceName + - " should be " + (shouldBeEnabled ? "enabled" : "disabled"), !clazz.equals("disabled"), is(shouldBeEnabled)); - if (shouldBeEnabled) { - doIfEnabled.accept(contextMenuItem); - } else { - // dismiss menu - Get.byClass("title").get(0).click(); - } - } - private ImmutableMap<String, String> expectedRowFields(String actualInstanceName) { return ImmutableMap.<String, String>builder() .put("userId", getUserCredentials().getUserId()) .put("serviceModelName", "action-data") .put("serviceInstanceName", actualInstanceName) .put("serviceModelVersion", "1.0") - .put("subscriberName", "USP VOICE") - .put("serviceType", "VIRTUAL USP") - .put("regionId", "mtn6") - .put("tenantName", "AIN Web Tool-15-D-testgamma") + .put("subscriberName", "SILVIA ROBBINS") + .put("serviceType", "TYLER SILVIA") + .put("regionId", "hvf6") + .put("tenantName", "AIN Web Tool-15-D-testalexandria") .put("aicZoneName", "NFTJSSSS-NFT1") - .put("project", "DFW") - .put("owningEntityName", "MetroPacketCore") + .put("project", "WATKINS") + .put("owningEntityName", "WayneHolland") + .put("pause", "false") + .build(); + } + + private ImmutableMap<String, String> expectedALaCarteRowFields(String actualInstanceName) { + return ImmutableMap.<String, String>builder() + .put("userId", getUserCredentials().getUserId()) + .put("serviceModelName", "Grouping Service for Test") + .put("serviceInstanceName", actualInstanceName) + .put("serviceModelVersion", "1.0") + .put("subscriberName", "SILVIA ROBBINS") + .put("serviceType", "TYLER SILVIA") + .put("project", "WATKINS") + .put("owningEntityName", "WayneHolland") .put("pause", "false") .build(); } - private String createSriovService(User user, List<String> serviceDynamicFields, - String csarName, String modelId, boolean modelWithGeneratedName, - boolean multiStageDesign, boolean tryCancelsAndReentries) { + private String createSriovService(ServiceData serviceData, boolean tryCancelsAndReentries) { + return createSriovService(serviceData, tryCancelsAndReentries, randomAlphabetic(5)); + } + + private String createSriovService(ServiceData serviceData, boolean tryCancelsAndReentries, String randomAlphabetic) { BrowseASDCPage browseASDCPage = new BrowseASDCPage(); + User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA); // simulate typing with spaces, but expected is without spaces - String serviceInstanceNameWithSpaces = RandomStringUtils.randomAlphabetic(5) + " instance name"; - String serviceInstanceName = serviceInstanceNameWithSpaces.replace(" ", ""); + String serviceInstanceNameWithSpaces = randomAlphabetic + " instance name"; + String serviceInstanceName = cleanSeparators(serviceInstanceNameWithSpaces); List<String> cycles = tryCancelsAndReentries ? ImmutableList.of("WILL_CANCEL", "AFTER_CANCEL") : ImmutableList.of("SINGLE_SHOT"); cycles.forEach(cycle -> { if ("AFTER_CANCEL".equals(cycle)) { - loadServicePopupOnBrowseASDCPage(modelId); + loadServicePopupOnBrowseASDCPage(serviceData.modelUuid); } else { - loadServicePopup(csarName, modelId); + loadServicePopup(serviceData.modelUuid); } - WebElement instanceName = Get.byId("instance-name"); - if (modelWithGeneratedName) { - Assert.assertNull(instanceName, "instance name input should be invisible when serviceEcompNaming == true."); + WebElement instanceName = Get.byId("instanceName"); + boolean isRequired = isElementByIdRequired("instanceName-label"); + if (serviceData.isGeneratedNaming) { + Assert.assertNotNull(instanceName, "instance name input should be visible when serviceEcompNaming == true."); + Assert.assertFalse(isRequired,"instance name input should be optional when ecompNaming == true."); + } else { - instanceName.sendKeys(serviceInstanceNameWithSpaces); + Assert.assertTrue(isRequired,"instance name input should be required when serviceEcompNaming == false."); + instanceName.sendKeys(serviceInstanceName); } //serviceType should be dependent on subscriber selection - assertElementDisabled("service-type-select"); - - GeneralUIUtils.ultimateWait(); - assertDropdownPermittedItemsByLabel(user.subscriberNames, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS); - VidBasePage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89"); + assertElementDisabled("serviceType-select"); + Wait.waitByClassAndText(Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS, "SILVIA ROBBINS", 30); GeneralUIUtils.ultimateWait(); + Click.byTestId(Constants.SUBSCRIBER_NAME_SELECT_TESTS_ID); + if (Features.FLAG_RESTRICTED_SELECT.isActive()) + assertElementExistAccordingTagNameAndTestId("select", Constants.SUBSCRIBER_SELECT_ID); + else{ + assertDropdownPermittedItemsByLabel(user.subscriberNames, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS); + } + VidBasePage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89"); //lcpRegion should be dependent on serviceType selection assertElementDisabled("lcpRegion-select"); - String serviceType = "VIRTUAL USP"; + String serviceType = "TYLER SILVIA"; Wait.waitByClassAndText(Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS, serviceType, 30); browseASDCPage.selectServiceTypeByName(serviceType); //tenant should be dependent on lcpRegion selection assertElementDisabled("tenant-select"); - String lcpRegion = "mtn6"; + String lcpRegion = "hvf6"; Wait.waitByClassAndText("lcpRegionOption", lcpRegion, 30); - browseASDCPage.selectLcpRegion(lcpRegion); + viewEditPage.selectLcpRegion(lcpRegion, AIC); + GeneralUIUtils.ultimateWait(); browseASDCPage.selectTenant("bae71557c5bb4d5aac6743a4e5f1d054"); - String setButtonTestId = "service-form-set"; + String setButtonTestId = "form-set"; assertSetButtonDisabled(setButtonTestId); - SelectOption.byTestIdAndVisibleText("MetroPacketCore", (Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID)); + SelectOption.byTestIdAndVisibleText("WayneHolland", (Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID)); assertSetButtonDisabled(setButtonTestId); - SelectOption.byTestIdAndVisibleText("DHV", Constants.ViewEdit.PRODUCT_FAMILY_SELECT_TESTS_ID); + SelectOption.byTestIdAndVisibleText("ERICA", Constants.ViewEdit.PRODUCT_FAMILY_SELECT_TESTS_ID); assertSetButtonEnabled(setButtonTestId); browseASDCPage.selectProductFamily("e433710f-9217-458d-a79d-1c7aff376d89"); - assertAllIsPermitted(Constants.BrowseASDC.AIC_OPTION_CLASS); browseASDCPage.selectAicZone("NFT1"); - SelectOption.byTestIdAndVisibleText("DFW", Constants.OwningEntity.PROJECT_SELECT_TEST_ID); + SelectOption.byTestIdAndVisibleText("WATKINS", Constants.OwningEntity.PROJECT_SELECT_TEST_ID); assertNotificationAreaVisibilityBehaviour(); - assertPauseOnPausePointsVisibility(multiStageDesign); + assertPauseOnPausePointsVisibility(serviceData.multiStageDesign); - validateDynamicFields(serviceDynamicFields); + validateDynamicFields(serviceData.dynamicFields); vidBasePage.screenshotDeployDialog("createSriovService-" + serviceInstanceName); @@ -475,7 +855,7 @@ public class NewServiceInstanceTest extends CreateInstanceDialogBaseTest { Click.byTestId(setButtonTestId); } - browseASDCPage.goOutFromIframe(); + VidBasePage.goOutFromIframe(); browseASDCPage.goToIframe(); @@ -483,112 +863,268 @@ public class NewServiceInstanceTest extends CreateInstanceDialogBaseTest { return serviceInstanceName; } - private void createVnf(boolean isInstanceNameGenerated, String vnfName, String serviceInstanceName, boolean tryCancelsAndReentries) { + private String createALaCarteService(ServiceData serviceData, String randomAlphabetic) { BrowseASDCPage browseASDCPage = new BrowseASDCPage(); - drawingBoardPage.clickAddButtonByNodeName(vnfName); + User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA); + + // simulate typing with spaces, but expected is without spaces + String serviceInstanceNameWithSpaces = randomAlphabetic + " instance name"; + String serviceInstanceName = cleanSeparators(serviceInstanceNameWithSpaces); + + loadServicePopup(serviceData.modelUuid); - if (isInstanceNameGenerated) { - WebElement instanceName = Get.byId("instance-name"); + WebElement instanceName = Get.byId("instanceName"); + if (serviceData.isGeneratedNaming) { Assert.assertNull(instanceName, "instance name input should be invisible when serviceEcompNaming == true."); } else { - Input.text("VNF instance name", "instanceName"); + instanceName.sendKeys(serviceInstanceName); + } + + //serviceType should be dependent on subscriber selection + assertElementDisabled("serviceType-select"); + Wait.waitByClassAndText(Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS, "SILVIA ROBBINS", 30); + GeneralUIUtils.ultimateWait(); + Click.byTestId(Constants.SUBSCRIBER_NAME_SELECT_TESTS_ID); + if (Features.FLAG_RESTRICTED_SELECT.isActive()) + assertElementExistAccordingTagNameAndTestId("select", Constants.SUBSCRIBER_SELECT_ID); + else{ + assertDropdownPermittedItemsByLabel(user.subscriberNames, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS); + + } + VidBasePage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89"); + + String serviceType = "TYLER SILVIA"; + Wait.waitByClassAndText(Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS, serviceType, 30); + browseASDCPage.selectServiceTypeByName(serviceType); + + String setButtonTestId = "form-set"; + assertSetButtonDisabled(setButtonTestId); + + SelectOption.byTestIdAndVisibleText("WayneHolland", (Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID)); + + SelectOption.byTestIdAndVisibleText("WATKINS", Constants.OwningEntity.PROJECT_SELECT_TEST_ID); + + validateDynamicFields(serviceData.dynamicFields); + + vidBasePage.screenshotDeployDialog("createALaCarteService-" + serviceInstanceName); + + Click.byTestId(setButtonTestId); + + VidBasePage.goOutFromIframe(); + + browseASDCPage.goToIframe(); + + return serviceInstanceName; + } + + private void assertElementExistAccordingTagNameAndTestId(String tag, String testId) { + WebElement webElement = Get.byId(testId); + Assert.assertEquals(webElement.getTagName(), tag); + } + + private void createVnf(ServiceData serviceData, boolean tryCancelsAndReentries, boolean addedByDefault, String serviceInstanceName) { + createVnf(serviceData.vnfData, tryCancelsAndReentries, addedByDefault, serviceInstanceName); + } + + private void createNetwork(VnfData vnfData, boolean tryCancelsAndReentries, boolean addedByDefault, String serviceInstanceName) { + createVnf(vnfData, tryCancelsAndReentries, addedByDefault, serviceInstanceName, true); + } + + private void createVnf(VnfData vnfData, boolean tryCancelsAndReentries, boolean addedByDefault, String serviceInstanceName) { + createVnf(vnfData, tryCancelsAndReentries, addedByDefault, serviceInstanceName, false); + } + + private void createVnf(VnfData vnfData, boolean tryCancelsAndReentries, boolean addedByDefault, String serviceInstanceName, boolean isNetwork) { + BrowseASDCPage browseASDCPage = new BrowseASDCPage(); + + String nodeToEdit = extractNodeToEdit(vnfData); + if (addedByDefault && Features.FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD.isActive()) { + hoverAndClickEditButton(nodeToEdit); + } else { + drawingBoardPage.clickAddButtonByNodeName(vnfData.vnfName); + } + + GeneralUIUtils.ultimateWait(); + + if (vnfData.isGeneratedNaming) { + Assert.assertFalse(isElementByIdRequired("instanceName-label") ,"instance name input should be optional when EcompNaming == true, and required when false."); + } else { + Input.text(vnfData.vnfInstanceName, "instanceName"); } + //tenant should be dependent on lcpRegion selection assertElementDisabled("tenant-select"); WebElement legacyRegion = Get.byTestId("lcpRegionText"); - Assert.assertNull(legacyRegion, "legacy region shouldn't be visible when lcp region isn't AAIAIC25,rdm3 or rdm5a."); + Assert.assertNull(legacyRegion, "legacy region shouldn't be visible when lcp region isn't JANET25,olson3 or olson5a."); - browseASDCPage.selectLcpRegion("AAIAIC25"); + browseASDCPage.selectLcpRegion("JANET25"); legacyRegion = Get.byTestId("lcpRegionText"); - Assert.assertNotNull(legacyRegion, "legacy region should be visible when lcp region is AAIAIC25,rdm3 or rdm5a."); + Assert.assertNotNull(legacyRegion, "legacy region should be visible when lcp region is JANET25,olson3 or olson5a."); browseASDCPage.selectTenant("092eb9e8e4b7412e8787dd091bc58e86"); - String setButtonTestId = "vnf-form-set"; - assertSetButtonDisabled(setButtonTestId); + assertSetButtonDisabled(VNF_SET_BUTTON_TEST_ID); browseASDCPage.selectPlatform("platform"); - assertSetButtonEnabled(setButtonTestId); + assertSetButtonEnabled(VNF_SET_BUTTON_TEST_ID); browseASDCPage.setLegacyRegion("some legacy region"); - browseASDCPage.selectLineOfBusiness("ECOMP"); + browseASDCPage.selectLineOfBusiness("ONAP"); Wait.waitByTestId("model-item-value-subscriberName", 10); - Assert.assertEquals(Get.byTestId("model-item-value-subscriberName").getText(), "USP VOICE", "Subscriber name should be shown in vf module"); + Assert.assertEquals(Get.byTestId("model-item-value-subscriberName").getText(), "SILVIA ROBBINS", "Subscriber name should be shown in vf module"); Assert.assertEquals(Get.byTestId("model-item-value-min"), null, "Min value should not be shown in VNF popup"); Assert.assertEquals(Get.byTestId("model-item-value-max"), null, "Max value should not be show in VNF popup"); - if (!isInstanceNameGenerated) { + if (!vnfData.isGeneratedNaming) { Assert.assertEquals(Get.byTestId("model-item-value-serviceName").getText(), serviceInstanceName, "Subscriber name should be shown in vf module"); } vidBasePage.screenshotDeployDialog("createVnf-" + serviceInstanceName); - Click.byTestId(setButtonTestId); - - String nodeToEdit = "69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_ADIOD-vPE 0"; + Click.byTestId(VNF_SET_BUTTON_TEST_ID); + if (isNetwork) { + return; + } if (tryCancelsAndReentries) { hoverAndClickEditButton(nodeToEdit); - Wait.byText("VIRTUAL USP"); + Wait.byText("TYLER SILVIA"); GeneralUIUtils.ultimateWait(); - Assert.assertEquals(Get.selectedOptionText(Constants.ViewEdit.LCP_REGION_SELECT_TESTS_ID), "AAIAIC25"); + assertThat(Get.selectedOptionText(Constants.ViewEdit.LCP_REGION_SELECT_TESTS_ID), startsWith("JANET25")); Assert.assertEquals(Get.selectedOptionText(Constants.ViewEdit.TENANT_SELECT_TESTS_ID), "USP-SIP-IC-24335-T-01"); - Assert.assertEquals(Get.selectedOptionText(Constants.ViewEdit.LINE_OF_BUSINESS_SELECT_TESTS_ID), "ECOMP"); + Assert.assertEquals(Get.selectedOptionText(Constants.ViewEdit.LINE_OF_BUSINESS_SELECT_TESTS_ID), "ONAP"); Assert.assertEquals(Get.selectedOptionText(Constants.OwningEntity.PLATFORM_SELECT_TEST_ID), "platform"); Click.byTestId(Constants.CANCEL_BUTTON_TEST_ID); + GeneralUIUtils.ultimateWait(); } else { - toggleItemInTree(nodeToEdit); + toggleItemInTree(Constants.DrawingBoard.AVAILABLE_MODELS_TREE); } + Click.byTestId("node-" + nodeToEdit); + } + + private String extractNodeToEdit(VnfData vnfData) { + return vnfData.vnfUuid + "-" + vnfData.vnfName; } - private void toggleItemInTree(String nodeToEdit) { - Click.byXpath("//tree-root[@data-tests-id='" + Constants.DrawingBoard.AVAILABLE_MODELS_TREE + "']//span[@class='" + Constants.DrawingBoard.TOGGLE_CHILDREN + "']"); + + private void toggleItemInTree(String tree) { + Click.byXpath("//tree-root[@data-tests-id='" + tree + "']//span[@class='" + Constants.DrawingBoard.TOGGLE_CHILDREN + "']"); } private void hoverAndClickEditButton(String nodeToEdit) { - String buttonOfEdit = Constants.DrawingBoard.NODE_PREFIX + nodeToEdit + Constants.DrawingBoard.CONTEXT_MENU_BUTTON; + hoverAndClickButton(nodeToEdit, Constants.DrawingBoard.CONTEXT_MENU_EDIT); + } + + private void hoverAndClickDeleteButton(String nodeToEdit) { + hoverAndClickButton(nodeToEdit, Constants.InstantiationStatus.CONTEXT_MENU_REMOVE); + } + + private void hoverAndClickDuplicateButton(String nodeToEdit) { + hoverAndClickButton(nodeToEdit, Constants.InstantiationStatus.CONTEXT_MENU_DUPLICATE); + } + private void hoverAndClickButton(String nodeToEdit, String contextMenuItem) { + String nodeOfEdit = Constants.DrawingBoard.NODE_PREFIX + nodeToEdit; + String buttonOfEdit = nodeOfEdit + Constants.DrawingBoard.CONTEXT_MENU_BUTTON; GeneralUIUtils.hoverOnAreaByTestId(buttonOfEdit); Click.byTestId(buttonOfEdit); - Click.byTestId(Constants.DrawingBoard.CONTEXT_MENU_ITEM); + Click.byTestId(contextMenuItem); } - private void createVfModule(String vfModuleName, boolean isInstanceNameGenerated, boolean vgEnabled, int vgMin, - int vgMax, List<String> vfModuleDynamicFields, String serviceInstanceName) { - String setButtonTestId = "vnf-form-set"; + private void uploadSupplementaryFile(String inputFileName, boolean isValid, BrowseASDCPage browseASDCPage, String setButtonTestId) { + if (Features.FLAG_SUPPLEMENTARY_FILE.isActive()) { + GeneralUIUtils.ultimateWait(); + Input.file("supplementaryFiles/" + inputFileName, "supplementaryFile"); + GeneralUIUtils.ultimateWait(); + WebElement fileName = Get.byTestId("file-name"); + Assert.assertEquals(fileName.getText(),inputFileName); + browseASDCPage.assertButtonState(setButtonTestId, isValid); + } + } + + private void deleteSupplementaryFile() { + if (Features.FLAG_SUPPLEMENTARY_FILE.isActive()) { + Click.byTestId("remove-uploaded-file"); + GeneralUIUtils.ultimateWait(); + WebElement fileName = Get.byTestId("file-name"); + Assert.assertEquals(fileName.getText(),"Choose file"); + } + } + + private void createVfModule(ServiceData serviceData, String serviceInstanceName, boolean addedByDefault, boolean addOpensPopup) { + clickAddVfModule(serviceData, addedByDefault); + if (!addOpensPopup) { + clickEditVfModule(serviceData); + } + fillAndSetVfModulePopup(serviceData, serviceInstanceName); + } + + private void fillAndSetVfModulePopup(ServiceData serviceData, String serviceInstanceName) { + String setButtonTestId = "form-set"; BrowseASDCPage browseASDCPage = new BrowseASDCPage(); -// Click.byTestId(Constants.DrawingBoard.NODE_PREFIX + vnfName); - drawingBoardPage.clickAddButtonByNodeName(vfModuleName); - if (!isInstanceNameGenerated) { - Input.text("VF instance name", "instanceName"); - } else { - Assert.assertNull(Get.byTestId("instanceName")); - Assert.assertNull(Get.byTestId("volumeGroupName")); + Assert.assertEquals(isElementByIdRequired("instanceName-label"), !serviceData.vnfData.isGeneratedNaming,"instance name input should be optional when EcompNaming == true, and required when false."); + + if (!serviceData.vnfData.isGeneratedNaming) { + Input.text("VF instance name", "instanceName"); } - if (vgEnabled && !isInstanceNameGenerated) { - browseASDCPage.setInputText("volumeGroupName", "some group name name"); + + if (serviceData.vfData.vgEnabled) { + browseASDCPage.setInputText("volumeGroupName", "_abc"); + Assert.assertEquals(isElementByIdRequired("volumeGroupName-label"), false, "volume Group name input should be always optional"); } else { Assert.assertNull(Get.byTestId("volumeGroupName"), "volumeGroupName input should be invisible when vgEnabled == false"); } Wait.waitByTestId("model-item-value-subscriberName", 10); - Assert.assertEquals(Get.byTestId("model-item-value-subscriberName").getText(), "USP VOICE", "Subscriber name should be shown in vf module"); - Assert.assertEquals(Get.byTestId("model-item-value-min").getText(), Integer.toString(vgMin), "Min should be shown"); - Assert.assertEquals(Get.byTestId("model-item-value-max").getText(), Integer.toString(vgMax), "Max should be shown"); - if (!isInstanceNameGenerated) { + Assert.assertEquals(Get.byTestId("model-item-value-subscriberName").getText(), "SILVIA ROBBINS", "Subscriber name should be shown in vf module"); + Assert.assertEquals(Get.byTestId("model-item-value-min").getText(), Integer.toString(serviceData.vfData.vfMin), "Min should be shown"); + Assert.assertEquals(Get.byTestId("model-item-value-max").getText(), Integer.toString(serviceData.vfData.vfMax), "Max should be shown"); + if (!serviceData.vnfData.isGeneratedNaming) { Wait.byText(serviceInstanceName); Assert.assertEquals(Get.byTestId("model-item-value-serviceName").getText(), serviceInstanceName, "Service name should be shown in vf module"); } - validateDynamicFields(vfModuleDynamicFields); + validateDynamicFields(serviceData.vfData.dynamicFields); + + uploadSupplementaryFile("invalid-file.json", false, browseASDCPage, setButtonTestId); + deleteSupplementaryFile(); + uploadSupplementaryFile("sample.json", true, browseASDCPage, setButtonTestId); browseASDCPage.screenshotDeployDialog("createVfModule-" + serviceInstanceName); Click.byTestId(setButtonTestId); } + private void clickEditVfModule(ServiceData serviceData) { + if (Features.FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD.isActive()) { + hoverAndClickEditButton(serviceData.vfData.uuid + "-" + serviceData.vfData.vfName); + } + } + + private void clickAddVfModule(ServiceData serviceData, boolean addedByDefault) { + if (Features.FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD.isActive() && addedByDefault) { + return; + } + System.out.println("VFModule should be added 'manually'"); + + final WebElement vfModuleNode = Get.byTestId(Constants.DrawingBoard.NODE_PREFIX + serviceData.vfData.vfName); + + if (vfModuleNode == null || !vfModuleNode.isDisplayed()) { + // expand tree + drawingBoardPage.clickNode(serviceData.vnfData.vnfName); + } + drawingBoardPage.clickAddButtonByNodeName(serviceData.vfData.vfName); + } + + private void clickRemoveVfModule(String vfModuleId, String vfModuleName) { + if (Features.FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD.isActive()) { + System.out.println("will remove " + vfModule0Name); + hoverAndClickDeleteButton(vfModuleId + "-" + vfModuleName); + } + } + private void assertPauseOnPausePointsVisibility(boolean visibility) { - WebElement pauseElem = Get.byId("pause"); + WebElement pauseElem = Get.byId("Pause"); final String assertionMessage = "pause on pause points visibility should be " + visibility; if (visibility) { Assert.assertNotNull(pauseElem, assertionMessage); @@ -607,121 +1143,71 @@ public class NewServiceInstanceTest extends CreateInstanceDialogBaseTest { Assert.assertNotNull(webElement, "notification area should be visible if more then 1 qty."); } - /** - * following are two popup service models that represent two opposite/extreme states of the popup. - * they should be enough to test all the possible popup states. - */ - private void loadMacroServicePopup_withDynamicFields_partialModelDetails_ecompNamingTrue() { - loadServicePopup("csar-withDynamicFields-ecompNamingTrue-partialModelDetails.zip", "2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"); - } - - private void loadMacroServicePopup_noDynamicFields_fullModelDetails_ecompNamingFalse() { - loadServicePopup("csar-noDynamicFields-ecompNamingFalse-fullModelDetails-1a80c596.zip", "1a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"); - } - - @DataProvider - private Object[][] createSriovService( - ) { - List<String> dynamicFields = Arrays.asList( - "2017488 adiodvpe0 VNF config template version:", - "Adiodvpe0 bandwidth units:", - "Adiodvpe0 bandwidth:", - "2017488 adiodvpe0 aic clli:", - "2017488 adiodvpe0 asn:", - "2017488 adiodvpe0 VNF instance name"); - ServiceData withEcompNaming = new ServiceData("csar-withDynamicFields-ecompNamingTrue-partialModelDetails.zip", - "2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd", - dynamicFields, - true, true, true, false, - "2017-488_ADIOD-vPE 0", - "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1", 0, 1, new ArrayList<>()); - return new Object[][]{{withEcompNaming}}; - } + private void prepareServicePreset(ModelInfo modelInfo, boolean deploy) { + String subscriberId = "e433710f-9217-458d-a79d-1c7aff376d89"; + if (deploy) { + registerExpectationForServiceDeployment( + ImmutableList.of( + modelInfo, + PASQUALEVmxVpeBvService488Annotations + ), + subscriberId, null); + } else { + registerExpectationForServiceBrowseAndDesign(ImmutableList.of(modelInfo), subscriberId); + } + } private class ServiceData { - - public ServiceData(String csarName, String modelUuid, List<String> dynamicFields, boolean isServiceGeneratedNaming, boolean isVnfGeneratedNaming, boolean isVgEnabled, boolean multiStageDesign, String vnfName, String vfName, int vfMin, int vfMax, List<String> vfModuleDynamicFields) { - this.csarName = csarName; + ServiceData(String modelUuid, List<String> dynamicFields, boolean isServiceGeneratedNaming, boolean isVnfGeneratedNaming, boolean isVgEnabled, boolean multiStageDesign, String vnfName, String vfName, int vfMin, int vfMax, List<String> vfModuleDynamicFields, String vfVersionId) { this.modelUuid = modelUuid; this.dynamicFields = dynamicFields; this.isGeneratedNaming = isServiceGeneratedNaming; this.multiStageDesign = multiStageDesign; - this.vnfData = new VnfData(vnfName, isVnfGeneratedNaming); - this.vfData = new VfData(vfName, isVgEnabled, vfMin, vfMax, vfModuleDynamicFields); + this.vnfData = new VnfData(vnfName, "69e09f68-8b63-4cc9-b9ff-860960b5db09", "VNF instance name", isVnfGeneratedNaming); + this.vfData = new VfData(vfName, isVgEnabled, vfMin, vfMax, vfModuleDynamicFields, vfVersionId); } - public String csarName; - public String modelUuid; - public List<String> dynamicFields; - public boolean isGeneratedNaming; - public boolean multiStageDesign; - public VnfData vnfData; - public VfData vfData; - + final String modelUuid; + final List<String> dynamicFields; + final boolean isGeneratedNaming; + final boolean multiStageDesign; + final VnfData vnfData; + final VfData vfData; } private class VnfData { - - public VnfData(String vnfName, boolean isGeneratedNaming) { + VnfData(String vnfName, String vnfUuid, String vnfInstanceName, boolean isGeneratedNaming) { this.vnfName = vnfName; + this.vnfUuid = vnfUuid; + this.vnfInstanceName = vnfInstanceName; this.isGeneratedNaming = isGeneratedNaming; } - public String vnfName; - public boolean isGeneratedNaming; + final String vnfName; + final String vnfUuid; + final String vnfInstanceName; + final boolean isGeneratedNaming; } private class VfData { - public VfData(String vfName, boolean vgEnabled, int vfMin, int vfMax, List<String> dynamicFields) { + VfData(String vfName, boolean vgEnabled, int vfMin, int vfMax, List<String> dynamicFields, String uuid) { this.vfName = vfName; this.vgEnabled = vgEnabled; this.vfMin = vfMin; this.vfMax = vfMax; this.dynamicFields = dynamicFields; + this.uuid = uuid; } - public int vfMin; - - public int vfMax; - - public String vfName; - - public boolean vgEnabled; - - public List<String> dynamicFields; - + final int vfMin; + final int vfMax; + final String uuid; + final String vfName; + final boolean vgEnabled; + final List<String> dynamicFields; } - private class ServiceStatusChecker implements Predicate<Boolean> { - private String actualInstanceName; - private Set<String> expectedStatuses; - private Set<String> columnClassesSet; - - public ServiceStatusChecker(String actualInstanceName, Set<String> expectedStatuses) { - this.actualInstanceName = actualInstanceName; - this.expectedStatuses = expectedStatuses; - } - - @Override - public boolean test(Boolean noMeaning) { - InstantiationStatusPage.clickRefreshButton(); - final WebElement row = InstantiationStatusPage.getInstantiationStatusRow(actualInstanceName); - if (row == null) { - System.err.println("**********************" + actualInstanceName + "************************************************"); - columnClassesSet = Collections.singleton(actualInstanceName + " NOT FOUND"); - return false; // treat missing row as if test condition not fulfilled - } else { - columnClassesSet = new HashSet<>(Arrays.asList( - row.findElements(By.xpath(".//*[@id='" + "jobStatus" + "']")).get(0).getAttribute("class").split(" "))); - return !(Sets.intersection(expectedStatuses, columnClassesSet).isEmpty()); - } - } - - public Set<String> getColumnClassesSet() { - return columnClassesSet; - } - } } diff --git a/vid-automation/src/main/java/vid/automation/test/test/PreviousVersionsPopupTest.java b/vid-automation/src/main/java/vid/automation/test/test/PreviousVersionsPopupTest.java index aefef20e2..c52dd6bac 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/PreviousVersionsPopupTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/PreviousVersionsPopupTest.java @@ -3,26 +3,27 @@ package vid.automation.test.test; import com.google.common.collect.ImmutableList; import org.junit.Assert; import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetMultipleVersion; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetNetworkZones; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetOneVersion; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetServicesGet; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubDetailsGet; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; +import org.onap.simulator.presetGenerator.presets.aai.*; import org.onap.simulator.presetGenerator.presets.ecompportal_att.PresetGetSessionSlotCheckIntervalGet; import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstancePost; import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceMetadataGet; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaModelGet; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openqa.selenium.By; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import vid.automation.test.infra.Click; +import vid.automation.test.infra.Get; import vid.automation.test.sections.BrowseASDCPage; import vid.automation.test.sections.CreateNewInstancePage; import vid.automation.test.sections.PreviousVersionDialog; import vid.automation.test.sections.SideMenu; import vid.automation.test.services.SimulatorApi; +import static vid.automation.test.infra.ModelInfo.ModelInfoWithMultipleVersions.modelInfoWithMultipleVersions; +import static vid.automation.test.infra.ModelInfo.serviceWithOneVersion; + public class PreviousVersionsPopupTest extends CreateInstanceDialogBaseTest{ BrowseASDCPage browseASDCPage = new BrowseASDCPage(); @@ -30,11 +31,11 @@ public class PreviousVersionsPopupTest extends CreateInstanceDialogBaseTest{ private String versionNumber1 = "1.0"; private String versionNumber2 = "2.0"; private String versionNumber3 = "3.0"; - private String modelVersionId1 = "aeababbc-010b-4a60-8df7-e64c07389466"; - private String modelVersionId2 = "aa2f8e9c-9e47-4b15-a95c-4a9385599abc"; - private String modelVersionId3 = "d849c57d-b6fe-4843-8349-4ab8bbb08d71"; - private static final String modelInvariantId = "a8dcd72d-d44d-44f2-aa85-53aa9ca99cba"; - private static final String serviceName = "action-data"; + private String modelVersionId1 = modelInfoWithMultipleVersions.modelVersionId1; + private String modelVersionId2 = modelInfoWithMultipleVersions.modelVersionId2; + private String modelVersionId3 = modelInfoWithMultipleVersions.modelVersionId3; + private static final String modelInvariantId = modelInfoWithMultipleVersions.modelInvariantId; + private static final String serviceName = modelInfoWithMultipleVersions.modelName; private String createModalTitleTestId = "create-modal-title"; @@ -58,8 +59,7 @@ public class PreviousVersionsPopupTest extends CreateInstanceDialogBaseTest{ @Test private void browseSDC_afterCancelOnPopup_browseSDCpageExists(){ prepareSimulatorWithThreeVersionsBeforeBrowseASDCService(); - SideMenu.navigateToBrowseASDCPage(); - browseASDCPage.clickPreviousVersionButton(); + navigateToBrowseAsdcAndClickPreviousButton(); browseASDCPage.clickCancelButton();// to change newVersionDialog.assertVersionRow(modelInvariantId,modelVersionId3,versionNumber3,"Browse_SDC_Service_Models-uuid-"); } @@ -67,14 +67,13 @@ public class PreviousVersionsPopupTest extends CreateInstanceDialogBaseTest{ private void browseSDC_previousVersionButton_notExists(){ prepareSimulatorWithOneVersionBeforeBrowseASDCService(); SideMenu.navigateToBrowseASDCPage(); - browseASDCPage.assertPreviousVersionButtonNotExists(modelInvariantId); + browseASDCPage.assertPreviousVersionButtonNotExists(serviceWithOneVersion.modelInvariantId); } @Test private void openPreviousVersionPopup_newestVersionButton_notExists(){ prepareSimulatorWithThreeVersionsBeforeBrowseASDCService(); - SideMenu.navigateToBrowseASDCPage(); - browseASDCPage.clickPreviousVersionButton(); + navigateToBrowseAsdcAndClickPreviousButton(); newVersionDialog.assertHighestVersionNotExists(modelVersionId3); newVersionDialog.clickCancelButton(); } @@ -84,8 +83,7 @@ public class PreviousVersionsPopupTest extends CreateInstanceDialogBaseTest{ prepareSimulatorWithThreeVersionsBeforeBrowseASDCService(); CreateNewInstancePage newInstance= new CreateNewInstancePage(); newVersionDialog = new PreviousVersionDialog(); - SideMenu.navigateToBrowseASDCPage(); - browseASDCPage.clickPreviousVersionButton(); + navigateToBrowseAsdcAndClickPreviousButton(); newVersionDialog.clickDeployServiceButtonByServiceUUID(modelVersionId2); assertNewInstanceFormOpened(createModalTitleTestId,expectedPopupIsALaCarteName); newInstance.clickCancelButtonByTestID(); @@ -94,6 +92,13 @@ public class PreviousVersionsPopupTest extends CreateInstanceDialogBaseTest{ } + private void navigateToBrowseAsdcAndClickPreviousButton() { + SideMenu.navigateToBrowseASDCPage(); + Click.byTestId("view-per-page-50"); + GeneralUIUtils.ultimateWait(); + Get.byTestId("PreviousVersion-"+modelInvariantId).findElement(By.tagName("button")).click(); + } + private void assertNewInstanceFormOpened(String createModalTitleTestId,String expectedInstanceFormName) { String newInstanceFormName = GeneralUIUtils.getWebElementByTestID(createModalTitleTestId).getText(); Assert.assertEquals(expectedInstanceFormName, newInstanceFormName); @@ -106,11 +111,12 @@ public class PreviousVersionsPopupTest extends CreateInstanceDialogBaseTest{ ImmutableList<BasePreset> presets = ImmutableList.of( new PresetGetSessionSlotCheckIntervalGet(), new PresetAAIGetSubscribersGet(), - new PresetAAIGetMultipleVersion(modelVersionId1,modelVersionId2,modelVersionId3, modelInvariantId), + new PresetAAIServiceDesignAndCreationPut(), new PresetAAIGetServicesGet(), new PresetSDCGetServiceMetadataGet(modelVersionId2, modelInvariantId, zipFileName), new PresetSDCGetServiceToscaModelGet(modelVersionId2, zipFileName), new PresetAAIGetSubDetailsGet(null), + new PresetAAIGetSubDetailsWithoutInstancesGet(null), new PresetAAIGetNetworkZones(), new PresetMSOCreateServiceInstancePost(), new PresetMSOOrchestrationRequestGet()); @@ -122,7 +128,7 @@ public class PreviousVersionsPopupTest extends CreateInstanceDialogBaseTest{ ImmutableList<BasePreset> presets = ImmutableList.of( new PresetGetSessionSlotCheckIntervalGet(), new PresetAAIGetSubscribersGet(), - new PresetAAIGetOneVersion(modelVersionId1, modelInvariantId), + new PresetAAIServiceDesignAndCreationPut(), new PresetAAIGetServicesGet()); SimulatorApi.registerExpectationFromPresets(presets, SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET); diff --git a/vid-automation/src/main/java/vid/automation/test/test/ReadOnlyTest.java b/vid-automation/src/main/java/vid/automation/test/test/ReadOnlyTest.java index c3ddd406b..8beb21982 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/ReadOnlyTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/ReadOnlyTest.java @@ -2,8 +2,9 @@ package vid.automation.test.test; import org.junit.Assert; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetNetworkCollectionDetails; -import org.openecomp.sdc.ci.tests.datatypes.UserCredentials; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; +import org.onap.sdc.ci.tests.datatypes.UserCredentials; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.testng.annotations.Test; @@ -18,6 +19,7 @@ import java.sql.*; import java.util.ArrayList; import java.util.List; +import static vid.automation.test.infra.ModelInfo.aLaCarteServiceCreationTest; import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; /** @@ -64,11 +66,8 @@ public class ReadOnlyTest extends VidBaseTestCase { @Test public void testBrowsASDCReadOnly() { - String zipFileName = "serviceCreationTest.zip"; - String modelVersionId = "aa2f8e9c-9e47-4b15-a95c-4a9385599abc"; - String modelInvariantId = "a8dcd72d-d44d-44f2-aa85-53aa9ca99cba"; - - registerExpectationForLegacyServiceDeployment(modelVersionId, modelInvariantId, zipFileName, null); + resetGetServicesCache(); + registerExpectationForLegacyServiceDeployment(aLaCarteServiceCreationTest, null); SideMenu.navigateToBrowseASDCPage(); Assert.assertTrue(isDeployBtnDisabled()); @@ -91,8 +90,7 @@ public class ReadOnlyTest extends VidBaseTestCase { @Test private void testCreateNewInstanceReadOnly() { - SimulatorApi.registerExpectation(SimulatorApi.RegistrationStrategy.APPEND, - "search_for_service_instance/aai_get_full_subscribers.json"); + SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(),SimulatorApi.RegistrationStrategy.APPEND); SideMenu.navigateToCreateNewServicePage(); assertDropdownPermittedItemsByValue(new ArrayList<String>(), Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS); } diff --git a/vid-automation/src/main/java/vid/automation/test/test/SanityMacroDeployTest.java b/vid-automation/src/main/java/vid/automation/test/test/SanityMacroDeployTest.java index dfa79bf30..0741a4b38 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/SanityMacroDeployTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/SanityMacroDeployTest.java @@ -1,83 +1,89 @@ package vid.automation.test.test; +import static org.hamcrest.Matchers.containsString; +import static vid.automation.test.infra.ModelInfo.macroForBrowseSdc; +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; + +import com.google.common.collect.ImmutableList; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.datatypes.UserCredentials; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.datatypes.UserCredentials; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIServiceDesignAndCreationPut; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateMacroPre1806Post; import org.openqa.selenium.WebElement; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import vid.automation.test.Constants; -import vid.automation.test.infra.FeatureTogglingTest; import vid.automation.test.infra.SelectOption; import vid.automation.test.model.User; import vid.automation.test.sections.BrowseASDCPage; import vid.automation.test.sections.SideMenu; import vid.automation.test.services.SimulatorApi; -import static org.hamcrest.Matchers.containsString; -import static vid.automation.test.infra.Features.FLAG_ASYNC_INSTANTIATION; - public class SanityMacroDeployTest extends CreateInstanceDialogBaseTest { static final String NEW_INSTANCE_NAME = "New Instance Name"; static final String SERVICE_NAME_PNF = "vidmacrofalsenaming"; - static final String SERVICE_UUID = "4d71990b-d8ad-4510-ac61-496288d9078e"; - static final String SUBSCRIBER = "FIREWALL/MISC"; + static final String SUBSCRIBER = "CRAIG/ROBERTS"; static final String PRODUCT = "Transport"; static final String SERVICE_TYPE = "AIM Transport"; - static final String LCP_REGION = "rdm3"; + static final String LCP_REGION = "olson3"; - static final String TENANT = "AIN Web Tool-15-D-testgamma"; + static final String TENANT = "AIN Web Tool-15-D-testalexandria"; static final String AIC_ZONE = "NFTJSSSS-NFT1"; static final String PROJECT = "yyy1"; static final String OWNING_ENTITY = "aaa1"; static final String RESOURCE_NAME = "MULTI_PROVIDER_PORT_GROUP 0"; static final String RESOURCE_DESCRIPTION = "Creates a neutron multi-provider VLAN network with dummy subnet"; - static final String SERVICE_INVARIANT_UUID = "d27e42cf-087e-4d31-88ac-6c4b7585f800"; static final String SERVICE_VERSION = "1.0"; static final String SERVICE_DESCRIPTION = "vidmacrofalsenaming"; static final String SERVICE_CATEGORY = "Network L1-3"; - public SanityMacroDeployTest() { - } - - @BeforeClass protected void registerToSimulator() { - SimulatorApi.registerExpectation(SimulatorApi.RegistrationStrategy.APPEND, - "sanity/browse_sdc_catalog_two_services.json", + resetGetServicesCache(); + invalidateSdcModelsCache(); + SimulatorApi.registerExpectation(SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET, "sanity/aai_get_services.json", "sanity/aai_get_aic_zones.json", - "search_for_service_instance/aai_get_full_subscribers.json", - "search_for_service_instance/aai_get_subscribers_for_customer_FIREWALL-MISC.json", + "search_for_service_instance/aai_get_subscribers_for_customer_CRAIG-ROBERTS.json", "sanity/aai_get_tenants.json", "sanity/get_mso_get_orch_request.json", - "sanity/post_mso_create_service_instance.json", "sanity/get_sdc_catalog_services_4d71990b.json", "sanity/aai_named_query_for_view_edit.json" ); + SimulatorApi.registerExpectationFromPresets(ImmutableList.of( + new PresetAAIServiceDesignAndCreationPut(), + new PresetMSOCreateMacroPre1806Post(), + new PresetAAIGetSubscribersGet(), + PresetAAIGetCloudOwnersByCloudRegionId.PRESET_RDM3_TO_ATT_NC + ), + APPEND); } @Override protected UserCredentials getUserCredentials() { - String userName = Constants.Users.FIREWALL_MISC_AIM_TRANSPORT; + String userName = Constants.Users.CRAIG_ROBERTS_AIM_TRANSPORT; User user = usersService.getUser(userName); return new UserCredentials(user.credentials.userId, user.credentials.password, userName, "", ""); } - @FeatureTogglingTest(value = FLAG_ASYNC_INSTANTIATION, flagActive = false) @Test private void browseServiceModel_MacroService_CreatedSuccessfully() { + BrowseASDCPage browseASDCPage = new BrowseASDCPage(); SideMenu.navigateToBrowseASDCPage(); GeneralUIUtils.ultimateWait(); - browseASDCPage.clickDeployServiceButtonByServiceUUID(SERVICE_UUID); + browseASDCPage.clickDeployServiceButtonByServiceUUID(macroForBrowseSdc.modelVersionId); WebElement modalTitle = GeneralUIUtils.getWebElementByTestID(Constants.CREATE_MODAL_TITLE_ID, 30); Assert.assertThat(modalTitle.getText().toLowerCase(), containsString("macro")); + GeneralUIUtils.ultimateWait(); assertServiceDetails(); @@ -91,17 +97,29 @@ public class SanityMacroDeployTest extends CreateInstanceDialogBaseTest { } private void fillCreateInstanceModal() { + + + waitForInstanceField(); + GeneralUIUtils.ultimateWait(); + GeneralUIUtils.sleep(10000); // stuff is getting weird + WebElement instance_name = GeneralUIUtils.getWebElementByTestID(Constants.INSTANCE_NAME_SELECT_TESTS_ID, 30); instance_name.sendKeys(NEW_INSTANCE_NAME); + waitForInstanceField(); + GeneralUIUtils.ultimateWait(); SelectOption.byTestIdAndVisibleText(SUBSCRIBER, Constants.SUBSCRIBER_NAME_SELECT_TESTS_ID); + waitForInstanceField(); GeneralUIUtils.ultimateWait(); SelectOption.byTestIdAndVisibleText(PRODUCT, Constants.ViewEdit.PRODUCT_FAMILY_SELECT_TESTS_ID); + + waitForInstanceField(); GeneralUIUtils.ultimateWait(); SelectOption.byTestIdAndVisibleText(SERVICE_TYPE, Constants.SERVICE_TYPE_SELECT_TESTS_ID); + GeneralUIUtils.ultimateWait(); - SelectOption.byTestIdAndVisibleText(LCP_REGION, Constants.ViewEdit.LCP_REGION_SELECT_TESTS_ID); + viewEditPage.selectLcpRegion(LCP_REGION, "AIC"); SelectOption.byTestIdAndVisibleText(TENANT, Constants.ViewEdit.TENANT_SELECT_TESTS_ID); SelectOption.byTestIdAndVisibleText(AIC_ZONE, Constants.ViewEdit.AIC_ZONE_TEST_ID); @@ -109,12 +127,22 @@ public class SanityMacroDeployTest extends CreateInstanceDialogBaseTest { SelectOption.byTestIdAndVisibleText(OWNING_ENTITY, Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID); } + private void waitForInstanceField() { + GeneralUIUtils.sleep(200); // stuff is getting weird + SelectOption.waitForOptionInSelect(SUBSCRIBER, Constants.SUBSCRIBER_NAME_SELECT_TESTS_ID); + SelectOption.waitForOptionInSelect(TENANT, Constants.ViewEdit.TENANT_SELECT_TESTS_ID); + SelectOption.waitForOptionInSelect(AIC_ZONE, Constants.ViewEdit.AIC_ZONE_TEST_ID); + SelectOption.waitForOptionInSelect(PROJECT, Constants.OwningEntity.PROJECT_SELECT_TEST_ID); + SelectOption.waitForOptionInSelect(OWNING_ENTITY, Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID); + GeneralUIUtils.sleep(200); // stuff is getting weird + } + private void assertServiceDetails() { WebElement currElem = GeneralUIUtils.getWebElementByTestID(Constants.SERVICE_NAME, 30); Assert.assertEquals(currElem.getText(), SERVICE_NAME_PNF); currElem = GeneralUIUtils.getWebElementByTestID(Constants.SERVICE_UUID, 30); - Assert.assertEquals(currElem.getText(), SERVICE_UUID); + Assert.assertEquals(currElem.getText(), macroForBrowseSdc.modelVersionId); currElem = GeneralUIUtils.getWebElementByTestID(Constants.RESOURCE_NAME, 30); Assert.assertEquals(currElem.getText(), RESOURCE_NAME); @@ -123,7 +151,7 @@ public class SanityMacroDeployTest extends CreateInstanceDialogBaseTest { Assert.assertEquals(currElem.getText(), RESOURCE_DESCRIPTION); currElem = GeneralUIUtils.getWebElementByTestID(Constants.SERVICE_INVARIANT_UUID, 30); - Assert.assertEquals(currElem.getText(), SERVICE_INVARIANT_UUID); + Assert.assertEquals(currElem.getText(), macroForBrowseSdc.modelInvariantId); currElem = GeneralUIUtils.getWebElementByTestID(Constants.SERVICE_VERSION, 30); Assert.assertEquals(currElem.getText(), SERVICE_VERSION); diff --git a/vid-automation/src/main/java/vid/automation/test/test/SanityTest.java b/vid-automation/src/main/java/vid/automation/test/test/SanityTest.java index 29d25f21f..4ec3d4958 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/SanityTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/SanityTest.java @@ -1,8 +1,10 @@ package vid.automation.test.test; +import java.io.IOException; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.datatypes.UserCredentials; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.datatypes.UserCredentials; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; import org.openqa.selenium.WebElement; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -14,12 +16,10 @@ import vid.automation.test.sections.SearchExistingPage; import vid.automation.test.sections.SideMenu; import vid.automation.test.services.SimulatorApi; -import java.io.IOException; - public class SanityTest extends VidBaseTestCase { - static final String SUBSCRIBER = "Mobility"; - static final String SERVICE_NAME = "abc_mdns_2017_1011_IST_Service_CSI"; + static final String SUBSCRIBER = "Emanuel"; + static final String SERVICE_NAME = "abc_CHARLOTTE_2017_1011_IST_Service_CSI"; static final String SERVICE_ID = "ec884145-dbe8-4228-8165-f0c4d7123f8b"; public SanityTest() throws IOException { @@ -29,19 +29,19 @@ public class SanityTest extends VidBaseTestCase { @BeforeClass protected void registerToSimulator() { SimulatorApi.registerExpectation(SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET, - "sanity/get_aai_get_subscribers.json" - , "sanity/aai_get_services.json" + "sanity/aai_get_services.json" , "sanity/get_aai_sub_details.json" , "sanity/get_aai_search_named_query.json" , "sanity/get_aai_search_instance_by_id.json" , "sanity/get_sdc_catalog_services_a1531622.json" , "sanity/get_aai_search_instance_by_name.json" ); + SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(), SimulatorApi.RegistrationStrategy.APPEND); } @Override protected UserCredentials getUserCredentials() { - String userName = Constants.Users.MOBILITY_VMMSC; + String userName = Constants.Users.EMANUEL_vWINIFRED; User user = usersService.getUser(userName); return new UserCredentials(user.credentials.userId, user.credentials.password, userName, "", ""); } @@ -90,13 +90,7 @@ public class SanityTest extends VidBaseTestCase { } private String confirmFilterById() { - WebElement filter = GeneralUIUtils.getWebElementByTestID(Constants.FILTER_SUBSCRIBER_DETAILS_ID, 30); - filter.sendKeys(SERVICE_ID); - - WebElement firstElement = GeneralUIUtils.getWebElementByTestID(Constants.INSTANCE_ID_FOR_NAME_TEST_ID_PREFIX + SERVICE_NAME, 30); - String filteredId = firstElement.getText(); - Assert.assertTrue(filteredId.equals(SERVICE_ID)); - return filteredId; + return confirmFilterById(SERVICE_NAME, SERVICE_ID); } private void confirmResultBySubscriber() { diff --git a/vid-automation/src/main/java/vid/automation/test/test/SearchExistingInstanceTest.java b/vid-automation/src/main/java/vid/automation/test/test/SearchExistingInstanceTest.java index 7f18b2f83..c8370a571 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/SearchExistingInstanceTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/SearchExistingInstanceTest.java @@ -1,20 +1,20 @@ package vid.automation.test.test; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; + +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import vid.automation.test.Constants; import vid.automation.test.infra.Click; -import vid.automation.test.infra.Wait; import vid.automation.test.model.User; import vid.automation.test.sections.SearchExistingPage; import vid.automation.test.sections.SideMenu; import vid.automation.test.services.BulkRegistration; import vid.automation.test.services.SimulatorApi; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; - public class SearchExistingInstanceTest extends VidBaseTestCase { public static final String serviceIdOeWirelineProjectX1 = "7e4f8130-5dee-47c4-8770-1abc5f5ded83"; @@ -22,25 +22,15 @@ public class SearchExistingInstanceTest extends VidBaseTestCase { @BeforeClass public void registerToSimulatorAndLogin() { - SimulatorApi.clearAll(); + SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(), SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET); BulkRegistration.searchExistingServiceInstanceByOEAndProject(); } - @Test(groups = { "shouldBeMigratedToWorkWithSimulator" }) - private void testSearchExistingInstanceById() throws Exception { - User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP); - relogin(user.credentials); - SideMenu.navigateToSearchExistingPage(); - goToExistingInstanceById("3f93c7cb-2fd0-4557-9514-e189b7b04f9d"); - - //a flow that updates an existing instance is tested in testCreateNewServiceInstance. - } - @Test private void testSearchExistingInstanceByOwningEntitySingleValue() { SearchExistingPage searchExistingPage = new SearchExistingPage(); SideMenu.navigateToSearchExistingPage(); - searchExistingPage.searchByOwningEntity("Wireline"); + searchExistingPage.searchByOwningEntity("Melissa"); searchExistingPage.clickSubmitButton(); GeneralUIUtils.ultimateWait(); assertTrue(searchExistingPage.checkEditOrViewExistsByInstanceId(serviceIdOeWirelineProjectX1)); @@ -49,7 +39,7 @@ public class SearchExistingInstanceTest extends VidBaseTestCase { @Test(groups = { "shouldBeMigratedToWorkWithSimulator" }) private void testSearchExistingInstanceByOwningEntityMultiValue() throws Exception { - User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP); + User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA); relogin(user.credentials); SearchExistingPage searchExistingPage = new SearchExistingPage(); SideMenu.navigateToSearchExistingPage(); @@ -78,7 +68,7 @@ public class SearchExistingInstanceTest extends VidBaseTestCase { SearchExistingPage searchExistingPage = new SearchExistingPage(); SideMenu.navigateToSearchExistingPage(); searchExistingPage.searchByProject("yyy1"); - searchExistingPage.searchByOwningEntity("Wireline"); + searchExistingPage.searchByOwningEntity("Melissa"); searchExistingPage.clickSubmitButton(); GeneralUIUtils.ultimateWait(); assertTrue(searchExistingPage.checkEditOrViewExistsByInstanceId(serviceIdOeWirelineProjectYYY1)); @@ -88,7 +78,7 @@ public class SearchExistingInstanceTest extends VidBaseTestCase { @Test(groups = { "shouldBeMigratedToWorkWithSimulator" }) private void testSearchExistingInstanceByProjectWithSpecialCharacters() throws Exception { - User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP); + User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA); relogin(user.credentials); SearchExistingPage searchExistingPage = new SearchExistingPage(); SideMenu.navigateToSearchExistingPage(); @@ -103,7 +93,7 @@ public class SearchExistingInstanceTest extends VidBaseTestCase { @Test(groups = { "shouldBeMigratedToWorkWithSimulator" }) private void testSearchExistingInstanceByProjectMultiValue() throws Exception { - User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP); + User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA); relogin(user.credentials); SearchExistingPage searchExistingPage = new SearchExistingPage(); SideMenu.navigateToSearchExistingPage(); diff --git a/vid-automation/src/main/java/vid/automation/test/test/VidBaseTestCase.java b/vid-automation/src/main/java/vid/automation/test/test/VidBaseTestCase.java index e5a8b5786..c472793fc 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/VidBaseTestCase.java +++ b/vid-automation/src/main/java/vid/automation/test/test/VidBaseTestCase.java @@ -3,22 +3,35 @@ package vid.automation.test.test; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.ImmutableList; import org.apache.commons.lang3.StringUtils; +import org.glassfish.jersey.uri.internal.JerseyUriBuilder; import org.junit.Assert; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubDetailsGet; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset; import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; -import org.onap.simulator.presetGenerator.presets.aai.*; -import org.onap.simulator.presetGenerator.presets.ecompportal_att.PresetGetSessionSlotCheckIntervalGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAICloudRegionAndSourceFromConfigurationPut; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetNetworkZones; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetPortMirroringSourcePorts; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetServicesGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubDetailsWithoutInstancesGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetTenants; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIPostNamedQueryForViewEdit; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIServiceDesignAndCreationPut; +import org.onap.simulator.presetGenerator.presets.ecompportal_att.EcompPortalPresetsUtils; import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2; import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstancePost; import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceMetadataGet; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaModelGet; -import org.openecomp.sdc.ci.tests.datatypes.UserCredentials; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.utilities.FileHandling; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.datatypes.UserCredentials; +import org.onap.sdc.ci.tests.execute.setup.SetupCDTest; +import org.onap.sdc.ci.tests.utilities.FileHandling; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebElement; +import org.springframework.http.client.ClientHttpRequestInterceptor; +import org.springframework.web.client.RestTemplate; import org.testng.ITestContext; import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeSuite; @@ -31,26 +44,71 @@ import vid.automation.test.sections.*; import vid.automation.test.services.CategoryParamsService; import vid.automation.test.services.SimulatorApi; import vid.automation.test.services.UsersService; +import vid.automation.test.utils.CookieAndJsonHttpHeadersInterceptor; import vid.automation.test.utils.DB_CONFIG; import vid.automation.test.utils.TestConfigurationHelper; +import vid.automation.test.utils.TestHelper; import java.io.File; import java.lang.reflect.Method; +import java.net.URI; +import java.net.URISyntaxException; import java.sql.*; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - +import java.util.*; +import java.util.concurrent.TimeUnit; + +import static java.util.Collections.emptySet; +import static java.util.Collections.singletonList; +import static java.util.stream.Collectors.*; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.collection.IsEmptyCollection.empty; import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertThat; import static org.testng.Assert.assertEquals; import static org.testng.AssertJUnit.fail; +import static vid.automation.test.utils.TestHelper.GET_SERVICE_MODELS_BY_DISTRIBUTION_STATUS; +import static vid.automation.test.utils.TestHelper.GET_TENANTS; public class VidBaseTestCase extends SetupCDTest{ protected final UsersService usersService = new UsersService(); protected final CategoryParamsService categoryParamsService = new CategoryParamsService(); + protected final RestTemplate restTemplate = new RestTemplate(); + protected final URI uri; + protected final URI envUrI; + + public VidBaseTestCase() { + try { + this.envUrI = new URI(System.getProperty("ENV_URL")); + } catch (URISyntaxException e) { + throw new RuntimeException(e); + } + this.uri = new JerseyUriBuilder().host(envUrI.getHost()).port(envUrI.getPort()).scheme("http").path("vid").build(); + } + + public void login() { + UserCredentials userCredentials = getUserCredentials(); + final List<ClientHttpRequestInterceptor> interceptors = singletonList(new CookieAndJsonHttpHeadersInterceptor(uri, userCredentials)); + restTemplate.setInterceptors(interceptors); + } + + public void invalidateSdcModelsCache() { + if (Features.FLAG_SERVICE_MODEL_CACHE.isActive()) { + restTemplate.postForObject(uri + "/rest/models/reset", "", Object.class); + } + } + + protected void resetGetServicesCache() { + login(); + TestHelper.resetAaiCache(GET_SERVICE_MODELS_BY_DISTRIBUTION_STATUS, restTemplate, uri); + } + + protected void resetGetTenantsCache() { + login(); + TestHelper.resetAaiCache(GET_TENANTS, restTemplate, uri); + } @Override protected UserCredentials getUserCredentials() { @@ -71,7 +129,7 @@ public class VidBaseTestCase extends SetupCDTest{ } @Override - protected org.openecomp.sdc.ci.tests.datatypes.Configuration getEnvConfiguration() { + protected org.onap.sdc.ci.tests.datatypes.Configuration getEnvConfiguration() { return TestConfigurationHelper.getEnvConfiguration(); } @@ -102,63 +160,86 @@ public class VidBaseTestCase extends SetupCDTest{ } } + @BeforeSuite(alwaysRun = true) + public void setSmallDefaultTimeout() throws Exception { + getDriver().manage().timeouts().implicitlyWait(250, TimeUnit.MILLISECONDS); + } + @Override protected void loginToLocalSimulator(UserCredentials userCredentials) { LoginExternalPage.performLoginExternal(userCredentials); } - static public class ModelInfo { - public final String modelVersionId; - public final String modelInvariantId; - public final String zipFileName; + protected String getReduxState() { + final JavascriptExecutor javascriptExecutor = (JavascriptExecutor) GeneralUIUtils.getDriver(); + String reduxState = (String)javascriptExecutor.executeScript("return window.sessionStorage.getItem('reduxState');"); + System.out.println(reduxState); + return reduxState; + } - public ModelInfo(String modelVersionId, String modelInvariantId, String zipFileName) { - this.modelVersionId = modelVersionId; - this.modelInvariantId = modelInvariantId; - this.zipFileName = zipFileName; + protected void setReduxState(String state) { + final JavascriptExecutor javascriptExecutor = (JavascriptExecutor) GeneralUIUtils.getDriver(); + String script = String.format("window.sessionStorage.setItem('reduxState', '%s');", state); + System.out.println("executing script:"); + System.out.println(script); + javascriptExecutor.executeScript(script); + } + + protected void registerExpectationForLegacyServiceDeployment(ModelInfo modelInfo, String subscriberId) { + List<BasePreset> presets = new ArrayList<>(Arrays.asList( + new PresetAAIPostNamedQueryForViewEdit(BaseMSOPreset.DEFAULT_INSTANCE_ID, true, false), + new PresetAAIGetPortMirroringSourcePorts("9533-config-LB1113", "myRandomInterfaceId", "i'm a port", true) + )); + + presets.add(new PresetMSOCreateServiceInstancePost()); + presets.add(new PresetMSOOrchestrationRequestGet()); + + presets.addAll(getPresetForServiceBrowseAndDesign(ImmutableList.of(modelInfo), subscriberId)); + + SimulatorApi.registerExpectationFromPresets(presets, SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET); + } + + protected void registerExpectationForServiceDeployment(List<ModelInfo> modelInfoList, String subscriberId, PresetMSOCreateServiceInstanceGen2 createServiceInstancePreset) { + List<BasePreset> presets = new ArrayList<>(Arrays.asList( + new PresetAAIPostNamedQueryForViewEdit(BaseMSOPreset.DEFAULT_INSTANCE_ID, true, false), + new PresetAAIGetPortMirroringSourcePorts("9533-config-LB1113", "myRandomInterfaceId", "i'm a port", true) + )); + + if (createServiceInstancePreset != null) { + presets.add(createServiceInstancePreset); } + presets.add(new PresetMSOOrchestrationRequestGet("IN_PROGRESS")); + + presets.addAll(getPresetForServiceBrowseAndDesign(modelInfoList, subscriberId)); + + SimulatorApi.registerExpectationFromPresets(presets, SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET); } - protected void registerExpectationForLegacyServiceDeployment(String modelVersionId, String modelInvariantId, String zipFileName, String subscriberId) { - registerExpectationForServiceDeployment(ServiceDeployment.LEGACY, ImmutableList.of(new ModelInfo(modelVersionId,modelInvariantId,zipFileName)), subscriberId); + protected void registerExpectationForServiceBrowseAndDesign(List<ModelInfo> modelInfoList, String subscriberId) { + SimulatorApi.registerExpectationFromPresets(getPresetForServiceBrowseAndDesign(modelInfoList, subscriberId), SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET); } - private enum ServiceDeployment {ASYNC, LEGACY} + protected List<BasePreset> getPresetForServiceBrowseAndDesign(List<ModelInfo> modelInfoList, String subscriberId) { - protected void registerExpectationForServiceDeployment(ServiceDeployment serviceDeploymentOnMsoExpectations, List<ModelInfo> modelInfoList, String subscriberId) { List<BasePreset> presets = new ArrayList<>(Arrays.asList( - new PresetGetSessionSlotCheckIntervalGet(), - new PresetAAIGetSubscribersGet(), - new PresetAAIGetServicesGet(), - new PresetAAIGetSubDetailsGet(subscriberId), - new PresetAAIPostNamedQueryForViewEdit("f8791436-8d55-4fde-b4d5-72dd2cf13cfb"), - new PresetAAICloudRegionAndSourceFromConfigurationPut("9533-config-LB1113", "myRandomCloudRegionId"), - new PresetAAIGetPortMirroringSourcePorts("9533-config-LB1113", "myRandomInterfaceId", "i'm a port", true), - new PresetAAIGetNetworkZones(), - new PresetAAIGetTenants(), - new PresetAAIServiceDesignAndCreationPut(modelInfoList.stream().map( - x-> new PresetAAIServiceDesignAndCreationPut.ServiceModelIdentifiers(x.modelVersionId, x.modelInvariantId)) - .collect(Collectors.toList())) - )); + new PresetAAIGetSubDetailsGet(subscriberId), + new PresetAAIGetSubDetailsWithoutInstancesGet(subscriberId), + new PresetAAIGetSubscribersGet(), + new PresetAAIGetServicesGet(), + new PresetAAICloudRegionAndSourceFromConfigurationPut("9533-config-LB1113", "myRandomCloudRegionId"), + new PresetAAIGetNetworkZones(), + new PresetAAIGetTenants(), + new PresetAAIServiceDesignAndCreationPut() + )); + + presets.addAll(EcompPortalPresetsUtils.getEcompPortalPresets()); modelInfoList.forEach(modelInfo -> { presets.add(new PresetSDCGetServiceMetadataGet(modelInfo.modelVersionId, modelInfo.modelInvariantId, modelInfo.zipFileName)); presets.add(new PresetSDCGetServiceToscaModelGet(modelInfo.modelVersionId, modelInfo.zipFileName)); }); - switch (serviceDeploymentOnMsoExpectations) { - case ASYNC: - presets.add(new PresetAAISearchNodeQueryEmptyResult()); - presets.add(new PresetMSOCreateServiceInstanceGen2()); - presets.add(new PresetMSOOrchestrationRequestGet("IN_PROGRESS")); - break; - case LEGACY: - presets.add(new PresetMSOCreateServiceInstancePost()); - presets.add(new PresetMSOOrchestrationRequestGet()); - break; - } - - SimulatorApi.registerExpectationFromPresets(presets, SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET); + return presets; } protected void relogin(Credentials credentials) throws Exception { @@ -200,13 +281,19 @@ public class VidBaseTestCase extends SetupCDTest{ GeneralUIUtils.ultimateWait(); List<WebElement> optionsList = GeneralUIUtils.getWebElementsListBy(By.className(dropdownOptionsClassName), 30); - for (WebElement option : - optionsList) { - String optionValue = option.getAttribute(attribute); - if ((option.isEnabled() && !permittedItems.contains(optionValue)) || - !option.isEnabled() && permittedItems.contains(optionValue)) { - fail(Constants.DROPDOWN_PERMITTED_ASSERT_FAIL_MESSAGE); - } + + final Map<Boolean, Set<String>> optionsMap = optionsList.stream() + .collect(groupingBy(WebElement::isEnabled, mapping(option -> option.getAttribute(attribute), toSet()))); + + assertGroupedPermissionsAreCorrect(permittedItems, optionsMap); + } + + private void assertGroupedPermissionsAreCorrect(ArrayList<String> permittedItems, Map<Boolean, Set<String>> optionsMap) { + if (permittedItems.isEmpty()) { + assertThat(Constants.DROPDOWN_PERMITTED_ASSERT_FAIL_MESSAGE, optionsMap.getOrDefault(Boolean.TRUE, emptySet()), is(empty())); + }else { + assertThat(Constants.DROPDOWN_PERMITTED_ASSERT_FAIL_MESSAGE, optionsMap.getOrDefault(Boolean.TRUE, emptySet()), containsInAnyOrder(permittedItems.toArray())); + assertThat(Constants.DROPDOWN_PERMITTED_ASSERT_FAIL_MESSAGE, optionsMap.getOrDefault(Boolean.FALSE, emptySet()), not(contains(permittedItems.toArray()))); } } @@ -216,7 +303,7 @@ public class VidBaseTestCase extends SetupCDTest{ GeneralUIUtils.getWebElementsListBy(By.className(dropdownOptionsClassName), 30); for (WebElement option : optionsList) { - String optionValue = option.getAttribute("value"); + //String optionValue = option.getAttribute("value"); if (!option.isEnabled()) { fail(Constants.DROPDOWN_PERMITTED_ASSERT_FAIL_MESSAGE); } @@ -227,14 +314,11 @@ public class VidBaseTestCase extends SetupCDTest{ GeneralUIUtils.ultimateWait(); List<WebElement> optionsList = GeneralUIUtils.getWebElementsListBy(By.className(dropdownOptionsClassName), 30); - for (WebElement option : - optionsList) { - String optionText = option.getText(); - if ((option.isEnabled() && !permittedItems.contains(optionText)) || - !option.isEnabled() && permittedItems.contains(optionText)) { - fail(Constants.DROPDOWN_PERMITTED_ASSERT_FAIL_MESSAGE); - } - } + + final Map<Boolean, Set<String>> optionsMap = optionsList.stream() + .collect(groupingBy(WebElement::isEnabled, mapping(WebElement::getText, toSet()))); + + assertGroupedPermissionsAreCorrect(permittedItems, optionsMap); } protected void assertViewEditButtonState(String expectedButtonText, String UUID) { @@ -244,14 +328,14 @@ public class VidBaseTestCase extends SetupCDTest{ } - protected void addNetwork(Map<String, String> metadata,String instanceName, String name, String lcpRegion, String productFamily,String platform, String lineOfBusiness, String tenant, String suppressRollback, + protected void addNetwork(Map<String, String> metadata,String instanceName, String name, String lcpRegion, String cloudOwner, String productFamily,String platform, String lineOfBusiness, String tenant, String suppressRollback, String legacyRegion, ArrayList<String> permittedTenants) { ViewEditPage viewEditPage = new ViewEditPage(); viewEditPage.selectNetworkToAdd(name); assertModelInfo(metadata, false); viewEditPage.setInstanceName(instanceName); - viewEditPage.selectLCPRegion(lcpRegion); + viewEditPage.selectLcpRegion(lcpRegion, cloudOwner); viewEditPage.selectProductFamily(productFamily); viewEditPage.selectLineOfBusiness(lineOfBusiness); assertDropdownPermittedItemsByValue(permittedTenants, Constants.ViewEdit.TENANT_OPTION_CLASS); @@ -313,10 +397,10 @@ public class VidBaseTestCase extends SetupCDTest{ searchExistingPage.clickEditViewByInstanceId(instanceUUID); } - void resumeVFModule(String vfModuleName, String lcpRegion, String tenant, String legacyRegion, ArrayList<String> permittedTenants){ + void resumeVFModule(String vfModuleName, String lcpRegion, String cloudOwner, String tenant, String legacyRegion, ArrayList<String> permittedTenants){ ViewEditPage viewEditPage = new ViewEditPage(); viewEditPage.clickResumeButton(vfModuleName); - viewEditPage.selectLCPRegion(lcpRegion); + viewEditPage.selectLcpRegion(lcpRegion, cloudOwner); assertDropdownPermittedItemsByValue(permittedTenants, Constants.ViewEdit.TENANT_OPTION_CLASS); viewEditPage.selectTenant(tenant); viewEditPage.setLegacyRegion(legacyRegion); @@ -384,7 +468,7 @@ public class VidBaseTestCase extends SetupCDTest{ } } - protected <T> void setNewInstance_leftPane_assertModelDataCorrect(Map<String, String> modelKeyToDataTestsIdMap, String prefix, T model) { + protected <T> void assertModelDataCorrect(Map<String, String> modelKeyToDataTestsIdMap, String prefix, T model) { modelKeyToDataTestsIdMap.forEach((fieldName, dataTestsId) -> { WebElement webElement = Get.byTestId(prefix + dataTestsId); assertEquals(webElement.getText(), getServiceFieldByName(fieldName, model)); @@ -410,7 +494,7 @@ public class VidBaseTestCase extends SetupCDTest{ private void assertMetadataItem(String keyTestId, String value, boolean withPrefix) { String elementTestId = (withPrefix ? Constants.ServiceModelInfo.INFO_TEST_ID_PREFIX:"") + keyTestId; String infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText(); - Assert.assertThat(String.format(Constants.ServiceModelInfo.METADETA_ERROR_MESSAGE, elementTestId), infoItemText, is(value)); + assertThat(String.format(Constants.ServiceModelInfo.METADETA_ERROR_MESSAGE, elementTestId), infoItemText, is(value)); } public DeployMacroDialogBase getMacroDialog(){ @@ -423,16 +507,12 @@ public class VidBaseTestCase extends SetupCDTest{ return new DeployMacroDialogOld(); } - protected void loadServicePopup(String zipFileName, String modelVersionId ) { - String modelInvariantId = "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0"; - String subscriberId = "e433710f-9217-458d-a79d-1c7aff376d89"; - registerExpectationForServiceDeployment( - ServiceDeployment.ASYNC, - ImmutableList.of( - new ModelInfo(modelVersionId, modelInvariantId, zipFileName), - new ModelInfo("f4d84bb4-a416-4b4e-997e-0059973630b9", "598e3f9e-3244-4d8f-a8e0-0e5d7a29eda9", "service-AdiodVmxVpeBvService488-csar-annotations.zip") - ), - subscriberId); + protected void loadServicePopup(ModelInfo modelInfo) { + loadServicePopup(modelInfo.modelVersionId); + } + + + protected void loadServicePopup(String modelVersionId) { SideMenu.navigateToBrowseASDCPage(); GeneralUIUtils.ultimateWait(); loadServicePopupOnBrowseASDCPage(modelVersionId); @@ -440,7 +520,7 @@ public class VidBaseTestCase extends SetupCDTest{ protected void loadServicePopupOnBrowseASDCPage(String modelVersionId ) { DeployMacroDialog deployMacroDialog = new DeployMacroDialog(); - deployMacroDialog.goOutFromIframe(); + VidBasePage.goOutFromIframe(); deployMacroDialog.clickDeployServiceButtonByServiceUUID(modelVersionId); deployMacroDialog.goToIframe(); GeneralUIUtils.ultimateWait(); @@ -464,6 +544,10 @@ public class VidBaseTestCase extends SetupCDTest{ org.testng.Assert.assertFalse(webElement.isEnabled(), "field should be disabled if the field it depends on was not selected yet."); } + public boolean isElementByIdRequired(String id) { + return Get.byId(id).getAttribute("class").contains("required"); + } + protected int getUserIdNumberFromDB(User user) { try (Connection connection = DriverManager.getConnection(DB_CONFIG.url, DB_CONFIG.username, DB_CONFIG.password)) { Statement stmt = connection.createStatement(); @@ -495,15 +579,38 @@ public class VidBaseTestCase extends SetupCDTest{ } protected void navigateToViewEditPageOfuspVoiceVidTest444(String aaiModelVersionId) { + navigateToViewEditPage("3f93c7cb-2fd0-4557-9514-e189b7b04f9d", aaiModelVersionId); + } + + protected void navigateToViewEditPageOf_test_sssdad() { + navigateToViewEditPage("c187e9fe-40c3-4862-b73e-84ff056205f6", "ee6d61be-4841-4f98-8f23-5de9da846ca7"); + } + + protected void navigateToViewEditPage(final String serviceInstanceId, String aaiModelVersionId) { VidBasePage vidBasePage = new VidBasePage(); SideMenu.navigateToWelcomePage(); vidBasePage.navigateTo("serviceModels.htm#/instantiate?" + "subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&" + "subscriberName=USP%20VOICE&" + "serviceType=VIRTUAL%20USP&" + - "serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&" + + "serviceInstanceId=" + serviceInstanceId + "&" + "aaiModelVersionId=" + aaiModelVersionId + "&" + "isPermitted=true"); GeneralUIUtils.ultimateWait(); } + + + public void hoverAndClickMenuByName(String nodeName, String nodeToEdit, String contextMenuItem ) { + String buttonOfEdit = Constants.DrawingBoard.NODE_PREFIX + nodeToEdit + Constants.DrawingBoard.CONTEXT_MENU_BUTTON; + + WebElement rightTreeNode = getTreeNodeByName(nodeName); + WebElement menuButton = Get.byXpath(rightTreeNode, ".//span[@data-tests-id='" + buttonOfEdit + "']"); + + GeneralUIUtils.clickElementUsingActions(menuButton); + Click.byTestId(contextMenuItem); + } + + private WebElement getTreeNodeByName(String nodeName) { + return Get.byXpath("//tree-node-content[.//*[contains(text(), '" + nodeName + "')]]"); + } } diff --git a/vid-automation/src/main/java/vid/automation/test/test/VidBaseTestWithoutLogin.java b/vid-automation/src/main/java/vid/automation/test/test/VidBaseTestWithoutLogin.java index 9dab455cc..48f776406 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/VidBaseTestWithoutLogin.java +++ b/vid-automation/src/main/java/vid/automation/test/test/VidBaseTestWithoutLogin.java @@ -1,7 +1,7 @@ package vid.automation.test.test; -import org.openecomp.sdc.ci.tests.datatypes.UserCredentials; -import org.openecomp.sdc.ci.tests.execute.setup.DriverFactory; +import org.onap.sdc.ci.tests.datatypes.UserCredentials; +import org.onap.sdc.ci.tests.execute.setup.DriverFactory; import vid.automation.test.utils.TestConfigurationHelper; public abstract class VidBaseTestWithoutLogin extends DriverFactory { @@ -12,7 +12,7 @@ public abstract class VidBaseTestWithoutLogin extends DriverFactory { } @Override - protected org.openecomp.sdc.ci.tests.datatypes.Configuration getEnvConfiguration() { + protected org.onap.sdc.ci.tests.datatypes.Configuration getEnvConfiguration() { return TestConfigurationHelper.getEnvConfiguration(); } diff --git a/vid-automation/src/main/java/vid/automation/test/test/ViewEditServiceInstanceTest.java b/vid-automation/src/main/java/vid/automation/test/test/ViewEditServiceInstanceTest.java index 3b9546fdd..ed64bba0a 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/ViewEditServiceInstanceTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/ViewEditServiceInstanceTest.java @@ -1,54 +1,65 @@ package vid.automation.test.test; +import static org.apache.logging.log4j.core.util.Assert.isNonEmpty; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.collection.IsEmptyCollection.empty; +import static org.testng.AssertJUnit.assertEquals; +import static vid.automation.test.infra.Features.FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE; +import static vid.automation.test.infra.Features.FLAG_COLLECTION_RESOURCE_SUPPORT; +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; + import com.google.common.collect.ImmutableMap; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.hamcrest.MatcherAssert; import org.junit.Assert; import org.junit.Before; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetNetworkCollectionDetails; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.testng.annotations.AfterMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import vid.automation.test.Constants; -import vid.automation.test.infra.*; +import vid.automation.test.infra.Click; +import vid.automation.test.infra.Exists; +import vid.automation.test.infra.FeatureTogglingTest; +import vid.automation.test.infra.Features; +import vid.automation.test.infra.Get; +import vid.automation.test.infra.Wait; import vid.automation.test.model.User; import vid.automation.test.sections.VidBasePage; import vid.automation.test.sections.ViewEditPage; import vid.automation.test.services.BulkRegistration; import vid.automation.test.services.SimulatorApi; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.time.LocalDate; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import static org.hamcrest.Matchers.equalTo; -import static org.testng.AssertJUnit.assertEquals; -import static vid.automation.test.infra.Features.FLAG_COLLECTION_RESOURCE_SUPPORT; -import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; - public class ViewEditServiceInstanceTest extends VidBaseTestCase { private ViewEditPage viewEditPage = new ViewEditPage(); VidBasePage vidBasePage =new VidBasePage(); private String serviceInstanceId = "3f93c7cb-2fd0-4557-9514-e189b7b04f9d"; private String crServiceInstanceId = "3f93c7cb-2fd0-4557-9514-e189b7testCR"; + private String serviceFabricInstanceId = "c187e9fe-40c3-4862-b73e-84ff056205f61234"; private String serviceInstanceId2 ="c187e9fe-40c3-4862-b73e-84ff056205f6"; private final String DEACTIVATE_ACTION = "deactivate"; private final String ACTIVATE_ACTION = "activate"; private List<String> pnfs = Arrays.asList("SANITY6785cce9", "tesai371ve2"); private final String serviceInstanceIdeWithoutModelVerId ="9caf5581-40ab-47be-b1f1-909a87724add"; - private final String crNetworkText ="NETWORK INSTANCE GROUP: l3network-id-rs804s | ROLE: HngwProtectedOam.OAM | TYPE: Tenant_Layer_3 | # OF NETWORKS: 3"; + private final String crNetworkText ="NETWORK INSTANCE GROUP: l3network-id-rs804s | ROLE: RosemaProtectedOam.OAM | TYPE: Tenant_Layer_3 | # OF NETWORKS: 3"; private final String crCollectionText ="COLLECTION: collection-name | TYPE: L3-NETWORK"; private final String crInfoText = "\"requestState\": \"COMPLETE\""; SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss"); - static final String LCP_REGION = "mtn6"; + static final String LCP_REGION = "hvf6"; + static final String CLOUD_OWNER = "AIC"; static final String TENANT = "bae71557c5bb4d5aac6743a4e5f1d054"; @@ -80,13 +91,16 @@ public class ViewEditServiceInstanceTest extends VidBaseTestCase { webElement.click(); viewEditPage.clickDeleteButton(); } - private void deleteInstance(String deleteButtonId, String successMessage) { + deleteInstance(deleteButtonId, successMessage, Constants.CONFIRM_RESUME_DELETE_TESTS_ID); + } + + private void deleteInstance(String deleteButtonId, String successMessage, String confirmButtonId) { navigateToViewEditPageOfuspVoiceVidTest444("7a6ee536-f052-46fa-aa7e-2fca9d674c44"); Click.byTestId(deleteButtonId); - viewEditPage.selectLCPRegion(LCP_REGION); + viewEditPage.selectLcpRegion(LCP_REGION, CLOUD_OWNER); viewEditPage.selectTenant(TENANT); - vidBasePage.clickConfirmButtonInResumeDelete(); + vidBasePage.clickButtonByTestId(confirmButtonId); viewEditPage.assertMsoRequestModal(successMessage); viewEditPage.clickCommitCloseButton(); GeneralUIUtils.ultimateWait(); @@ -106,6 +120,28 @@ public class ViewEditServiceInstanceTest extends VidBaseTestCase { deleteInstance(Constants.ViewEdit.DELETE_VF_MODULE_BUTTON_TEST_ID + "aa", Constants.ViewEdit.VF_MODULE_DELETED_SUCCESSFULLY_TEXT); } + @FeatureTogglingTest(value = FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE) + @Test + public void softDeleteAndResumeVfModuleInstance_deleteDialogAppears_msoResponseIsOk() { + SimulatorApi.clearAll(); + String vfModuleName = "my_vfModule"; + BulkRegistration.deleteExistingVfModuleInstance("ACTIVE"); + deleteInstance(Constants.ViewEdit.DELETE_VF_MODULE_BUTTON_TEST_ID + vfModuleName, Constants.ViewEdit.VF_MODULE_DELETED_SUCCESSFULLY_TEXT, Constants.SOFT_DELETE_TESTS_ID); + BulkRegistration.resumeWithHomingDataVfModule("ACTIVE", "Assigned", vfModuleName); + navigateToViewEditPageOfuspVoiceVidTest444("7a6ee536-f052-46fa-aa7e-2fca9d674c44"); + viewEditPage.clickResumeButton(vfModuleName); + assertThat("Select lcp region shouldn't be display when homing data is presented", + GeneralUIUtils.getDriver().findElements(Get.getXpathForDataTestId(Constants.ViewEdit.LCP_REGION_SELECT_TESTS_ID)), + is(empty())); + assertThat("Select tenant shouldn't be display when homing data is presented", + GeneralUIUtils.getDriver().findElements(Get.getXpathForDataTestId(Constants.ViewEdit.TENANT_SELECT_TESTS_ID)), + is(empty())); + viewEditPage.clickConfirmButtonInResumeDelete(); + assertSuccessfulVFModuleCreation(); + viewEditPage.clickCommitCloseButton(); + GeneralUIUtils.ultimateWait(); + } + @Test public void deleteNetworkInstance_deleteDialogAppears_msoResponseIsOk() { SimulatorApi.clearAll(); @@ -147,12 +183,30 @@ public class ViewEditServiceInstanceTest extends VidBaseTestCase { viewEditPage.clickCloseButton(); } + @Test + public void testActivateServiceInstanceWithFabric() { + String orchStatus = "assiGNed"; + SimulatorApi.clearAll(); + BulkRegistration.searchExistingServiceInstanceWithFabric(orchStatus); + goToExistingInstanceById(serviceFabricInstanceId); + viewEditPage.assertButtonState(Constants.ViewEdit.DEACTIVATE_BUTTON_TEST_ID,false); + boolean flagIsActive = Features.FLAG_FABRIC_CONFIGURATION_ASSIGNMENTS.isActive(); + if(flagIsActive) { + viewEditPage.assertButtonState(Constants.ViewEdit.ACTIVATE_FABRIC_CONFIGURATION_BUTTON_TEST_ID, true); + viewEditPage.clickActivateFabricConfigurationButton(); + viewEditPage.assertMsoRequestModal(Constants.ViewEdit.MSO_SUCCESSFULLY_TEXT); + viewEditPage.clickCloseButton(); + } + } + private void assertAndCheckShowAssignmentsSdncUrl(String orchStatus, String serviceInstanceId) { boolean buttonIsEnable = Features.FLAG_SHOW_ASSIGNMENTS.isActive() && orchStatus.equals("assiGNed"); - viewEditPage.assertButtonState(Constants.ViewEdit.SHOW_ASSIGNMENTS_BUTTON_TEST_ID, buttonIsEnable); + boolean isNotDisplay = GeneralUIUtils.getDriver().findElements(Get.getXpathForDataTestId(Constants.ViewEdit.SHOW_ASSIGNMENTS_BUTTON_TEST_ID)).isEmpty(); + Assert.assertNotEquals(isNotDisplay, buttonIsEnable); + if (buttonIsEnable) { WebElement webElement = Get.byTestId(Constants.ViewEdit.SHOW_ASSIGNMENTS_BUTTON_TEST_ID); - String expectedUrl = "https://mtanjv9sdma51.aic.cip.att.com:8448/configAdapter/index#/resource_manager/"+serviceInstanceId; + String expectedUrl = "https://mtan.onap.org:8448/configAdapter/index#/resource_manager/"+serviceInstanceId; MatcherAssert.assertThat("Show assignments SDNC url is wrong", webElement.getAttribute("href"), equalTo(expectedUrl)); } @@ -358,13 +412,13 @@ public class ViewEditServiceInstanceTest extends VidBaseTestCase { "pending-delete", false); for(Map.Entry<String, Boolean> entry: vfModulesStatuses.entrySet()) { WebElement vfModule = GeneralUIUtils.getWebElementByClassName("vfModuleTreeNode-" + entry.getKey()); - Assert.assertEquals(!vfModule.findElements(By.className("resume")).isEmpty(), entry.getValue()); + Assert.assertEquals(isNonEmpty(vfModule.findElements(By.className("resume"))), entry.getValue()); } } @Before public void before() throws Exception { - User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP); + User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA); relogin(user.credentials); } diff --git a/vid-automation/src/main/java/vid/automation/test/test/ViewEditWithDrawingBoardTest.java b/vid-automation/src/main/java/vid/automation/test/test/ViewEditWithDrawingBoardTest.java new file mode 100644 index 000000000..724e68065 --- /dev/null +++ b/vid-automation/src/main/java/vid/automation/test/test/ViewEditWithDrawingBoardTest.java @@ -0,0 +1,178 @@ +package vid.automation.test.test; + +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.SERVICE_NAME; +import static org.testng.AssertJUnit.assertTrue; +import static vid.automation.test.infra.ModelInfo.aLaCarteVnfGroupingService; +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET; +import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMultimap; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIFilterServiceInstanceById; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetServicesGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubDetailsGetSpecificService; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubDetailsWithoutInstancesGetSpecificService; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIModelsByInvariantIdGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet; +import org.onap.simulator.presetGenerator.presets.ecompportal_att.PresetGetSessionSlotCheckIntervalGet; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOAddOrRemoveOneInstanceGroupMember; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2WithNamesAlacarteGroupingService; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteInstanceGroup; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames; +import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceMetadataGet; +import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaModelGet; +import org.testng.annotations.Test; +import vid.automation.test.Constants; +import vid.automation.test.infra.FeatureTogglingTest; +import vid.automation.test.infra.Features; +import vid.automation.test.infra.Wait; +import vid.automation.test.sections.DrawingBoardPage; +import vid.automation.test.sections.VidBasePage; +import vid.automation.test.services.SimulatorApi; + +public class ViewEditWithDrawingBoardTest extends VidBaseTestCase { + private final String RELATED_VNF_UUID1 = "a9f1b136-11ed-471f-8d77-f123c7501a01"; + private final String RELATED_VNF_UUID2 = "963b67e1-079a-404e-abef-b745d770bd85"; + private final String RELATED_VNF_UUID3 = "5a34a4f4-81a4-4eed-871b-f0b1187160d4"; + private static final String MSO_COMPLETE_STATUS = "COMPLETE"; + private static final String COMPLETED = "COMPLETED"; + private String vnfGroupInstanceId; + private String vnfGroupInstanceName; + private String serviceInstanceName; + private String serviceInstanceId = "b9af7c1d-a2d7-4370-b747-1b266849ad32"; + String subscriberId = "e433710f-9217-458d-a79d-1c7aff376d89"; + String serviceType = "TYLER SILVIA"; + String serviceReqId = "3cf5ea96-6b34-4945-b5b1-4a7798b1caf2"; + + @FeatureTogglingTest(Features.FLAG_1902_VNF_GROUPING) + @Test + public void testDeleteVnfGroupWithMembers() { + + String vnf1Name = registerServiceInstanceTopologyExpectationOnAAIAndGetVnf1Name(); + final ImmutableMap<PresetMSOServiceInstanceGen2WithNames.Keys, String> names = ImmutableMap.of(SERVICE_NAME, serviceInstanceName); + + + List<BasePreset> presets = ImmutableList.of( + new PresetAAIGetSubscribersGet(), + new PresetAAIGetServicesGet(), + new PresetAAIFilterServiceInstanceById(subscriberId, serviceType, serviceInstanceId), + new PresetAAIGetSubDetailsGetSpecificService(subscriberId, serviceType, "Active", aLaCarteVnfGroupingService, serviceInstanceId), + new PresetAAIGetSubDetailsWithoutInstancesGetSpecificService(subscriberId, serviceType), + new PresetSDCGetServiceMetadataGet(aLaCarteVnfGroupingService), + new PresetSDCGetServiceToscaModelGet(aLaCarteVnfGroupingService), + new PresetMSOCreateServiceInstanceGen2WithNamesAlacarteGroupingService(names, 0, serviceReqId) + ); + + SimulatorApi.registerExpectationFromPresets(presets, APPEND); + registerMsoPreset(); + GeneralUIUtils.ultimateWait(); + goToExistingInstanceById(serviceInstanceId); + GeneralUIUtils.ultimateWait(); + + DrawingBoardPage drawingBoardPage = new DrawingBoardPage(); + drawingBoardPage.goToIframe(); + GeneralUIUtils.ultimateWait(); + hoverAndClickMenuByName(vnf1Name, "daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0", Constants.InstantiationStatus.CONTEXT_MENU_DELETE); + GeneralUIUtils.ultimateWait(); + drawingBoardPage.clickDeployButton(); + + + VidBasePage.goOutFromIframe(); + GeneralUIUtils.ultimateWait(); + drawingBoardPage.goToIframe(); + GeneralUIUtils.ultimateWait(); + + DrawingBoardPage.ServiceStatusChecker serviceStatusChecker = new DrawingBoardPage.ServiceStatusChecker(serviceInstanceName, Collections.singleton(COMPLETED)); + boolean statusIsShown = Wait.waitFor(serviceStatusChecker, null, 10, 1); + assertTrue("Service "+serviceInstanceName+" wasn't completed after in time", statusIsShown); + + } + + public void registerMsoPreset(){ + String vnfGroupRequestId = UUID.randomUUID().toString(); + String firstMemberRequestId = UUID.randomUUID().toString(); + String secondMemberRequestId = UUID.randomUUID().toString(); + String thirdMemberRequestId = UUID.randomUUID().toString(); + + List <PresetMSODeleteInstanceGroup> vnfGroupPreset = ImmutableList.of( + new PresetMSODeleteInstanceGroup(vnfGroupRequestId, vnfGroupInstanceId, getUserCredentials().getUserId())); + + List<PresetMSOAddOrRemoveOneInstanceGroupMember> instanceGroupMemberPreset = ImmutableList.of( + new PresetMSOAddOrRemoveOneInstanceGroupMember(vnfGroupInstanceId, "963b67e1-079a-404e-abef-b745d770bd85", getUserCredentials().getUserId(), firstMemberRequestId, PresetMSOAddOrRemoveOneInstanceGroupMember.InstanceGroupMemberAction.Remove), + new PresetMSOAddOrRemoveOneInstanceGroupMember(vnfGroupInstanceId, "a9f1b136-11ed-471f-8d77-f123c7501a01", getUserCredentials().getUserId(), secondMemberRequestId, PresetMSOAddOrRemoveOneInstanceGroupMember.InstanceGroupMemberAction.Remove), + new PresetMSOAddOrRemoveOneInstanceGroupMember(vnfGroupInstanceId, "5a34a4f4-81a4-4eed-871b-f0b1187160d4", getUserCredentials().getUserId(), thirdMemberRequestId, PresetMSOAddOrRemoveOneInstanceGroupMember.InstanceGroupMemberAction.Remove) + ); + + List<PresetMSOOrchestrationRequestGet> inProgressPresets = new ArrayList<>(); + inProgressPresets.add(new PresetMSOOrchestrationRequestGet(MSO_COMPLETE_STATUS, vnfGroupRequestId)); + inProgressPresets.add(new PresetMSOOrchestrationRequestGet(MSO_COMPLETE_STATUS, firstMemberRequestId)); + inProgressPresets.add(new PresetMSOOrchestrationRequestGet(MSO_COMPLETE_STATUS, secondMemberRequestId)); + inProgressPresets.add(new PresetMSOOrchestrationRequestGet(MSO_COMPLETE_STATUS, thirdMemberRequestId)); + + final ImmutableList.Builder<BasePreset> basePresetBuilder = new ImmutableList.Builder<>(); + basePresetBuilder + .addAll(instanceGroupMemberPreset) + .addAll(inProgressPresets) + .addAll(vnfGroupPreset); + List<BasePreset> presets = basePresetBuilder.build(); + registerExpectationFromPresets(presets, SimulatorApi.RegistrationStrategy.APPEND); + } + + + public String registerServiceInstanceTopologyExpectationOnAAIAndGetVnf1Name() { + PresetAAIStandardQueryGet relatedVnf1 = + PresetAAIStandardQueryGet.ofVnf(RELATED_VNF_UUID1, "7a6ee536-f052-46fa-aa7e-2fca9d674c44", "7a6ee536-f052-46fa-aa7e-2fca9d674c44", + "", ImmutableMultimap.of()); + + PresetAAIStandardQueryGet relatedVnf2 = + PresetAAIStandardQueryGet.ofVnf(RELATED_VNF_UUID2, "d6557200-ecf2-4641-8094-5393ae3aae60","d6557200-ecf2-4641-8094-5393ae3aae60", + "", ImmutableMultimap.of()); + + PresetAAIStandardQueryGet relatedVnf3 = + PresetAAIStandardQueryGet.ofVnf(RELATED_VNF_UUID3, "d6557200-ecf2-4641-8094-5393ae3aae60","d6557200-ecf2-4641-8094-5393ae3aae60", + "", ImmutableMultimap.of()); + + final PresetAAIStandardQueryGet vnfGroup1 = + PresetAAIStandardQueryGet.ofInstanceGroup("vnfGroup-type", "Teresa Bradley", + ImmutableMultimap.<String, String>builder() + .putAll("generic-vnf", relatedVnf1.getReqPath(), relatedVnf2.getReqPath(), relatedVnf3.getReqPath()) + .build() + ); + + final PresetAAIStandardQueryGet vnfGroup2 = + PresetAAIStandardQueryGet.ofInstanceGroup("vnfGroup-type", "Stanley Mccarthy", ImmutableMultimap.of()); + + final PresetAAIStandardQueryGet serviceInstance = + PresetAAIStandardQueryGet.ofServiceInstance(serviceInstanceId, aLaCarteVnfGroupingService.modelVersionId, aLaCarteVnfGroupingService.modelInvariantId, "e433710f-9217-458d-a79d-1c7aff376d89", "TYLER SILVIA", + ImmutableMultimap.<String, String>builder() + .putAll("instance-group", vnfGroup1.getReqPath(), vnfGroup2.getReqPath()) + .build() + ); + SimulatorApi.registerExpectationFromPresets(ImmutableList.of( + serviceInstance, + vnfGroup1,vnfGroup2, relatedVnf1, relatedVnf2, relatedVnf3, + new PresetAAIModelsByInvariantIdGet(ImmutableList.of(aLaCarteVnfGroupingService.modelInvariantId)), + new PresetGetSessionSlotCheckIntervalGet(), + new PresetAAIGetSubscribersGet(), + new PresetSDCGetServiceMetadataGet(aLaCarteVnfGroupingService), + new PresetSDCGetServiceToscaModelGet(aLaCarteVnfGroupingService) + ), CLEAR_THEN_SET); + + serviceInstanceName = serviceInstance.getInstanceName(); + vnfGroupInstanceName = vnfGroup1.getInstanceName(); + vnfGroupInstanceId = vnfGroup1.getInstanceId(); + return vnfGroupInstanceName; + } + + +} diff --git a/vid-automation/src/main/java/vid/automation/test/test/SubInterfaceTest.java b/vid-automation/src/main/java/vid/automation/test/test/VlanTagSubInterfaceTest.java index 59baaf776..3f8db2a94 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/SubInterfaceTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/VlanTagSubInterfaceTest.java @@ -1,12 +1,27 @@ package vid.automation.test.test; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; +import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId.PRESET_AAIAIC25_TO_ATT_AIC; +import static org.testng.AssertJUnit.assertEquals; +import static vid.automation.test.infra.Features.FLAG_COLLECTION_RESOURCE_SUPPORT; +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; +import static vid.automation.test.test.ALaCarteflowTest.AIC; + import com.google.common.collect.ImmutableList; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetInstanceGroupsByCloudRegionInvalidRequest; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetRelatedInstanceGroupsByVnfId; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetServicesGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetTenants; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVNFInstancePost; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVnfVlanTagging; import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.Select; import org.testng.Assert; @@ -19,49 +34,36 @@ import vid.automation.test.infra.FeatureTogglingTest; import vid.automation.test.infra.Get; import vid.automation.test.infra.SelectOption; import vid.automation.test.sections.SearchExistingPage; -import vid.automation.test.sections.ViewEditPage; +import vid.automation.test.sections.VidBasePage; import vid.automation.test.services.BulkRegistration; import vid.automation.test.services.SimulatorApi; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.is; -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertNull; -import static vid.automation.test.infra.Features.FLAG_COLLECTION_RESOURCE_SUPPORT; -import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; - @FeatureTogglingTest(FLAG_COLLECTION_RESOURCE_SUPPORT) -public class SubInterfaceTest extends CreateInstanceDialogBaseTest { +public class VlanTagSubInterfaceTest extends CreateInstanceDialogBaseTest { - private final ViewEditPage viewEditPage = new ViewEditPage(); private final String ecompNamingFalseInstanceId = "dc3a893e-0104-4ef6-abfe-6c2932294a3e"; private final String ecompNamingTrueInstanceId = "dc3a893e-0104-4ef6-abfe-6c2932294a3f"; @BeforeClass protected void registerToSimulator() { SimulatorApi.clearAll(); - BulkRegistration.createNewServiceInstance("USP VOICE"); + BulkRegistration.createNewServiceInstance("SILVIA ROBBINS"); BulkRegistration.searchExistingVFServiceWithVFCInstanceGroupInstance("Created"); SimulatorApi.registerExpectation(SimulatorApi.RegistrationStrategy.APPEND , "add_subinterface/get_sdc_catalog_services_vid-test-333.json" - , "add_subinterface/aai_get_services.json" - , "add_subinterface/aai_get_subscribers.json" , "add_subinterface/aai_get_aic_zones.json" ); - final PresetAAIGetInstanceGroupsByCloudRegionInvalidRequest presetAAIGetInstanceGroupsByCloudRegion1 = new PresetAAIGetInstanceGroupsByCloudRegionInvalidRequest("e433710f-9217-458d-a79d-1c7aff376d89", "mtn6", "untraaa"); - final PresetAAIGetInstanceGroupsByCloudRegionInvalidRequest presetAAIGetInstanceGroupsByCloudRegion2 = new PresetAAIGetInstanceGroupsByCloudRegionInvalidRequest("e433710f-9217-458d-a79d-1c7aff376d89", "AAIAIC25", "untraaa"); + final PresetAAIGetInstanceGroupsByCloudRegionInvalidRequest presetAAIGetInstanceGroupsByCloudRegion1 = new PresetAAIGetInstanceGroupsByCloudRegionInvalidRequest("irma-aic", "hvf6", "untraaa"); + final PresetAAIGetInstanceGroupsByCloudRegionInvalidRequest presetAAIGetInstanceGroupsByCloudRegion2 = new PresetAAIGetInstanceGroupsByCloudRegionInvalidRequest("irma-aic", "JANET25", "untraaa"); SimulatorApi.registerExpectationFromPresets(ImmutableList.of( - new PresetMSOCreateVNFInstancePost(ecompNamingTrueInstanceId, "6bce7302-70bd-4057-b48e-8d5b99e686ca"), - new PresetMSOCreateVNFInstancePost(ecompNamingFalseInstanceId, "6bce7302-70bd-4057-b48e-8d5b99e686cb"), + new PresetAAIGetServicesGet(), + new PresetAAIGetSubscribersGet(), + new PresetMSOCreateVnfVlanTagging(ecompNamingTrueInstanceId, "6bce7302-70bd-4057-b48e-8d5b99e686ca", true), + new PresetMSOCreateVnfVlanTagging(ecompNamingFalseInstanceId, "6bce7302-70bd-4057-b48e-8d5b99e686cb", false), + PRESET_AAIAIC25_TO_ATT_AIC, new PresetAAIGetTenants(), presetAAIGetInstanceGroupsByCloudRegion1, presetAAIGetInstanceGroupsByCloudRegion2, @@ -77,17 +79,20 @@ public class SubInterfaceTest extends CreateInstanceDialogBaseTest { @DataProvider private Object[][] getServices() { - return new Object[][]{{ecompNamingTrueInstanceId, true}, {ecompNamingFalseInstanceId, false}}; + return new Object[][]{ + {ecompNamingTrueInstanceId}, + {ecompNamingFalseInstanceId} + }; } @Test(dataProvider = "getServices") - public void createSubInterface_validPopupDataAndUIEcompNamingTrue(String serviceUuid, boolean ecompNamingEnabled) { + public void createSubInterface_validPopupDataAndUI(String serviceUuid) { SearchExistingPage searchExistingPage = new SearchExistingPage(); - searchExistingPage.goOutFromIframe(); + VidBasePage.goOutFromIframe(); goToExistingInstanceById(serviceUuid); - String vnfName = "vDBE 0"; + String vnfName = "vDOROTHEA 0"; Assert.assertNotNull(Get.byClassAndText("instanceGroupTreeNode","instance group name")); GeneralUIUtils.clickOnElementByTestId(Constants.ViewEdit.ADD_VNF_BUTTON_TEST_ID, 60); GeneralUIUtils.clickOnElementByTestId(Constants.ViewEdit.VNF_OPTION_TEST_ID_PREFIX + vnfName, 60); @@ -97,17 +102,13 @@ public class SubInterfaceTest extends CreateInstanceDialogBaseTest { searchExistingPage.goToIframe(); WebElement instanceNameInput = GeneralUIUtils.getInputElement(Constants.INSTANCE_NAME_SELECT_TESTS_ID); - if (ecompNamingEnabled) { - assertNull(instanceNameInput); - } else { - instanceNameInput.sendKeys("New Name"); - } - SelectOption.byTestIdAndVisibleText("VIRTUAL USP", Constants.ViewEdit.PRODUCT_FAMILY_SELECT_TESTS_ID); - SelectOption.byTestIdAndVisibleText("AAIAIC25", Constants.ViewEdit.LCP_REGION_SELECT_TESTS_ID); + instanceNameInput.sendKeys("NewName"); + SelectOption.byTestIdAndVisibleText("TYLER SILVIA", Constants.ViewEdit.PRODUCT_FAMILY_SELECT_TESTS_ID); + viewEditPage.selectLcpRegion("JANET25", AIC); SelectOption.byTestIdAndVisibleText("USP-SIP-IC-24335-T-01", Constants.ViewEdit.TENANT_SELECT_TESTS_ID); SelectOption.byTestIdAndVisibleText("UUUAIAAI-YYY1", Constants.ViewEdit.AIC_ZONE_TEST_ID); - SelectOption.byTestIdAndVisibleText("plat1", Constants.OwningEntity.PLATFORM_SELECT_TEST_ID); - SelectOption.byTestIdAndVisibleText("ecomp", Constants.OwningEntity.LOB_SELECT_TEST_ID); + SelectOption.byTestIdAndVisibleText("xxx1", Constants.OwningEntity.PLATFORM_SELECT_TEST_ID); + SelectOption.byTestIdAndVisibleText("ONAP", Constants.OwningEntity.LOB_SELECT_TEST_ID); SelectOption.byTestIdAndVisibleText("Rollback", Constants.SUPPRESS_ROLLBACK_SELECT_TESTS_ID); @@ -177,7 +178,7 @@ public class SubInterfaceTest extends CreateInstanceDialogBaseTest { } Click.byTestId(Constants.ConfigurationCreation.NEXT_BUTTON_TEST_ID); - searchExistingPage.goOutFromIframe(); + VidBasePage.goOutFromIframe(); assertSuccessfulServiceInstanceCreation(); viewEditPage.clickCommitCloseButton(); } diff --git a/vid-automation/src/main/java/vid/automation/test/utils/CookieAndJsonHttpHeadersInterceptor.java b/vid-automation/src/main/java/vid/automation/test/utils/CookieAndJsonHttpHeadersInterceptor.java index 07fd3754e..c98b2428a 100644 --- a/vid-automation/src/main/java/vid/automation/test/utils/CookieAndJsonHttpHeadersInterceptor.java +++ b/vid-automation/src/main/java/vid/automation/test/utils/CookieAndJsonHttpHeadersInterceptor.java @@ -1,7 +1,7 @@ package vid.automation.test.utils; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.datatypes.UserCredentials; +import org.onap.sdc.ci.tests.datatypes.UserCredentials; import org.springframework.http.*; import org.springframework.http.client.ClientHttpRequestExecution; import org.springframework.http.client.ClientHttpRequestInterceptor; diff --git a/vid-automation/src/main/java/vid/automation/test/utils/DB_CONFIG.java b/vid-automation/src/main/java/vid/automation/test/utils/DB_CONFIG.java index ef5625232..717e2a746 100644 --- a/vid-automation/src/main/java/vid/automation/test/utils/DB_CONFIG.java +++ b/vid-automation/src/main/java/vid/automation/test/utils/DB_CONFIG.java @@ -1,8 +1,8 @@ package vid.automation.test.utils; public class DB_CONFIG { - public static String url = String.format("jdbc:mariadb://%s:%d/vid_openecomp_epsdk", - System.getProperty("DB_HOST", System.getProperty("VID_HOST", "127.0.0.1" )), + public static String url = String.format("jdbc:mariadb://%s:%d/vid_portal", + System.getProperty("DB_HOST", System.getProperty("VID_HOST", "10.0.0.10" )), Integer.valueOf(System.getProperty("DB_PORT", "3306")) ); public static String username = "euser"; diff --git a/vid-automation/src/main/java/vid/automation/test/utils/ExtendedHamcrestMatcher.java b/vid-automation/src/main/java/vid/automation/test/utils/ExtendedHamcrestMatcher.java new file mode 100644 index 000000000..b1c713f1e --- /dev/null +++ b/vid-automation/src/main/java/vid/automation/test/utils/ExtendedHamcrestMatcher.java @@ -0,0 +1,24 @@ +package vid.automation.test.utils; + +import org.hamcrest.Matcher; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import static org.hamcrest.core.AllOf.allOf; +import static org.hamcrest.core.IsCollectionContaining.hasItem; + +public class ExtendedHamcrestMatcher { + + + //this method return matcher for has items that support collection as input (Instead of ...) + public static <T> Matcher<Iterable<T>> hasItemsFromCollection(Collection<T> items) { + List<Matcher<? super Iterable<T>>> all = new ArrayList<>(items.size()); + for (T element : items) { + all.add(hasItem(element)); + } + + return allOf(all); + } +} diff --git a/vid-automation/src/main/java/vid/automation/test/utils/ReadFile.java b/vid-automation/src/main/java/vid/automation/test/utils/ReadFile.java index 655cc20a6..1f6cd032b 100644 --- a/vid-automation/src/main/java/vid/automation/test/utils/ReadFile.java +++ b/vid-automation/src/main/java/vid/automation/test/utils/ReadFile.java @@ -3,7 +3,7 @@ package vid.automation.test.utils; import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; -import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.onap.sdc.ci.tests.utilities.FileHandling; import vid.automation.test.infra.Input; import java.io.IOException; diff --git a/vid-automation/src/main/java/vid/automation/test/utils/RegExMatcher.java b/vid-automation/src/main/java/vid/automation/test/utils/RegExMatcher.java new file mode 100644 index 000000000..c540cf5ea --- /dev/null +++ b/vid-automation/src/main/java/vid/automation/test/utils/RegExMatcher.java @@ -0,0 +1,29 @@ +package vid.automation.test.utils; + +import org.hamcrest.Description; +import org.hamcrest.TypeSafeMatcher; + +public class RegExMatcher extends TypeSafeMatcher<String> { + + private final String regEx; + + public RegExMatcher(String regEx) { + this.regEx = regEx; + } + + + @Override + public void describeTo(Description description) { + description.appendText("matches regEx="+regEx); + } + + + @Override + protected boolean matchesSafely(String item) { + return item.matches(regEx); + } + + public static RegExMatcher matchesRegEx(final String regEx) { + return new RegExMatcher(regEx); + } +} diff --git a/vid-automation/src/main/java/vid/automation/test/utils/TestConfigurationHelper.java b/vid-automation/src/main/java/vid/automation/test/utils/TestConfigurationHelper.java index ae731dbc0..0b2978dda 100644 --- a/vid-automation/src/main/java/vid/automation/test/utils/TestConfigurationHelper.java +++ b/vid-automation/src/main/java/vid/automation/test/utils/TestConfigurationHelper.java @@ -6,13 +6,13 @@ public class TestConfigurationHelper { private TestConfigurationHelper(){} - public static org.openecomp.sdc.ci.tests.datatypes.Configuration getEnvConfiguration() { + public static org.onap.sdc.ci.tests.datatypes.Configuration getEnvConfiguration() { try { String envUrl = System.getProperty("ENV_URL"); boolean isCustomLogin = Boolean.parseBoolean(System.getProperty("CUSTOM_LOGIN")); - org.openecomp.sdc.ci.tests.datatypes.Configuration configuration = new org.openecomp.sdc.ci.tests.datatypes.Configuration(envUrl, isCustomLogin); + org.onap.sdc.ci.tests.datatypes.Configuration configuration = new org.onap.sdc.ci.tests.datatypes.Configuration(envUrl, isCustomLogin); String geckoDriverPath = System.getProperty("GECKO_PATH"); if(geckoDriverPath == null){ diff --git a/vid-automation/src/main/java/vid/automation/test/utils/TestHelper.java b/vid-automation/src/main/java/vid/automation/test/utils/TestHelper.java new file mode 100644 index 000000000..83876fa27 --- /dev/null +++ b/vid-automation/src/main/java/vid/automation/test/utils/TestHelper.java @@ -0,0 +1,15 @@ +package vid.automation.test.utils; + +import org.springframework.web.client.RestTemplate; + +import java.net.URI; + +public class TestHelper { + + public static String GET_SERVICE_MODELS_BY_DISTRIBUTION_STATUS = "getServiceModelsByDistributionStatus"; + public static String GET_TENANTS = "getTenants"; + + public static void resetAaiCache(String cacheName, RestTemplate restTemplate, URI vidUri) { + restTemplate.delete(vidUri + "/aai_reset_cache/"+cacheName); + } +} |