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.execute.sanity;
23 import com.aventstack.extentreports.Status;
24 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
25 import org.openecomp.sdc.be.model.Resource;
26 import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
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.InformationalArtifactsPlaceholders;
31 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
32 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ResourceMetadataEnum;
33 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ToscaArtifactsScreenEnum;
34 import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
35 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
36 import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
37 import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
38 import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
39 import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
40 import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
41 import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
42 import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
43 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
44 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
45 import org.openecomp.sdc.ci.tests.execute.setup.AttFtpClient;
46 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
47 import org.openecomp.sdc.ci.tests.pages.CompositionPage;
48 import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
49 import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
50 import org.openecomp.sdc.ci.tests.pages.HomePage;
51 import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
52 import org.openecomp.sdc.ci.tests.pages.InputsPage;
53 import org.openecomp.sdc.ci.tests.pages.PropertiesPage;
54 import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
55 import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage;
56 import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
57 import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
58 import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis;
59 import org.openecomp.sdc.ci.tests.utilities.FileHandling;
60 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
61 import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
62 import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils;
63 import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
64 import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
65 import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
66 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
67 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
68 import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
69 import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
70 import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
71 import org.openecomp.sdc.ci.tests.verificator.VfModuleVerificator;
72 import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
73 import org.openqa.selenium.By;
74 import org.openqa.selenium.WebElement;
75 import org.testng.AssertJUnit;
76 import org.testng.annotations.BeforeClass;
77 import org.testng.annotations.BeforeMethod;
78 import org.testng.annotations.Test;
81 import java.util.ArrayList;
82 import java.util.Arrays;
83 import java.util.HashMap;
84 import java.util.List;
87 import static org.assertj.core.api.Assertions.assertThat;
90 public class VfAPI extends SetupCDTest {
92 private String filePath;
95 public void beforeClass() {
96 filePath = FileHandling.getFilePath("");
100 public void beforeTest() {
101 System.out.println("File repository is : " + filePath);
102 getExtendTest().log(Status.INFO, "File repository is : " + filePath);
105 private ResourceReqDetails createVFviaAPI() {
106 ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
107 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating VF %s", vfMetaData.getName()));
108 AtomicOperationUtils.createResourceByResourceDetails(vfMetaData, UserRoleEnum.DESIGNER, true).left().value();
114 public void updateVF() throws Exception {
117 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
118 ResourceUIUtils.createVF(resourceMetaData, getUser());
121 ResourceReqDetails updatedResource = new ResourceReqDetails();
122 updatedResource.setName(ElementFactory.getResourcePrefix() + "UpdatedName" + resourceMetaData.getName());
123 updatedResource.setDescription("kuku");
124 updatedResource.setVendorName("updatedVendor");
125 updatedResource.setVendorRelease("updatedRelease");
126 updatedResource.setContactId("ab0001");
127 updatedResource.setCategories(resourceMetaData.getCategories());
128 updatedResource.setVersion("0.1");
129 updatedResource.setResourceType(ResourceTypeEnum.VF.getValue());
130 List<String> newTags = resourceMetaData.getTags();
131 newTags.remove(resourceMetaData.getName());
132 newTags.add(updatedResource.getName());
133 updatedResource.setTags(newTags);
134 ResourceUIUtils.updateResource(updatedResource, getUser());
136 VfVerificator.verifyVFMetadataInUI(updatedResource);
137 VfVerificator.verifyVFUpdated(updatedResource, getUser());
142 public void vfcLinkedToComputeInVfFlowApi() throws Exception {
143 String fileName = "vFW_VFC2.yml";
144 ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
148 Resource vfc = AtomicOperationUtils.importResource(filePath, fileName).left().value();
149 atomicResourceMetaData.setName(vfc.getName());
151 //Certify VFC via API
152 vfc = (Resource) AtomicOperationUtils.changeComponentState(vfc, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
155 ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
156 AtomicOperationUtils.createResourceByResourceDetails(vfMetaData, UserRoleEnum.DESIGNER, true).left().value();
158 //Go to Catalog and find the created VF
159 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
160 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
162 //Composition - drag the created VFC and another element, link between them
163 DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
164 CanvasManager canvasManager = CanvasManager.getCanvasManager();
165 CompositionPage.searchForElement(String.format("%s %s", LeftPanelCanvasItems.COMPUTE.getValue(), "1.0"));
166 CanvasElement computeElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
167 CompositionPage.searchForElement(atomicResourceMetaData.getName());
168 CanvasElement cpElement = canvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
169 AssertJUnit.assertNotNull(cpElement);
170 ServiceVerificator.verifyNumOfComponentInstances(vfMetaData, "0.1", 2, getUser());
171 canvasManager.linkElements(cpElement, computeElement);
173 vfMetaData.setVersion("0.1");
174 VfVerificator.verifyLinkCreated(vfMetaData, getUser(), 1);
176 ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0");
183 public void addUpdateDeleteDeploymentArtifactToVfTestApi() throws Exception {
185 ResourceReqDetails vfMetaData = createVFviaAPI();
187 //Go to Catalog and find the created VF
188 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
189 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
191 ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
193 List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
194 deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"));
195 deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "YANG_XML"));
196 for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
197 DeploymentArtifactPage.clickAddNewArtifact();
198 ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
200 AssertJUnit.assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));
202 String newDescription = "new description";
203 DeploymentArtifactPage.clickEditArtifact(deploymentArtifactList.get(0).getArtifactLabel());
204 DeploymentArtifactPage.artifactPopup().insertDescription(newDescription);
205 DeploymentArtifactPage.artifactPopup().clickDoneButton();
206 String actualArtifactDescription = DeploymentArtifactPage.getArtifactDescription(deploymentArtifactList.get(0).getArtifactLabel());
207 AssertJUnit.assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
209 DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifactList.get(0).getArtifactLabel());
210 DeploymentArtifactPage.clickOK();
211 AssertJUnit.assertTrue("artifact " + deploymentArtifactList.get(0).getArtifactLabel() + "is not deleted", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size() - 1));
213 AssertJUnit.assertTrue("artifact " + deploymentArtifactList.get(1).getArtifactLabel() + "is not displayed", DeploymentArtifactPage.clickOnArtifactDescription(deploymentArtifactList.get(1).getArtifactLabel()).isDisplayed());
218 public void addUpdateDeleteInformationalArtifactApi() throws Exception {
220 ResourceReqDetails vfMetaData = createVFviaAPI();
222 //Go to Catalog and find the created VF
223 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
224 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
226 ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
228 ArtifactInfo informationalArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER");
229 InformationalArtifactPage.clickAddNewArtifact();
230 ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact);
232 AssertJUnit.assertTrue("artifact table does not contain artifacts uploaded", InformationalArtifactPage.checkElementsCountInTable(1));
234 String newDescription = "new description";
235 InformationalArtifactPage.clickEditArtifact(informationalArtifact.getArtifactLabel());
236 InformationalArtifactPage.artifactPopup().insertDescription(newDescription);
237 InformationalArtifactPage.artifactPopup().clickDoneButton();
238 String actualArtifactDescription = InformationalArtifactPage.getArtifactDescription(informationalArtifact.getArtifactLabel());
239 AssertJUnit.assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
241 InformationalArtifactPage.clickDeleteArtifact(informationalArtifact.getArtifactLabel());
242 InformationalArtifactPage.clickOK();
243 AssertJUnit.assertTrue("artifact " + informationalArtifact.getArtifactLabel() + "is not deleted", InformationalArtifactPage.checkElementsCountInTable(0));
248 public void addPropertiesToVfcInstanceInVfTestApi() throws Exception {
250 String fileName = "vFW_VFC.yml";
251 ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
255 Resource vfc = AtomicOperationUtils.importResource(filePath, fileName).left().value();
256 atomicResourceMetaData.setName(vfc.getName());
258 //Certify VFC via API
259 vfc = (Resource) AtomicOperationUtils.changeComponentState(vfc, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
262 ResourceReqDetails vfMetaData = createVFviaAPI();
264 //Go to Catalog and find the created VF
265 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
266 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
268 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
269 CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
270 CompositionPage.searchForElement(atomicResourceMetaData.getName());
271 CanvasElement vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
273 vfCanvasManager.clickOnCanvaElement(vfcElement);
274 CompositionPage.showPropertiesAndAttributesTab();
275 List<WebElement> properties = CompositionPage.getProperties();
276 String propertyValue = "abc123";
277 for (int i = 0; i < 2; i++) {
278 WebElement findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-and-attribute-label"));
280 PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(propertyValue);
281 PropertiesPage.getPropertyPopup().clickSave();
284 findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-value"));
285 AssertJUnit.assertTrue(findElement.getText().equals(propertyValue));
288 ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
293 public void changeInstanceVersionTest() throws Exception{
295 ResourceReqDetails atomicResourceMetaData = null;
296 ResourceReqDetails vfMetaData = null;
297 CanvasManager vfCanvasManager;
298 CanvasElement vfcElement = null;
299 String fileName = "vFW_VFC3.yml";
301 atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
302 ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
303 ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
305 vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
306 ResourceUIUtils.createVF(vfMetaData, getUser());
307 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
308 vfCanvasManager = CanvasManager.getCanvasManager();
309 CompositionPage.searchForElement(atomicResourceMetaData.getName());
310 vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
313 CompositionPage.clickSubmitForTestingButton(vfMetaData.getName());
317 String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
318 String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
319 AssertJUnit.assertTrue(errorMessage.contains(checkUIResponseOnError));
322 reloginWithNewRole(UserRoleEnum.TESTER);
323 GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
324 TesterOperationPage.certifyComponent(atomicResourceMetaData.getName());
326 reloginWithNewRole(UserRoleEnum.DESIGNER);
327 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
328 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
329 vfCanvasManager = CanvasManager.getCanvasManager();
330 CompositionPage.changeComponentVersion(vfCanvasManager, vfcElement, "1.0");
333 VfVerificator.verifyInstanceVersion(vfMetaData, getUser(), atomicResourceMetaData.getName(), "1.0");
337 ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0");
342 // future removed from ui
343 @Test(enabled = true)
344 public void addUpdateDeleteSimplePropertiesToVfTest() throws Exception {
345 ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
346 ResourceUIUtils.createVF(vfMetaData, getUser());
348 ResourceGeneralPage.getLeftMenu().moveToPropertiesScreen();
349 List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER);
350 int propertiesCount = PropertiesPage.getElemenetsFromTable().size();
351 for (PropertyTypeEnum prop : propertyList) {
352 PropertiesUIUtils.addNewProperty(prop);
354 AssertJUnit.assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> PropertiesPage.getElemenetsFromTable()));
355 VfVerificator.verifyPropertiesInUI(propertyList);
356 PropertiesPage.verifyTotalProperitesField(propertiesCount + propertyList.size());
359 PropertyTypeEnum prop = propertyList.get(0);
360 prop.setDescription("updatedDescription");
361 prop.setValue("value");
362 PropertiesUIUtils.updateProperty(prop);
364 PropertiesPage.clickDeletePropertyArtifact(prop.getName());
365 AssertJUnit.assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size() - 1, () -> PropertiesPage.getElemenetsFromTable()));
368 // future removed from ui
369 @Test(enabled = true)
370 public void vfcInstancesInputScreenTest() throws Exception {
371 ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
372 ResourceUIUtils.createVF(vfMetaData, getUser());
374 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
375 CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
377 Map<String, String> elementsIntancesMap = new HashMap<String, String>();
378 for (LeftPanelCanvasItems element : Arrays.asList(LeftPanelCanvasItems.DATABASE, LeftPanelCanvasItems.BLOCK_STORAGE)) {
379 CanvasElement elementOnCanvas = vfCanvasManager.createElementOnCanvas(element);
380 vfCanvasManager.clickOnCanvaElement(elementOnCanvas);
381 String selectedInstanceName = CompositionPage.getSelectedInstanceName();
382 elementsIntancesMap.put(selectedInstanceName, element.getValue());
385 CompositionPage.moveToInputsScreen();
386 int canvasElementsSize = vfCanvasManager.getCanvasElements().size();
387 AssertJUnit.assertTrue("Instances count is not as expected: " + canvasElementsSize, InputsPage.checkElementsCountInTable(canvasElementsSize));
389 for (String element : elementsIntancesMap.keySet()) {
390 String resourceName = elementsIntancesMap.get(element);
391 ResourceReqDetails resource = new ResourceReqDetails();
392 resource.setName(resourceName);
393 resource.setVersion("1.0");
394 resource.setResourceType(ResourceTypeEnum.VFC.toString());
395 RestResponse restResponse = RestCDUtils.getResource(resource, getUser());
396 Map<String, String> propertiesNameTypeJson = ResponseParser.getPropertiesNameType(restResponse);
398 List<WebElement> propertyRowsFromTable = InputsPage.getInstancePropertiesList(element);
399 AssertJUnit.assertTrue("Some properties are missing in table. Instance name is : " + element, propertyRowsFromTable.size() == propertiesNameTypeJson.size());
400 VfVerificator.verifyVfInputs(element, propertiesNameTypeJson, propertyRowsFromTable);
402 GeneralUIUtils.clickOnElementByText(element);
409 public void addAllInformationalArtifactPlaceholdersInVfTestApi() throws Exception {
411 ResourceReqDetails vfMetaData = createVFviaAPI();
412 //Go to Catalog and find the created VF
413 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
414 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
416 ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
417 int fileNameCounter = 0;
419 for (InformationalArtifactsPlaceholders informArtifact : InformationalArtifactsPlaceholders.values()) {
420 fileName = HEAT_FILE_YAML_NAME_PREFIX + fileNameCounter + HEAT_FILE_YAML_NAME_SUFFIX;
421 ArtifactUIUtils.fillPlaceHolderInformationalArtifact(informArtifact,
422 FileHandling.getFilePath("uniqueFileNames"), fileName,
423 informArtifact.getValue());
426 assertThat(InformationalArtifactPage.checkElementsCountInTable(InformationalArtifactsPlaceholders.values().length)).isTrue();
430 public void verifyToscaArtifactsExistApi() throws Exception {
432 ResourceReqDetails vfMetaData = createVFviaAPI();
434 //Go to Catalog and find the created VF
435 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
436 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
438 final int numOfToscaArtifacts = 2;
439 ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
440 AssertJUnit.assertTrue(ToscaArtifactsPage.checkElementsCountInTable(numOfToscaArtifacts));
442 for (int i = 0; i < numOfToscaArtifacts; i++) {
443 String typeFromScreen = ToscaArtifactsPage.getArtifactType(i);
444 AssertJUnit.assertTrue(typeFromScreen.equals(ArtifactTypeEnum.TOSCA_CSAR.getType()) || typeFromScreen.equals(ArtifactTypeEnum.TOSCA_TEMPLATE.getType()));
447 //TODO Andrey should click on certify button
448 ToscaArtifactsPage.clickCertifyButton(vfMetaData.getName());
449 vfMetaData.setVersion("1.0");
450 VfVerificator.verifyToscaArtifactsInfo(vfMetaData, getUser());
453 @Test(enabled = true)
454 public void testDownload() throws Exception {
455 // ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
456 // ResourceUIUtils.createResource(vfMetaData, getUser());
458 // final int numOfToscaArtifacts = 2;
459 // ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
460 // assertTrue(ToscaArtifactsPage.checkElementsCountInTable(numOfToscaArtifacts));
461 // GeneralUIUtils.clickOnElementByTestId("download-Tosca Model");
462 // System.out.println("download me");
464 AttFtpClient attFtpClient = AttFtpClient.getFtpClient();
466 File retrieveLastModifiedFileFromFTP = attFtpClient.retrieveLastModifiedFileFromFTP();
467 attFtpClient.deleteFilesFromFTPserver();
471 public void vfCertificationTestApi() throws Exception {
473 ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
474 Resource vf = AtomicOperationUtils.createResourceByResourceDetails(vfMetaData, UserRoleEnum.DESIGNER, true).left().value();
477 vf = (Resource) AtomicOperationUtils.changeComponentState(vf, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
479 //Go to Catalog and find the created VF
480 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
481 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
483 VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CERTIFIED);
487 public void deleteVfCheckedoutTestApi() throws Exception {
489 ResourceReqDetails vfMetaData = createVFviaAPI();
491 //Go to Catalog and find the created VF
492 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
493 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
495 GeneralPageElements.clickTrashButtonAndConfirm();
497 vfMetaData.setVersion("0.1");
498 VfVerificator.verifyVfDeleted(vfMetaData, getUser());
502 public void revertVfMetadataTestApi() throws Exception {
504 ResourceReqDetails vfMetaData = createVFviaAPI();
506 //Go to Catalog and find the created VF
507 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
508 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
510 ResourceReqDetails vfRevertDetails = new ResourceReqDetails();
511 vfRevertDetails.setName("ciUpdatedName");
512 vfRevertDetails.setDescription("kuku");
513 vfRevertDetails.setCategories(vfMetaData.getCategories());
514 vfRevertDetails.setVendorName("updatedVendor");
515 vfRevertDetails.setVendorRelease("updatedRelease");
516 ResourceUIUtils.fillResourceGeneralInformationPage(vfRevertDetails, getUser(), false);
518 GeneralPageElements.clickRevertButton();
520 VfVerificator.verifyVFMetadataInUI(vfMetaData);
525 public void addDeploymentArtifactInCompositionScreenTestApi() throws Exception {
527 ResourceReqDetails vfMetaData = createVFviaAPI();
529 //Go to Catalog and find the created VF
530 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
531 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
533 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
535 ArtifactInfo artifact = new ArtifactInfo(filePath, "Heat-File.yaml", "kuku", "artifact3", "OTHER");
536 CompositionPage.showDeploymentArtifactTab();
537 CompositionPage.clickAddArtifactButton();
538 ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());
540 List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className("i-sdc-designer-sidebar-section-content-item-artifact"));
541 AssertJUnit.assertEquals(1, actualArtifactList.size());
544 // future removed from ui
545 @Test(enabled = true)
546 public void addPropertyInCompositionScreenTest() throws Exception {
547 ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
548 ResourceUIUtils.createVF(vfMetaData, getUser());
550 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
552 CompositionPage.showPropertiesAndAttributesTab();
553 List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER);
554 int propertiesCount = CompositionPage.getProperties().size();
555 for (PropertyTypeEnum prop : propertyList) {
556 PropertiesUIUtils.addNewProperty(prop);
558 AssertJUnit.assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> CompositionPage.getProperties()));
562 public void addDeploymentArtifactAndVerifyInCompositionScreenApi() throws Exception {
564 ResourceReqDetails vfMetaData = createVFviaAPI();
566 //Go to Catalog and find the created VF
567 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
568 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
570 ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
572 ArtifactInfo deploymentArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER");
573 DeploymentArtifactPage.clickAddNewArtifact();
574 ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
575 AssertJUnit.assertTrue(DeploymentArtifactPage.checkElementsCountInTable(1));
577 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
579 CompositionPage.showDeploymentArtifactTab();
580 List<WebElement> deploymentArtifactsFromScreen = CompositionPage.getDeploymentArtifacts();
581 AssertJUnit.assertTrue(1 == deploymentArtifactsFromScreen.size());
583 String actualArtifactFileName = deploymentArtifactsFromScreen.get(0).getText();
584 AssertJUnit.assertTrue("asc_heat-0-2.yaml".equals(actualArtifactFileName));
588 public void checkoutVfTest() throws Exception{
589 ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
590 ResourceUIUtils.createVF(vfMetaData, getUser());
592 ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
593 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
594 GeneralPageElements.clickCheckoutButton();
596 vfMetaData.setVersion("0.2");
597 VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
598 VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
600 ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName());
602 reloginWithNewRole(UserRoleEnum.TESTER);
603 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
604 TesterOperationPage.certifyComponent(vfMetaData.getName());
606 reloginWithNewRole(UserRoleEnum.DESIGNER);
607 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
608 ResourceGeneralPage.clickCheckoutButton();
610 vfMetaData.setVersion("1.1");
611 vfMetaData.setUniqueId(null);
612 VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
613 VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
617 public void deleteInstanceFromVfCanvasApi() throws Exception {
619 ResourceReqDetails vfMetaData = createVFviaAPI();
621 //Go to Catalog and find the created VF
622 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
623 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
625 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
626 CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
627 CanvasElement computeElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
628 vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.PORT);
630 vfCanvasManager.clickOnCanvaElement(computeElement);
631 vfCanvasManager.deleteElementFromCanvas(computeElement);
633 VfVerificator.verifyNumOfComponentInstances(vfMetaData, 1, getUser());
637 public void changeInstanceNameInVfTestApi() throws Exception {
639 ResourceReqDetails vfMetaData = createVFviaAPI();
641 //Go to Catalog and find the created VF
642 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
643 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
645 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
646 CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
647 CanvasElement computeElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
649 String updatedInstanceName = "updatedName";
650 vfCanvasManager.updateElementNameInCanvas(computeElement, updatedInstanceName);
652 String actualSelectedInstanceName = CompositionPage.getSelectedInstanceName();
653 AssertJUnit.assertTrue(updatedInstanceName.equals(actualSelectedInstanceName));
658 public void submitVfForTestingWithNonCertifiedAssetApi() throws Exception{
659 String fileName = "vFW_VFC4.yml";
660 ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
663 Resource vfc = AtomicOperationUtils.importResource(filePath, fileName).left().value();
664 atomicResourceMetaData.setName(vfc.getName());
666 //Submit VFC for testing via API
667 vfc = (Resource) AtomicOperationUtils.changeComponentState(vfc, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFICATIONREQUEST, true).getLeft();
670 ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
671 AtomicOperationUtils.createResourceByResourceDetails(vfMetaData, UserRoleEnum.DESIGNER, true).left().value();
673 //Go to Catalog and find the created VF
674 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
675 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
677 DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
678 CanvasManager canvasManager = CanvasManager.getCanvasManager();
679 CompositionPage.searchForElement(atomicResourceMetaData.getName());
680 canvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
683 //TODO Andrey should click on certify button
684 CompositionPage.clickCertifyButton(vfMetaData.getName());
688 String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
689 String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
690 AssertJUnit.assertTrue(errorMessage.contains(checkUIResponseOnError));
693 ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
698 public void isDisabledAndReadOnlyInCheckinApi() throws Exception {
700 ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
701 Resource vf = AtomicOperationUtils.createResourceByResourceDetails(vfMetaData, UserRoleEnum.DESIGNER, true).left().value();
703 //Check in VF via API
704 vf = (Resource) AtomicOperationUtils.changeComponentState(vf, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
706 //Go to Catalog and find the created VF
707 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
708 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
710 ResourceMetadataEnum[] fieldsForCheck = {ResourceMetadataEnum.RESOURCE_NAME,
711 ResourceMetadataEnum.DESCRIPTION, ResourceMetadataEnum.VENDOR_NAME, ResourceMetadataEnum.VENDOR_RELEASE,
712 ResourceMetadataEnum.CONTACT_ID};
714 for (ResourceMetadataEnum field : fieldsForCheck) {
715 AssertJUnit.assertTrue(GeneralUIUtils.isElementReadOnly(field.getValue()));
718 AssertJUnit.assertTrue(GeneralUIUtils.isElementDisabled(ResourceMetadataEnum.CATEGORY.getValue()));
719 AssertJUnit.assertTrue(GeneralUIUtils.isElementDisabled(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue()));
723 public void displayHomeAfterNavigationToOnboardingTest() throws Exception {
724 //Production bug scenario: "Home" - Click on any VF/ Service - Copy the URL - Go to “ONBOARD” - Paste the URL - Review the breadcrumbs
725 // Expected: "Home" Actual: "Onboarding"
728 ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
729 Resource vf = AtomicOperationUtils.createResourceByResourceDetails(vfMetaData, UserRoleEnum.DESIGNER, true).left().value();
731 //Check in VF via API
732 vf = (Resource) AtomicOperationUtils.changeComponentState(vf, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
734 //Find the created VF on Home page
735 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
736 HomePage.navigateToHomePage();
737 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
739 //Copy current URL, navigate to OB screen and paste URL
740 String url = GeneralUIUtils.copyCurrentURL();
741 CompositionPage.moveToOnboardScreen();
742 GeneralUIUtils.navigateToURL(url);
743 GeneralUIUtils.ultimateWait();
745 //Validate that main menu button is Home and not Onboarding
746 String id = DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue();
747 WebElement button = GeneralUIUtils.getWebElementByTestID(id);
748 AssertJUnit.assertTrue(button.getAttribute("text").trim().equals("HOME"));
752 public void exportToscaWithModulePropertiesVFTest() throws Exception {
753 String vnfFile = "1-Vf-zrdm5bpxmc02-092017-(MOBILITY)_v2.0.zip";
754 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
755 VendorSoftwareProductObject vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
756 String vspName = vsp.getName();
757 ResourceGeneralPage.clickCertifyButton(vspName);
758 Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "1.0");
759 VfModuleVerificator.validateSpecificModulePropertiesFromRequest(resource);
763 public void exportToscaWithModulePropertiesTemplateCheckVFTest() throws Exception {
764 String vnfFile = "1-Vf-zrdm5bpxmc02-092017-(MOBILITY)_v2.0.zip";
765 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
766 OnboardingUiUtils.onboardAndValidate(resourceReqDetails, FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
767 ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
768 GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_MODEL.getValue());
769 File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir();
770 ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(latestFilefromDir);
771 VfModuleVerificator.validateSpecificModulePropertiesFromFile(toscaDefinition);
776 protected UserRoleEnum getRole() {
777 return UserRoleEnum.DESIGNER;