2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.ci.tests.US;
23 import java.util.ArrayList;
24 import java.util.List;
27 import org.openecomp.sdc.ci.tests.datatypes.*;
28 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
29 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
30 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
31 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
32 import org.openecomp.sdc.ci.tests.pages.CompositionPage;
33 import org.openecomp.sdc.ci.tests.utilities.FileHandling;
34 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
35 import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
36 import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
37 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
38 import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
39 import org.testng.annotations.Test;
41 import com.clearspring.analytics.util.Pair;
43 public class Service_Tests_UI extends SetupCDTest{
45 public Service_Tests_UI() {
48 // US839610 - E2E Declare VL / CP properties as inputs in service level
50 public void declareVL_CP_InputsInServiceLevel() throws Exception {
51 String vnfFile = "FDNT.zip";
52 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
53 Pair<String, VendorSoftwareProductObject> VspName = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
54 ServiceReqDetails servicemetadata = ElementFactory.getDefaultService(getUser());
55 ServiceUIUtils.createService(servicemetadata, getUser());
56 GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION);
57 CanvasManager service_CanvasManager = CanvasManager.getCanvasManager();
58 CompositionPage.searchForElement(VspName.left);
59 GeneralUIUtils.waitForLoader();
60 CanvasElement vfi_Element = service_CanvasManager.createElementOnCanvas(VspName.left);
61 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue())
63 GeneralUIUtils.findComponentAndClick(servicemetadata.getName());
64 GeneralUIUtils.moveToStep(StepsEnum.INPUTS);
65 GeneralUIUtils.getWebElementByTestID("inputs-vf-instance-1").click();
66 // GeneralUIUtils.onNameClicked(input);
69 public void CreateServiceWithCpInstance() throws Exception {
70 String vnfFile = "FDNT.zip";
71 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
72 Pair<String, VendorSoftwareProductObject> VspName = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
73 ServiceReqDetails servicemetadata = ElementFactory.getDefaultService(getUser());
74 ServiceUIUtils.createService(servicemetadata, getUser());
75 GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION);
76 CanvasManager service_CanvasManager = CanvasManager.getCanvasManager();
77 CompositionPage.searchForElement(VspName.left);
78 GeneralUIUtils.waitForLoader();
79 CanvasElement vfi_Element = service_CanvasManager.createElementOnCanvas(VspName.left);
80 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue())
82 GeneralUIUtils.findComponentAndClick(servicemetadata.getName());
83 GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_VIEW);
84 String version = GeneralUIUtils.getWebElementByTestID("versionHeader").getText();
85 RestResponse service = ServiceRestUtils.getServiceByNameAndVersion(getUser(), servicemetadata.getName(),
86 version.substring(1));
87 List<String> serviceResponseArray = new ArrayList<String>();
88 serviceResponseArray =LocalGeneralUtilities.getValuesFromJsonArray(service);
89 servicemetadata.setUniqueId(serviceResponseArray.get(0));
90 RestResponse serviceResponse = ServiceRestUtils.getService(servicemetadata, getUser());
91 if (serviceResponseArray.get(0).contains("VL")) {
92 System.out.println("OK");
98 protected UserRoleEnum getRole() {
99 return UserRoleEnum.DESIGNER;