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.CanvasElement;
28 import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
29 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
30 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
31 import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
32 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
33 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
34 import org.openecomp.sdc.ci.tests.execute.sanity.Onboard;
35 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
36 import org.openecomp.sdc.ci.tests.pages.CompositionPage;
37 import org.openecomp.sdc.ci.tests.utilities.FileHandling;
38 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
39 import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
40 import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
41 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
42 import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
43 import org.testng.annotations.Test;
45 import com.clearspring.analytics.util.Pair;
47 public class Service_Tests_UI extends SetupCDTest{
49 public Service_Tests_UI() {
50 // TODO Auto-generated constructor stub
53 // US839610 - E2E Declare VL / CP properties as inputs in service level
55 public void declareVL_CP_InputsInServiceLevel() throws Exception {
56 String vnfFile = "FDNT.zip";
57 Pair<String,Map<String,String>> VspName =OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
58 ServiceReqDetails servicemetadata = ElementFactory.getDefaultService(getUser());
59 ServiceUIUtils.createService(servicemetadata, getUser());
60 GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION);
61 CanvasManager service_CanvasManager = CanvasManager.getCanvasManager();
62 CompositionPage.searchForElement(VspName.left);
63 GeneralUIUtils.waitForLoader();
64 CanvasElement vfi_Element = service_CanvasManager.createElementOnCanvas(VspName.left);
65 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue())
67 GeneralUIUtils.findComponentAndClick(servicemetadata.getName());
68 GeneralUIUtils.moveToStep(StepsEnum.INPUTS);
69 GeneralUIUtils.getWebElementByTestID("inputs-vf-instance-1").click();
70 // GeneralUIUtils.onNameClicked(input);
73 public void CreateServiceWithCpInstance() throws Exception {
74 String vnfFile = "FDNT.zip";
75 Pair<String,Map<String,String>> VspName =OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
76 ServiceReqDetails servicemetadata = ElementFactory.getDefaultService(getUser());
77 ServiceUIUtils.createService(servicemetadata, getUser());
78 GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION);
79 CanvasManager service_CanvasManager = CanvasManager.getCanvasManager();
80 CompositionPage.searchForElement(VspName.left);
81 GeneralUIUtils.waitForLoader();
82 CanvasElement vfi_Element = service_CanvasManager.createElementOnCanvas(VspName.left);
83 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue())
85 GeneralUIUtils.findComponentAndClick(servicemetadata.getName());
86 GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_VIEW);
87 String version = GeneralUIUtils.getWebElementByTestID("versionHeader").getText();
88 RestResponse service = ServiceRestUtils.getServiceByNameAndVersion(getUser(), servicemetadata.getName(),
89 version.substring(1));
90 List<String> serviceResponseArray = new ArrayList<String>();
91 serviceResponseArray =LocalGeneralUtilities.getValuesFromJsonArray(service);
92 servicemetadata.setUniqueId(serviceResponseArray.get(0));
93 RestResponse serviceResponse = ServiceRestUtils.getService(servicemetadata, getUser());
94 if (serviceResponseArray.get(0).contains("VL")) {
95 System.out.println("OK");
101 protected UserRoleEnum getRole() {
102 // TODO Auto-generated method stub
103 return UserRoleEnum.DESIGNER;