summaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/java
diff options
context:
space:
mode:
authorOfir Sonsino <os0695@att.com>2018-01-31 17:19:00 +0200
committerOfir Sonsino <os0695@att.com>2018-01-31 17:19:00 +0200
commit1cfb08779ea0e00be69e072a940b3063e049fe6b (patch)
tree6602a900387c8393ed0dcd81c0539381632903c6 /vid-automation/src/main/java
parent2f20b001b9243e0f8b44aecc768ec265fd538732 (diff)
org.onap migration
Change-Id: I52f0b2851f2c765752b6d21f49b32136d7d72a3d Issue-ID: VID-86 Signed-off-by: Ofir Sonsino <os0695@att.com>
Diffstat (limited to 'vid-automation/src/main/java')
-rw-r--r--vid-automation/src/main/java/vid/automation/test/Constants.java343
-rw-r--r--vid-automation/src/main/java/vid/automation/test/StartTest.java66
-rw-r--r--vid-automation/src/main/java/vid/automation/test/infra/Click.java54
-rw-r--r--vid-automation/src/main/java/vid/automation/test/infra/Exists.java34
-rw-r--r--vid-automation/src/main/java/vid/automation/test/infra/Get.java95
-rw-r--r--vid-automation/src/main/java/vid/automation/test/infra/Input.java38
-rw-r--r--vid-automation/src/main/java/vid/automation/test/infra/SelectOption.java47
-rw-r--r--vid-automation/src/main/java/vid/automation/test/infra/Wait.java99
-rw-r--r--vid-automation/src/main/java/vid/automation/test/model/Credentials.java9
-rw-r--r--vid-automation/src/main/java/vid/automation/test/model/Environment.java11
-rw-r--r--vid-automation/src/main/java/vid/automation/test/model/Service.java27
-rw-r--r--vid-automation/src/main/java/vid/automation/test/model/ServicesObject.java11
-rw-r--r--vid-automation/src/main/java/vid/automation/test/model/User.java15
-rw-r--r--vid-automation/src/main/java/vid/automation/test/model/UsersObject.java13
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/BrowseASDCPage.java12
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/ChangeManagementPage.java15
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/CreateNewInstancePage.java21
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/CreationDialog.java8
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/LoginExternalPage.java29
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/PnfSearchAssociationPage.java24
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/SearchExistingPage.java77
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/SideMenu.java30
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/TestEnvironmentPage.java39
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/VidBasePage.java132
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/ViewEditPage.java84
-rw-r--r--vid-automation/src/main/java/vid/automation/test/services/BulkRegistration.java94
-rw-r--r--vid-automation/src/main/java/vid/automation/test/services/ServicesService.java47
-rw-r--r--vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java98
-rw-r--r--vid-automation/src/main/java/vid/automation/test/services/UsersService.java31
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/AssociatePnfTest.java201
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java221
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java596
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/CreateInstanceDialogBaseTest.java35
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/CreateNewInstanceTest.java84
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/EnvironmentsTest.java484
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/ReadOnlyTest.java64
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/SearchExistingInstanceTest.java83
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/VidBaseTestCase.java235
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/ViewEditServiceInstanceTest.java158
-rw-r--r--vid-automation/src/main/java/vid/automation/test/utils/ReadFile.java33
40 files changed, 3797 insertions, 0 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
new file mode 100644
index 000000000..17b96fc74
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/Constants.java
@@ -0,0 +1,343 @@
+package vid.automation.test;
+
+public class Constants {
+ public static final String SERVICE_NAME = "Service Name";
+ public static final String SERVICE_UUID = "Service UUID";
+ public static final String SERVICE_INVARIANT_UUID = "Service Invariant UUID";
+ public static final String SERVICE_VERSION = "Service Version";
+ public static final String SERVICE_DESCRIPTION = "Service Description";
+ public static final String SERVICE_CATEGORY = "Service Category";
+ public static final String SUBSCRIBER_NAME = "Subscriber Name";
+ public static final String SERVICE_TYPE = "Service Type";
+ public static final String SERVICE_ROLE = "Service Role";
+ public static final int generalTimeout = 20;
+ public static final int generalRetries = 30;
+ public static final String generalSubmitButtonId = "submit";
+ public static final String generalCancelButtonId = "cancel";
+ public static final String generalCloseModalButtonClass = "modal-close";
+ public static final String generalModalTitleClass = "modal-title";
+ 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 CLOSE_BUTTON_TEXT = "Close";
+ public static final String SUBMIT_BUTTON_TEXT = "Submit";
+ public static final String SERVICE_TYPE_SELECT_TESTS_ID = "serviceType";
+ public static final String BROWSE_SEARCH = "browseFilter";
+ public static final String SUBSCRIBER_NAME_SELECT_TESTS_ID = "subscriberName";
+ public static final String SUPPRESS_ROLLBACK_SELECT_TESTS_ID = "suppressRollback";
+ public static final String INSTANCE_NAME_SELECT_TESTS_ID = "instanceName";
+ public static final String DEPLOY_BUTTON_TESTS_ID_PREFIX = "deploy-";
+ public static final String VIEW_BUTTON_TEXT = "View";
+ public static final String VIEW_EDIT_BUTTON_TEXT = "View/Edit";
+ public static final String VIEW_EDIT_TEST_ID_PREFIX = "view/edit-test-data-id-";
+ public static final String INSTANCE_ID_FOR_NAME_TEST_ID_PREFIX = "instance-id-for-name-";
+ public static final String MULTI_SELECT_UNSELECTED_CLASS = "item-unselected";
+ public static final String ACTIVE = "Active";
+ public static final String INACTIVE = "Inactive";
+
+
+ public static final String PNF_SERVICE_TYPE = "pnf";
+
+ public class SideMenu {
+ public static final int numOfButtons = 7;
+ public static final String buttonClass = "att-accordion__group";
+ public static final String SEARCH_EXISTING_SERVICE = "Search for Existing Service Instances";
+ public static final String BROWSE_ASDC_SERVICE_MODELS = "Browse ASDC Service Models";
+ public static final String CREATE_NEW_SERVICE = "Create New Service Instance";
+ public static final String VNF_CHANGES = "VNF Changes";
+ public static final String TEST_ENVIRONMENTS = "Test Environments";
+ }
+
+ public class ChangeManagement {
+ //general constants:
+ public static final String pageHeadlineId = "change-management-headline";
+
+ //headline bar constants:
+ public static final String headlineNewButtonId = "change-management-new-button";
+ public static final String headlineSchedulerButtonId = "change-management-scheduler-button";
+ public static final String headlineSearchInputId = "change-management-search";
+
+ //new change management modal constants:
+ public static final String newModalSubscriberInputId = "subscriber";
+ public static final String newModalServiceTypeInputId = "serviceType";
+ public static final String newModalVNFTypeInputId = "vnfType";
+ public static final String newModalFromVNFVersionInputId = "fromVNFVersion";
+ public static final String newModalVNFNameInputId = "vnfName";
+ public static final String newModalWorkFlowInputId = "workflow";
+ public static final String newModalTargetVersionInputsClass = "vnf-versions-select-as-text";
+
+
+ //Scheduler
+
+ public static final String schedulerModalRangeLabel = "Range";
+ public static final String schedulerModalNowLabel = "Now";
+ public static final String schedulerModalStartDateInputId = "startDate";
+ public static final String schedulerModalEndDateInputId = "endDate";
+ public static final String schedulerModalNextMonthButtonClass = "adp-next";
+ public static final String schedulerModalScheduleButtonText = "Schedule";
+ public static final String schedulerModalTimeUnitSelectId = "timeUnitSelect";
+ public static final String schedulerModalPolicySelectId = "policy";
+ public static final String schedulerModalDurationInputTestId = "durationInput";
+ public static final String schedulerModalFallbackInputTestId = "fallbackInput";
+ public static final String schedulerModalConcurrencyLimitInputTestId = "concurrencyLimitInput";
+ public static final String schedulerModalHoursOption = "hours";
+
+ //dashboard constants:
+ public static final String dashboardActiveTabId = "active-tab";
+ public static final String dashboardFinishedTabId = "finished-tab";
+ public static final String dashboardActiveTableId = "active-table";
+ public static final String dashboardFinishedTableId = "finished-table";
+ public static final String dashboardInProgressTheadId = "in-progress-table-head";
+ public static final String dashboardPendingTheadId = "pending-table-head";
+ public static final String dashboardFinishedTheadId = "finished-table-head";
+ public static final String failedIconClass = "icon-x";
+ public static final String processIconClass = "icon-process";
+ public static final String alertIconClass = "icon-alert";
+ public static final String pendingIconClass = "icon-pending";
+ public static final String viewIconClass = "icon-view";
+ public static final String pendingTableId = "pending-table";
+ public static final String cancelPendingButtonClass = "cancel-action";
+
+ //failed change management modal constants:
+ public static final String failedModalHeaderId = "failed-modal-header";
+ public static final String failedModalContentId = "failed-modal-content";
+ public static final String failedModalRetryButtonId = "failed-retry-button";
+ public static final String failedModalRollbackButtonId = "failed-rollback-button";
+
+ //in progress change management modal constants:
+ public static final String inProgressModalHeaderId = "in-progress-modal-header";
+ public static final String inProgressModalContentId = "in-progress-modal-content";
+ public static final String inProgressModalStopButtonId = "in-progress-stop-button";
+ public static final String inProgressModalRollbackButtonId = "in-progress-rollback-button";
+
+ //alert change management modal constants:
+ public static final String alertModalHeaderId = "alert-modal-header";
+ public static final String alertModalContentId = "alert-modal-content";
+ public static final String alertModalContinueButtonId = "alert-continue-button";
+ public static final String alertModalRollbackButtonId = "alert-rollback-button";
+
+ //pending change management modal constants:
+ public static final String pendingModalHeaderId = "pending-modal-header";
+ public static final String pendingModalContentId = "pending-modal-content";
+ public static final String pendingModalRescheduleButtonId = "pending-reschedule-button";
+ public static final String pendingModalRollbackButtonId = "pending-rollback-button";
+ public static final String pendingModalCancelWorkflowButtonClass = "btn-cancel-workflow";
+ }
+
+ public class TestEnvironments {
+ // general constants:
+ public static final String PAGE_HEADLINE = "test-environments-headline";
+
+ // headline bar constants:
+ public static final String HEADLINE_NEW_BUTTON = "test-environments-new-button";
+ public static final String HEADLINE_SEARCH_INPUT = "test-environments-search";
+ public static final String SEARCH_INPUT = "test-search-input";
+ public static final String TEXT_TO_FILTER = "4eb";
+
+ public static final String REFRESH_BUTTON = "test-environments-refresh";
+ public static final String NO_DATA_MESSAGE = "test-environments-no-data";
+ public static final String ERROR_MESSAGE = "test-environments-error";
+ public static final String TRY_AGAIN_BUTTON = "try-again";
+ public static final String ENVIRONMENTS_TABLE = "test-environments-table";
+ public static final String TABLE_HEADER_ASC = "tablesorter-headerAsc";
+
+ // new popup
+ public static final String NEW_ENVIRONMENT_FORM = "test-new-environment-form";
+ public static final String INSTANCE_NAME_INPUT = "environment-name";
+ public static final String ECOMP_ID_DROP_DOWN = "ecomp-instance-id";
+ public static final String ECOMP_NAME_INPUT = "ecomp-instance-name";
+ public static final String TENANT_CONTEXT_INPUT = "tenant-context";
+ public static final String ENVIRONMENT_TYPE_DROP_DOWN = "operational-environment-type";
+ public static final String WORKLOAD_CONTEXT_DROP_DOWN = "workload-context";
+ public static final String SUBMIT_BUTTON = "submit-button";
+ public static final String CANCEL_BUTTON = "cancel-button";
+ public static final String MODAL_CLOSE_BUTTON_CLASS = "modal-close";
+ public static final String POPUP_ERROR_MESSAGE = "test-new-environment-error";
+ public static final String environmentCreatedSuccesfullyMessage = "Operational Environment successfully created";
+
+ // json content
+ public static final String HEADERS_LIST = "headers";
+ public static final String BASIC_LIST = "basicList";
+ public static final String FULL_LIST = "fullList";
+ public static final String FILTERED_LIST = "filteredList";
+ public static final String SORTED_LIST = "sortedList";
+
+ // activate
+ public static final String environmentActivatedSuccesfullyMessage = "Operational Environment successfully activated";
+ public static final String environmentDeactivatedSuccesfullyMessage = "Operational Environment successfully deactivated";
+ public static final String activateButtonIdPrefix = "testEnvActivate-";
+ public static final String deactivateButtonIdPrefix = "testEnvDeactivate-";
+ public static final String environmentStatusIdPrefix = "testEnvStatus-";
+ public static final String attachButtonIdPrefix = "testEnvAttach-";
+ }
+
+ public class Modals {
+ public static final String modalClass = "div[modal-animation='true']";
+ }
+
+ public class BrowseASDC {
+ public static final String DATE_FORMAT = "yyyy-MM-dd_HH-mm-ss-SSS";
+ public static final String SERVICE_INSTANCE_NAME_PREFIX = "vid-e2e-test_service_";
+ public static final String DEPOLY_SERVICE_CLASS = "deploy-service-class";
+ public static final String SERVICE_INSTANCE_CREATED_SUCCESSFULLY_TEXT = "COMPLETE - Service Instance was created successfully.";
+ public static final String SERVICE_INSTANCE_CREATION_FAILED_MESSAGE = "failed to create service instance";
+ public static final String CREATE_SERVICE_INSTANCE = "Create Service Instance";
+ public static final String MSO_COMMIT_DIALOG_CLOSE_BUTTON = "msoCommitDialogCloseButton";
+ public static final String AIC_OPTION_CLASS = "aic_zoneOption";
+ }
+
+ public class EditExistingInstance {
+ public static final String SELECT_SERVICE_INSTANCE = "Select a Service Instance";
+ public static final String SERVICE_INSTANCE_ID = "Service Instance Id";
+ public static final String SERVICE_INSTANCE_NAME = "Service Instance Name";
+ public static final String SEARCH_FOR_EXISTING_INSTANCES_INPUT = "searchForExistingInstancesText";
+ public static final String SELECT_OWNING_ENTITY_ID = "selectOwningEntity";
+ public static final String SELECT_PROJECT_ID = "selectProject";
+
+ public static final String DELETE_VNF_BTN = "delete-vnf-btn";
+ public static final String ADD_VNF_MODULE_DROPDOWN = "add-vnf-module-dropdown";
+ public static final String ADD_CUSTOM_VNF_MODULE_DROPDOWN = "add-custom-vnf-module-dropdown";
+ public static final String ADD_CUSTOM_VOLUME_GROUP = "add-custom-volume-group";
+ public static final String ADD_VOLUME_GROUP = "add-volume-group";
+ public static final String DELETE_VF_MODULE = "delete-vf-module";
+ public static final String DELETE_VNF_VOLUME_GROUP = "delete-vnf-volume-group";
+ public static final String DELETE_NETWORK = "delete-network";
+ }
+
+ public class CreateNewInstance {
+ public static final String SUBSCRIBER_NAME_OPTION_CLASS = "subscriberNameOption";
+ public static final String SERVICE_TYPE_OPTION_CLASS = "serviceTypeOption";
+ public static final String SELECTED_SUBSCRIBER_NAME_TEST_ID = "selectedSubscriberName";
+ public static final String SELECTED_SERVICE_TYPE_NAME_TEST_ID = "selectedServiceTypeName";
+ public static final String SERVICE_INSTANCE_NAME_PREFIX = "vid-e2e-test_aai_service_";
+ }
+
+ public class ViewEdit {
+ public static final String VNF_CREATED_SUCCESSFULLY_TEXT = "COMPLETE - Vnf has been created successfully.";
+ public static final String VOLUME_GROUP_CREATED_SUCCESSFULLY_TEXT = "COMPLETE - Volume Group has been created successfully.";
+ public static final String VF_MODULE_CREATED_SUCCESSFULLY_TEXT = "COMPLETE - VF Module has been created successfully.";
+ public static final String VNF_CREATION_FAILED_MESSAGE = "failed to create service instance VNF";
+ public static final String VOLUME_GROUP_CREATION_FAILED_MESSAGE = "failed to create Volume Group";
+ public static final String VF_MODULE_CREATION_FAILED_MESSAGE = "failed to create VF Module";
+ public static final String PRODUCT_FAMILY_SELECT_TESTS_ID = "productFamily";
+ public static final String LCP_REGION_SELECT_TESTS_ID = "lcpRegion";
+ public static final String LEGACY_REGION_INPUT_TESTS_ID = "lcpRegionText";
+ public static final String TENANT_SELECT_TESTS_ID = "tenant";
+ public static final String TENANT_OPTION_CLASS = "tenantOption";
+ public static final String VNF_INSTANCE_NAME_PREFIX = "vid-e2e-test_vnf_";
+ public static final String AIC_ZONE_TEST_ID = "aic_zone";
+ public static final String VOLUME_GROUP_OPTION_TEST_ID_PREFIX = "addVolumeGroupOption-";
+ public static final String VF_MODULE_OPTION_TEST_ID_PREFIX = "addVFModuleOption-";
+ public static final String VNF_OPTION_TEST_ID_PREFIX = "addVNFOption-";
+ public static final String VOLUME_GROUP_INSTANCE_NAME_PREFIX = "vid-e2e-test-volume_group_";
+ public static final String VF_MODULE_INSTANCE_NAME_PREFIX = "vid-e2e-test-volume_vf_module_";
+ public static final String ADD_VNF_BUTTON_TEST_ID = "addVNFButton";
+ public static final String ADD_VOLUME_GROUP_BUTTON_TEST_ID = "addVolumeGroupButton";
+ public static final String ADD_VF_MODULE_GROUP_BUTTON_TEST_ID = "addVFModuleButton";
+ public static final String DELETE_VNF_BUTTON_TEST_ID = "deleteVNFButton";
+ 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 OPTION_IN_DROPDOWN_NOT_EXISTS = "the option %s in dropdown %s not exists";
+ public static final String DISSOCIATE_BTN_CLASS = "dissociate-pnf";
+ public static final String DISSOCIATE_CONFIRM_MODAL_TEXT = "Are you sure you would like to dissociate %s from the service instance?";
+ public static final String DEACTIVATE_BUTTON_TEST_ID = "deactivateButton";
+ public static final String ENABLE_ERROR_MESSAGE = "The %s option should not be enabled";
+ public static final String DISABLE_ERROR_MESSAGE = "The %s option should be enabled";
+ public static final String DISSOCIATE_CONFIRM_MODAL_BTN_ID = "ok-button";
+
+ }
+ public class PnfAssociation {
+ public static final String PNF_NAME_TEST_ID = "pnfName";
+ public static final String SEARCH_PNF_TEST_ID = "searchPnf";
+ public static final String ASSOCIATE_PNF_TEST_ID = "associatePnf";
+ public static final String PNF_ENABLE_ASSOCIATE_ERROR_MESSAGE = "The Associate option not enabled";
+ public static final String PNF_DISABLE_ASSOCIATE_ERROR_MESSAGE = "The Associate option enabled when pnf is not found";
+ public static final String PNF_ASSOCIATED_SUCCESSFULLY_TEXT = "COMPLETE - PNF has been associated successfully.";
+ public static final String PNF_ASSOCIATED_FAILED_MESSAGE = "failed to associate PNF to service instance";
+ public static final String NOT_FOUND_ERROR_TEST_ID = "pnfNotFoundErrorMessage";
+ public static final String NOT_FOUND_ERROR_MESSAGE = "Errorn with the error messge not found PNF";
+
+ public static final String MSO_MODAL_TEST_ID = "msoPopup";
+ public static final String MSO_MODAL_STATUS_TEST_ID = "msoRequestStatus";
+ //pnf properties
+ public static final String PNF_INSTANCE_NAME_TEST_ID = "pnfInstancePnfName";
+ public static final String PNF_INSTANCE_NAME2_TEST_ID = "pnfInstancePnfName2";
+ public static final String PNF_INSTANCE_NAME2_SOURCE_TEST_ID = "pnfInstancePnfName2Source";
+ public static final String PNF_INSTANCE_ID_TEST_ID = "pnfInstancePnfId";
+ public static final String PNF_INSTANCE_EQUIP_TYPE_TEST_ID = "pnfInstanceEquipType";
+ public static final String PNF_INSTANCE_EQUIP_VENDOR_TEST_ID = "pnfInstanceEquipVendor";
+ public static final String PNF_INSTANCE_EQUIP_MODEL_TEST_ID = "pnfInstanceEquipModel";
+ public static final String PNF_INSTANCE_ERROR_MESSAGE = "The PNF Instance info %s does not match";
+
+ }
+ public class serviceModelInfo{
+ public static final String INFO_TEST_ID_PREFIX = "info-test-data-id-";
+ public static final String SERVIICE_NAME_KEY = "ServiceName";
+ public static final String SUBSCRIBER_NAME_KEY = "SubscriberName";
+ public static final String SERVICE_INSTANCE_NAME = "ServiceInstanceName";
+ public static final String MODEL_NAME = "ModelName";
+ public static final String MODEL_INVARIANT_UUID = "ModelInvariantUUID";
+ public static final String MODEL_VERSION = "ModelVersion";
+ public static final String MODEL_UUID = "ModelUUID";
+ public static final String MODEL_CUSTOMIZATION_UUID = "ModelCustomizationUUID";
+ public static final String RESOURCE_NAME = "ResourceName";
+ public static final String NF_TYPE = "NFType";
+ public static final String NF_ROLE = "NFRole";
+ public static final String NF_FUNCTION = "NFFunction";
+ public static final String NF_NAMING_CODE = "NFNamingCode";
+ public static final String METADETA_ERROR_MESSAGE = "The service model info %s does not match";
+ }
+
+ public class OwningEntity {
+ public static final String PROJECT_SELECT_TEST_ID = "project";
+ public static final String OWNING_ENTITY_SELECT_TEST_ID = "owningEntity";
+ public static final String PLATFORM_SELECT_TEST_ID = "platform";
+ public static final String LOB_SELECT_TEST_ID = "lineOfBusiness";
+ }
+
+ 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 SUPRE_USER = "su";
+ }
+
+ public class RegisterToSimulator {
+
+ //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_SERVICE_INSTANCE_BY_ID_2 = "search_for_service_instance/aai_filter_service_instance_by_id_2.json";
+ public static final String GET_SUBSCRIBERS_FOR_CUSTOMER = "search_for_service_instance/aai_get_subscribers_for_customer.json";
+ public static final String GET_SUBSCRIBERS_FOR_CUSTOMER_2 = "search_for_service_instance/aai_get_subscribers_for_customer_2.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_VIEW_EDIT_2 = "search_for_service_instance/aai_named_query_for_view_edit_2.json";
+ }
+
+ public class pProbe {
+ public static final String GET_SERVICE_INSTANCE_WITH_LOGICAL_LINKS = "pProbe/aai_get_service_instance_with_logical_links.json";
+ public static final String GET_LOGICAL_LINK = "pProbe/aai_get_logical_link.json";
+ public static final String GET_SPECIFIC_PNF = "pProbe/aai_get_specific_pnf.json";
+ public static final String GET_SPECIFIC_PNF_ERROR = "pProbe/aai_get_specific_pnf_error.json";
+ public static final String ADD_PNF_RELATIONSHIP = "pProbe/mso_add_pnf_relationship.json";
+ public static final String ADD_PNF_RELATIONSHIP_ERROR = "pProbe/mso_add_pnf_relationship_error.json";
+ public static final String GET_ADD_PNF_RELATIONSHIP_ORCH_REQ = "pProbe/mso_get_add_relationship_orch_req.json";
+ public static final String REMOVE_PNF_RELATIONSHIP = "pProbe/mso_remove_pnf_relationship.json";
+ public static final String GET_REMOVE_PNF_RELATIONSHIP_ORCH_REQ = "pProbe/mso_get_remove_relationship_orch_req.json";
+ public static final String REMOVE_PNF_RELATIONSHIP_ERROR = "pProbe/mso_remove_pnf_relationship_error.json";
+ }
+
+ public class activateDeactivate{
+ public static final String AAI_GET_SERVICE_INSTANCE = "activateDeactivate/aai_get_service_instance.json";
+ public static final String ACTIVATE_SERVICE_INSTANCE = "activateDeactivate/mso_activate_service_instance.json";
+ public static final String ACTIVATE_SERVICE_INSTANCE_ERROR = "activateDeactivate/mso_activate_service_instance_error.json";
+ public static final String ACTIVATE_SERVICE_INSTANCE_ORCH_REQUEST = "activateDeactivate/mso_activate_service_instance_orch_req.json";
+ }
+
+ public class genericRequest{
+ public static final String ECOMP_PORTAL_GET_SESSION_SLOT_CHECK_INTERVAL = "ecompportal_getSessionSlotCheckInterval.json";
+ }
+ }
+}
diff --git a/vid-automation/src/main/java/vid/automation/test/StartTest.java b/vid-automation/src/main/java/vid/automation/test/StartTest.java
new file mode 100644
index 000000000..742cb6f1e
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/StartTest.java
@@ -0,0 +1,66 @@
+package vid.automation.test;
+
+import org.testng.TestNG;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PropertyConfigurator;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+/**
+ * Created by itzikliderman on 21/06/2017.
+ */
+public class StartTest {
+ public static boolean debug = false;
+
+ public static AtomicBoolean loggerInitialized = new AtomicBoolean(false);
+
+ protected static Logger logger = null;
+
+ public static void main (String[] args) throws IOException {
+ String debugEnabled = System.getProperty("debug");
+ if (debugEnabled != null && debugEnabled.equalsIgnoreCase("true")) {
+ debug = true;
+ }
+ System.out.println("Debug mode is " + (debug ? "enabled" : "disabled"));
+
+ enableLogger();
+
+ TestNG testng = new TestNG();
+
+ List<String> suites = new ArrayList<String>();
+ suites.add(args[0]);
+ testng.setTestSuites(suites);
+ testng.setUseDefaultListeners(true);
+ testng.setOutputDirectory("target/");
+
+ testng.run();
+ }
+
+ public StartTest() {
+ logger = Logger.getLogger(StartTest.class.getName());
+ }
+
+ public static void enableLogger() {
+
+ if (false == loggerInitialized.get()) {
+
+ loggerInitialized.set(true);
+
+ String log4jPropsFile = System.getProperty("log4j.configuration");
+// if (System.getProperty("os.name").contains("Windows")) {
+ String logProps = "src/main/resources/ci/conf/log4j.properties";
+ if (log4jPropsFile == null) {
+ System.setProperty("targetlog", "target/");
+ log4jPropsFile = logProps;
+ }
+
+// }
+ PropertyConfigurator.configureAndWatch(log4jPropsFile);
+
+ }
+ }
+
+}
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
new file mode 100644
index 000000000..f2cbbef80
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/infra/Click.java
@@ -0,0 +1,54 @@
+package vid.automation.test.infra;
+
+import org.junit.Assert;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.Select;
+
+import java.util.List;
+
+public class Click {
+ public static void byText(String text) {
+ WebElement element = GeneralUIUtils.findByText(text);
+ Assert.assertTrue(element != null);
+
+ element.click();
+ }
+
+ public static void byId(String id) {
+ WebElement element = Get.byId(id);
+ Assert.assertTrue(element != null);
+
+ element.click();
+ }
+
+ public static void byTestId(String testId) {
+ WebElement element = Get.byTestId(testId);
+ Assert.assertTrue(element != null);
+ element.click();
+ }
+
+ public static void byClass(String className) {
+ List<WebElement> elements = Get.byClass(className);
+ Assert.assertTrue(elements != null && elements.size() > 0);
+
+ elements.get(0).click();
+ }
+
+ public static void onFirstSelectOptionById(String id) {
+ Select selectlist = new Select(Get.byId(id));
+ if(selectlist.getOptions().size() > 1) {
+ selectlist.selectByIndex(1);
+ }
+ }
+
+ public static void onFirstSelectOptionByClass(String className) {
+ final List<WebElement> webElements = Get.byClass(className);
+ webElements.forEach(webElement -> {
+ Select selectlist = new Select(webElement);
+ if (selectlist.getOptions().size() > 1) {
+ selectlist.selectByIndex(1);
+ }
+ });
+ }
+}
diff --git a/vid-automation/src/main/java/vid/automation/test/infra/Exists.java b/vid-automation/src/main/java/vid/automation/test/infra/Exists.java
new file mode 100644
index 000000000..14339d63f
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/infra/Exists.java
@@ -0,0 +1,34 @@
+package vid.automation.test.infra;
+
+import org.openqa.selenium.NoSuchElementException;
+import vid.automation.test.Constants;
+
+public class Exists {
+ public static boolean byId(String id) {
+ return Get.byId(id) != null;
+ }
+
+ public static boolean byTestId(String testId) {
+ return Get.byTestId(testId) != null;
+ }
+
+ public static boolean byClass(String className) {
+ return Get.byClass(className) != null;
+ }
+
+ public static boolean byClassAndText(String className, String text) {
+ return Get.byClassAndText(className, text) != null;
+ }
+
+ public static boolean byCssSelectorAndText(String css, String text) {
+ return Get.byCssSelectorAndText(css, text) != null;
+ }
+
+ public static boolean modal() {
+ try {
+ return Get.byCssSelector(Constants.Modals.modalClass) != null;
+ } catch (NoSuchElementException exception) {
+ return false;
+ }
+ }
+}
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
new file mode 100644
index 000000000..f9ce529f8
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/infra/Get.java
@@ -0,0 +1,95 @@
+package vid.automation.test.infra;
+
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Get {
+ public static WebElement byId(String id) {
+ try {
+ return GeneralUIUtils.getDriver().findElement(By.id(id));
+ } catch (Exception var2) {
+ return null;
+ }
+ }
+
+ public static WebElement byTestId(String dataTestId) {
+ try {
+ return GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']"));
+ } catch (Exception var2) {
+ return null;
+ }
+ }
+
+
+
+ public static WebElement byClassAndText(String className, String text) {
+ WebElement result = null;
+ List<WebElement> elements = GeneralUIUtils.getWebElementsListByContainsClassName(className);
+
+ for(WebElement element : elements) {
+ if (element.getText().contains(text)) {
+ result = element;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ public static WebElement byCssSelectorAndText(String css, String text) {
+ WebElement element = GeneralUIUtils.getDriver().findElement(By.cssSelector(css));
+
+ if (element != null && element.getText().contains(text)) {
+ return element;
+ }
+
+ return null;
+ }
+
+ public static String selectedOptionText(String dataTestId) {
+ return GeneralUIUtils.getSelectedElementFromDropDown(dataTestId).getText();
+ }
+
+ public static List<WebElement> byClass(String className) {
+ return GeneralUIUtils.getWebElementsListByContainsClassName(className);
+ }
+
+ public static WebElement byCssSelector(String css) {
+ return GeneralUIUtils.getDriver().findElement(By.cssSelector(css));
+ }
+
+ public static List<String> tableHeaderValuesByTestId(String tableId) {
+ return tableValuesById(tableId, "thead", "th").get(0);
+ }
+
+ public static List<List<String>> tableBodyValuesByTestId(String tableId) {
+ return tableValuesById(tableId, "tbody", "td");
+ }
+
+ private static List<WebElement> rowsByTableId(String tableId,String section, String column) {
+ try {
+ return GeneralUIUtils.getElemenetsFromTable(By.xpath("//table[@data-tests-id=\"" + tableId + "\"]/" + section + "/tr"));
+ } catch (Exception var2) {
+ return null;
+ }
+ }
+
+ private static List<List<String>> tableValuesById(String tableId, String section, String column) {
+ List<WebElement> rows = rowsByTableId(tableId, section, column);
+ if(rows != null) {
+ List<List<String>> tableContent = new ArrayList<List<String>>();
+ for(WebElement row:rows) {
+ List<WebElement> columns = row.findElements(By.xpath(column));
+ tableContent.add(GeneralUIUtils.getWebElementListText(columns));
+ }
+ return tableContent;
+ }
+ else {
+ return null;
+ }
+ }
+}
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
new file mode 100644
index 000000000..15fa22549
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/infra/Input.java
@@ -0,0 +1,38 @@
+package vid.automation.test.infra;
+
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang3.SystemUtils;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+
+/**
+ * Created by itzikliderman on 11/09/2017.
+ */
+public class Input {
+ public static void text(String text, String inputTestsId) {
+ WebElement inputElement = GeneralUIUtils.getWebElementByTestID(inputTestsId, 30);
+ inputElement.sendKeys(text);
+ }
+
+ public static String getValueByTestId(String testId) {
+ WebElement input = GeneralUIUtils.getInputElement(testId);
+ return input.getAttribute("value");
+ }
+
+ /*
+ Get relative path to resource and id of file input element,
+ and send the resource full path to the input element
+ */
+ public static void file(String pathInResources, String inputId) {
+
+ String path = Input.class.getResource("../../../../"+pathInResources).getPath().toString();
+ if (SystemUtils.IS_OS_WINDOWS) {
+ path = FilenameUtils.separatorsToSystem(path);
+ if (path.charAt(0)=='\\') {
+ path = path.substring(1);
+ }
+ }
+ WebElement inputElement = Get.byId(inputId);
+ inputElement.sendKeys(path);
+ }
+}
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
new file mode 100644
index 000000000..048174e99
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/infra/SelectOption.java
@@ -0,0 +1,47 @@
+package vid.automation.test.infra;
+
+import org.openecomp.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;
+
+/**
+ * Created by itzikliderman on 18/07/2017.
+ */
+public class SelectOption {
+ public static Select byValue(String value, String dataTestsId) {
+ Select select = new Select(GeneralUIUtils.getWebElementByTestID(dataTestsId));
+ if(value != null) {
+ select.selectByValue(value);
+ }
+
+ return select;
+ }
+
+ public static void byIdAndVisibleText(String id, String text) {
+ Select selectlist = new Select(Get.byId(id));
+ selectlist.selectByVisibleText(text);
+ }
+
+ public static void byClassAndVisibleText(String className, String text) {
+ final List<WebElement> webElements = Get.byClass(className);
+ webElements.forEach(webElement -> {
+ final String id = webElement.getAttribute("id");
+ byIdAndVisibleText(id, text);
+ });
+ }
+
+ public static void byTestIdAndVisibleText(String displayName, String selectDataTestId) {
+ GeneralUIUtils.getSelectList(displayName, selectDataTestId);
+ }
+
+ public static void selectFirstTwoOptionsFromMultiselectById(String multiSelectId) throws InterruptedException {
+ Click.byId(multiSelectId);
+ Thread.sleep(1000);
+ Click.byClass(Constants.MULTI_SELECT_UNSELECTED_CLASS);
+ Click.byClass(Constants.MULTI_SELECT_UNSELECTED_CLASS);
+
+ }
+}
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
new file mode 100644
index 000000000..fa6ce4f38
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/infra/Wait.java
@@ -0,0 +1,99 @@
+package vid.automation.test.infra;
+
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.NoSuchElementException;
+import vid.automation.test.Constants;
+
+import java.util.concurrent.TimeUnit;
+import java.util.function.Predicate;
+
+public class Wait {
+ public static boolean byText(String text) {
+ return GeneralUIUtils.findAndWaitByText(text, Constants.generalTimeout);
+ }
+
+ public static <T> boolean waitFor(Predicate<T> predicate, T input, int numOfRetries, int interval, TimeUnit intervalUnit) {
+ for (int i=0; i<numOfRetries; i++) {
+ try {
+ if (predicate.test(input)) {
+ return true;
+ }
+ }
+ catch (Throwable t) {
+ System.out.println("a retry failed duo to:" +t.getMessage());
+ }
+ try {
+ intervalUnit.sleep(interval);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ return false;
+ }
+
+ public static <T> boolean waitFor(Predicate<T> predicate, T input, int numOfRetries, int interval) {
+ return waitFor(predicate, input, numOfRetries, interval, TimeUnit.SECONDS);
+ }
+
+ public static boolean waitByClassAndText(String className, String text, int timeoutInSeconds) {
+ return waitFor((x->Get.byClassAndText(className,text)!=null),null, timeoutInSeconds, 1);
+ }
+
+ public static boolean waitByTestId(String dataTestId, int timeoutInSeconds) {
+ return waitFor((x->Get.byTestId(dataTestId)!=null),null, timeoutInSeconds, 1);
+ }
+
+ public static void angularHttpRequestsLoaded() {
+ JavascriptExecutor js = (JavascriptExecutor) GeneralUIUtils.getDriver();
+ for (int i=0; i<Constants.generalRetries; i++) {
+ Object result = js.executeScript("return window.angular.element('body').injector().get('$http').pendingRequests.length;");
+ if(result.toString().equals("0")) {
+ break;
+ } else {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ public static void modalToDisappear() {
+ for (int i=0; i<Constants.generalRetries; i++) {
+ try {
+ Object modalElement = Get.byCssSelector(Constants.Modals.modalClass);
+ if(modalElement == null) {
+ break;
+ } else {
+ Thread.sleep(1000);
+ }
+ } catch (NoSuchElementException e) {
+ break;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static void modalToBeDisplayed() {
+ for (int i=0; i<Constants.generalRetries; i++) {
+ try {
+ Object modalElement = Get.byCssSelector(Constants.Modals.modalClass);
+ if(modalElement == null) {
+ Thread.sleep(1000);
+ } else {
+ break;
+ }
+ } catch (Exception e) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ e.printStackTrace();
+ }
+ }
+ }
+}
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
new file mode 100644
index 000000000..0dc26aefd
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/model/Credentials.java
@@ -0,0 +1,9 @@
+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/Environment.java b/vid-automation/src/main/java/vid/automation/test/model/Environment.java
new file mode 100644
index 000000000..9304dd998
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/model/Environment.java
@@ -0,0 +1,11 @@
+package vid.automation.test.model;
+
+public class Environment {
+ public String operationalEnvironmentId;
+ public String operationalEnvironmentName;
+ public String operationalEnvironmentType;
+ public String EcompEnvironmentId;
+ public String EcompEnvironmentName;
+ public String tenantContext;
+ public String workloadContext;
+}
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
new file mode 100644
index 000000000..f5eaf6b0d
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/model/Service.java
@@ -0,0 +1,27 @@
+package vid.automation.test.model;
+
+import java.util.ArrayList;
+
+/**
+ * Created by itzikliderman on 19/06/2017.
+ */
+public class Service {
+
+ public String type;
+
+ public String uuid;
+
+ public String invariantUuid;
+
+ public String name;
+
+ public String version;
+
+ public String category;
+
+ public String description;
+
+ public String serviceRole;
+
+ public Service() {}
+}
diff --git a/vid-automation/src/main/java/vid/automation/test/model/ServicesObject.java b/vid-automation/src/main/java/vid/automation/test/model/ServicesObject.java
new file mode 100644
index 000000000..2ab0df296
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/model/ServicesObject.java
@@ -0,0 +1,11 @@
+package vid.automation.test.model;
+
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * Created by itzikliderman on 21/06/2017.
+ */
+public class ServicesObject {
+ public HashMap<String, Service> services;
+}
diff --git a/vid-automation/src/main/java/vid/automation/test/model/User.java b/vid-automation/src/main/java/vid/automation/test/model/User.java
new file mode 100644
index 000000000..c4b06d4bc
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/model/User.java
@@ -0,0 +1,15 @@
+package vid.automation.test.model;
+
+import vid.automation.test.model.Credentials;
+
+import java.util.ArrayList;
+
+/**
+ * Created by Oren on 7/16/17.
+ */
+public class User {
+ public Credentials credentials;
+ public ArrayList<String> subscribers;
+ public ArrayList<String> serviceTypes;
+ public ArrayList<String> tenants;
+}
diff --git a/vid-automation/src/main/java/vid/automation/test/model/UsersObject.java b/vid-automation/src/main/java/vid/automation/test/model/UsersObject.java
new file mode 100644
index 000000000..e03ac0d4a
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/model/UsersObject.java
@@ -0,0 +1,13 @@
+package vid.automation.test.model;
+
+import vid.automation.test.model.User;
+
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * Created by Oren on 7/16/17.
+ */
+public class UsersObject {
+ public HashMap<String, User> users;
+}
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
new file mode 100644
index 000000000..f9a2e43a5
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/sections/BrowseASDCPage.java
@@ -0,0 +1,12 @@
+package vid.automation.test.sections;
+
+import vid.automation.test.Constants;
+
+/**
+ * Created by itzikliderman on 13/06/2017.
+ */
+public class BrowseASDCPage extends VidBasePage {
+ public String generateInstanceName() {
+ return generateInstanceName(Constants.BrowseASDC.SERVICE_INSTANCE_NAME_PREFIX);
+ }
+}
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
new file mode 100644
index 000000000..bcf035c00
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/sections/ChangeManagementPage.java
@@ -0,0 +1,15 @@
+package vid.automation.test.sections;
+
+import vid.automation.test.Constants;
+import vid.automation.test.infra.Click;
+
+public class ChangeManagementPage extends VidBasePage {
+ public static void openChangeManagementPage() {
+ Click.byText(Constants.SideMenu.VNF_CHANGES);
+ }
+
+ public static void openNewChangeManagementModal() {
+ ChangeManagementPage.openChangeManagementPage();
+ Click.byId(Constants.ChangeManagement.headlineNewButtonId);
+ }
+}
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
new file mode 100644
index 000000000..2eef9b3af
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/sections/CreateNewInstancePage.java
@@ -0,0 +1,21 @@
+package vid.automation.test.sections;
+
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import vid.automation.test.Constants;
+import vid.automation.test.model.Service;
+
+/**
+ * Created by itzikliderman on 13/06/2017.
+ */
+public class CreateNewInstancePage extends VidBasePage {
+
+ public CreateNewInstancePage clickCloseButton() {
+ GeneralUIUtils.clickOnElementByTestId(Constants.BrowseASDC.MSO_COMMIT_DIALOG_CLOSE_BUTTON, 30);
+ return this;
+ }
+
+ public String generateInstanceName() {
+ return generateInstanceName(Constants.CreateNewInstance.SERVICE_INSTANCE_NAME_PREFIX);
+ }
+
+}
diff --git a/vid-automation/src/main/java/vid/automation/test/sections/CreationDialog.java b/vid-automation/src/main/java/vid/automation/test/sections/CreationDialog.java
new file mode 100644
index 000000000..fdc78d2e5
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/sections/CreationDialog.java
@@ -0,0 +1,8 @@
+package vid.automation.test.sections;
+
+/**
+ * Created by itzikliderman on 31/07/2017.
+ */
+public class CreationDialog extends VidBasePage{
+
+}
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
new file mode 100644
index 000000000..c1053d2a5
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/sections/LoginExternalPage.java
@@ -0,0 +1,29 @@
+package vid.automation.test.sections;
+
+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 static org.junit.Assert.*;
+
+
+public class LoginExternalPage {
+
+
+ static private final String SUCCESSFUL_LOGIN_STRING_SEARCH = "Welcome to VID";
+
+ static void sendUserAndPasswordKeys(UserCredentials userCredentials) {
+ WebElement loginIdInputElem = GeneralUIUtils.getWebElementBy(By.name("loginId"));
+ loginIdInputElem.sendKeys(userCredentials.getUserId());
+ WebElement passwordInputElem = GeneralUIUtils.getWebElementBy(By.name("password"));
+ passwordInputElem.sendKeys(userCredentials.getPassword());
+ }
+
+ static public void performLoginExternal(UserCredentials userCredentials) {
+ sendUserAndPasswordKeys(userCredentials);
+ WebElement loginButton = GeneralUIUtils.getWebElementBy(By.id("loginBtn"), 30);
+ loginButton.click();
+ boolean isLoginSuccess = GeneralUIUtils.findAndWaitByText(SUCCESSFUL_LOGIN_STRING_SEARCH, 30);
+ assertTrue(isLoginSuccess);
+ }
+}
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
new file mode 100644
index 000000000..3f8061a78
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/sections/PnfSearchAssociationPage.java
@@ -0,0 +1,24 @@
+package vid.automation.test.sections;
+
+import org.junit.Assert;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+import vid.automation.test.Constants;
+
+public class PnfSearchAssociationPage extends VidBasePage {
+ public PnfSearchAssociationPage setPnfName(String pnfName){
+ setInputText(Constants.PnfAssociation.PNF_NAME_TEST_ID, pnfName);
+ return this;
+ }
+ public PnfSearchAssociationPage clickSearchButton() {
+ GeneralUIUtils.clickOnElementByTestId(Constants.PnfAssociation.SEARCH_PNF_TEST_ID, 60);
+ return this;
+ }
+ public PnfSearchAssociationPage clickAssociateButton() {
+ GeneralUIUtils.clickOnElementByTestId(Constants.PnfAssociation.ASSOCIATE_PNF_TEST_ID, 100);
+ return this;
+ }
+
+
+
+}
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
new file mode 100644
index 000000000..5fc4894e9
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/sections/SearchExistingPage.java
@@ -0,0 +1,77 @@
+package vid.automation.test.sections;
+
+import org.junit.Assert;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+import vid.automation.test.Constants;
+
+
+/**
+ * Created by pickjonathan on 10/07/2017.
+ */
+
+public class SearchExistingPage extends VidBasePage {
+
+ public SearchExistingPage() {}
+
+ public void selectSearchById(){
+ selectSearchBy(Constants.EditExistingInstance.SERVICE_INSTANCE_ID);
+ }
+
+ public void selectSearchByName(){
+ selectSearchBy(Constants.EditExistingInstance.SERVICE_INSTANCE_NAME);
+ }
+
+ public void selectSearchBy(String searchTypeOptionText) {
+ boolean findAndWaitByText = GeneralUIUtils.findAndWaitByText(Constants.EditExistingInstance.SELECT_SERVICE_INSTANCE, 30);
+ Assert.assertTrue(findAndWaitByText);
+ GeneralUIUtils.clickOnElementByText(Constants.EditExistingInstance.SELECT_SERVICE_INSTANCE, 30);
+
+ boolean isSearchByIdAvailable = GeneralUIUtils.findAndWaitByText(searchTypeOptionText, 30);
+ Assert.assertTrue(isSearchByIdAvailable);
+ GeneralUIUtils.clickOnElementByText(searchTypeOptionText, 30);
+ }
+
+ public void searchForInstanceByUuid(String uuid) {
+ selectSearchById();
+ startSearchByInstanceIdentifier(uuid);
+ }
+
+ private void startSearchByInstanceIdentifier(String text) {
+ WebElement textInputWebElement = GeneralUIUtils.getWebElementByTestID(Constants.EditExistingInstance.SEARCH_FOR_EXISTING_INSTANCES_INPUT, 30);
+ Assert.assertTrue(textInputWebElement != null);
+ textInputWebElement.sendKeys(text);
+ clickSubmitButton();
+ }
+
+ public void searchForInstanceByName(String name) {
+ selectSearchByName();
+ startSearchByInstanceIdentifier(name);
+ }
+
+ public void checkForEditButtons() {
+ boolean isDeleteVisible = GeneralUIUtils.waitForElementInVisibilityByTestId(Constants.EditExistingInstance.DELETE_VNF_BTN, 30);
+ Assert.assertFalse(isDeleteVisible);
+
+ boolean isAddVnfModuleVisible = GeneralUIUtils.waitForElementInVisibilityByTestId(Constants.EditExistingInstance.ADD_VNF_MODULE_DROPDOWN, 30);
+ Assert.assertFalse(isAddVnfModuleVisible);
+
+ boolean isAddCustomVnfModuleVisible = GeneralUIUtils.waitForElementInVisibilityByTestId(Constants.EditExistingInstance.ADD_CUSTOM_VNF_MODULE_DROPDOWN, 30);
+ Assert.assertFalse(isAddCustomVnfModuleVisible);
+
+ boolean isAddCustomVolumeGroupVisible = GeneralUIUtils.waitForElementInVisibilityByTestId(Constants.EditExistingInstance.ADD_CUSTOM_VOLUME_GROUP, 30);
+ Assert.assertFalse(isAddCustomVolumeGroupVisible);
+
+ boolean isAddVolumeGroupVisible = GeneralUIUtils.waitForElementInVisibilityByTestId(Constants.EditExistingInstance.ADD_VOLUME_GROUP, 30);
+ Assert.assertFalse(isAddVolumeGroupVisible);
+
+ boolean isDeleteVfModuleVisible = GeneralUIUtils.waitForElementInVisibilityByTestId(Constants.EditExistingInstance.DELETE_VF_MODULE, 30);
+ Assert.assertFalse(isDeleteVfModuleVisible);
+
+ boolean isDeleteVnfGroupVisible = GeneralUIUtils.waitForElementInVisibilityByTestId(Constants.EditExistingInstance.DELETE_VNF_VOLUME_GROUP, 30);
+ Assert.assertFalse(isDeleteVnfGroupVisible);
+
+ boolean isDeleteNetworkVisible = GeneralUIUtils.waitForElementInVisibilityByTestId(Constants.EditExistingInstance.DELETE_NETWORK);
+ Assert.assertFalse(isDeleteNetworkVisible);
+ }
+}
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
new file mode 100644
index 000000000..8745001dd
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/sections/SideMenu.java
@@ -0,0 +1,30 @@
+package vid.automation.test.sections;
+
+import org.junit.Assert;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import vid.automation.test.Constants;
+
+public class SideMenu {
+ public static void navigateToBrowseASDCPage() {
+ navigateToPage(Constants.SideMenu.BROWSE_ASDC_SERVICE_MODELS);
+ }
+
+ public static void navigateToSearchExistingPage() {
+ navigateToPage(Constants.SideMenu.SEARCH_EXISTING_SERVICE);
+ }
+
+ public static void navigateToCreateNewServicePage() {
+ navigateToPage(Constants.SideMenu.CREATE_NEW_SERVICE);
+ }
+
+ public static void navigateToTestEnvironmentsPage() {
+ navigateToPage(Constants.SideMenu.TEST_ENVIRONMENTS);
+ }
+
+ private static void navigateToPage(String PageName) {
+ boolean findAndWaitByText = GeneralUIUtils.findAndWaitByText(PageName, 30);
+ Assert.assertTrue(findAndWaitByText);
+ GeneralUIUtils.clickOnElementByText(PageName, 150);
+ GeneralUIUtils.ultimateWait();
+ }
+}
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
new file mode 100644
index 000000000..f63906323
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/sections/TestEnvironmentPage.java
@@ -0,0 +1,39 @@
+package vid.automation.test.sections;
+
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import vid.automation.test.Constants;
+import vid.automation.test.infra.Click;
+import vid.automation.test.infra.Get;
+
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
+public class TestEnvironmentPage extends VidBasePage {
+
+ public static void clickTestEnvironmentActivate(String envId) {
+ getTestEnvironmentActivationButton(envId).click();
+ }
+
+ public static void clickTestEnvironmentDeactivate(String envId) {
+ getTestEnvironmentDeactivationButton(envId).click();
+ }
+
+ public static WebElement getTestEnvironmentActivationButton(String envId) {
+ WebElement webElement = Get.byId(Constants.TestEnvironments.activateButtonIdPrefix + envId);
+ return webElement;
+ }
+
+ public static WebElement getTestEnvironmentDeactivationButton(String envId) {
+ WebElement webElement = Get.byId(Constants.TestEnvironments.deactivateButtonIdPrefix + envId);
+ return webElement;
+ }
+
+ public static WebElement getTestEnvironmentAttachButton(String envId) {
+ WebElement webElement = Get.byId(Constants.TestEnvironments.attachButtonIdPrefix + envId);
+ return webElement;
+ }
+}
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
new file mode 100644
index 000000000..6e0367edd
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/sections/VidBasePage.java
@@ -0,0 +1,132 @@
+package vid.automation.test.sections;
+
+import org.junit.Assert;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+import vid.automation.test.Constants;
+import vid.automation.test.infra.Click;
+import vid.automation.test.infra.SelectOption;
+import vid.automation.test.infra.Wait;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+public class VidBasePage {
+
+ public VidBasePage setInstanceName(String name) {
+ setInputText(Constants.INSTANCE_NAME_SELECT_TESTS_ID, name);
+ return this;
+ }
+
+ public void generateAndSetInstanceName(String prefix) {
+ String instanceName = generateInstanceName(prefix);
+ setInstanceName(instanceName);
+ }
+
+ public VidBasePage setInputText(String inputTestsId, String text) {
+ WebElement instanceNameInput = GeneralUIUtils.getInputElement(inputTestsId);
+ instanceNameInput.sendKeys(text);
+ return this;
+ }
+
+ public String generateInstanceName(String prefix) {
+ SimpleDateFormat sdf = new SimpleDateFormat(Constants.BrowseASDC.DATE_FORMAT);
+ Date now = Calendar.getInstance().getTime();
+ return prefix + sdf.format(now);
+ }
+
+ public VidBasePage selectServiceTypeByName(String serviceType) {
+ SelectOption.byTestIdAndVisibleText(serviceType, Constants.SERVICE_TYPE_SELECT_TESTS_ID);
+ return this;
+ }
+
+ public static void selectSubscriberById(String subscriberId) {
+ SelectOption.byValue(subscriberId, Constants.SUBSCRIBER_NAME_SELECT_TESTS_ID);
+ }
+
+ public VidBasePage selectProductFamily(String productFamily) {
+ SelectOption.byValue(productFamily, Constants.ViewEdit.PRODUCT_FAMILY_SELECT_TESTS_ID);
+ return this;
+ }
+
+ public VidBasePage selectSuppressRollback(String shouldSuppress) {
+ SelectOption.byTestIdAndVisibleText(shouldSuppress, Constants.SUPPRESS_ROLLBACK_SELECT_TESTS_ID);
+ return this;
+ }
+
+ public VidBasePage clickDeployServiceButtonByServiceUUID(String serviceUUID) {
+ setInputText(Constants.BROWSE_SEARCH, serviceUUID);
+ String elementTestId = Constants.DEPLOY_BUTTON_TESTS_ID_PREFIX + serviceUUID;
+ GeneralUIUtils.clickOnElementByTestId(elementTestId, 30);
+ GeneralUIUtils.ultimateWait();
+ return this;
+ }
+
+ public VidBasePage clickEditViewByInstanceId(String instanceId) {
+ String elementTestId = Constants.VIEW_EDIT_TEST_ID_PREFIX + instanceId;
+ GeneralUIUtils.clickOnElementByTestId(elementTestId, 100);
+ GeneralUIUtils.ultimateWait();
+ return this;
+ }
+
+ public VidBasePage clickSubmitButton() {
+ GeneralUIUtils.clickOnElementByText(Constants.SUBMIT_BUTTON_TEXT, 30);
+ return this;
+ }
+
+ public VidBasePage clickCancelButton() {
+ Click.byId(Constants.generalCancelButtonId);
+ return this;
+ }
+
+
+ public VidBasePage clickConfirmButton() {
+ GeneralUIUtils.clickOnElementByTestId(Constants.CONFIRM_BUTTON_TESTS_ID, 30);
+ return this;
+ }
+
+ public VidBasePage clickCloseButton() {
+ GeneralUIUtils.clickOnElementByText(Constants.CLOSE_BUTTON_TEXT, 30);
+ return this;
+ }
+
+ public VidBasePage selectLcpRegion(String lcpRegion) {
+ SelectOption.byValue(lcpRegion, Constants.ViewEdit.LCP_REGION_SELECT_TESTS_ID);
+ return this;
+ }
+
+ public VidBasePage selectTenant(String tenant) {
+ SelectOption.byValue(tenant, Constants.ViewEdit.TENANT_SELECT_TESTS_ID);
+ return this;
+ }
+
+ public VidBasePage selectAicZone(String aicZone) {
+ SelectOption.byValue(aicZone, Constants.ViewEdit.AIC_ZONE_TEST_ID);
+ return this;
+ }
+
+ public void assertButtonState(String dataTestId, boolean shouldBeEnabled) {
+ GeneralUIUtils.ultimateWait();
+ WebElement webElement = GeneralUIUtils.getWebElementByTestID(dataTestId, 60);
+ boolean enabledElement= webElement.getAttribute("disabled")==null?true:false;
+ if(shouldBeEnabled) {
+ Assert.assertTrue(String.format(Constants.ViewEdit.ENABLE_ERROR_MESSAGE,dataTestId), enabledElement);
+ }else{
+ Assert.assertFalse(String.format(Constants.ViewEdit.DISABLE_ERROR_MESSAGE,dataTestId),enabledElement);
+ }
+
+ }
+ public VidBasePage assertMsoRequestModal(String statusMsg) {
+ boolean waitForTextResult = Wait.waitByClassAndText("status", statusMsg, 60);
+ Assert.assertTrue(statusMsg + " message didn't appear on time", waitForTextResult);
+
+ return this;
+ }
+
+ public VidBasePage refreshPage() {
+ GeneralUIUtils.getDriver().navigate().refresh();
+ return this;
+ }
+
+}
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
new file mode 100644
index 000000000..5f532d22a
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/sections/ViewEditPage.java
@@ -0,0 +1,84 @@
+package vid.automation.test.sections;
+
+import org.junit.Assert;
+import org.openecomp.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.Get;
+import vid.automation.test.infra.SelectOption;
+import vid.automation.test.infra.Wait;
+
+/**
+ * Created by itzikliderman on 13/06/2017.
+ */
+public class ViewEditPage extends VidBasePage {
+ public ViewEditPage selectNodeInstanceToAdd(String vnfName) {
+ selectFromDropdownByTestId(Constants.ViewEdit.VNF_OPTION_TEST_ID_PREFIX + vnfName,
+ Constants.ViewEdit.ADD_VNF_BUTTON_TEST_ID);
+ return this;
+ }
+
+ public ViewEditPage selectVolumeGroupToAdd(String volumeGroupName) {
+ selectFromDropdownByTestId(Constants.ViewEdit.VOLUME_GROUP_OPTION_TEST_ID_PREFIX + volumeGroupName,
+ Constants.ViewEdit.ADD_VOLUME_GROUP_BUTTON_TEST_ID);
+ return this;
+ }
+
+ public ViewEditPage selectFromDropdownByText(String itemText, String dropdownButtonTestId) {
+ GeneralUIUtils.clickOnElementByTestId(dropdownButtonTestId, 30);
+ GeneralUIUtils.clickOnElementByText(itemText, 30);
+ return this;
+ }
+
+ public ViewEditPage selectFromDropdownByTestId(String itemTestId, String dropdownButtonTestId) {
+ GeneralUIUtils.clickOnElementByTestId(dropdownButtonTestId, 60);
+ Assert.assertTrue(String.format(Constants.ViewEdit.OPTION_IN_DROPDOWN_NOT_EXISTS,dropdownButtonTestId,"Add network instance"),GeneralUIUtils.getWebElementByTestID(itemTestId) != null );
+ GeneralUIUtils.clickOnElementByTestId(itemTestId, 60);
+ return this;
+ }
+
+ public ViewEditPage selectProductFamily(String productFamily){
+ SelectOption.byValue(productFamily, Constants.ViewEdit.PRODUCT_FAMILY_SELECT_TESTS_ID);
+ return this;
+ }
+
+ public ViewEditPage selectLCPRegion(String lcpRegion){
+ SelectOption.byValue(lcpRegion, Constants.ViewEdit.LCP_REGION_SELECT_TESTS_ID);
+ return this;
+ }
+
+ public ViewEditPage setLegacyRegion(String legacyRegionName){
+ setInputText(Constants.ViewEdit.LEGACY_REGION_INPUT_TESTS_ID, legacyRegionName);
+ return this;
+ }
+
+ public ViewEditPage selectTenant(String tenant){
+ SelectOption.byValue(tenant, Constants.ViewEdit.TENANT_SELECT_TESTS_ID);
+ return this;
+ }
+
+ public VidBasePage clickActivateButton() {
+ GeneralUIUtils.clickOnElementByTestId(Constants.ViewEdit.ACTIVATE_BUTTON_TEST_ID, 60);
+ return this;
+ }
+
+ public WebElement getPnf(String pnfName) {
+ WebElement pnfElement = Get.byClassAndText("tree-node", "PNF: " + pnfName);
+ Assert.assertNotNull("Pnf "+ pnfName +" not found under service instance", pnfElement);
+ return pnfElement;
+ }
+
+ public ViewEditPage clickDissociatePnfButton(String pnfName) {
+ WebElement pnfToDissociate = getPnf(pnfName);
+ WebElement dissociateBtn = pnfToDissociate.findElement(By.className(Constants.ViewEdit.DISSOCIATE_BTN_CLASS));
+ Assert.assertNotNull("Dissociate button not found for pnf " + pnfName, dissociateBtn);
+ dissociateBtn.click();
+ return this;
+ }
+
+ public VidBasePage clickDeactivateButton() {
+ GeneralUIUtils.clickOnElementByTestId(Constants.ViewEdit.DEACTIVATE_BUTTON_TEST_ID, 30);
+ return this;
+ }
+}
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
new file mode 100644
index 000000000..4cdd85d24
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/services/BulkRegistration.java
@@ -0,0 +1,94 @@
+package vid.automation.test.services;
+
+import com.google.common.collect.ImmutableMap;
+import vid.automation.test.Constants;
+
+public class BulkRegistration {
+
+ public static void searchExistingServiceInstance() {
+ searchExistingServiceInstance("Active");
+ }
+ public static void searchExistingServiceInstance(String orchStatus) {
+ 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,
+ Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER,
+ Constants.RegisterToSimulator.SearchForServiceInstance.FILTER_SERVICE_INSTANCE_BY_ID,
+ Constants.RegisterToSimulator.SearchForServiceInstance.NAMED_QUERY_VIEW_EDIT
+
+ }, ImmutableMap.<String, Object>of("<ORCH_STATUS>", orchStatus));
+ }
+
+ public static void searchExistingServiceInstance2(String orchStatus) {
+ SimulatorApi.registerExpectation(
+ new String [] {
+ Constants.RegisterToSimulator.SearchForServiceInstance.GET_FULL_SUBSCRIBERS,
+ Constants.RegisterToSimulator.SearchForServiceInstance.GET_SERVICES,
+ Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_2,
+ Constants.RegisterToSimulator.SearchForServiceInstance.FILTER_SERVICE_INSTANCE_BY_ID_2,
+ Constants.RegisterToSimulator.SearchForServiceInstance.NAMED_QUERY_VIEW_EDIT_2
+ }, ImmutableMap.<String, Object>of("<ORCH_STATUS>", orchStatus));
+ }
+
+ public static void associatePnf() {
+ SimulatorApi.registerExpectation(
+ new String [] {
+ Constants.RegisterToSimulator.pProbe.GET_SERVICE_INSTANCE_WITH_LOGICAL_LINKS,
+ Constants.RegisterToSimulator.pProbe.GET_SPECIFIC_PNF,
+ Constants.RegisterToSimulator.pProbe.ADD_PNF_RELATIONSHIP,
+ Constants.RegisterToSimulator.pProbe.GET_ADD_PNF_RELATIONSHIP_ORCH_REQ
+ }, ImmutableMap.<String, Object>of());
+ }
+
+ public static void searchPnfError() {
+ SimulatorApi.registerExpectation(
+ new String [] {
+ Constants.RegisterToSimulator.pProbe.GET_SERVICE_INSTANCE_WITH_LOGICAL_LINKS,
+ Constants.RegisterToSimulator.pProbe.GET_SPECIFIC_PNF_ERROR
+ }, ImmutableMap.<String, Object>of());
+ }
+ public static void associatePnfError() {
+ SimulatorApi.registerExpectation(
+ new String [] {
+ Constants.RegisterToSimulator.pProbe.GET_SERVICE_INSTANCE_WITH_LOGICAL_LINKS,
+ Constants.RegisterToSimulator.pProbe.GET_SPECIFIC_PNF,
+ Constants.RegisterToSimulator.pProbe.ADD_PNF_RELATIONSHIP_ERROR
+ }, ImmutableMap.<String, Object>of());
+ }
+
+ public static void dissociatePnf() {
+ SimulatorApi.registerExpectation(
+ new String [] {
+ Constants.RegisterToSimulator.pProbe.REMOVE_PNF_RELATIONSHIP,
+ Constants.RegisterToSimulator.pProbe.GET_REMOVE_PNF_RELATIONSHIP_ORCH_REQ
+ }, ImmutableMap.<String, Object>of());
+ }
+
+ public static void getAssociatedPnfs() {
+ SimulatorApi.registerExpectation(
+ new String [] {
+ Constants.RegisterToSimulator.pProbe.GET_SERVICE_INSTANCE_WITH_LOGICAL_LINKS,
+ Constants.RegisterToSimulator.pProbe.GET_LOGICAL_LINK
+ }, ImmutableMap.<String, Object>of());
+ }
+
+ public static void activateServiceInstance(String action) {
+ SimulatorApi.registerExpectation(
+ new String [] {
+ Constants.RegisterToSimulator.pProbe.GET_SERVICE_INSTANCE_WITH_LOGICAL_LINKS,
+ Constants.RegisterToSimulator.activateDeactivate.ACTIVATE_SERVICE_INSTANCE,
+ Constants.RegisterToSimulator.activateDeactivate.ACTIVATE_SERVICE_INSTANCE_ORCH_REQUEST
+ }, ImmutableMap.<String, Object>of("<ACTIVE_ACTION>", action));
+ }
+
+ public static void activateServiceInstanceError(String action) {
+ SimulatorApi.registerExpectation(
+ new String []{
+ Constants.RegisterToSimulator.pProbe.GET_SERVICE_INSTANCE_WITH_LOGICAL_LINKS,
+ Constants.RegisterToSimulator.activateDeactivate.ACTIVATE_SERVICE_INSTANCE_ERROR
+ } , ImmutableMap.<String, Object>of("<ACTIVE_ACTION>", action));
+ }
+
+}
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
new file mode 100644
index 000000000..39f235b9e
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/services/ServicesService.java
@@ -0,0 +1,47 @@
+package vid.automation.test.services;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import vid.automation.test.model.Service;
+import vid.automation.test.model.ServicesObject;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+
+/**
+ * Created by itzikliderman on 08/09/2017.
+ */
+public class ServicesService {
+ private HashMap<String, Service> services;
+
+ public ServicesService() throws IOException {
+ services = getServicesFromJson();
+
+ }
+
+ HashMap<String, Service> getServicesFromJson() throws IOException {
+ String fileName = "services";
+ ObjectMapper mapper = new ObjectMapper();
+ ServicesObject servicesObject;
+ try {
+ File servicesFile = FileHandling.getConfigFile(fileName);
+ if(!servicesFile.exists()) {
+ String basePath = System.getProperty("BASE_PATH");
+ servicesFile = new File( basePath + File.separator + "conf" + File.separator + fileName);
+ }
+ servicesObject = mapper.readValue(servicesFile, ServicesObject.class);
+ return servicesObject.services;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public Service getService(String serviceId) {
+ return services.get(serviceId);
+ }
+}
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
new file mode 100644
index 000000000..95370fc82
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java
@@ -0,0 +1,98 @@
+package vid.automation.test.services;
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.commons.io.IOUtils;
+import org.apache.log4j.Logger;
+import org.glassfish.jersey.client.ClientProperties;
+import org.glassfish.jersey.uri.internal.JerseyUriBuilder;
+import org.springframework.http.HttpStatus;
+
+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.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.util.Map;
+
+import static org.testng.Assert.assertEquals;
+
+public class SimulatorApi {
+
+ private static Logger logger = Logger.getLogger(SimulatorApi.class.getName());
+
+ public enum RegistrationStrategy {
+ APPEND, CLEAR_THEN_SET
+ }
+
+ private static final URI uri;
+ private static final Client client;
+
+ static {
+ String host = System.getProperty("VID_HOST", "127.0.0.1" );
+ Integer port = Integer.valueOf(System.getProperty("VID_PORT", "8080"));
+ uri = new JerseyUriBuilder().host(host).port(port).scheme("http").path("vidSimulator").build();
+ client = ClientBuilder.newClient();
+ client.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true);
+ }
+
+ public static void registerExpectation(String expectationFilename) {
+ registerExpectation(expectationFilename, ImmutableMap.<String, Object>of(), RegistrationStrategy.APPEND);
+ }
+
+ public static void registerExpectation(String expectationFilename, RegistrationStrategy registrationStrategy) {
+ registerExpectation(expectationFilename, ImmutableMap.<String, Object>of(), registrationStrategy);
+ }
+
+ public static void registerExpectation(String expectationTemplateFilename, ImmutableMap<String, Object> templateParams) {
+ registerExpectation(expectationTemplateFilename, templateParams, RegistrationStrategy.APPEND);
+ }
+
+ public static void registerExpectation(String... expectationTemplateFilenames) {
+ registerExpectation(expectationTemplateFilenames, ImmutableMap.of());
+ }
+
+ public static void registerExpectation(String[] expectationTemplateFilenames, ImmutableMap<String, Object> templateParams) {
+ for (String expectationTemplateFilename: expectationTemplateFilenames) {
+ registerExpectation(expectationTemplateFilename, templateParams);
+ }
+ }
+
+ public static void registerExpectation(String expectationTemplateFilename, ImmutableMap<String, Object> templateParams, RegistrationStrategy registrationStrategy) {
+
+ try {
+ final InputStream resource = SimulatorApi.class.getClassLoader().getResourceAsStream("registration_to_simulator/" + expectationTemplateFilename);
+ if (resource == null) throw new RuntimeException("template file not found: " + "/registration_to_simulator/" + expectationTemplateFilename);
+ String content = IOUtils.toString(resource, "UTF-8");
+
+ for (Map.Entry<String, Object> templateParam : templateParams.entrySet()) {
+ content = content.replaceAll(templateParam.getKey(), templateParam.getValue().toString());
+ }
+
+ registerToSimulatorAndAssertSuccess(content, registrationStrategy);
+
+ } catch (IOException e) {
+ logger.error("couldn't read " + expectationTemplateFilename, e);
+// throw new RuntimeException("couldn't read " + expectationTemplateFilename, e);
+ }
+ }
+
+ private static void registerToSimulatorAndAssertSuccess(String content, RegistrationStrategy registrationStrategy) {
+ WebTarget webTarget = client.target(uri).path("registerToVidSimulator");
+ Response response;
+ if (registrationStrategy == RegistrationStrategy.CLEAR_THEN_SET) {
+ response = webTarget.request().delete();
+ assertEquals(response.getStatus(), HttpStatus.OK.value());
+ }
+ response = webTarget.request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(content));
+ assertEquals(response.getStatus(), HttpStatus.OK.value());
+ }
+
+ public static void clearAll() {
+ WebTarget webTarget = client.target(uri).path("registerToVidSimulator");
+ webTarget.request().delete();
+ }
+}
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
new file mode 100644
index 000000000..e8df17764
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/services/UsersService.java
@@ -0,0 +1,31 @@
+package vid.automation.test.services;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import vid.automation.test.model.User;
+import vid.automation.test.model.UsersObject;
+import vid.automation.test.utils.ReadFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+
+/**
+ * Created by itzikliderman on 08/09/2017.
+ */
+public class UsersService {
+ private HashMap<String, User> users;
+
+ public UsersService() throws IOException {
+ users = getUsersFromJson();
+ }
+
+ HashMap<String, User> getUsersFromJson() throws IOException {
+ UsersObject usersObject = ReadFile.getJsonFile("users", UsersObject.class);
+ return usersObject.users;
+ }
+
+ public User getUser(String userId) {
+ return users.get(userId);
+ }
+}
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
new file mode 100644
index 000000000..894be37b0
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/test/AssociatePnfTest.java
@@ -0,0 +1,201 @@
+package vid.automation.test.test;
+
+import org.junit.Assert;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+import org.testng.annotations.Test;
+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.Wait;
+import vid.automation.test.model.User;
+import vid.automation.test.sections.PnfSearchAssociationPage;
+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 vid.automation.test.services.UsersService;
+
+import java.io.IOException;
+
+public class AssociatePnfTest extends VidBaseTestCase {
+
+ private UsersService usersService = new UsersService();
+ private VidBasePage vidBasePage = new VidBasePage();
+ private ViewEditPage viewEditPage = new ViewEditPage();
+ private PnfSearchAssociationPage pnfSearchAssociationPage = new PnfSearchAssociationPage();
+ private String serviceInstanceId = "3f93c7cb-2fd0-4557-9514-e189b7b04f9d";
+ private String pnfInstanceName = "MX_960-F722";
+ private String pnfModelName = "pnf 0";
+
+ public AssociatePnfTest() throws IOException { }
+ //work with Simulator & asdc client
+ @Test
+ public void testAssociatePnf() throws Exception {
+ SimulatorApi.clearAll();
+ BulkRegistration.searchExistingServiceInstance();
+ BulkRegistration.associatePnf();
+ User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
+ relogin(user.credentials);
+ goToExistingInstanceById(serviceInstanceId);//vid-test-444
+ addPNF(pnfModelName);//vid-test-444
+ searchPNF(pnfInstanceName);
+ testResultSearchPNF();
+ associatePNF();
+ vidBasePage.assertMsoRequestModal("COMPLETE - Success");
+ vidBasePage.clickCloseButton();
+ }
+
+ @Test
+ public void testRainyAssociatePnf() throws Exception {
+ SimulatorApi.clearAll();
+ BulkRegistration.searchExistingServiceInstance();
+ BulkRegistration.associatePnfError();
+ User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
+ relogin(user.credentials);
+ goToExistingInstanceById(serviceInstanceId);
+ addPNF(pnfModelName);
+ searchPNF(pnfInstanceName);
+ associatePNF();
+ vidBasePage.assertMsoRequestModal("Error");
+ vidBasePage.clickCloseButton();
+ }
+ @Test
+ public void testRainyChoosePnf() throws Exception {
+ SimulatorApi.clearAll();
+ BulkRegistration.searchExistingServiceInstance();
+ BulkRegistration.associatePnfError();
+ User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
+ relogin(user.credentials);
+ goToExistingInstanceById(serviceInstanceId);
+ String pnfName= "pnf 1";
+ GeneralUIUtils.clickOnElementByTestId(Constants.ViewEdit.ADD_VNF_BUTTON_TEST_ID, 60);
+ String message = String.format(Constants.ViewEdit.OPTION_IN_DROPDOWN_NOT_EXISTS,
+ Constants.ViewEdit.ADD_VNF_BUTTON_TEST_ID,"Add network instance");
+ boolean waitForElementResult = Wait.waitByTestId(Constants.ViewEdit.VNF_OPTION_TEST_ID_PREFIX + pnfName, 60);
+ Assert.assertTrue(message, !waitForElementResult);
+ }
+ @Test
+ public void testRainySearchPnfInstance() throws Exception {
+ SimulatorApi.clearAll();
+ BulkRegistration.searchExistingServiceInstance();
+ BulkRegistration.associatePnfError();
+ User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
+ relogin(user.credentials);
+ goToExistingInstanceById(serviceInstanceId);
+ addPNF(pnfModelName);
+ searchPNF("AAAAA");
+ Wait.angularHttpRequestsLoaded();
+ WebElement errorMessageWebElement = GeneralUIUtils.getWebElementByTestID(Constants.PnfAssociation.NOT_FOUND_ERROR_TEST_ID, 60);
+ Assert.assertEquals("not found PNF instance, error message not equals the expected message","The specified PNF instance AAAAA does not exist in A&AI.\n" +
+ "Please note: A&AI is case sensitive",errorMessageWebElement.getText());
+ Assert.assertTrue(Constants.PnfAssociation.NOT_FOUND_ERROR_MESSAGE, errorMessageWebElement!=null);
+ assertAssociateButtonState(false);
+ }
+
+ private void assertAssociateButtonState(boolean shouldBeEnabled) {
+ WebElement associateWebElement = GeneralUIUtils.getWebElementByTestID(Constants.PnfAssociation.ASSOCIATE_PNF_TEST_ID, 60);
+ boolean enabledAssociate=associateWebElement.isEnabled();
+
+ if(shouldBeEnabled) {
+ Assert.assertTrue(Constants.PnfAssociation.PNF_ENABLE_ASSOCIATE_ERROR_MESSAGE, enabledAssociate);
+ }else{
+ Assert.assertTrue(Constants.PnfAssociation.PNF_DISABLE_ASSOCIATE_ERROR_MESSAGE, !enabledAssociate);
+ }
+ GeneralUIUtils.ultimateWait();
+ }
+ private void associatePNF() throws InterruptedException {
+ pnfSearchAssociationPage.clickAssociateButton();
+ }
+
+ private void addPNF(String name){
+ viewEditPage.selectNodeInstanceToAdd(name);
+ checkServiceModelInfo();
+ assertAssociateButtonState(false);
+ }
+
+ private void searchPNF(String name){
+ pnfSearchAssociationPage.setPnfName(name);
+ pnfSearchAssociationPage.clickSearchButton();
+ }
+
+ private void testResultSearchPNF(){
+ checkPnfProperties();
+ Wait.angularHttpRequestsLoaded();
+ assertAssociateButtonState(true);
+ }
+ private void checkServiceModelInfo() {
+ Wait.angularHttpRequestsLoaded();
+ //Service name
+ String elementTestId = Constants.serviceModelInfo.INFO_TEST_ID_PREFIX + Constants.serviceModelInfo.SERVIICE_NAME_KEY;
+ String infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
+ Assert.assertEquals(String.format(Constants.serviceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"Demo Service 1");
+ //model name
+ elementTestId = Constants.serviceModelInfo.INFO_TEST_ID_PREFIX + Constants.serviceModelInfo.MODEL_NAME;
+ infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
+ Assert.assertEquals(String.format(Constants.serviceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"Test Pnf");
+ //service instance name
+ elementTestId = Constants.serviceModelInfo.INFO_TEST_ID_PREFIX + Constants.serviceModelInfo.SERVICE_INSTANCE_NAME;
+ infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
+ Assert.assertEquals(String.format(Constants.serviceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"vid-test-444");
+ //Model Invariant UUID
+ elementTestId = Constants.serviceModelInfo.INFO_TEST_ID_PREFIX + Constants.serviceModelInfo.MODEL_INVARIANT_UUID;
+ infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
+ Assert.assertEquals(String.format(Constants.serviceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"61eba322-c758-48f6-8942-1a7625aaaffb");
+ //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");
+ //Model Version
+ elementTestId = Constants.serviceModelInfo.INFO_TEST_ID_PREFIX + Constants.serviceModelInfo.MODEL_VERSION;
+ infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
+ Assert.assertEquals(String.format(Constants.serviceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"0.1");
+ //Model UUID
+ elementTestId = Constants.serviceModelInfo.INFO_TEST_ID_PREFIX + Constants.serviceModelInfo.MODEL_UUID;
+ infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
+ Assert.assertEquals(String.format(Constants.serviceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"089b1c03-ff6b-4914-8c20-a7de3d375e8d");
+ //Model Customization UUID
+ elementTestId = Constants.serviceModelInfo.INFO_TEST_ID_PREFIX + Constants.serviceModelInfo.MODEL_CUSTOMIZATION_UUID;
+ infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
+ Assert.assertEquals(String.format(Constants.serviceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"cabf6d26-c362-4444-ba06-f850e8af2d35");
+ //Resource Name
+ elementTestId = Constants.serviceModelInfo.INFO_TEST_ID_PREFIX + Constants.serviceModelInfo.RESOURCE_NAME;
+ infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
+ Assert.assertEquals(String.format(Constants.serviceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,pnfModelName);
+ }
+
+ private void checkPnfProperties() {
+ //Pnf Instance unique name
+ String elementTestId = Constants.PnfAssociation.PNF_INSTANCE_NAME_TEST_ID;
+ String infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
+ Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,pnfInstanceName);
+ //Pnf Instance name2
+ elementTestId = Constants.PnfAssociation.PNF_INSTANCE_NAME2_TEST_ID;
+ infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
+ Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,"MX_960-F722-name-2");
+ //Pnf Instance name2 source
+ elementTestId = Constants.PnfAssociation.PNF_INSTANCE_NAME2_SOURCE_TEST_ID;
+ infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
+ Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,"MX_960-F722-name-2-source");
+ //Pnf Instance Id
+ elementTestId = Constants.PnfAssociation.PNF_INSTANCE_ID_TEST_ID;
+ infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
+ Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,"MX_960-F722-id");
+ //Pnf Instance Equipment type
+ elementTestId = Constants.PnfAssociation.PNF_INSTANCE_EQUIP_TYPE_TEST_ID;
+ infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
+ Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,"Switch");
+ //Pnf Instance Equipment vendor
+ elementTestId = Constants.PnfAssociation.PNF_INSTANCE_EQUIP_VENDOR_TEST_ID;
+ infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
+ Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,"Cisco");
+ //Pnf Instance Equipment model
+ elementTestId = Constants.PnfAssociation.PNF_INSTANCE_EQUIP_MODEL_TEST_ID;
+ infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
+ Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,"ASR1002-X");
+ }
+
+
+
+}
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
new file mode 100644
index 000000000..eb1c62faa
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java
@@ -0,0 +1,221 @@
+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.infra.Click;
+import vid.automation.test.model.*;
+import vid.automation.test.sections.BrowseASDCPage;
+import vid.automation.test.sections.SideMenu;
+import vid.automation.test.sections.ViewEditPage;
+import vid.automation.test.services.ServicesService;
+import vid.automation.test.services.UsersService;
+
+import java.io.IOException;
+
+public class BrowseASDCTest extends CreateInstanceDialogBaseTest {
+ private UsersService usersService = new UsersService();
+ private ServicesService servicesService = new ServicesService();
+
+ public BrowseASDCTest() throws IOException {
+ }
+
+ @Test
+ public void testPNFOnCreatePopup() throws Exception {
+ Service service = servicesService.getService("f39389e4-2a9c-4085-8ac3-04aea9c651be");
+ BrowseASDCPage browseASDCPage = new BrowseASDCPage();
+ SideMenu.navigateToBrowseASDCPage();
+ browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid);
+ assertThatServiceCreationDialogIsVisible();
+ validatePNFCreationDialog(service, "Mobility", "pnf");
+ }
+
+ private void validatePNFCreationDialog(Service service, String serviceType, String serviceRole) {
+ assertServiceMetadata(serviceType, Constants.SERVICE_TYPE);
+ assertServiceMetadata(serviceRole, Constants.SERVICE_ROLE);
+ validateServiceCreationDialog(service);
+ }
+
+ @Test
+ private void testPNFMacroInstantation() throws Exception {
+ User user = usersService.getUser(Constants.Users.MOBILITY_MOBILITY);
+ relogin(user.credentials);
+
+ BrowseASDCPage browseASDCPage = new BrowseASDCPage();
+ SideMenu.navigateToBrowseASDCPage();
+ browseASDCPage.clickDeployServiceButtonByServiceUUID("f39389e4-2a9c-4085-8ac3-04aea9c651be");
+ assertThatServiceCreationDialogIsVisible();
+ assertDropdownPermittedItemsByValue(user.subscribers, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
+ browseASDCPage.selectSubscriberById("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ browseASDCPage.selectProductFamily("ebc3bc3d-62fd-4a3f-a037-f619df4ff034");
+ GeneralUIUtils.ultimateWait();
+
+ browseASDCPage.selectServiceTypeByName("Mobility");
+ GeneralUIUtils.ultimateWait();
+ browseASDCPage.selectLcpRegion("mtn16");
+
+ browseASDCPage.selectTenant("a259ae7b7c3f493cb3d91f95a7c18149");
+ assertAllIsPermitted(Constants.BrowseASDC.AIC_OPTION_CLASS);
+ browseASDCPage.selectAicZone("NFT1");
+
+ Click.onFirstSelectOptionById(Constants.OwningEntity.PROJECT_SELECT_TEST_ID);
+ Click.onFirstSelectOptionById(Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
+
+ browseASDCPage.clickConfirmButton();
+
+ assertSuccessfulServiceInstanceCreation();
+
+ browseASDCPage.clickCloseButton();
+
+ ViewEditPage viewEditPage = new ViewEditPage();
+ viewEditPage.clickActivateButton();
+ }
+
+ @Test
+ private void testServiceInstantation() throws Exception {
+ User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
+ relogin(user.credentials);
+
+ BrowseASDCPage browseASDCPage = new BrowseASDCPage();
+ SideMenu.navigateToBrowseASDCPage();
+
+ Service service = servicesService.getService("c079d859-4d81-4add-a9c3-94551f96e2b0");
+
+ browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid);
+ validateServiceCreationDialog(service);
+
+ browseASDCPage.setInstanceName(browseASDCPage.generateInstanceName());
+
+ assertDropdownPermittedItemsByValue(user.subscribers, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
+ browseASDCPage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89");
+
+ String serviceType = "VIRTUAL USP";
+ GeneralUIUtils.findAndWaitByText(serviceType, 30);
+
+ assertDropdownPermittedItemsByValue(user.serviceTypes, Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS);
+ browseASDCPage.selectServiceTypeByName(serviceType);
+
+ Click.onFirstSelectOptionById(Constants.OwningEntity.PROJECT_SELECT_TEST_ID);
+ Click.onFirstSelectOptionById(Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
+
+ browseASDCPage.selectSuppressRollback("false");
+
+ browseASDCPage.clickConfirmButton();
+
+ assertSuccessfulServiceInstanceCreation();
+
+ browseASDCPage.clickCloseButton();
+ GeneralUIUtils.ultimateWait();
+
+ addVNF("VID-PCRF-05-15-17 0", "AAIAIC25", "092eb9e8e4b7412e8787dd091bc58e86",
+ "false", "some legacy region", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", user.tenants);
+ addVolumeGroup("VidPcrf051517..pcrf_nimbus_pcm..module-4", "AAIAIC25",
+ "092eb9e8e4b7412e8787dd091bc58e86", "false", "some legacy region", user.tenants);
+ addVFModule("VidPcrf051517..pcrf_nimbus_psm..module-1", "AAIAIC25",
+ "092eb9e8e4b7412e8787dd091bc58e86", "false", "some legacy region", user.tenants);
+ }
+
+ @Test
+ private void testCategoryParamsDropdownsExistsInCreationDialog() throws Exception {
+ User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
+ relogin(user.credentials);
+
+ BrowseASDCPage browseASDCPage = new BrowseASDCPage();
+ SideMenu.navigateToBrowseASDCPage();
+
+ Service service = servicesService.getService("c079d859-4d81-4add-a9c3-94551f96e2b0");
+
+ browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid);
+ assertThatServiceCreationDialogIsVisible();
+
+ GeneralUIUtils.clickOnElementByTestId(Constants.OwningEntity.PROJECT_SELECT_TEST_ID);
+ GeneralUIUtils.clickOnElementByTestId(Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
+ }
+
+ @Test
+ private void testOwningEntityRequiredAndProjectOptional() throws Exception {
+ User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
+ relogin(user.credentials);
+
+ BrowseASDCPage browseASDCPage = new BrowseASDCPage();
+ SideMenu.navigateToBrowseASDCPage();
+
+ Service service = servicesService.getService("c079d859-4d81-4add-a9c3-94551f96e2b0");
+
+ browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid);
+ validateServiceCreationDialog(service);
+
+ browseASDCPage.setInstanceName(browseASDCPage.generateInstanceName());
+
+ assertDropdownPermittedItemsByValue(user.subscribers, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
+ browseASDCPage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89");
+
+ String serviceType = "VIRTUAL USP";
+ GeneralUIUtils.findAndWaitByText(serviceType, 30);
+
+ assertDropdownPermittedItemsByValue(user.serviceTypes, Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS);
+ browseASDCPage.selectServiceTypeByName(serviceType);
+
+ browseASDCPage.clickConfirmButton();
+
+ GeneralUIUtils.findAndWaitByText("Missing data", 5);
+
+ Click.onFirstSelectOptionById(Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
+
+ browseASDCPage.clickConfirmButton();
+ assertSuccessfulServiceInstanceCreation();
+ }
+
+ @Test
+ protected void testLineOfBusinessOptionalAndPlatformRequired() throws Exception {
+
+ User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
+ relogin(user.credentials);
+
+ BrowseASDCPage browseASDCPage = new BrowseASDCPage();
+ SideMenu.navigateToBrowseASDCPage();
+
+ Service service = servicesService.getService("c079d859-4d81-4add-a9c3-94551f96e2b0");
+
+ browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid);
+ validateServiceCreationDialog(service);
+
+ browseASDCPage.setInstanceName(browseASDCPage.generateInstanceName());
+
+ assertDropdownPermittedItemsByValue(user.subscribers, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
+ browseASDCPage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89");
+
+ String serviceType = "VIRTUAL USP";
+ GeneralUIUtils.findAndWaitByText(serviceType, 30);
+
+ assertDropdownPermittedItemsByValue(user.serviceTypes, Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS);
+ browseASDCPage.selectServiceTypeByName(serviceType);
+
+ Click.onFirstSelectOptionById(Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
+
+ browseASDCPage.clickConfirmButton();
+ assertSuccessfulServiceInstanceCreation();
+
+ browseASDCPage.clickCloseButton();
+ GeneralUIUtils.ultimateWait();
+
+ //now add the VNF
+ ViewEditPage viewEditPage = new ViewEditPage();
+
+ viewEditPage.selectNodeInstanceToAdd("VID-PCRF-05-15-17 0");
+ viewEditPage.generateAndSetInstanceName(Constants.ViewEdit.VNF_INSTANCE_NAME_PREFIX);
+ viewEditPage.selectProductFamily("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ viewEditPage.selectLCPRegion("AAIAIC25");
+ viewEditPage.selectTenant("092eb9e8e4b7412e8787dd091bc58e86");
+ viewEditPage.setLegacyRegion("llkjhlkjhlkjh");
+
+ browseASDCPage.clickConfirmButton();
+
+ GeneralUIUtils.findAndWaitByText("Missing data", 5);
+
+ Click.onFirstSelectOptionById(Constants.OwningEntity.PLATFORM_SELECT_TEST_ID);
+
+ viewEditPage.clickConfirmButton();
+ assertSuccessfulVNFCreation();
+ }
+}
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
new file mode 100644
index 000000000..732d2998c
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java
@@ -0,0 +1,596 @@
+package vid.automation.test.test;
+
+
+//import com.sun.tools.internal.jxc.ap.Const;
+
+import com.google.common.primitives.Ints;
+import org.json.JSONException;
+import org.junit.Assert;
+import org.openecomp.sdc.ci.tests.datatypes.UserCredentials;
+import org.openqa.selenium.support.ui.Select;
+import org.skyscreamer.jsonassert.JSONAssert;
+import org.skyscreamer.jsonassert.JSONCompareMode;
+import org.testng.annotations.*;
+import vid.automation.test.Constants;
+import vid.automation.test.infra.*;
+import vid.automation.test.sections.ChangeManagementPage;
+import vid.automation.test.services.SimulatorApi;
+
+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 {
+
+ @Test
+ public void testLeftPanelChangeManagementButton() {
+ Assert.assertTrue(Wait.byText(Constants.SideMenu.VNF_CHANGES));
+ }
+
+ @Test
+ public void testChangeManagementHeaderLine() {
+ ChangeManagementPage.openChangeManagementPage();
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.pageHeadlineId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.headlineNewButtonId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.headlineSearchInputId));
+ }
+
+ @Test
+ public void testOpenNewChangeManagementModal() {
+ ChangeManagementPage.openNewChangeManagementModal();
+ Assert.assertTrue(Exists.modal());
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalSubscriberInputId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalServiceTypeInputId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalVNFNameInputId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalVNFTypeInputId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalFromVNFVersionInputId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalWorkFlowInputId));
+ Assert.assertTrue(Exists.byId(Constants.generalSubmitButtonId));
+ Assert.assertTrue(Exists.byId(Constants.generalCancelButtonId));
+ Click.byId(Constants.generalCancelButtonId);
+ Wait.modalToDisappear();
+ }
+
+ private void openAndFill1stScreen(String vnfName, String vnfTargetVersion, String workflow) {
+ String subscriberId = VNF_DATA_WITH_IN_PLACE.subscriberId;
+ String serviceType = VNF_DATA_WITH_IN_PLACE.serviceType;
+ String vnfType = VNF_DATA_WITH_IN_PLACE.vnfType;
+ String vnfSourceVersion = VNF_DATA_WITH_IN_PLACE.vnfSourceVersion;
+
+ ChangeManagementPage.openNewChangeManagementModal();
+ Wait.angularHttpRequestsLoaded();
+ ChangeManagementPage.selectSubscriberById(subscriberId);
+ Wait.angularHttpRequestsLoaded();
+ SelectOption.byIdAndVisibleText(Constants.ChangeManagement.newModalServiceTypeInputId, serviceType);
+ Wait.angularHttpRequestsLoaded();
+ SelectOption.byIdAndVisibleText(Constants.ChangeManagement.newModalVNFTypeInputId, vnfType);
+ Wait.angularHttpRequestsLoaded();
+ SelectOption.byIdAndVisibleText(Constants.ChangeManagement.newModalFromVNFVersionInputId, vnfSourceVersion);
+ Wait.angularHttpRequestsLoaded();
+ Click.byId(Constants.ChangeManagement.newModalVNFNameInputId);
+ Click.byText(vnfName);
+ Wait.angularHttpRequestsLoaded();
+ if (vnfTargetVersion != null) {
+ SelectOption.byClassAndVisibleText(Constants.ChangeManagement.newModalTargetVersionInputsClass, vnfTargetVersion);
+ Wait.angularHttpRequestsLoaded();
+ }
+ SelectOption.byIdAndVisibleText(Constants.ChangeManagement.newModalWorkFlowInputId, workflow);
+
+ }
+
+ public void scheduleChange2ndScreen(String duration, String fallback, String concurrencyLimit, String policy) {
+
+ Wait.byText(Constants.ChangeManagement.schedulerModalNowLabel);
+ Click.byText(Constants.ChangeManagement.schedulerModalNowLabel);
+
+// Click.byId(Constants.ChangeManagement.schedulerModalStartDateInputId); //next month must be in the future
+// Click.byClass(Constants.ChangeManagement.schedulerModalNextMonthButtonClass);
+// Wait.byText(startDate);
+// Click.byText(startDate);
+//
+// Click.byId(Constants.ChangeManagement.schedulerModalEndDateInputId); //next month must be in the future
+// Click.byClass(Constants.ChangeManagement.schedulerModalNextMonthButtonClass);
+// Wait.byText(endDate);
+// Click.byText(endDate);
+
+ SelectOption.byValue(Constants.ChangeManagement.schedulerModalHoursOption, Constants.ChangeManagement.schedulerModalTimeUnitSelectId);
+
+ Input.text(duration, Constants.ChangeManagement.schedulerModalDurationInputTestId);
+ Input.text(fallback, Constants.ChangeManagement.schedulerModalFallbackInputTestId);
+ Input.text(concurrencyLimit, Constants.ChangeManagement.schedulerModalConcurrencyLimitInputTestId);
+ Wait.angularHttpRequestsLoaded();
+ SelectOption.byIdAndVisibleText(Constants.ChangeManagement.schedulerModalPolicySelectId, policy);
+
+ Click.byText(Constants.ChangeManagement.schedulerModalScheduleButtonText);
+
+ }
+
+ static class DB_CONFIG {
+ static String url = String.format("jdbc:mariadb://%s:%d/vid_portal",
+ System.getProperty("DB_HOST", System.getProperty("VID_HOST", "127.0.0.1" )),
+ Integer.valueOf(System.getProperty("DB_PORT", "3306"))
+ );
+ static String username = "euser";
+ static String password = "euser";
+
+ static final int userId = 822;
+ static final int roleVFlowLogicId = 10822;
+ static final int roleMobilityId = 11822;
+ static final int vnfZrdm3amdns02test2Id = 11822;
+ static final int vnfHarrisonKrisId = 12822;
+ }
+
+ static class VNF_DATA_WITH_IN_PLACE {
+ static String subscriberId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb";
+ static String serviceType = "vFlowLogic";
+ static String vnfType = "vMobileDNS";
+ static String vnfSourceVersion = "1.0";
+ static String vnfName = "zrdm3amdns02test2";
+ static String vnfTargetVersion = "5.0";
+ static String workflowName = "VNF In Place Software Update";
+ }
+
+ @AfterClass
+ protected void dropUser822() {
+ 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 `fn_user_role` WHERE `USER_ID` = " + DB_CONFIG.userId);
+ stmt.addBatch("DELETE FROM `fn_role` WHERE `ROLE_ID` = " + DB_CONFIG.roleVFlowLogicId);
+ stmt.addBatch("DELETE FROM `fn_role` WHERE `ROLE_ID` = " + DB_CONFIG.roleMobilityId);
+ stmt.addBatch("DELETE FROM `fn_user` WHERE `USER_ID` = " + DB_CONFIG.userId);
+ int[] executeBatch = stmt.executeBatch();
+
+ stmt = connection.createStatement();
+ stmt.addBatch("DELETE FROM `vid_vnf_workflow` WHERE `VNF_DB_ID` = " + DB_CONFIG.vnfZrdm3amdns02test2Id);
+ stmt.addBatch("DELETE FROM `vid_vnf` WHERE `VNF_DB_ID` = " + DB_CONFIG.vnfZrdm3amdns02test2Id);
+ executeBatch = stmt.executeBatch();
+
+ stmt = connection.createStatement();
+ stmt.addBatch("DELETE FROM `vid_vnf_workflow` WHERE `VNF_DB_ID` = " + DB_CONFIG.vnfHarrisonKrisId);
+ stmt.addBatch("DELETE FROM `vid_vnf` WHERE `VNF_DB_ID` = " + DB_CONFIG.vnfHarrisonKrisId);
+ executeBatch = stmt.executeBatch();
+
+ } catch (SQLException e) {
+ throw new IllegalStateException("Cannot connect the database!", e);
+ }
+ }
+
+ @BeforeClass
+ protected void registerToSimulator() {
+ SimulatorApi.registerExpectation(
+ "changeManagement/ecompportal_getSessionSlotCheckInterval.json"
+ , "changeManagement/get_aai_get_subscribers.json"
+ , "changeManagement/get_aai_sub_details.json"
+ , "changeManagement/get_scheduler_details_short.json"
+ , "changeManagement/get_sdc_catalog_services_2f80c596.json"
+ , "changeManagement/get_service-design-and-creation.json"
+ , "changeManagement/get_vnf_data_by_globalid_and_service_type.json"
+ , "changeManagement/service-design-and-creation.json"
+ );
+ }
+
+ @BeforeClass
+ protected void prepareUser822() {
+
+ dropUser822();
+
+ System.out.println("Connecting database...");
+
+ try (Connection connection = DriverManager.getConnection(DB_CONFIG.url, DB_CONFIG.username, DB_CONFIG.password)) {
+
+ System.out.println("Database connected!");
+
+ ///////////////////////////////
+ // Add user with specific roles
+ Statement stmt = connection.createStatement();
+ stmt.addBatch("INSERT INTO `fn_user` (`USER_ID`, `ORG_USER_ID`, `LOGIN_ID`, `LOGIN_PWD`) VALUES (" + DB_CONFIG.userId + ", 'Porfirio Gerhardt', '"+ DB_CONFIG.userId +"', '"+ DB_CONFIG.userId +"')");
+ stmt.addBatch("INSERT INTO `fn_role` (`ROLE_ID`, `ROLE_NAME`, `ACTIVE_YN`, `PRIORITY`) VALUES (" + DB_CONFIG.roleVFlowLogicId + ", 'PACKET CORE___vFlowLogic', 'Y', 5)");
+ stmt.addBatch("INSERT INTO `fn_role` (`ROLE_ID`, `ROLE_NAME`, `ACTIVE_YN`, `PRIORITY`) VALUES (" + DB_CONFIG.roleMobilityId + ", 'PACKET CORE___Mobility', 'Y', 5)");
+ stmt.addBatch("INSERT INTO `fn_user_role` (`USER_ID`, `ROLE_ID`, `PRIORITY`, `APP_ID`) VALUES (" + DB_CONFIG.userId + ", 16, NULL, 1)");
+ stmt.addBatch("INSERT INTO `fn_user_role` (`USER_ID`, `ROLE_ID`, `PRIORITY`, `APP_ID`) VALUES (" + DB_CONFIG.userId + ", " + DB_CONFIG.roleVFlowLogicId + ", NULL, 1)");
+ stmt.addBatch("INSERT INTO `fn_user_role` (`USER_ID`, `ROLE_ID`, `PRIORITY`, `APP_ID`) VALUES (" + DB_CONFIG.userId + ", " + DB_CONFIG.roleMobilityId + ", NULL, 1)");
+ int[] executeBatch = stmt.executeBatch();
+ assertThat(Ints.asList(executeBatch), everyItem(greaterThan(0)));
+
+ ///////////////////////////////
+ // Add 2 vnfs with some workflows
+ stmt = connection.createStatement();
+ stmt.addBatch("INSERT INTO `vid_vnf` (`VNF_DB_ID`, `VNF_APP_UUID`, `VNF_APP_INVARIANT_UUID`) " +
+ "VALUES (" + DB_CONFIG.vnfZrdm3amdns02test2Id + ", '76e908e0-5201-44d2-a3e2-9e6128d05820', '72e465fe-71b1-4e7b-b5ed-9496118ff7a8')");
+ stmt.addBatch("INSERT INTO `vid_vnf_workflow` (`VNF_DB_ID`, `WORKFLOW_DB_ID`) VALUES (" + DB_CONFIG.vnfZrdm3amdns02test2Id + ", 2)");
+ stmt.addBatch("INSERT INTO `vid_vnf_workflow` (`VNF_DB_ID`, `WORKFLOW_DB_ID`) VALUES (" + DB_CONFIG.vnfZrdm3amdns02test2Id + ", 3)");
+ executeBatch = stmt.executeBatch();
+ assertThat(Ints.asList(executeBatch), everyItem(greaterThan(0)));
+
+ stmt = connection.createStatement();
+ stmt.addBatch("INSERT INTO `vid_vnf` (`VNF_DB_ID`, `VNF_APP_UUID`, `VNF_APP_INVARIANT_UUID`) " +
+ "VALUES (" + DB_CONFIG.vnfHarrisonKrisId + ", '0903e1c0-8e03-4936-b5c2-260653b96413', '00beb8f9-6d39-452f-816d-c709b9cbb87d')");
+ stmt.addBatch("INSERT INTO `vid_vnf_workflow` (`VNF_DB_ID`, `WORKFLOW_DB_ID`) VALUES (" + DB_CONFIG.vnfHarrisonKrisId + ", 1)");
+ stmt.addBatch("INSERT INTO `vid_vnf_workflow` (`VNF_DB_ID`, `WORKFLOW_DB_ID`) VALUES (" + DB_CONFIG.vnfHarrisonKrisId + ", 2)");
+ executeBatch = stmt.executeBatch();
+ assertThat(Ints.asList(executeBatch), everyItem(greaterThan(0)));
+
+ } catch (SQLException e) {
+ throw new IllegalStateException("Cannot connect the database!", e);
+ }
+
+ }
+
+ @Override
+ protected UserCredentials getUserCredentials() {
+ return new UserCredentials("" + DB_CONFIG.userId, "" + DB_CONFIG.userId, "", "", "");
+ }
+
+
+ @Test
+ public void testWorkflowVNFInPlaceSoftwareUpdateNotInWorkflowsListWhenNotExpected() {
+ List<String> workflows = getListOfWorkflowsFor("Harrison Kris");
+ assertThat(workflows, not(hasItem(VNF_DATA_WITH_IN_PLACE.workflowName)));
+ }
+
+ @Test
+ public void testWorkflowVNFInPlaceSoftwareUpdateInWorkflowsListWhenExpected() {
+ List<String> workflows = getListOfWorkflowsFor(VNF_DATA_WITH_IN_PLACE.vnfName);
+ assertThat(workflows, hasItem(VNF_DATA_WITH_IN_PLACE.workflowName));
+ }
+
+ public void openAndFill1stScreenWithWorkflowVNFInPlaceSoftwareUpdate() {
+ openAndFill1stScreen(VNF_DATA_WITH_IN_PLACE.vnfName, VNF_DATA_WITH_IN_PLACE.vnfTargetVersion, VNF_DATA_WITH_IN_PLACE.workflowName);
+ }
+
+ @AfterMethod(alwaysRun = true)
+ public void closeForm() {
+ // Tries closing left-out popups, if any
+ // If none -- catch clause will swallow the exception
+ try {
+ Click.byId(Constants.generalCancelButtonId);
+ Click.byId(Constants.generalCancelButtonId);
+ Click.byId(Constants.generalCancelButtonId);
+ } catch (Exception | Error e) {
+ // ok, stop
+ }
+ Wait.modalToDisappear();
+ }
+
+ @Test
+ public void testWorkflowVNFInPlaceSoftwareUpdateShows3Fields() {
+ openAndFill1stScreenWithWorkflowVNFInPlaceSoftwareUpdate();
+
+ List<String> idsWithoutMatchingElement =
+ Stream.of(
+ "operations-timeout",
+ "existing-software-version",
+ "new-software-version")
+ .filter(id -> Get.byId(id) == null)
+ .collect(Collectors.toList());
+ assertThat("all three special VNFInPlace fields should appear", idsWithoutMatchingElement, is(empty()));
+
+ assertThat(Get.byId(Constants.generalSubmitButtonId).isEnabled(), is(false));
+ }
+
+ @Test
+ public void testWorkflowVNFInPlaceSoftwareUpdate3ValidValues() {
+ openAndFill1stScreenWithWorkflowVNFInPlaceSoftwareUpdate();
+
+ final String[][] options = {
+ {"true", "111", "222", "333"}
+ , {"true", "14710454", "Cz-Ou0EK5eH9.gAK1", "G9bUiFX3QM8xpxF8TlZ7b5T0"}
+ , {"true", "25316893", "fMx9V5kp.5.JGtYRhNGVTPoJ", "Jv5IieY0kTNjkfZ64bHXngR6"}
+ , {"true", "8", "3t3MhTRqkyjB85o5NC9OacAw", "B.bJ6f7KYI6WzDMR0fyNM9r4"}
+ , {"true", "3176", "ZlRS7tczf0cbMxQbBfyc6AP5", "1G1"}
+ , {"true", "78058488", "n", "WkH"}
+ , {"true", "501778", "1.d74LrJbBmcR.7bfvH.UZMX", "tFTAel7PS4RKEJeJ0b6mTeVT"}
+ , {"true", "76639623", "m2.EhbBxRE.rJj3j6qDtMxGR", "Rgkm-EPM1K0KAWm43Ex1wwjj"}
+ , {"true", "91244280", "zPDHRrXW65xR6GV.gVZND8C0", "mkrqFG26m7Vmv-28etQVyp04"}
+ , {"true", "8966", "7k2sRK2qSFRVCFpEvrlbmxAL", "IlvfmWTqzpF0Jo3elpZPHXx"}
+ , {"true", "01303495", "G26yl8B0NbLIKxu23h86QbZz", "vSou1seqCrcv9KoVbhlj4Wa4"}
+ , {"true", "787", "ce7joKCHYowpM2PtCb53Zs2v", ".qw1oY9HKjfAF2Yt05JNgib9"}
+ , {"true", "40116583", "-3bDEzEn.RbNnT2hWKQqf2HL", "QzlKlKZiIpc7sQ.EzO"}
+ , {"false", "", "222", "333"}
+ , {"false", "111", "", "333"}
+ , {"false", "111", "222", ""}
+ , {"false", "111a", "222", "333"}
+ , {"false", "aaa", "222", "333"}
+ , {"false", "111-", "222", "333"}
+// , {"false", " 111", "222", "333"}
+// , {"false", "111", "222 ", "333"}
+// , {"false", "111", "222", " 333"}
+ , {"false", "111", "222", "3 33"}
+ , {"false", "111", "22,2", "333"}
+ , {"false", "111", "222~", "333"}
+ , {"false", "111", "222", "333&"}
+ , {"false", "$", "222", "333"}
+ , {"false", "111", "@", "333"}
+ , {"false", "111", "222", "^^^^^^"}
+ };
+
+ for (String[] option : options) {
+ fillVNFInPlace3Fields(option[1], option[2], option[3]);
+ assertThat("failed for set: " + Arrays.toString(option),
+ Get.byId(Constants.generalSubmitButtonId).isEnabled(), is(Boolean.parseBoolean(option[0])));
+ }
+
+ }
+
+ private void fillVNFInPlace3Fields(String operationsTimeout, String existingSwVersion, String newSwVersion) {
+ Get.byId("operations-timeout").clear();
+ Get.byId("existing-software-version").clear();
+ Get.byId("new-software-version").clear();
+
+ Get.byId("operations-timeout").sendKeys(operationsTimeout);
+ Get.byId("existing-software-version").sendKeys(existingSwVersion);
+ Get.byId("new-software-version").sendKeys(newSwVersion);
+ }
+
+ private List<String> getListOfWorkflowsFor(String vnfName) {
+
+ openAndFill1stScreen(vnfName, null /*no matter*/, "Replace");
+
+ Select selectlist = new Select(Get.byId("workflow"));
+ List<String> workflows = selectlist.getOptions().stream().map(we -> we.getText()).collect(Collectors.toList());
+
+ Click.byId(Constants.generalCancelButtonId);
+
+ return workflows;
+ }
+
+ @DataProvider
+ public static Object[][] dataForUpdateWorkflowPartialWithInPlace() {
+ return new Object[][] {
+ { "1111", "22222", "33333" }
+ , {"8", "3t3MhTRqkyjB85o5NC9OacAw", "B.bJ6f7KYI6Wz-----DMR0.fyNM9r4"}
+ , {"78058488", "n", "WkH"}
+ };
+ }
+
+ @Test(dataProvider = "dataForUpdateWorkflowPartialWithInPlace")
+ public void testVidToMsoCallbackDataWithInPlaceSWUpdate(String operationsTimeout, String existingSwVersion, String newSwVersion) {
+
+ openAndFill1stScreenWithWorkflowVNFInPlaceSoftwareUpdate();
+ fillVNFInPlace3Fields(operationsTimeout, existingSwVersion, newSwVersion);
+
+ String payload = "\"payload\":\"{\\\"existing-software-version\\\":\\\""+ existingSwVersion +"\\\",\\\"new-software-version\\\":\\\""+ newSwVersion +"\\\",\\\"operation-timeout\\\":\\\""+ operationsTimeout +"\\\"}\",";
+
+ assertThatVidToMsoCallbackDataIsOk(VNF_DATA_WITH_IN_PLACE.workflowName, payload);
+ }
+
+ @Test
+ public void testVidToMsoCallbackData() {
+ String workflow = "Replace";
+
+ openAndFill1stScreen(VNF_DATA_WITH_IN_PLACE.vnfName, VNF_DATA_WITH_IN_PLACE.vnfTargetVersion, workflow);
+
+ assertThatVidToMsoCallbackDataIsOk(workflow, "");
+ }
+
+ private void assertThatVidToMsoCallbackDataIsOk(String workflow, String payload) {
+ Assert.assertTrue(Get.byId(Constants.generalSubmitButtonId).isEnabled());
+ Click.byId(Constants.generalSubmitButtonId);
+
+ String vidToMsoCallbackData = Input.getValueByTestId("vidToMsoCallbackData");
+
+ String modelInvariantId = "72e465fe-71b1-4e7b-b5ed-9496118ff7a8";
+ String vnfInstanceId = "8e5e3ba1-3fe6-4d86-966e-f9f03dab4855";
+ String expected = getExpectedVidToMsoCallbackData(modelInvariantId, vnfInstanceId, VNF_DATA_WITH_IN_PLACE.vnfName, VNF_DATA_WITH_IN_PLACE.vnfTargetVersion, workflow, payload);
+
+ try {
+ JSONAssert.assertEquals("built mso request is not ok", expected, vidToMsoCallbackData, JSONCompareMode.STRICT);
+ } catch (JSONException e) {
+ throw new RuntimeException(e);
+ }
+
+ Click.byId(Constants.generalCancelButtonId);
+ }
+
+ @Test(enabled = false)
+ public void testUpdateWorkflowNow() {
+
+ String workflow = "Update";
+
+ String duration = "1";
+ String fallback = "1";
+ String concurrencyLimit = "1";
+ String policy = "SNIRO_1710.Config_MS_PlacementOptimizationPolicy_dhv_v1.1.xml";
+
+ openAndFill1stScreen(VNF_DATA_WITH_IN_PLACE.vnfName, VNF_DATA_WITH_IN_PLACE.vnfTargetVersion, workflow);
+ Assert.assertTrue(Get.byId(Constants.generalSubmitButtonId).isEnabled());
+ Click.byId(Constants.generalSubmitButtonId);
+
+ scheduleChange2ndScreen(duration, fallback, concurrencyLimit, policy);
+ }
+
+ @Test
+ public void testNewChangeManagementCreation() {
+ ChangeManagementPage.openChangeManagementPage();
+
+ //TODO: After scheduler will be ready than we will examine if the creation working fine.
+ }
+
+ @Test
+ public void testMainDashboardTable() {
+ ChangeManagementPage.openChangeManagementPage();
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.dashboardActiveTabId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.dashboardFinishedTabId));
+
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.dashboardActiveTableId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.dashboardInProgressTheadId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.dashboardPendingTheadId));
+
+ 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() {
+ ChangeManagementPage.openChangeManagementPage();
+
+ //TODO: After scheduler will be ready than we will examine if the content is valid.
+ }
+
+ @Test(enabled = false)
+ public void testOpenFailedStatusModal() {
+ ChangeManagementPage.openChangeManagementPage();
+
+ if(!Exists.byClass(Constants.ChangeManagement.failedIconClass)) {
+ //TODO: Create a job which will shown with status fail.
+ }
+
+ Click.byClass(Constants.ChangeManagement.failedIconClass);
+ Wait.modalToBeDisplayed();
+ Assert.assertTrue(Exists.modal());
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.failedModalHeaderId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.failedModalContentId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.failedModalRetryButtonId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.failedModalRollbackButtonId));
+
+ Click.byClass(Constants.generalCloseModalButtonClass);
+ Wait.modalToDisappear();
+ }
+
+ @Test(enabled = false)
+ public void testOpenInProgressStatusModal() {
+ ChangeManagementPage.openChangeManagementPage();
+
+ if(!Exists.byClass(Constants.ChangeManagement.processIconClass)) {
+ //TODO: Create a job which will shown with status in-progress.
+ }
+
+ Click.byClass(Constants.ChangeManagement.processIconClass);
+ Wait.modalToBeDisplayed();
+ Assert.assertTrue(Exists.modal());
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.inProgressModalHeaderId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.inProgressModalContentId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.inProgressModalStopButtonId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.inProgressModalRollbackButtonId));
+
+ Click.byClass(Constants.generalCloseModalButtonClass);
+ Wait.modalToDisappear();
+ }
+
+ @Test(enabled = false)
+ public void testOpenAlertStatusModal() {
+ ChangeManagementPage.openChangeManagementPage();
+
+ if(!Exists.byClass(Constants.ChangeManagement.alertIconClass)) {
+ //TODO: Create a job which will shown with status alert.
+ }
+
+ Click.byClass(Constants.ChangeManagement.alertIconClass);
+ Wait.modalToBeDisplayed();
+ Assert.assertTrue(Exists.modal());
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.alertModalHeaderId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.alertModalContentId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.alertModalContinueButtonId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.alertModalRollbackButtonId));
+
+ Click.byClass(Constants.generalCloseModalButtonClass);
+ Wait.modalToDisappear();
+ }
+
+ @Test(enabled = false)
+ public void testOpenPendingStatusModal() {
+ ChangeManagementPage.openChangeManagementPage();
+
+ if(!Exists.byClass(Constants.ChangeManagement.pendingIconClass)) {
+ //TODO: Create a job which will shown with status pending.
+ }
+
+ Click.byClass(Constants.ChangeManagement.pendingIconClass);
+ Wait.modalToBeDisplayed();
+ Assert.assertTrue(Exists.modal());
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.pendingModalHeaderId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.pendingModalContentId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.pendingModalRescheduleButtonId));
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.pendingModalRollbackButtonId));
+
+ Click.byClass(Constants.generalCloseModalButtonClass);
+ Wait.modalToDisappear();
+ }
+
+ @Test(enabled = false)
+ public void testSuccessCancelPendingWorkflow() {
+ ChangeManagementPage.openChangeManagementPage();
+ Wait.angularHttpRequestsLoaded();
+
+ Click.byClass(Constants.ChangeManagement.cancelPendingButtonClass); //cancel pending workflow modal
+ Wait.modalToBeDisplayed();
+ Assert.assertTrue(Exists.modal());
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.pendingModalHeaderId));
+ Assert.assertTrue(Exists.byClass(Constants.ChangeManagement.pendingModalCancelWorkflowButtonClass));
+ Click.byClass(Constants.ChangeManagement.pendingModalCancelWorkflowButtonClass);
+ Wait.angularHttpRequestsLoaded();
+
+ Wait.modalToBeDisplayed(); //success alert modal should appear
+ Assert.assertTrue(Exists.modal());
+ Assert.assertTrue(Exists.byId(Constants.ChangeManagement.alertModalHeaderId));
+ Assert.assertTrue(Exists.byClassAndText(Constants.generalModalTitleClass, "Success"));
+ Click.byClass(Constants.generalCloseModalButtonClass);
+ Wait.modalToDisappear();
+ //TODO check the workflow deleted from table/changed to deleted action
+ }
+
+ private String getExpectedVidToMsoCallbackData(String modelInvariantId, String vnfInstanceId, String vnfName, String vnfTargetVersion, String workflow, String payload) {
+ return "" +
+ "{" +
+ " \"requestType\": \"" + workflow + "\"," +
+ " \"requestDetails\": [" +
+ " {" +
+ " \"vnfName\": \"" + vnfName + "\"," +
+ " \"vnfInstanceId\": \"" + vnfInstanceId + "\"," +
+ " \"modelInfo\": {" +
+ " \"modelType\": \"vnf\"," +
+ " \"modelInvariantId\": \"" + modelInvariantId + "\"," +
+ " \"modelVersionId\": \"76e908e0-5201-44d2-a3e2-9e6128d05820\"," +
+ " \"modelName\": \"" + vnfName + "\"," +
+ " \"modelVersion\": \"" + vnfTargetVersion + "\"," +
+ " \"modelCustomizationId\": \"c00e8fc8-af39-4da8-8c78-a7efc2fe5994\"" +
+ " }," +
+ " \"cloudConfiguration\": {" +
+ " \"lcpCloudRegionId\": \"mdt1\"," +
+ " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" +
+ " }," +
+ " \"requestInfo\": {" +
+ " \"source\": \"VID\"," +
+ " \"suppressRollback\": false," +
+ " \"requestorId\": \"az2016\"" +
+ " }," +
+ " \"relatedInstanceList\": [" +
+ " {" +
+ " \"relatedInstance\": {" +
+ " \"instanceId\": \"97315a05-e6f3-4c47-ae7e-d850c327aa08\"," +
+ " \"modelInfo\": {" +
+ " \"modelType\": \"service\"," +
+ " \"modelInvariantId\": \"e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0\"," +
+ " \"modelVersionId\": \"76e908e0-5201-44d2-a3e2-9e6128d05820\"," +
+ " \"modelName\": \"action-data\"," +
+ " \"modelVersion\": \"1.0\"" +
+ " }" +
+ " }" +
+ " }" +
+ " ]," +
+ " \"requestParameters\": {" +
+ payload +
+ " \"usePreload\": true" +
+ " }" +
+ " }" +
+ " ]" +
+ "}";
+ }
+
+}
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
new file mode 100644
index 000000000..ff7dc3441
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/test/CreateInstanceDialogBaseTest.java
@@ -0,0 +1,35 @@
+package vid.automation.test.test;
+
+import org.junit.Assert;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+import vid.automation.test.Constants;
+import vid.automation.test.model.Service;
+
+public class CreateInstanceDialogBaseTest extends VidBaseTestCase {
+ void assertServiceMetadata(String expectedMetadata, String actualMetadata) {
+ WebElement serviceNameElem = GeneralUIUtils.getWebElementByTestID(actualMetadata);
+ String actualServiceName = serviceNameElem.getText();
+ Assert.assertEquals(expectedMetadata, actualServiceName);
+ }
+
+ void validateServiceCreationDialog(Service expectedService) {
+ assertThatServiceCreationDialogIsVisible();
+ assertServiceMetadata(expectedService.name, Constants.SERVICE_NAME);
+ assertServiceMetadata(expectedService.uuid, Constants.SERVICE_UUID);
+ assertServiceMetadata(expectedService.invariantUuid, Constants.SERVICE_INVARIANT_UUID);
+ assertServiceMetadata(expectedService.category, Constants.SERVICE_CATEGORY);
+ assertServiceMetadata(expectedService.version, Constants.SERVICE_VERSION);
+ assertServiceMetadata(expectedService.description, Constants.SERVICE_DESCRIPTION);
+ }
+
+ void assertThatServiceCreationDialogIsVisible() {
+ boolean byText = GeneralUIUtils.findAndWaitByText(Constants.BrowseASDC.CREATE_SERVICE_INSTANCE, 15);
+ Assert.assertTrue(byText);
+ }
+
+ void assertSuccessfulServiceInstanceCreation() {
+ boolean byText = GeneralUIUtils.findAndWaitByText(Constants.BrowseASDC.SERVICE_INSTANCE_CREATED_SUCCESSFULLY_TEXT, 100);
+ Assert.assertTrue(Constants.BrowseASDC.SERVICE_INSTANCE_CREATION_FAILED_MESSAGE, byText);
+ }
+}
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
new file mode 100644
index 000000000..46238acac
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/test/CreateNewInstanceTest.java
@@ -0,0 +1,84 @@
+package vid.automation.test.test;
+
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import vid.automation.test.Constants;
+import vid.automation.test.model.Service;
+import vid.automation.test.model.User;
+import vid.automation.test.sections.CreateNewInstancePage;
+import vid.automation.test.sections.SideMenu;
+import vid.automation.test.services.ServicesService;
+import vid.automation.test.services.UsersService;
+
+import java.io.IOException;
+
+public class CreateNewInstanceTest extends CreateInstanceDialogBaseTest {
+ private UsersService usersService = new UsersService();
+ private ServicesService servicesService = new ServicesService();
+
+ public CreateNewInstanceTest() throws IOException {
+ }
+
+ @Test
+ private void testCreateNewServiceInstance() throws Exception {
+ User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
+ relogin(user.credentials);
+
+ SideMenu.navigateToCreateNewServicePage();
+
+ CreateNewInstancePage createNewInstancePage = new CreateNewInstancePage();
+
+ String subscriberName = "USP VOICE";
+ assertDropdownPermittedItemsByValue(user.subscribers, 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";
+ assertDropdownPermittedItemsByName(user.serviceTypes, Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS);
+ createNewInstancePage.selectServiceTypeByName(serviceType);
+ createNewInstancePage.clickSubmitButton();
+ assertSuccessfulSelection(Constants.CreateNewInstance.SELECTED_SERVICE_TYPE_NAME_TEST_ID, serviceType);
+
+ Service service = servicesService.getService( "c079d859-4d81-4add-a9c3-94551f96e2b0");
+
+ createNewInstancePage.clickDeployServiceButtonByServiceUUID(service.uuid);
+
+ validateServiceCreationDialog(service, subscriberName, serviceType);
+
+ String instanceName = createNewInstancePage.generateInstanceName();
+ createNewInstancePage.setInstanceName(instanceName);
+ createNewInstancePage.selectSuppressRollback("false");
+ createNewInstancePage.clickConfirmButton();
+
+ assertSuccessfulServiceInstanceCreation();
+
+ createNewInstancePage.clickCloseButton();
+
+ GeneralUIUtils.ultimateWait();
+
+ goToExistingInstanceByName(instanceName);
+
+ addVNF("VID-PCRF-05-15-17 0", "AAIAIC25", "092eb9e8e4b7412e8787dd091bc58e86",
+ "false", "some legacy region", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", user.tenants);
+ addVolumeGroup("VidPcrf051517..pcrf_nimbus_pcm..module-4", "AAIAIC25",
+ "092eb9e8e4b7412e8787dd091bc58e86", "false", "some legacy region", user.tenants);
+ addVFModule("VidPcrf051517..pcrf_nimbus_psm..module-1", "AAIAIC25",
+ "092eb9e8e4b7412e8787dd091bc58e86", "false", "some legacy region", user.tenants);
+ }
+
+ private void assertSuccessfulSelection(String elementTestId, String expectedSelection) {
+ GeneralUIUtils.ultimateWait();
+ WebElement selectedElement = GeneralUIUtils.getWebElementByTestID(elementTestId, 30);
+ Assert.assertEquals(selectedElement.getText(), expectedSelection);
+ }
+
+ private void validateServiceCreationDialog(Service expectedService, String subscriberName, String serviceType) {
+ assertServiceMetadata(subscriberName, Constants.SUBSCRIBER_NAME);
+ assertServiceMetadata(serviceType, Constants.SERVICE_TYPE);
+ validateServiceCreationDialog(expectedService);
+
+ }
+}
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
new file mode 100644
index 000000000..1c8101953
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/test/EnvironmentsTest.java
@@ -0,0 +1,484 @@
+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.openqa.selenium.WebElement;
+import org.springframework.http.HttpStatus;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import vid.automation.test.Constants;
+import vid.automation.test.infra.*;
+import vid.automation.test.model.Environment;
+import vid.automation.test.sections.SideMenu;
+import vid.automation.test.services.SimulatorApi.RegistrationStrategy;
+
+import vid.automation.test.sections.TestEnvironmentPage;
+import vid.automation.test.sections.VidBasePage;
+import vid.automation.test.services.SimulatorApi;
+import vid.automation.test.utils.ReadFile;
+
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static vid.automation.test.Constants.TestEnvironments.REFRESH_BUTTON;
+
+
+/*
+
+1. Activate
+ a. Happy scenario
+ i. Polling screen is displayed
+ ii. Environment status become active in environments table
+ iii. Button become deactivation
+ iv. Attach file button is shown
+ b. Non JSON file content – error is shown
+ c. Invalid manifest format in the JSON – error is shown
+ d. MSO Error – 500/400 – error is shown
+2. Attach manifest
+ a. Happy scenario
+ i. Polling screen is displayed
+ b. MSO Error – 500/400 – error is shown
+
+3. Deactivate
+ a. Happy scenario
+ i. Polling screen is displayed
+ ii. Environment status become inactive in environments table
+ iii. Button become activation
+ iv. Attach file button is not shown
+ b. MSO Error – 500/400 – error is shown
+
+ */
+
+public class EnvironmentsTest extends VidBaseTestCase {
+
+ public static final String GET_EMPTY_OPERATIONAL_ENVIRONMENT_JSON = "get_empty_operational_environment.json";
+ public static final String GET_OPERATIONAL_ENVIRONMENT_JSON = "get_operational_environment.json";
+ public static final String GET_FULL_OPERATIONAL_ENVIRONMENT_JSON = "get_full_operational_environment.json";
+ public static final String GET_ERROR_OPERATIONAL_ENVIRONMENT_JSON = "get_error_operational_environment.json";
+ public static final String POST_OPERATIONAL_ENVIRONMENT_JSON = "post_operational_environment.json";
+ static final String ENVIRONMENTS_CONF = "environments";
+ static final String NEW_ENVIRONMENT_CONF = "newEnvironment";
+
+ public static final String ENV_ID_FOR_ACTIVATION = "f07ca256-96dd-40ad-b4d2-7a77e2a974eb";
+ public static final String ENV_ID_FOR_DEACTIVATION = "f07ca256-96dd-40ad-b4d2-7a77e2a974ec";
+ private VidBasePage vidBasePage = new VidBasePage();
+
+ public static enum FailureType {
+ ACTIVATION_FAILURE,
+ DEACTIVATION_FAILURE,
+ GET_STATUS_FAILURE
+ }
+
+ @Test
+ public void testLeftPanelTestEnvironmentButton() {
+ List<WebElement> leftPanelButtons = Get.byClass(Constants.SideMenu.buttonClass);
+ Assert.assertTrue(Wait.byText(Constants.SideMenu.TEST_ENVIRONMENTS));
+ }
+
+ @Test
+ public void testEnvironmentHeaderLine() {
+ SideMenu.navigateToTestEnvironmentsPage();
+ Assert.assertTrue(Exists.byTestId(Constants.TestEnvironments.PAGE_HEADLINE));
+ Assert.assertTrue(Exists.byTestId(Constants.TestEnvironments.HEADLINE_NEW_BUTTON));
+ Assert.assertTrue(Exists.byTestId(Constants.TestEnvironments.HEADLINE_SEARCH_INPUT));
+ }
+
+ @Test
+ public void testTable() throws Exception {
+ SimulatorApi.registerExpectation(GET_OPERATIONAL_ENVIRONMENT_JSON);
+ vidBasePage.refreshPage();
+ Map <String, List<String>> file = ReadFile.getJsonFile(ENVIRONMENTS_CONF, Map.class);
+ String tableId = Constants.TestEnvironments.ENVIRONMENTS_TABLE;
+ SideMenu.navigateToTestEnvironmentsPage();
+ boolean emptyTableMessage = Exists.byTestId(Constants.TestEnvironments.NO_DATA_MESSAGE);
+ boolean errorMessage = Exists.byTestId(Constants.TestEnvironments.ERROR_MESSAGE);
+ Assert.assertFalse(emptyTableMessage || errorMessage);
+ List<String> headers = Get.tableHeaderValuesByTestId(tableId);
+ Assert.assertEquals(file.get(Constants.TestEnvironments.HEADERS_LIST), headers);
+ List<List<String>> body = Get.tableBodyValuesByTestId(tableId);
+ Assert.assertEquals(file.get(Constants.TestEnvironments.BASIC_LIST), body);
+ }
+
+ @Test
+ public void testSortTable() throws Exception {
+ SimulatorApi.registerExpectation(GET_OPERATIONAL_ENVIRONMENT_JSON, RegistrationStrategy.CLEAR_THEN_SET);
+ vidBasePage.refreshPage();
+ Map <String, List<String>> file = ReadFile.getJsonFile(ENVIRONMENTS_CONF, Map.class);
+ String tableId = Constants.TestEnvironments.ENVIRONMENTS_TABLE;
+ SideMenu.navigateToTestEnvironmentsPage();
+ Click.byClass(Constants.TestEnvironments.TABLE_HEADER_ASC);
+ GeneralUIUtils.ultimateWait();
+ List<List<String>> body = Get.tableBodyValuesByTestId(tableId);
+ Assert.assertEquals(file.get(Constants.TestEnvironments.SORTED_LIST), body);
+ GeneralUIUtils.ultimateWait();
+ }
+
+ @Test
+ public void testFilterTable() throws Exception {
+ SimulatorApi.registerExpectation(GET_OPERATIONAL_ENVIRONMENT_JSON, RegistrationStrategy.CLEAR_THEN_SET);
+ vidBasePage.refreshPage();
+ Map <String, List<String>> file = ReadFile.getJsonFile(ENVIRONMENTS_CONF, Map.class);
+ String tableId = Constants.TestEnvironments.ENVIRONMENTS_TABLE;
+ SideMenu.navigateToTestEnvironmentsPage();
+ Input.text(Constants.TestEnvironments.TEXT_TO_FILTER, Constants.TestEnvironments.SEARCH_INPUT);
+ GeneralUIUtils.ultimateWait();
+ List<List<String>> body = Get.tableBodyValuesByTestId(tableId);
+ Assert.assertEquals(file.get(Constants.TestEnvironments.FILTERED_LIST), body);
+ GeneralUIUtils.ultimateWait();
+ }
+
+
+ @Test
+ public void testEmptyTableMessage() throws Exception {
+ SimulatorApi.registerExpectation(GET_EMPTY_OPERATIONAL_ENVIRONMENT_JSON);
+ vidBasePage.refreshPage();
+ SideMenu.navigateToTestEnvironmentsPage();
+ boolean emptyTableMessage = Exists.byTestId(Constants.TestEnvironments.NO_DATA_MESSAGE);
+ Assert.assertTrue(emptyTableMessage);
+ Assert.assertFalse(Exists.byTestId(Constants.TestEnvironments.TRY_AGAIN_BUTTON));
+ Assert.assertFalse(Exists.byTestId(Constants.TestEnvironments.ENVIRONMENTS_TABLE));
+ GeneralUIUtils.ultimateWait();
+ }
+
+ @Test
+ public void testErrorMessage() throws Exception {
+ SimulatorApi.registerExpectation(GET_ERROR_OPERATIONAL_ENVIRONMENT_JSON);
+ vidBasePage.refreshPage();
+ SideMenu.navigateToTestEnvironmentsPage();
+ boolean errorMessage = Exists.byTestId(Constants.TestEnvironments.ERROR_MESSAGE);
+ Assert.assertTrue(errorMessage);
+ Assert.assertTrue(Exists.byTestId(Constants.TestEnvironments.TRY_AGAIN_BUTTON));
+ Assert.assertFalse(Exists.byTestId(Constants.TestEnvironments.ENVIRONMENTS_TABLE));
+ GeneralUIUtils.ultimateWait();
+ }
+
+ @Test
+ public void testNewEnvironmentPopup() throws Exception {
+ SimulatorApi.registerExpectation(GET_OPERATIONAL_ENVIRONMENT_JSON, RegistrationStrategy.CLEAR_THEN_SET);
+ SimulatorApi.registerExpectation(POST_OPERATIONAL_ENVIRONMENT_JSON);
+ SimulatorApi.registerExpectation("environment/status/get_cloud_resources_request_status.json",
+ ImmutableMap.of("status_message", Constants.TestEnvironments.environmentCreatedSuccesfullyMessage,
+ "REQUEST-TYPE","Create"));
+ vidBasePage.refreshPage();
+ Environment environment = ReadFile.getJsonFile(NEW_ENVIRONMENT_CONF, Environment.class);
+ SideMenu.navigateToTestEnvironmentsPage();
+ Click.byTestId(Constants.TestEnvironments.HEADLINE_NEW_BUTTON);
+ Wait.modalToBeDisplayed();
+ Assert.assertTrue(Exists.byTestId(Constants.TestEnvironments.NEW_ENVIRONMENT_FORM));
+
+ boolean errorMessage = Exists.byTestId(Constants.TestEnvironments.POPUP_ERROR_MESSAGE);
+ Assert.assertFalse(errorMessage);
+
+ Assert.assertFalse(Get.byTestId(Constants.TestEnvironments.SUBMIT_BUTTON).isEnabled());
+ Input.text(environment.operationalEnvironmentName, Constants.TestEnvironments.INSTANCE_NAME_INPUT);
+
+ GeneralUIUtils.ultimateWait();
+ SelectOption.byTestIdAndVisibleText(environment.EcompEnvironmentId, Constants.TestEnvironments.ECOMP_ID_DROP_DOWN);
+
+ String ecompNameText = Input.getValueByTestId(Constants.TestEnvironments.ECOMP_NAME_INPUT);
+ Assert.assertEquals(environment.EcompEnvironmentName, ecompNameText);
+
+ String tenantContextText = Input.getValueByTestId(Constants.TestEnvironments.TENANT_CONTEXT_INPUT);
+ Assert.assertEquals(environment.tenantContext, tenantContextText);
+
+ String environmentTypeDefault = Get.selectedOptionText(Constants.TestEnvironments.ENVIRONMENT_TYPE_DROP_DOWN);
+ Assert.assertEquals(environment.operationalEnvironmentType, environmentTypeDefault);
+
+ SelectOption.byTestIdAndVisibleText(environment.workloadContext, Constants.TestEnvironments.WORKLOAD_CONTEXT_DROP_DOWN);
+
+ WebElement submitButton = Get.byTestId(Constants.TestEnvironments.SUBMIT_BUTTON);
+ Assert.assertTrue(submitButton.isEnabled());
+ Click.byTestId(Constants.TestEnvironments.SUBMIT_BUTTON);
+ boolean waitForTextResult = Wait.waitByClassAndText("status", Constants.TestEnvironments.environmentCreatedSuccesfullyMessage, 60);
+ assertTrue(Constants.TestEnvironments.environmentCreatedSuccesfullyMessage + " message didn't appear on time", waitForTextResult);
+
+ vidBasePage.clickCloseButton();
+ GeneralUIUtils.ultimateWait();
+
+ // refresh table
+ Map <String, List<String>> file = ReadFile.getJsonFile(ENVIRONMENTS_CONF, Map.class);
+ String tableId = Constants.TestEnvironments.ENVIRONMENTS_TABLE;
+ SimulatorApi.registerExpectation(GET_FULL_OPERATIONAL_ENVIRONMENT_JSON,
+ ImmutableMap.of("new_name", environment.operationalEnvironmentName, "new_tenant", environment.tenantContext, "new_ecomp_id", environment.EcompEnvironmentId, "new_ecomp_name", environment.EcompEnvironmentName, "new_workload_context", environment.workloadContext), RegistrationStrategy.CLEAR_THEN_SET);
+ Click.byTestId(REFRESH_BUTTON);
+ Wait.angularHttpRequestsLoaded();
+ List<List<String>> body = Get.tableBodyValuesByTestId(tableId);
+ Assert.assertEquals(file.get(Constants.TestEnvironments.FULL_LIST), body);
+ GeneralUIUtils.ultimateWait();
+ }
+
+ @Test
+ public void testAaiErrorNewEnvironmentPopup() throws Exception {
+ SimulatorApi.registerExpectation(GET_ERROR_OPERATIONAL_ENVIRONMENT_JSON);
+ vidBasePage.refreshPage();
+ SideMenu.navigateToTestEnvironmentsPage();
+ Click.byTestId(Constants.TestEnvironments.HEADLINE_NEW_BUTTON);
+ Assert.assertTrue(Exists.byTestId(Constants.TestEnvironments.NEW_ENVIRONMENT_FORM));
+ GeneralUIUtils.ultimateWait();
+ boolean errorMessage = Exists.byTestId(Constants.TestEnvironments.POPUP_ERROR_MESSAGE);
+ Assert.assertTrue(errorMessage);
+ Click.byTestId(Constants.TestEnvironments.CANCEL_BUTTON);
+ Wait.modalToDisappear();
+ GeneralUIUtils.ultimateWait();
+ }
+
+ @Test
+ public void testCancelNewPopup() {
+ SideMenu.navigateToTestEnvironmentsPage();
+ Click.byTestId(Constants.TestEnvironments.HEADLINE_NEW_BUTTON);
+ Assert.assertTrue(Exists.modal());
+ Click.byTestId(Constants.TestEnvironments.CANCEL_BUTTON);
+ Wait.modalToDisappear();
+ Assert.assertFalse(Exists.modal());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ @Test
+ public void testCloseNewPopup() {
+ SideMenu.navigateToTestEnvironmentsPage();
+ Click.byTestId(Constants.TestEnvironments.HEADLINE_NEW_BUTTON);
+ Wait.modalToBeDisplayed();
+ Assert.assertTrue(Exists.modal());
+ GeneralUIUtils.ultimateWait();
+ Click.byClass(Constants.TestEnvironments.MODAL_CLOSE_BUTTON_CLASS);
+ Wait.modalToDisappear();
+ GeneralUIUtils.ultimateWait();
+ Assert.assertFalse(Exists.modal());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ @Test
+ public void testApplicationEnvironmentActivation() throws Exception {
+ String envId = ENV_ID_FOR_ACTIVATION;
+ SimulatorApi.registerExpectation("environment/activate/get_operational_environments_aai1.json");
+ SimulatorApi.registerExpectation("environment/activate/post_activate_operational_environment.json",
+ ImmutableMap.of("ENV-UUID", envId));
+ SimulatorApi.registerExpectation("environment/status/get_cloud_resources_request_status.json",
+ ImmutableMap.of("status_message", Constants.TestEnvironments.environmentActivatedSuccesfullyMessage,
+ "REQUEST-TYPE","Activate"));
+ clickOnActivationButtonAndUploadFile(envId, "manifest.json");
+
+ Click.byId(Constants.generalSubmitButtonId);
+ SimulatorApi.registerExpectation("environment/activate/get_operational_environments_aai1.json",
+ ImmutableMap.of("Deactivate", "Activate"));
+
+ boolean waitForTextResult = Wait.waitByClassAndText("status", Constants.TestEnvironments.environmentActivatedSuccesfullyMessage, 60);
+ assertTrue(Constants.TestEnvironments.environmentActivatedSuccesfullyMessage + " message didn't appear on time", waitForTextResult);
+
+ vidBasePage.clickCloseButton();
+
+ GeneralUIUtils.ultimateWait();
+
+ WebElement deactivationButton = TestEnvironmentPage.getTestEnvironmentDeactivationButton(envId);
+ assertTrue("Failed to find Deactivate button for test env with id: "+envId, deactivationButton.isDisplayed());
+
+ WebElement status = Get.byId(Constants.TestEnvironments.environmentStatusIdPrefix + envId);
+ assertEquals("Active", status.getText());
+
+ WebElement attachButton = TestEnvironmentPage.getTestEnvironmentAttachButton(envId);
+ assertTrue("Failed to find Attach button for test env with id: "+envId, attachButton.isDisplayed());
+
+ //make sure page is clickable
+ SideMenu.navigateToTestEnvironmentsPage();
+ }
+
+ @Test
+ public void testApplicationEnvironmentDeactivation() throws Exception {
+ String envId = ENV_ID_FOR_DEACTIVATION;
+ SimulatorApi.registerExpectation("environment/activate/get_operational_environments_aai1.json");
+ SimulatorApi.registerExpectation("environment/deactivate/post_deactivate_operational_environment.json",
+ ImmutableMap.of("ENV-UUID", envId));
+ SimulatorApi.registerExpectation("environment/status/get_cloud_resources_request_status.json",
+ ImmutableMap.of("status_message", Constants.TestEnvironments.environmentDeactivatedSuccesfullyMessage,
+ "REQUEST-TYPE","Deactivate"));
+ deactivateEnv(envId);
+
+ SimulatorApi.registerExpectation("environment/deactivate/get_operational_environments_aai1.json");
+ GeneralUIUtils.findAndWaitByText(Constants.TestEnvironments.environmentDeactivatedSuccesfullyMessage, 60);
+
+ vidBasePage.clickCloseButton();
+
+ GeneralUIUtils.ultimateWait();
+
+ WebElement activationButton = TestEnvironmentPage.getTestEnvironmentActivationButton(envId);
+ assertTrue("Failed to find Activate button for test env with id: "+envId, activationButton.isDisplayed());
+
+ WebElement status = Get.byId(Constants.TestEnvironments.environmentStatusIdPrefix + envId);
+ assertEquals("Inactive", status.getText());
+
+ WebElement attachButton = TestEnvironmentPage.getTestEnvironmentAttachButton(envId);
+ assertFalse("attach button shouldn't be displayed for test env with id: "+envId, attachButton.isDisplayed());
+
+ SideMenu.navigateToTestEnvironmentsPage();
+ }
+
+ private void deactivateEnv(String envId) {
+ vidBasePage.refreshPage();
+ SideMenu.navigateToTestEnvironmentsPage();
+ WebElement deactivationButton = TestEnvironmentPage.getTestEnvironmentDeactivationButton(envId);
+ assertTrue("Failed to find Deactivation button for test env with id: "+envId, deactivationButton.isDisplayed());
+ deactivationButton.click();
+ }
+
+ @DataProvider
+ public static Object[][] badManifestProvider() {
+ return new Object[][]{
+ {"bad_manifest_structure.json","Manifest structure is wrong"},
+ {"manifest_with_wrong_recovery_action.json", "Wrong value for RecoveryAction in manifest. Allowed options are: abort,retry,skip. Wrong value is: leave"}
+ };
+ };
+
+ @Test
+ public void testApplicationEnvironmentActivationBadManifestStructure() throws Exception {
+ testApplicationEnvironmentActivationBadManifestStructure("bad_manifest_structure.json", "Manifest structure is wrong");
+ testApplicationEnvironmentActivationBadManifestStructure("manifest_with_wrong_recovery_action.json",
+ "Wrong value for RecoveryAction in manifest. Allowed options are: abort, retry, skip. Wrong value is: leave");
+ }
+
+ //@Test(dataProvider = "badManifestProvider") TODO : use data provider here (for some reason not work with ui-ci framework)
+ public void testApplicationEnvironmentActivationBadManifestStructure(String badManifestFileName, String exceptedErrorMsg) throws Exception {
+ SimulatorApi.registerExpectation("environment/activate/get_operational_environments_aai1.json");
+ clickOnActivationButtonAndUploadFile(ENV_ID_FOR_ACTIVATION, badManifestFileName);
+ WebElement attachButton = Get.byId("submit");
+ assertEquals("Wrong text for submit button in activate modal", "Attach", attachButton.getText());
+ attachButton.click();
+ boolean waitForTextResult = Wait.waitByClassAndText("error", exceptedErrorMsg, 30);
+ assertTrue(exceptedErrorMsg+ " message didn't appear on time", waitForTextResult);
+ vidBasePage.clickCloseButton();
+ GeneralUIUtils.ultimateWait();
+ SideMenu.navigateToTestEnvironmentsPage();
+ }
+
+ @Test
+ public void testApplicationEnvironmentActivationNonJsonManifest() throws Exception {
+ SimulatorApi.registerExpectation("environment/activate/get_operational_environments_aai1.json");
+ String fileName = "non_valid_json.json";
+ clickOnActivationButtonAndUploadFile(ENV_ID_FOR_ACTIVATION, fileName);
+ WebElement errorLabel = Get.byId("errorLabel");
+ assertEquals("wrong error message for non valid json file", "file: " + fileName + " is not a valid JSON", errorLabel.getText());
+ vidBasePage.clickCancelButton();
+ GeneralUIUtils.ultimateWait();
+ }
+
+ private void clickOnActivationButtonAndUploadFile(String envId, String inputFileName) {
+ vidBasePage.refreshPage();
+ SideMenu.navigateToTestEnvironmentsPage();
+ WebElement activationButton = TestEnvironmentPage.getTestEnvironmentActivationButton(envId);
+ assertTrue("Failed to find Activate button for test env with id: "+envId, activationButton.isDisplayed());
+ activationButton.click();
+ Input.file("applicationEnvironment/"+inputFileName, "testEnvManifestFileInput");
+ WebElement manifestFileName = Get.byId("manifestFileName");
+ assertEquals("Manifest file name is wrong in test environment activation modal", inputFileName, manifestFileName.getText());
+ }
+
+ @Test
+ public void testAttachManifestFileHappyFlow() throws Exception {
+ String envId = ENV_ID_FOR_ACTIVATION;
+ SimulatorApi.registerExpectation("environment/activate/post_activate_operational_environment.json",
+ ImmutableMap.of("ENV-UUID", envId));
+ SimulatorApi.registerExpectation("environment/attachManifest/get_attachable_operational_environment.json");
+ SimulatorApi.registerExpectation("environment/status/get_cloud_resources_request_status.json",
+ ImmutableMap.of("status_message", Constants.TestEnvironments.environmentActivatedSuccesfullyMessage));
+ vidBasePage.refreshPage();
+ SideMenu.navigateToTestEnvironmentsPage();
+ WebElement attachButton = TestEnvironmentPage.getTestEnvironmentAttachButton(ENV_ID_FOR_ACTIVATION);
+ attachButton.click();
+
+ Input.file("applicationEnvironment/manifest.json", "testEnvManifestFileInput");
+
+ Click.byId(Constants.generalSubmitButtonId);
+
+ boolean waitForTextResult = Wait.waitByClassAndText("status", Constants.TestEnvironments.environmentActivatedSuccesfullyMessage, 60);
+ assertTrue(Constants.TestEnvironments.environmentActivatedSuccesfullyMessage + " message didn't appear on time", waitForTextResult);
+
+ vidBasePage.clickCloseButton();
+ }
+ @Test
+ public void testApplicationEnvironmentActivationErrorResponseFromMso() throws Exception {
+ String payload = "ERROR_PAYLOAD";
+ testApplicationEnvironmentActivationErrorResponseFromMso(HttpStatus.INTERNAL_SERVER_ERROR, payload, FailureType.ACTIVATION_FAILURE);
+ testApplicationEnvironmentActivationErrorResponseFromMso(HttpStatus.BAD_REQUEST, payload, FailureType.ACTIVATION_FAILURE);
+ testApplicationEnvironmentActivationErrorResponseFromMso(HttpStatus.INTERNAL_SERVER_ERROR, payload, FailureType.GET_STATUS_FAILURE);
+ testApplicationEnvironmentActivationErrorResponseFromMso(HttpStatus.BAD_REQUEST, payload, FailureType.GET_STATUS_FAILURE);
+ }
+
+
+ public void testApplicationEnvironmentActivationErrorResponseFromMso(HttpStatus errorStatus, String payload, FailureType failureType) throws Exception {
+
+ String envId = ENV_ID_FOR_ACTIVATION;
+ SimulatorApi.registerExpectation("environment/activate/get_operational_environments_aai1.json");
+ switch (failureType) {
+ case ACTIVATION_FAILURE:
+ SimulatorApi.registerExpectation("environment/activate/mso_error_response_for_post_operational_environment.json",
+ ImmutableMap.of("ERROR_CODE", errorStatus.value(), "ENV-UUID", envId));
+ break;
+ case GET_STATUS_FAILURE:
+ SimulatorApi.registerExpectation("environment/activate/post_activate_operational_environment.json",
+ ImmutableMap.of("ENV-UUID", envId));
+ break;
+ }
+
+ SimulatorApi.registerExpectation("environment/status/get_cloud_resources_request_status_bad_response.json",
+ ImmutableMap.of("ERROR_CODE", errorStatus.value(), "ENV-UUID", envId));
+
+ clickOnActivationButtonAndUploadFile(envId, "manifest.json");
+ Click.byId(Constants.generalSubmitButtonId);
+ Wait.waitByClassAndText("error", "System failure", 60);
+ Wait.waitByClassAndText("log", errorStatus.getReasonPhrase(), 60);
+ Wait.waitByClassAndText("log", payload, 60);
+ vidBasePage.clickCloseButton();
+
+ GeneralUIUtils.waitForAngular();
+
+ WebElement status = Get.byId(Constants.TestEnvironments.environmentStatusIdPrefix + envId);
+ assertEquals(Constants.INACTIVE, status.getText());
+ //make sure page is clickable
+ SideMenu.navigateToTestEnvironmentsPage();
+ }
+
+ @Test
+ public void testApplicationEnvironmentDeactivationErrorResponseFromMso() throws Exception {
+ String payload = "<html><head><title>Error</title></head><body>REASON</body></html>";
+ testApplicationEnvironmentDeactivationErrorResponseFromMso(HttpStatus.INTERNAL_SERVER_ERROR, payload, FailureType.DEACTIVATION_FAILURE);
+ testApplicationEnvironmentDeactivationErrorResponseFromMso(HttpStatus.BAD_REQUEST, payload, FailureType.DEACTIVATION_FAILURE);
+ testApplicationEnvironmentDeactivationErrorResponseFromMso(HttpStatus.INTERNAL_SERVER_ERROR, payload, FailureType.GET_STATUS_FAILURE);
+ testApplicationEnvironmentDeactivationErrorResponseFromMso(HttpStatus.BAD_REQUEST, payload, FailureType.GET_STATUS_FAILURE);
+ }
+
+ public void testApplicationEnvironmentDeactivationErrorResponseFromMso(HttpStatus errorStatus, String payload, FailureType failureType) throws Exception {
+ String envId = ENV_ID_FOR_DEACTIVATION;
+ payload = payload.replace("REASON", errorStatus.getReasonPhrase());
+ SimulatorApi.registerExpectation("environment/activate/get_operational_environments_aai1.json");
+ switch (failureType) {
+ case DEACTIVATION_FAILURE:
+ SimulatorApi.registerExpectation("environment/deactivate/error_deactivate_operational_environment.json",
+ ImmutableMap.of("ERROR_CODE", errorStatus.value(), "ENV-UUID", envId,"ERROR_PAYLOAD", payload));
+ break;
+ case GET_STATUS_FAILURE:
+ SimulatorApi.registerExpectation("environment/deactivate/post_deactivate_operational_environment.json",
+ ImmutableMap.of("ENV-UUID", envId));
+ break;
+ }
+ SimulatorApi.registerExpectation("environment/status/get_cloud_resources_request_status_bad_response.json",
+ ImmutableMap.of("ERROR_CODE", errorStatus.value(), "ENV-UUID", envId, "ERROR_PAYLOAD", payload));
+ deactivateEnv(envId);
+
+ Wait.waitByClassAndText("error", "System failure", 60);
+ Wait.waitByClassAndText("log", errorStatus.getReasonPhrase(), 60);
+ Wait.waitByClassAndText("log", payload, 60);
+ vidBasePage.clickCloseButton();
+
+ GeneralUIUtils.ultimateWait();
+
+ WebElement status = Get.byId(Constants.TestEnvironments.environmentStatusIdPrefix + envId);
+ assertEquals(Constants.ACTIVE, status.getText());
+ //make sure page is clickable
+ SideMenu.navigateToTestEnvironmentsPage();
+ }
+
+
+}
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
new file mode 100644
index 000000000..5607496dc
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/test/ReadOnlyTest.java
@@ -0,0 +1,64 @@
+package vid.automation.test.test;
+
+import org.junit.Assert;
+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.testng.annotations.Test;
+import vid.automation.test.Constants;
+import vid.automation.test.model.User;
+import vid.automation.test.sections.SearchExistingPage;
+import vid.automation.test.sections.SideMenu;
+import vid.automation.test.services.UsersService;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+/**
+ * Created by Oren on 7/16/17.
+ */
+public class ReadOnlyTest extends VidBaseTestCase {
+ UsersService usersService = new UsersService();
+
+ public ReadOnlyTest() throws IOException {
+ }
+
+ @Override
+ protected UserCredentials getUserCredentials() {
+ User user = usersService.getUser(Constants.Users.READONLY);
+ return new UserCredentials(user.credentials.userId, user.credentials.password, "", "", "");
+ }
+
+ @Test
+ public void testBrowsASDCReadOnly() {
+ SideMenu.navigateToBrowseASDCPage();
+ Assert.assertTrue(isDeployBtnDisabled());
+ }
+
+ private boolean isDeployBtnDisabled(){
+ WebElement deployBtn = GeneralUIUtils.getWebElementBy(By.className(Constants.BrowseASDC.DEPOLY_SERVICE_CLASS));
+ return !deployBtn.isEnabled();
+ }
+
+ @Test
+ public void testSearchExistingReadOnly() {
+ String UUID = "1dddde21-daad-4433-894e-bd715e98d587";
+ SearchExistingPage searchExistingPage = new SearchExistingPage();
+ SideMenu.navigateToSearchExistingPage();
+ searchExistingPage.searchForInstanceByUuid(UUID);
+ searchExistingPage.clickSubmitButton();
+ assertViewEditButtonState(Constants.VIEW_BUTTON_TEXT, UUID);
+ searchExistingPage.clickEditViewByInstanceId(UUID);
+ searchExistingPage.checkForEditButtons();
+ }
+
+ @Test
+ private void testCreateNewInstanceReadOnly() {
+ SideMenu.navigateToCreateNewServicePage();
+ assertDropdownPermittedItemsByValue(new ArrayList<String>(), Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
+ }
+
+
+}
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
new file mode 100644
index 000000000..f3261a21a
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/test/SearchExistingInstanceTest.java
@@ -0,0 +1,83 @@
+package vid.automation.test.test;
+
+import org.testng.annotations.Test;
+import vid.automation.test.Constants;
+import vid.automation.test.infra.Click;
+import vid.automation.test.model.User;
+import vid.automation.test.sections.SearchExistingPage;
+import vid.automation.test.sections.SideMenu;
+import vid.automation.test.services.UsersService;
+
+import java.io.IOException;
+
+public class SearchExistingInstanceTest extends VidBaseTestCase {
+
+ private UsersService usersService = new UsersService();
+
+ public SearchExistingInstanceTest() throws IOException {
+ }
+
+ @Test
+ 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() throws Exception {
+ User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
+ relogin(user.credentials);
+ SearchExistingPage searchExistingPage = new SearchExistingPage();
+ SideMenu.navigateToSearchExistingPage();
+ Click.byId(Constants.EditExistingInstance.SELECT_OWNING_ENTITY_ID);
+ Thread.sleep(1000);
+ Click.byText("owning-entity-SDN-RXU4");
+ searchExistingPage.clickSubmitButton();
+ searchExistingPage.clickEditViewByInstanceId("SDN-RXU4-B-servInstance-E1802");
+ }
+
+ @Test
+ private void testSearchExistingInstanceByOwningEntityMultiValue() throws Exception {
+ User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
+ relogin(user.credentials);
+ SearchExistingPage searchExistingPage = new SearchExistingPage();
+ SideMenu.navigateToSearchExistingPage();
+ Click.byId(Constants.EditExistingInstance.SELECT_OWNING_ENTITY_ID);
+ Thread.sleep(1000);
+ Click.byText("owning-entity-SDN-RXU4");
+ Click.byText("owning-entity-SDN-LT1");
+ searchExistingPage.clickSubmitButton();
+ searchExistingPage.clickEditViewByInstanceId("SDN-LT1-B-servInstance-E1802");
+ }
+
+ @Test
+ private void testSearchExistingInstanceByProjectSingleValue() throws Exception {
+ User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
+ relogin(user.credentials);
+ SearchExistingPage searchExistingPage = new SearchExistingPage();
+ SideMenu.navigateToSearchExistingPage();
+ Click.byId(Constants.EditExistingInstance.SELECT_PROJECT_ID);
+ Thread.sleep(1000);
+ Click.byText("x1");
+ searchExistingPage.clickSubmitButton();
+ searchExistingPage.clickEditViewByInstanceId("SDN-LT1-B-servInstance-E1802");
+ }
+
+ @Test
+ private void testSearchExistingInstanceByProjectMultiValue() throws Exception {
+ User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
+ relogin(user.credentials);
+ SearchExistingPage searchExistingPage = new SearchExistingPage();
+ SideMenu.navigateToSearchExistingPage();
+ Click.byId(Constants.EditExistingInstance.SELECT_PROJECT_ID);
+ Thread.sleep(1000);
+ Click.byText("x1");
+ Click.byText("x3");
+ searchExistingPage.clickSubmitButton();
+ searchExistingPage.clickEditViewByInstanceId("SDN-LT1-B-servInstance-E1802");
+ }
+}
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
new file mode 100644
index 000000000..d4e09be2d
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/test/VidBaseTestCase.java
@@ -0,0 +1,235 @@
+package vid.automation.test.test;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Assert;
+import org.openecomp.sdc.ci.tests.datatypes.Configuration;
+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.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import vid.automation.test.Constants;
+import vid.automation.test.infra.Click;
+import vid.automation.test.infra.SelectOption;
+import vid.automation.test.model.*;
+import vid.automation.test.sections.*;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.testng.AssertJUnit.fail;
+
+
+public class VidBaseTestCase extends SetupCDTest {
+
+ static String currentUserId = null;
+
+ @Override
+ protected UserCredentials getUserCredentials() {
+ ObjectMapper mapper = new ObjectMapper().enableDefaultTyping();
+ try {
+ File configFile = FileHandling.getConfigFile("credentials");
+ if(!configFile.exists()) {
+ String basePath = System.getProperty("BASE_PATH");
+ configFile = new File( basePath + File.separator + "conf" + File.separator + "credentials");
+ }
+ Credentials credentials = mapper.readValue(configFile, Credentials.class);
+ return new UserCredentials(credentials.userId, credentials.password, "", "", "");
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ @Override
+ protected org.openecomp.sdc.ci.tests.datatypes.Configuration getEnvConfiguration() {
+
+ try {
+ String envUrl = System.getProperty("ENV_URL");
+ boolean isCustomLogin = Boolean.valueOf(System.getProperty("CUSTOM_LOGIN"));
+ Configuration configuration = new org.openecomp.sdc.ci.tests.datatypes.Configuration(envUrl, isCustomLogin);
+ //configuration.setBrowser("chorme");
+ return configuration;
+ //return new org.openecomp.sdc.ci.tests.datatypes.Configuration(envUrl, isCustomLogin);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ @Override
+ protected void loginToLocalSimulator(UserCredentials userCredentials) {
+ LoginExternalPage.performLoginExternal(userCredentials);
+ }
+
+ protected void relogin(Credentials credentials) throws Exception {
+ if (!credentials.userId.equals(currentUserId)) {
+ currentUserId = credentials.userId;
+ UserCredentials userCredentials = new UserCredentials(credentials.userId,
+ credentials.password, "", "", "");
+ reloginWithNewRole(userCredentials);
+ }
+ }
+
+ /**
+ * Validates that permitted options are enabled and others are disabled.
+ *
+ * @param permittedItems the list of permitted items.
+ * @param dropdownOptionsClassName the class name of the specific dropdown options.
+ * @return true, if all dropdown options disabled state is according to the permissions.
+ */
+ protected void assertDropdownPermittedItemsByValue(ArrayList<String> permittedItems, String dropdownOptionsClassName) {
+ GeneralUIUtils.ultimateWait();
+ List<WebElement> optionsList =
+ GeneralUIUtils.getWebElementsListBy(By.className(dropdownOptionsClassName), 30);
+ for (WebElement option :
+ optionsList) {
+ String optionValue = option.getAttribute("value");
+ if ((option.isEnabled() && !permittedItems.contains(optionValue)) ||
+ !option.isEnabled() && permittedItems.contains(optionValue)) {
+ fail(Constants.DROPDOWN_PERMITTED_ASSERT_FAIL_MESSAGE);
+ }
+ }
+ }
+
+ protected void assertAllIsPermitted(String dropdownOptionsClassName) {
+ GeneralUIUtils.ultimateWait();
+ List<WebElement> optionsList =
+ GeneralUIUtils.getWebElementsListBy(By.className(dropdownOptionsClassName), 30);
+ for (WebElement option :
+ optionsList) {
+ String optionValue = option.getAttribute("value");
+ if (!option.isEnabled()) {
+ fail(Constants.DROPDOWN_PERMITTED_ASSERT_FAIL_MESSAGE);
+ }
+ }
+ }
+
+ protected void assertDropdownPermittedItemsByName(ArrayList<String> permittedItems, String dropdownOptionsClassName) {
+ 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);
+ }
+ }
+ }
+
+ protected void assertViewEditButtonState(String expectedButtonText, String UUID) {
+ WebElement viewEditWebElement = GeneralUIUtils.getWebElementByTestID(Constants.VIEW_EDIT_TEST_ID_PREFIX + UUID, 100);
+ Assert.assertEquals(expectedButtonText, viewEditWebElement.getText());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ protected void addVNF(String name, String lcpRegion, String tenant, String suppressRollback,
+ String legacyRegion, String productFamily, ArrayList<String> permittedTenants) throws InterruptedException {
+ ViewEditPage viewEditPage = new ViewEditPage();
+
+ viewEditPage.selectNodeInstanceToAdd(name);
+ viewEditPage.generateAndSetInstanceName(Constants.ViewEdit.VNF_INSTANCE_NAME_PREFIX);
+ viewEditPage.selectProductFamily(productFamily);
+ viewEditPage.selectLCPRegion(lcpRegion);
+
+ assertDropdownPermittedItemsByValue(permittedTenants, Constants.ViewEdit.TENANT_OPTION_CLASS);
+ viewEditPage.selectTenant(tenant);
+
+ Click.onFirstSelectOptionById(Constants.OwningEntity.PLATFORM_SELECT_TEST_ID);
+ SelectOption.selectFirstTwoOptionsFromMultiselectById(Constants.OwningEntity.LOB_SELECT_TEST_ID);
+
+ viewEditPage.selectSuppressRollback(suppressRollback);
+
+ viewEditPage.setLegacyRegion(legacyRegion);
+
+ viewEditPage.clickConfirmButton();
+ assertSuccessfulVNFCreation();
+ viewEditPage.clickCloseButton();
+ GeneralUIUtils.ultimateWait();
+ }
+
+ protected void addVFModule(String name, String lcpRegion, String tenant, String suppressRollback,
+ String legacyRegion, ArrayList<String> permittedTenants) {
+ ViewEditPage viewEditPage = new ViewEditPage();
+
+ viewEditPage.selectVolumeGroupToAdd(name);
+ viewEditPage.generateAndSetInstanceName(Constants.ViewEdit.VF_MODULE_INSTANCE_NAME_PREFIX);
+ viewEditPage.selectLCPRegion(lcpRegion);
+
+ assertDropdownPermittedItemsByValue(permittedTenants, Constants.ViewEdit.TENANT_OPTION_CLASS);
+ viewEditPage.selectTenant(tenant);
+
+ viewEditPage.selectSuppressRollback(suppressRollback);
+
+ viewEditPage.setLegacyRegion(legacyRegion);
+
+ viewEditPage.clickConfirmButton();
+ assertSuccessfulVFModuleCreation();
+ viewEditPage.clickCloseButton();
+ GeneralUIUtils.ultimateWait();
+ }
+
+ protected void addVolumeGroup(String name, String lcpRegion, String tenant, String suppressRollback,
+ String legacyRegion, ArrayList<String> permittedTenants) {
+ ViewEditPage viewEditPage = new ViewEditPage();
+
+ viewEditPage.selectVolumeGroupToAdd(name);
+ viewEditPage.generateAndSetInstanceName(Constants.ViewEdit.VOLUME_GROUP_INSTANCE_NAME_PREFIX);
+ viewEditPage.selectLCPRegion(lcpRegion);
+
+ assertDropdownPermittedItemsByValue(permittedTenants, Constants.ViewEdit.TENANT_OPTION_CLASS);
+ viewEditPage.selectTenant(tenant);
+
+ viewEditPage.selectSuppressRollback(suppressRollback);
+
+ viewEditPage.setLegacyRegion(legacyRegion);
+
+ viewEditPage.clickConfirmButton();
+ assertSuccessfulVolumeGroupCreation();
+ viewEditPage.clickCloseButton();
+ GeneralUIUtils.ultimateWait();
+ }
+
+ void assertSuccessfulVNFCreation() {
+ boolean byText = GeneralUIUtils.findAndWaitByText(Constants.ViewEdit.VNF_CREATED_SUCCESSFULLY_TEXT, 100);
+ Assert.assertTrue(Constants.ViewEdit.VNF_CREATION_FAILED_MESSAGE, byText);
+ }
+
+ void assertSuccessfulPNFAssociation() {
+ //TODO
+ boolean byText = GeneralUIUtils.findAndWaitByText(Constants.PnfAssociation.PNF_ASSOCIATED_SUCCESSFULLY_TEXT, 100);
+ Assert.assertTrue(Constants.PnfAssociation.PNF_ASSOCIATED_FAILED_MESSAGE, byText);
+ }
+ void assertSuccessfulVolumeGroupCreation() {
+ boolean byText = GeneralUIUtils.findAndWaitByText(Constants.ViewEdit.VOLUME_GROUP_CREATED_SUCCESSFULLY_TEXT, 100);
+ Assert.assertTrue(Constants.ViewEdit.VOLUME_GROUP_CREATION_FAILED_MESSAGE, byText);
+ }
+
+ void assertSuccessfulVFModuleCreation() {
+ boolean byText = GeneralUIUtils.findAndWaitByText(Constants.ViewEdit.VF_MODULE_CREATED_SUCCESSFULLY_TEXT, 100);
+ Assert.assertTrue(Constants.ViewEdit.VF_MODULE_CREATION_FAILED_MESSAGE, byText);
+ }
+
+ void goToExistingInstanceById(String instanceUUID) {
+ SearchExistingPage searchExistingPage = new SearchExistingPage();
+ SideMenu.navigateToSearchExistingPage();
+ searchExistingPage.searchForInstanceByUuid(instanceUUID);
+ assertViewEditButtonState( Constants.VIEW_EDIT_BUTTON_TEXT, instanceUUID);
+ searchExistingPage.clickEditViewByInstanceId(instanceUUID);
+ }
+
+ void goToExistingInstanceByName(String instanceName) {
+ SearchExistingPage searchExistingPage = new SearchExistingPage();
+ SideMenu.navigateToSearchExistingPage();
+ searchExistingPage.searchForInstanceByName(instanceName);
+ WebElement instanceIdRow = GeneralUIUtils.getWebElementByTestID(Constants.INSTANCE_ID_FOR_NAME_TEST_ID_PREFIX + instanceName, 30);
+ String instanceId = instanceIdRow.getText();
+ assertViewEditButtonState( Constants.VIEW_EDIT_BUTTON_TEXT, instanceId);
+ searchExistingPage.clickEditViewByInstanceId(instanceId);
+ }
+
+}
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
new file mode 100644
index 000000000..f38433bde
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/test/ViewEditServiceInstanceTest.java
@@ -0,0 +1,158 @@
+package vid.automation.test.test;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.openqa.selenium.WebElement;
+import org.testng.annotations.Test;
+import vid.automation.test.Constants;
+import vid.automation.test.infra.Exists;
+import vid.automation.test.infra.Get;
+import vid.automation.test.infra.Wait;
+import vid.automation.test.model.User;
+import vid.automation.test.sections.ViewEditPage;
+import vid.automation.test.services.BulkRegistration;
+import vid.automation.test.services.SimulatorApi;
+import vid.automation.test.services.UsersService;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+public class ViewEditServiceInstanceTest extends VidBaseTestCase {
+
+ private ViewEditPage viewEditPage = new ViewEditPage();
+ private UsersService usersService = new UsersService();
+ private String serviceInstanceId = "3f93c7cb-2fd0-4557-9514-e189b7b04f9d";
+ private String serviceInstanceId2 ="f36f5734-e9df-4fbf-9f35-61be13f028a1";
+ private final String DEACTIVATE_ACTION = "deactivate";
+ private final String ACTIVATE_ACTION = "activate";
+ private List<String> pnfs = Arrays.asList("SANITY6785cce9", "tesai371ve2");
+
+ public ViewEditServiceInstanceTest() throws IOException { }
+
+ @Test
+ public void testGetAssociatedPnfsForServiceInstance() {
+ SimulatorApi.clearAll();
+ BulkRegistration.searchExistingServiceInstance();
+ BulkRegistration.getAssociatedPnfs();
+
+ goToExistingInstanceById(serviceInstanceId);
+ for (String pnf: pnfs) {
+ viewEditPage.getPnf(pnf);
+ }
+ }
+
+ @Test
+ public void testPnfsNotExistForServiceInstance() {
+ SimulatorApi.clearAll();
+ BulkRegistration.searchExistingServiceInstance();
+
+ goToExistingInstanceById(serviceInstanceId);
+ assertNoPnfExists();
+ }
+ @Test
+ public void testActivateServiceInstance()throws Exception {
+ SimulatorApi.clearAll();
+ BulkRegistration.searchExistingServiceInstance("Created");
+ BulkRegistration.activateServiceInstance(ACTIVATE_ACTION);
+ goToExistingInstanceById(serviceInstanceId);
+ viewEditPage.assertButtonState(Constants.ViewEdit.ACTIVATE_BUTTON_TEST_ID,true);
+ viewEditPage.assertButtonState(Constants.ViewEdit.DEACTIVATE_BUTTON_TEST_ID,false);
+ viewEditPage.clickActivateButton();
+ viewEditPage.assertMsoRequestModal("COMPLETE - Success");
+ viewEditPage.clickCloseButton();
+ }
+
+ @Test
+ public void testActivateServiceInstanceError()throws Exception {
+ SimulatorApi.clearAll();
+ BulkRegistration.searchExistingServiceInstance("Created");
+ BulkRegistration.activateServiceInstanceError(ACTIVATE_ACTION);
+ goToExistingInstanceById(serviceInstanceId);
+ viewEditPage.assertButtonState(Constants.ViewEdit.ACTIVATE_BUTTON_TEST_ID,true);
+ viewEditPage.assertButtonState(Constants.ViewEdit.DEACTIVATE_BUTTON_TEST_ID,false);
+ viewEditPage.clickActivateButton();
+ viewEditPage.assertMsoRequestModal("Error");
+ viewEditPage.clickCloseButton();
+ }
+ @Test
+ public void testDeactivateServiceInstance(){
+ SimulatorApi.clearAll();
+ BulkRegistration.searchExistingServiceInstance("Active");
+ BulkRegistration.activateServiceInstance(DEACTIVATE_ACTION);
+ goToExistingInstanceById(serviceInstanceId);
+ viewEditPage.assertButtonState(Constants.ViewEdit.DEACTIVATE_BUTTON_TEST_ID,true);
+ viewEditPage.assertButtonState(Constants.ViewEdit.ACTIVATE_BUTTON_TEST_ID,false);
+ viewEditPage.clickDeactivateButton();
+ viewEditPage.assertMsoRequestModal("COMPLETE - Success");
+ SimulatorApi.clearAll();
+ BulkRegistration.searchExistingServiceInstance("PendingDelete");
+ BulkRegistration.activateServiceInstance(ACTIVATE_ACTION);
+ viewEditPage.clickCloseButton();
+ viewEditPage.assertButtonState(Constants.ViewEdit.ACTIVATE_BUTTON_TEST_ID,true);
+ viewEditPage.assertButtonState(Constants.ViewEdit.DEACTIVATE_BUTTON_TEST_ID,false);
+ }
+
+ @Test
+ public void testDeactivateServiceInstanceError()throws Exception {
+ SimulatorApi.clearAll();
+ BulkRegistration.searchExistingServiceInstance("Active");
+ BulkRegistration.activateServiceInstanceError(DEACTIVATE_ACTION);
+ goToExistingInstanceById(serviceInstanceId);
+ viewEditPage.assertButtonState(Constants.ViewEdit.ACTIVATE_BUTTON_TEST_ID,false);
+ viewEditPage.assertButtonState(Constants.ViewEdit.DEACTIVATE_BUTTON_TEST_ID,true);
+ viewEditPage.clickDeactivateButton();
+ viewEditPage.assertMsoRequestModal("Error");
+ viewEditPage.clickCloseButton();
+ }
+ @Test
+ public void testSuccessDissociatePnfFromServiceInstance() throws Exception {
+ SimulatorApi.clearAll();
+ BulkRegistration.searchExistingServiceInstance();
+ BulkRegistration.getAssociatedPnfs();
+ BulkRegistration.dissociatePnf();
+ goToExistingInstanceById(serviceInstanceId);
+ dissociatePnf(pnfs.get(0)); //SANITY6785cce9
+ viewEditPage.assertMsoRequestModal("COMPLETE - Success");
+ viewEditPage.clickCloseButton();
+ }
+
+ @Test
+ public void testFailDissociatePnfFromServiceInstance() throws Exception {
+ SimulatorApi.clearAll();
+ BulkRegistration.searchExistingServiceInstance();
+ BulkRegistration.getAssociatedPnfs();
+ SimulatorApi.registerExpectation(Constants.RegisterToSimulator.pProbe.REMOVE_PNF_RELATIONSHIP_ERROR);
+
+ goToExistingInstanceById(serviceInstanceId);
+ dissociatePnf(pnfs.get(0)); //SANITY6785cce9
+ viewEditPage.assertMsoRequestModal("Error");
+ viewEditPage.clickCloseButton();
+ }
+
+ private void assertNoPnfExists() {
+ WebElement pnfElement = viewEditPage.getPnf("");
+ Assert.assertNull("Pnf found under service instance", pnfElement);
+ }
+
+ private void dissociatePnf(String pnfName) throws InterruptedException {
+ viewEditPage.clickDissociatePnfButton(pnfName);
+ assertDissociateConfirmModal(pnfName);
+ }
+
+ private void assertDissociateConfirmModal(String pnfName) {
+ Wait.modalToBeDisplayed();
+ Assert.assertTrue(Exists.modal());
+ Assert.assertTrue(Exists.byCssSelectorAndText(".modal-body span", String.format(Constants.ViewEdit.DISSOCIATE_CONFIRM_MODAL_TEXT, pnfName)));
+ WebElement confirmBtn = Get.byId(Constants.ViewEdit.DISSOCIATE_CONFIRM_MODAL_BTN_ID);
+ Assert.assertNotNull(confirmBtn);
+ confirmBtn.click();
+ Wait.modalToDisappear();
+ }
+ @Before
+ public void before() throws Exception {
+ User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
+ relogin(user.credentials);
+ }
+
+}
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
new file mode 100644
index 000000000..7652e09b7
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/utils/ReadFile.java
@@ -0,0 +1,33 @@
+package vid.automation.test.utils;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import vid.automation.test.model.User;
+import vid.automation.test.model.UsersObject;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+
+public class ReadFile {
+ public static <T> T getJsonFile(String fileName, Class<T> clazz) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ T list;
+ try {
+ File testCaseFile = FileHandling.getConfigFile(fileName);
+ if(!testCaseFile.exists()) {
+ String basePath = System.getProperty("BASE_PATH");
+ testCaseFile = new File( basePath + File.separator + "conf" + File.separator + fileName);
+ }
+ list = (T) mapper.readValue(testCaseFile, clazz);
+ return list;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+}