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 static org.testng.AssertJUnit.assertTrue;
25 import java.util.ArrayList;
26 import java.util.Arrays;
27 import java.util.HashMap;
28 import java.util.List;
31 import org.openecomp.sdc.be.dao.api.ActionStatus;
32 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
33 import org.openecomp.sdc.be.model.LifecycleStateEnum;
34 import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
35 import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
36 import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
37 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
38 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifactsPlaceholders;
39 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
40 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ResourceMetadataEnum;
41 import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
42 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
43 import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
44 import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
45 import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
46 import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
47 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
48 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
49 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
50 import org.openecomp.sdc.ci.tests.pages.CompositionPage;
51 import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
52 import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
53 import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
54 import org.openecomp.sdc.ci.tests.pages.InputsPage;
55 import org.openecomp.sdc.ci.tests.pages.PropertiesPage;
56 import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
57 import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
58 import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage;
59 import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
60 import org.openecomp.sdc.ci.tests.utilities.FileHandling;
61 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
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.general.ElementFactory;
66 import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
67 import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
68 import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
69 import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
70 import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
71 import org.openqa.selenium.By;
72 import org.openqa.selenium.WebElement;
73 import org.testng.Assert;
74 import org.testng.SkipException;
75 import org.testng.annotations.BeforeMethod;
76 import org.testng.annotations.Test;
78 import com.aventstack.extentreports.Status;
80 public class ImportDCAE extends SetupCDTest {
82 private static final String SERVICE_INPUT_TEST_VF2_CSAR = "service_input_test_VF2.csar";
83 private String filePath;
86 public void beforeTest(){
87 filePath = FileHandling.getFilePath("");
91 public void updateDCAEAsset() throws Exception {
92 ResourceReqDetails resourceMetaData = createDCAEAsset();
95 ResourceReqDetails updatedResource = new ResourceReqDetails();
96 updatedResource.setName(ElementFactory.getResourcePrefix() + "UpdatedName" + resourceMetaData.getName());
97 updatedResource.setDescription("kuku");
98 updatedResource.setVendorName("updatedVendor");
99 updatedResource.setVendorRelease("updatedRelease");
100 updatedResource.setContactId("ab0001");
101 updatedResource.setCategories(resourceMetaData.getCategories());
102 updatedResource.setVersion("0.1");
103 List<String> newTags = resourceMetaData.getTags();
104 newTags.remove(resourceMetaData.getName());
105 newTags.add(updatedResource.getName());
106 updatedResource.setTags(newTags);
107 ResourceUIUtils.updateResource(updatedResource, getUser());
109 VfVerificator.verifyVFMetadataInUI(updatedResource);
110 VfVerificator.verifyVFUpdated(updatedResource, getUser());
114 public void vfcLinkedToComputeInDCAEAssetFlowTest() throws Exception {
115 String fileName = "importVFC_VFC14.yml";
116 ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
119 ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
120 ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
122 reloginWithNewRole(UserRoleEnum.TESTER);
123 GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
124 TesterOperationPage.certifyComponent(atomicResourceMetaData.getName());
126 reloginWithNewRole(UserRoleEnum.DESIGNER);
127 ResourceReqDetails resourceMetaData = createDCAEAsset();
129 DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
130 CanvasManager canvasManager = CanvasManager.getCanvasManager();
131 CanvasElement computeElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
132 CompositionPage.searchForElement(atomicResourceMetaData.getName());
133 CanvasElement cpElement = canvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
134 Assert.assertNotNull(cpElement);
135 ServiceVerificator.verifyNumOfComponentInstances(resourceMetaData, "0.1", 4, getUser());
137 canvasManager.linkElements(cpElement, computeElement);
139 resourceMetaData.setVersion("0.1");
140 VfVerificator.verifyLinkCreated(resourceMetaData, getUser(), 1);
143 ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0");
149 public void addUpdateDeleteDeploymentArtifactToDCAEAssetTest() throws Exception {
151 ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
153 List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
154 deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", ArtifactTypeEnum.OTHER.getType()));
155 deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", ArtifactTypeEnum.YANG_XML.getType()));
156 for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
157 DeploymentArtifactPage.clickAddNewArtifact();
158 ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
160 assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));
162 String newDescription = "new description";
163 DeploymentArtifactPage.clickEditArtifact(deploymentArtifactList.get(0).getArtifactLabel());
164 DeploymentArtifactPage.artifactPopup().insertDescription(newDescription);
165 DeploymentArtifactPage.artifactPopup().clickDoneButton();
166 String actualArtifactDescription = DeploymentArtifactPage.getArtifactDescription(deploymentArtifactList.get(0).getArtifactLabel());
167 assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
169 DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifactList.get(0).getArtifactLabel());
170 DeploymentArtifactPage.clickOK();
171 assertTrue("artifact "+ deploymentArtifactList.get(0).getArtifactLabel() + "is not deleted", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size() - 1));
173 assertTrue("artifact "+ deploymentArtifactList.get(1).getArtifactLabel() + "is not displayed", DeploymentArtifactPage.clickOnArtifactDescription(deploymentArtifactList.get(1).getArtifactLabel()).isDisplayed());
177 public void addUpdateDeleteInformationalArtifactDCAEAssetTest() throws Exception {
179 ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
181 ArtifactInfo informationalArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", ArtifactTypeEnum.OTHER.getType());
182 InformationalArtifactPage.clickAddNewArtifact();
183 ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact);
185 assertTrue("artifact table does not contain artifacts uploaded", InformationalArtifactPage.checkElementsCountInTable(1));
187 String newDescription = "new description";
188 InformationalArtifactPage.clickEditArtifact(informationalArtifact.getArtifactLabel());
189 InformationalArtifactPage.artifactPopup().insertDescription(newDescription);
190 InformationalArtifactPage.artifactPopup().clickDoneButton();
191 String actualArtifactDescription = InformationalArtifactPage.getArtifactDescription(informationalArtifact.getArtifactLabel());
192 assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
194 InformationalArtifactPage.clickDeleteArtifact(informationalArtifact.getArtifactLabel());
195 InformationalArtifactPage.clickOK();
196 assertTrue("artifact "+ informationalArtifact.getArtifactLabel() + "is not deleted", InformationalArtifactPage.checkElementsCountInTable(0));
200 public void addPropertiesToVfcInstanceInDCAEAssetTest() throws Exception {
203 throw new SkipException("Open bug 373762, can't update properties on CP or VFC instance on Composition screen");
206 String fileName = "importVFC_VFC15.yml";
207 ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
210 ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
211 ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName());
215 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
216 CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
217 CompositionPage.searchForElement(atomicResourceMetaData.getName());
218 CanvasElement vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
220 vfCanvasManager.clickOnCanvaElement(vfcElement);
221 CompositionPage.showPropertiesAndAttributesTab();
222 List<WebElement> properties = CompositionPage.getProperties();
223 String propertyValue = "abc123";
224 for (int i = 0; i < 2; i++) {
225 WebElement findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-and-attribute-label"));
227 PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(propertyValue);
228 PropertiesPage.getPropertyPopup().clickSave();
230 findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-value"));
231 assertTrue(findElement.getText().equals(propertyValue));
235 ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
240 public void changeInstanceVersionDCAEAssetTest() throws Exception{
241 ResourceReqDetails atomicResourceMetaData = null;
242 ResourceReqDetails vfMetaData = null;
243 CanvasManager vfCanvasManager;
244 CanvasElement vfcElement = null;
245 String fileName = "importVFC_VFC16.yml";
247 atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
248 ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
249 ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
251 vfMetaData = createDCAEAsset();
252 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
253 vfCanvasManager = CanvasManager.getCanvasManager();
254 CompositionPage.searchForElement(atomicResourceMetaData.getName());
255 vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
257 CompositionPage.clickSubmitForTestingButton(vfMetaData.getName());
261 String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
262 String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
263 Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
266 reloginWithNewRole(UserRoleEnum.TESTER);
267 GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
268 TesterOperationPage.certifyComponent(atomicResourceMetaData.getName());
270 reloginWithNewRole(UserRoleEnum.DESIGNER);
271 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
272 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
273 vfCanvasManager = CanvasManager.getCanvasManager();
274 CompositionPage.changeComponentVersion(vfCanvasManager, vfcElement, "1.0");
277 VfVerificator.verifyInstanceVersion(vfMetaData, getUser(), atomicResourceMetaData.getName(), "1.0");
281 ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0");
286 // future removed from ui
287 @Test(enabled = false)
288 public void addUpdateDeleteSimplePropertiesToDCAEAssetTest() throws Exception{
291 ResourceGeneralPage.getLeftMenu().moveToPropertiesScreen();
292 List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER);
293 int propertiesCount = PropertiesPage.getElemenetsFromTable().size();
294 for (PropertyTypeEnum prop : propertyList){
295 PropertiesUIUtils.addNewProperty(prop);
297 assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> PropertiesPage.getElemenetsFromTable()));
298 VfVerificator.verifyPropertiesInUI(propertyList);
299 PropertiesPage.verifyTotalProperitesField(propertiesCount + propertyList.size());
301 PropertyTypeEnum prop = propertyList.get(0);
302 prop.setDescription("updatedDescription");
303 prop.setValue("value");
304 PropertiesUIUtils.updateProperty(prop);
306 PropertiesPage.clickDeletePropertyArtifact(prop.getName());
307 assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size() - 1, () -> PropertiesPage.getElemenetsFromTable()));
310 // future removed from ui
311 @Test(enabled = false)
312 public void DCAEAssetInstancesInputScreenTest() throws Exception{
315 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
316 CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
318 Map<String, String> elementsIntancesMap = new HashMap<String, String>();
319 for (LeftPanelCanvasItems element : Arrays.asList(LeftPanelCanvasItems.DATABASE)){
320 CanvasElement elementOnCanvas = vfCanvasManager.createElementOnCanvas(element);
321 vfCanvasManager.clickOnCanvaElement(elementOnCanvas);
322 String selectedInstanceName = CompositionPage.getSelectedInstanceName();
323 elementsIntancesMap.put(selectedInstanceName, element.getValue());
326 CompositionPage.moveToInputsScreen();
327 int canvasElementsSize = vfCanvasManager.getCanvasElements().size() + 2;
328 List<String> inputsNamesFromTable = InputsPage.getVFCInstancesNamesFromTable();
329 assertTrue(String.format("Instances count is not as Expected: %s Actual: %s", canvasElementsSize, inputsNamesFromTable.size()), inputsNamesFromTable.size() == canvasElementsSize);
331 for (String instanceName :inputsNamesFromTable){
332 String resourceName = instanceName.split(" ")[0];
333 ResourceReqDetails resource = new ResourceReqDetails();
334 resource.setName(resourceName);
335 resource.setVersion("1.0");
336 if (resourceName.equals("Port")){
337 resource.setResourceType(ResourceTypeEnum.CP.toString());
339 resource.setResourceType(ResourceTypeEnum.VFC.toString());
341 RestResponse restResponse = RestCDUtils.getResource(resource, getUser());
342 Map<String, String> propertiesNameTypeJson = ResponseParser.getPropertiesNameType(restResponse);
344 List<WebElement> propertyRowsFromTable = InputsPage.getInstancePropertiesList(resourceName);
345 assertTrue("Some properties are missing in table. Instance name is : " + resourceName, propertyRowsFromTable.size() == propertiesNameTypeJson.size());
346 VfVerificator.verifyVfInputs(instanceName, propertiesNameTypeJson, propertyRowsFromTable);
348 GeneralUIUtils.clickOnElementByText(resourceName);
353 public void addAllInformationalArtifactPlaceholdersInDCAEAssetTest() throws Exception{
355 ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
357 for(InformationalArtifactsPlaceholders informArtifact : InformationalArtifactsPlaceholders.values()){
358 ArtifactUIUtils.fillPlaceHolderInformationalArtifact(informArtifact, filePath,"asc_heat 0 2.yaml", informArtifact.getValue());
361 assertTrue(InformationalArtifactPage.checkElementsCountInTable(InformationalArtifactsPlaceholders.values().length));
365 public void verifyToscaArtifactsExistDCAEAssetTest() throws Exception{
366 ResourceReqDetails vfMetaData = createDCAEAsset();
368 final int numOfToscaArtifacts = 2;
369 ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
370 assertTrue(ToscaArtifactsPage.checkElementsCountInTable(numOfToscaArtifacts));
372 for(int i = 0; i < numOfToscaArtifacts; i++){
373 String typeFromScreen = ToscaArtifactsPage.getArtifactType(i);
374 assertTrue(typeFromScreen.equals(ArtifactTypeEnum.TOSCA_CSAR.getType()) || typeFromScreen.equals(ArtifactTypeEnum.TOSCA_TEMPLATE.getType()));
377 ToscaArtifactsPage.clickSubmitForTestingButton(vfMetaData.getName());
378 VfVerificator.verifyToscaArtifactsInfo(vfMetaData, getUser());
382 public void DCAEAssetCertificationTest() throws Exception{
383 ResourceReqDetails vfMetaData = createDCAEAsset();
385 String vfName = vfMetaData.getName();
387 ResourceGeneralPage.clickCheckinButton(vfName);
388 GeneralUIUtils.findComponentAndClick(vfName);
389 ResourceGeneralPage.clickSubmitForTestingButton(vfName);
391 reloginWithNewRole(UserRoleEnum.TESTER);
392 GeneralUIUtils.findComponentAndClick(vfName);
393 TesterOperationPage.certifyComponent(vfName);
395 vfMetaData.setVersion("1.0");
396 VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.CERTIFIED);
398 reloginWithNewRole(UserRoleEnum.DESIGNER);
399 GeneralUIUtils.findComponentAndClick(vfName);
400 VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CERTIFIED);
404 public void deleteDCAEAssetCheckedoutTest() throws Exception{
405 ResourceReqDetails vfMetaData = createDCAEAsset();
407 GeneralPageElements.clickTrashButtonAndConfirm();
409 vfMetaData.setVersion("0.1");
410 VfVerificator.verifyVfDeleted(vfMetaData, getUser());
414 public void revertDCAEAssetMetadataTest() throws Exception{
415 ResourceReqDetails vfMetaData = createDCAEAsset();
417 ResourceReqDetails vfRevertDetails = new ResourceReqDetails();
418 vfRevertDetails.setName("ciUpdatedName");
419 vfRevertDetails.setDescription("kuku");
420 vfRevertDetails.setCategories(vfMetaData.getCategories());
421 vfRevertDetails.setVendorName("updatedVendor");
422 vfRevertDetails.setVendorRelease("updatedRelease");
423 ResourceUIUtils.fillResourceGeneralInformationPage(vfRevertDetails, getUser(), false);
425 GeneralPageElements.clickRevertButton();
427 VfVerificator.verifyVFMetadataInUI(vfMetaData);
431 public void addDeploymentArtifactInCompositionScreenDCAEAssetTest() throws Exception{
434 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
436 ArtifactInfo artifact = new ArtifactInfo(filePath, "Heat-File.yaml", "kuku", "artifact3",ArtifactTypeEnum.OTHER.getType());
437 CompositionPage.showDeploymentArtifactTab();
438 CompositionPage.clickAddArtifactButton();
439 ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());
441 List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className("i-sdc-designer-sidebar-section-content-item-artifact"));
442 Assert.assertEquals(1, actualArtifactList.size());
445 // future removed from ui
446 @Test(enabled = false)
447 public void addPropertyInCompositionScreenDCAEAssetTest() throws Exception{
450 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
452 CompositionPage.showPropertiesAndAttributesTab();
453 List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER);
454 int propertiesCount = CompositionPage.getProperties().size();
455 for (PropertyTypeEnum prop : propertyList){
456 PropertiesUIUtils.addNewProperty(prop);
458 assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> CompositionPage.getProperties()));
462 public void addDeploymentArtifactAndVerifyInCompositionScreenDCAEAssetTest() throws Exception{
465 ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
467 ArtifactInfo deploymentArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", ArtifactTypeEnum.OTHER.getType());
468 DeploymentArtifactPage.clickAddNewArtifact();
469 ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
470 assertTrue(DeploymentArtifactPage.checkElementsCountInTable(1));
472 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
474 CompositionPage.showDeploymentArtifactTab();
475 List<WebElement> deploymentArtifactsFromScreen = CompositionPage.getDeploymentArtifacts();
476 assertTrue(1 == deploymentArtifactsFromScreen.size());
478 String actualArtifactFileName = deploymentArtifactsFromScreen.get(0).getText();
479 assertTrue("asc_heat-0-2.yaml".equals(actualArtifactFileName));
483 public void checkoutDCAEAssetTest() throws Exception{
484 ResourceReqDetails vfMetaData = createDCAEAsset();
486 ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
487 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
488 GeneralPageElements.clickCheckoutButton();
490 vfMetaData.setVersion("0.2");
491 VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
492 VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
494 ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName());
496 reloginWithNewRole(UserRoleEnum.TESTER);
497 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
498 TesterOperationPage.certifyComponent(vfMetaData.getName());
500 reloginWithNewRole(UserRoleEnum.DESIGNER);
501 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
502 ResourceGeneralPage.clickCheckoutButton();
504 vfMetaData.setVersion("1.1");
505 vfMetaData.setUniqueId(null);
506 VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
507 VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
511 public void deleteInstanceFromDCAEAssetCanvas() throws Exception{
512 ResourceReqDetails vfMetaData = createDCAEAsset();
514 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
515 CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
516 CanvasElement computeElement = CompositionPage.addElementToCanvasScreen(LeftPanelCanvasItems.COMPUTE, vfCanvasManager);
518 vfCanvasManager.clickOnCanvaElement(computeElement);
519 vfCanvasManager.deleteElementFromCanvas(computeElement);
521 VfVerificator.verifyNumOfComponentInstances(vfMetaData, 2, getUser());
525 public void changeInstanceNameInDCAEAssetTest() throws Exception{
528 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
529 CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
530 CanvasElement computeElement = CompositionPage.addElementToCanvasScreen(LeftPanelCanvasItems.COMPUTE, vfCanvasManager);
532 String updatedInstanceName = "updatedName";
533 vfCanvasManager.updateElementNameInCanvas(computeElement, updatedInstanceName);
535 String actualSelectedInstanceName = CompositionPage.getSelectedInstanceName();
536 assertTrue(updatedInstanceName.equals(actualSelectedInstanceName));
540 public void submitDCAEAssetForTestingWithNonCertifiedAsset() throws Exception{
541 String fileName = "importVFC_VFC17.yml";
543 ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
544 ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
545 ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
547 ResourceReqDetails vfMetaData = createDCAEAsset();
548 DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
549 CanvasManager canvasManager = CanvasManager.getCanvasManager();
550 CompositionPage.addElementToCanvasScreen(atomicResourceMetaData.getName(), canvasManager);
553 CompositionPage.clickSubmitForTestingButton(vfMetaData.getName());
557 String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
558 String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
559 Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
562 ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
567 public void isDisabledAndReadOnlyInCheckinDCAEAssetTest() throws Exception{
568 ResourceReqDetails vfMetaData = createDCAEAsset();
569 ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
570 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
572 ResourceMetadataEnum[] fieldsForCheck = {ResourceMetadataEnum.RESOURCE_NAME,
573 ResourceMetadataEnum.DESCRIPTION,
574 ResourceMetadataEnum.VENDOR_NAME,
575 ResourceMetadataEnum.VENDOR_RELEASE,
576 ResourceMetadataEnum.CONTACT_ID,
577 ResourceMetadataEnum.CATEGORY,
578 ResourceMetadataEnum.TAGS};
580 for (ResourceMetadataEnum field: fieldsForCheck){
581 VfVerificator.verifyIsElementDisabled(field.getValue(), field.name());
583 VfVerificator.verifyIsElementDisabled(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue(), DataTestIdEnum.LifeCyleChangeButtons.CREATE.name());
587 public void removeFileFromGeneralPageDCAEAssetTest() throws Exception{
588 String fileName2 = SERVICE_INPUT_TEST_VF2_CSAR;
589 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
590 ResourceUIUtils.importVfFromCsarNoCreate(resourceMetaData, filePath, fileName2, getUser());
591 GeneralPageElements.clickDeleteFile();
594 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue(), 30);
603 public void activityLogDCAEAssetTest() throws Exception{
606 ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
608 ArtifactInfo informationalArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", ArtifactTypeEnum.OTHER.getType());
609 InformationalArtifactPage.clickAddNewArtifact();
610 ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact);
612 ResourceGeneralPage.getLeftMenu().moveToActivityLogScreen();
614 int numberOfRows = GeneralUIUtils.getElementsByCSS("div[class^='flex-container']").size();
615 assertTrue("Wrong rows number, should be 2", numberOfRows == 2);
619 public void checkinCheckoutChangeDeleteVersionDCAEAssetTest() throws Exception{
620 ResourceReqDetails atomicResourceMetaData = createDCAEAsset();
622 ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName());
623 GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
624 GeneralPageElements.clickCheckoutButton();
625 VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
627 GeneralPageElements.selectVersion("V0.1");
628 VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKIN);
629 GeneralUIUtils.clickJSOnElementByText("latest version");
631 GeneralPageElements.clickTrashButtonAndConfirm();
632 GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
633 String actualVersion = GeneralUIUtils.getSelectedElementFromDropDown(DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue()).getText();
634 assertTrue("Expected version: V0.1, Actual version: " + actualVersion, actualVersion.equals("V0.1"));
638 public void badFileDCAEAssetTest() throws Exception {
639 String customFileName = "badVF.csar";
640 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
642 ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, customFileName, getUser());
646 String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
647 String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.CSAR_INVALID.name());
648 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating error messdge..."));
649 Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
654 public void validContactAfterCreateDCAEAssetTest() throws Exception{
655 ResourceReqDetails resourceMetaData = createDCAEAsset();
656 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating that userID equal to user that was logged in..."));
657 assertTrue("Wrong userId", resourceMetaData.getContactId().equals(ResourceGeneralPage.getContactIdText()));
660 public ResourceReqDetails createDCAEAsset() throws Exception{
661 String fileName2 = SERVICE_INPUT_TEST_VF2_CSAR;
662 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
663 ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser());
664 resourceMetaData.setVersion("0.1");
665 return resourceMetaData;
669 protected UserRoleEnum getRole() {
670 return UserRoleEnum.DESIGNER;