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.dao.api.ActionStatus;
25 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
26 import org.openecomp.sdc.be.model.LifecycleStateEnum;
27 import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
28 import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
29 import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
30 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
31 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifactsPlaceholders;
32 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
33 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ResourceMetadataEnum;
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.enums.ArtifactTypeEnum;
37 import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
38 import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
39 import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
40 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
41 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
42 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
43 import org.openecomp.sdc.ci.tests.pages.CompositionPage;
44 import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
45 import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
46 import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
47 import org.openecomp.sdc.ci.tests.pages.InputsPage;
48 import org.openecomp.sdc.ci.tests.pages.PropertiesPage;
49 import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
50 import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage;
51 import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
52 import org.openecomp.sdc.ci.tests.utilities.FileHandling;
53 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
54 import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils;
55 import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
56 import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
57 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
58 import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
59 import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
60 import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
61 import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
62 import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
63 import org.openqa.selenium.By;
64 import org.openqa.selenium.WebElement;
65 import org.testng.Assert;
66 import org.testng.annotations.BeforeMethod;
67 import org.testng.annotations.Test;
69 import java.util.ArrayList;
70 import java.util.Arrays;
71 import java.util.HashMap;
72 import java.util.List;
75 import static org.assertj.core.api.Assertions.assertThat;
76 import static org.testng.AssertJUnit.assertTrue;
78 public class ImportDCAE extends SetupCDTest {
80 private static final int CLICKING_ON_ELEMENT_TIMEOUT = 30;
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 final int expectedNumberOfComponentInstances = 4;
116 String fileName = "importVFC_VFC14.yml";
117 ResourceReqDetails atomicResourceMetaData =
118 ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(
119 ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT,
120 ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
123 ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
124 //TODO Andrey should click on certify button
125 ResourceGeneralPage.clickCertifyButton(atomicResourceMetaData.getName());
127 /*reloginWithNewRole(UserRoleEnum.TESTER);
128 GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
129 TesterOperationPage.certifyComponent(atomicResourceMetaData.getName());
131 reloginWithNewRole(UserRoleEnum.DESIGNER);*/
132 ResourceReqDetails resourceMetaData = createDCAEAsset();
134 DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
135 CanvasManager canvasManager = CanvasManager.getCanvasManager();
136 CanvasElement computeElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
137 CompositionPage.searchForElement(atomicResourceMetaData.getName());
138 CanvasElement cpElement = canvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
139 Assert.assertNotNull(cpElement);
140 ServiceVerificator.verifyNumOfComponentInstances(
141 resourceMetaData, "0.1",
142 expectedNumberOfComponentInstances, getUser());
144 canvasManager.linkElements(cpElement, computeElement);
146 resourceMetaData.setVersion("0.1");
147 VfVerificator.verifyLinkCreated(resourceMetaData, getUser(), 1);
149 ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0");
155 public void addUpdateDeleteDeploymentArtifactToDCAEAssetTest() throws Exception {
157 ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
159 List<ArtifactInfo> deploymentArtifactList = new ArrayList<>();
160 deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", ArtifactTypeEnum.OTHER.getType()));
161 deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", ArtifactTypeEnum.YANG_XML.getType()));
162 for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
163 DeploymentArtifactPage.clickAddNewArtifact();
164 ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
166 assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));
168 String newDescription = "new description";
169 DeploymentArtifactPage.clickEditArtifact(deploymentArtifactList.get(0).getArtifactLabel());
170 DeploymentArtifactPage.artifactPopup().insertDescription(newDescription);
171 DeploymentArtifactPage.artifactPopup().clickDoneButton();
172 String actualArtifactDescription = DeploymentArtifactPage.getArtifactDescription(deploymentArtifactList.get(0).getArtifactLabel());
173 assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
175 DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifactList.get(0).getArtifactLabel());
176 DeploymentArtifactPage.clickOK();
177 assertTrue("artifact " + deploymentArtifactList.get(0).getArtifactLabel() + "is not deleted", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size() - 1));
179 assertTrue("artifact " + deploymentArtifactList.get(1).getArtifactLabel() + "is not displayed", DeploymentArtifactPage.clickOnArtifactDescription(deploymentArtifactList.get(1).getArtifactLabel()).isDisplayed());
183 public void addUpdateDeleteInformationalArtifactDCAEAssetTest() throws Exception {
185 ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
187 ArtifactInfo informationalArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", ArtifactTypeEnum.OTHER.getType());
188 InformationalArtifactPage.clickAddNewArtifact();
189 ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact);
191 assertTrue("artifact table does not contain artifacts uploaded", InformationalArtifactPage.checkElementsCountInTable(1));
193 String newDescription = "new description";
194 InformationalArtifactPage.clickEditArtifact(informationalArtifact.getArtifactLabel());
195 InformationalArtifactPage.artifactPopup().insertDescription(newDescription);
196 InformationalArtifactPage.artifactPopup().clickDoneButton();
197 String actualArtifactDescription = InformationalArtifactPage.getArtifactDescription(informationalArtifact.getArtifactLabel());
198 assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
200 InformationalArtifactPage.clickDeleteArtifact(informationalArtifact.getArtifactLabel());
201 InformationalArtifactPage.clickOK();
202 assertTrue("artifact " + informationalArtifact.getArtifactLabel() + "is not deleted", InformationalArtifactPage.checkElementsCountInTable(0));
206 public void addPropertiesToVfcInstanceInDCAEAssetTest() throws Exception {
209 // throw new SkipException("Open bug 373762, can't update properties on CP or VFC instance on Composition screen");
210 SetupCDTest.getExtendTest().log(Status.INFO, "Open bug 373762, can't update properties on CP or VFC instance on Composition screen");
213 String fileName = "importVFC_VFC15.yml";
214 ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
217 ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
218 ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName());
222 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
223 CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
224 CompositionPage.searchForElement(atomicResourceMetaData.getName());
225 CanvasElement vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
227 vfCanvasManager.clickOnCanvaElement(vfcElement);
228 CompositionPage.showPropertiesAndAttributesTab();
229 List<WebElement> properties = CompositionPage.getProperties();
230 String propertyValue = "abc123";
231 for (int i = 0; i < 2; i++) {
232 WebElement findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-and-attribute-label"));
234 PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(propertyValue);
235 PropertiesPage.getPropertyPopup().clickSave();
237 findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-value"));
238 assertTrue(findElement.getText().equals(propertyValue));
241 ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
246 public void changeInstanceVersionDCAEAssetTest() throws Exception {
247 ResourceReqDetails atomicResourceMetaData = null;
248 ResourceReqDetails vfMetaData = null;
249 CanvasManager vfCanvasManager;
250 CanvasElement vfcElement = null;
251 String fileName = "importVFC_VFC16.yml";
253 atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
254 ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
255 //TODO Andrey changed to click on checkIn button
256 ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName());
258 vfMetaData = createDCAEAsset();
259 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
260 vfCanvasManager = CanvasManager.getCanvasManager();
261 CompositionPage.searchForElement(atomicResourceMetaData.getName());
262 vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
263 //TODO Andrey should click on certify button
264 CompositionPage.clickCertifyButton(vfMetaData.getName());
266 } catch (Exception e) {
267 String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
268 String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
269 Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
270 GeneralUIUtils.closeErrorMessage();
271 GeneralPageElements.clickOnHomeButton();
273 GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
274 ResourceGeneralPage.clickCertifyButton(atomicResourceMetaData.getName());
276 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
277 ResourceGeneralPage.clickCheckoutButton();
278 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
279 vfMetaData.setVersion("0.2");
280 vfCanvasManager = CanvasManager.getCanvasManager();
281 CompositionPage.changeComponentVersion(vfCanvasManager, vfcElement, "1.0");
284 VfVerificator.verifyInstanceVersion(vfMetaData, getUser(), atomicResourceMetaData.getName(), "1.0");
286 ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0");
291 // future removed from ui
292 @Test(enabled = false)
293 public void addUpdateDeleteSimplePropertiesToDCAEAssetTest() throws Exception {
296 ResourceGeneralPage.getLeftMenu().moveToPropertiesScreen();
297 List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER);
298 int propertiesCount = PropertiesPage.getElemenetsFromTable().size();
299 for (PropertyTypeEnum prop : propertyList) {
300 PropertiesUIUtils.addNewProperty(prop);
302 assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> PropertiesPage.getElemenetsFromTable()));
303 VfVerificator.verifyPropertiesInUI(propertyList);
304 PropertiesPage.verifyTotalProperitesField(propertiesCount + propertyList.size());
306 PropertyTypeEnum prop = propertyList.get(0);
307 prop.setDescription("updatedDescription");
308 prop.setValue("value");
309 PropertiesUIUtils.updateProperty(prop);
311 PropertiesPage.clickDeletePropertyArtifact(prop.getName());
312 assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size() - 1, () -> PropertiesPage.getElemenetsFromTable()));
315 // future removed from ui
316 @Test(enabled = false)
317 public void DCAEAssetInstancesInputScreenTest() throws Exception {
320 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
321 CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
323 Map<String, String> elementsIntancesMap = new HashMap<String, String>();
324 for (LeftPanelCanvasItems element : Arrays.asList(LeftPanelCanvasItems.DATABASE)) {
325 CanvasElement elementOnCanvas = vfCanvasManager.createElementOnCanvas(element);
326 vfCanvasManager.clickOnCanvaElement(elementOnCanvas);
327 String selectedInstanceName = CompositionPage.getSelectedInstanceName();
328 elementsIntancesMap.put(selectedInstanceName, element.getValue());
331 CompositionPage.moveToInputsScreen();
332 int canvasElementsSize = vfCanvasManager.getCanvasElements().size() + 2;
333 List<String> inputsNamesFromTable = InputsPage.getVFCInstancesNamesFromTable();
334 assertTrue(String.format("Instances count is not as Expected: %s Actual: %s", canvasElementsSize, inputsNamesFromTable.size()), inputsNamesFromTable.size() == canvasElementsSize);
336 for (String instanceName : inputsNamesFromTable) {
337 String resourceName = instanceName.split(" ")[0];
338 ResourceReqDetails resource = new ResourceReqDetails();
339 resource.setName(resourceName);
340 resource.setVersion("1.0");
341 if (resourceName.equals("Port")) {
342 resource.setResourceType(ResourceTypeEnum.CP.toString());
344 resource.setResourceType(ResourceTypeEnum.VFC.toString());
346 RestResponse restResponse = RestCDUtils.getResource(resource, getUser());
347 Map<String, String> propertiesNameTypeJson = ResponseParser.getPropertiesNameType(restResponse);
349 List<WebElement> propertyRowsFromTable = InputsPage.getInstancePropertiesList(resourceName);
350 assertTrue("Some properties are missing in table. Instance name is : " + resourceName, propertyRowsFromTable.size() == propertiesNameTypeJson.size());
351 VfVerificator.verifyVfInputs(instanceName, propertiesNameTypeJson, propertyRowsFromTable);
353 GeneralUIUtils.clickOnElementByText(resourceName);
358 public void addAllInformationalArtifactPlaceholdersInDCAEAssetTest() throws Exception {
360 ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
361 int fileNameCounter = 0;
363 for (InformationalArtifactsPlaceholders informArtifact : InformationalArtifactsPlaceholders.values()) {
364 fileName = HEAT_FILE_YAML_NAME_PREFIX + fileNameCounter + HEAT_FILE_YAML_NAME_SUFFIX;
365 ArtifactUIUtils.fillPlaceHolderInformationalArtifact(informArtifact,
366 FileHandling.getFilePath("uniqueFileNames"), fileName, informArtifact.getValue());
370 assertThat(InformationalArtifactPage.checkElementsCountInTable(InformationalArtifactsPlaceholders.values().length)).isTrue();
374 public void verifyToscaArtifactsExistDCAEAssetTest() throws Exception {
375 ResourceReqDetails vfMetaData = createDCAEAsset();
377 final int numOfToscaArtifacts = 2;
378 ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
379 assertTrue(ToscaArtifactsPage.checkElementsCountInTable(numOfToscaArtifacts));
381 for (int i = 0; i < numOfToscaArtifacts; i++) {
382 String typeFromScreen = ToscaArtifactsPage.getArtifactType(i);
383 assertTrue(typeFromScreen.equals(ArtifactTypeEnum.TOSCA_CSAR.getType()) || typeFromScreen.equals(ArtifactTypeEnum.TOSCA_TEMPLATE.getType()));
385 //TODO Andrey should click on certify button
386 ToscaArtifactsPage.clickCertifyButton(vfMetaData.getName());
387 vfMetaData.setVersion("1.0");
388 VfVerificator.verifyToscaArtifactsInfo(vfMetaData, getUser());
392 public void DCAEAssetCertificationTest() throws Exception {
393 ResourceReqDetails vfMetaData = createDCAEAsset();
395 String vfName = vfMetaData.getName();
397 ResourceGeneralPage.clickCheckinButton(vfName);
398 GeneralUIUtils.findComponentAndClick(vfName);
399 //TODO Andrey should click on certify button
400 ResourceGeneralPage.clickCertifyButton(vfName);
402 /*reloginWithNewRole(UserRoleEnum.TESTER);
403 GeneralUIUtils.findComponentAndClick(vfName);
404 TesterOperationPage.certifyComponent(vfName);*/
406 vfMetaData.setVersion("1.0");
407 VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.CERTIFIED);
409 /*reloginWithNewRole(UserRoleEnum.DESIGNER);*/
410 GeneralUIUtils.findComponentAndClick(vfName);
411 VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CERTIFIED);
415 public void deleteDCAEAssetCheckedoutTest() throws Exception {
416 ResourceReqDetails vfMetaData = createDCAEAsset();
418 GeneralPageElements.clickTrashButtonAndConfirm();
420 vfMetaData.setVersion("0.1");
421 VfVerificator.verifyVfDeleted(vfMetaData, getUser());
425 public void revertDCAEAssetMetadataTest() throws Exception {
426 ResourceReqDetails vfMetaData = createDCAEAsset();
428 ResourceReqDetails vfRevertDetails = new ResourceReqDetails();
429 vfRevertDetails.setName("ciUpdatedName");
430 vfRevertDetails.setDescription("kuku");
431 vfRevertDetails.setCategories(vfMetaData.getCategories());
432 vfRevertDetails.setVendorName("updatedVendor");
433 vfRevertDetails.setVendorRelease("updatedRelease");
434 ResourceUIUtils.fillResourceGeneralInformationPage(vfRevertDetails, getUser(), false);
436 GeneralPageElements.clickRevertButton();
438 VfVerificator.verifyVFMetadataInUI(vfMetaData);
442 public void addDeploymentArtifactInCompositionScreenDCAEAssetTest() throws Exception {
445 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
447 ArtifactInfo artifact = new ArtifactInfo(filePath, "Heat-File.yaml", "kuku", "artifact3", ArtifactTypeEnum.OTHER.getType());
448 CompositionPage.showDeploymentArtifactTab();
449 CompositionPage.clickAddArtifactButton();
450 ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());
452 List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className("i-sdc-designer-sidebar-section-content-item-artifact"));
453 Assert.assertEquals(1, actualArtifactList.size());
456 // future removed from ui
457 @Test(enabled = false)
458 public void addPropertyInCompositionScreenDCAEAssetTest() throws Exception {
461 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
463 CompositionPage.showPropertiesAndAttributesTab();
464 List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER);
465 int propertiesCount = CompositionPage.getProperties().size();
466 for (PropertyTypeEnum prop : propertyList) {
467 PropertiesUIUtils.addNewProperty(prop);
469 assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> CompositionPage.getProperties()));
473 public void addDeploymentArtifactAndVerifyInCompositionScreenDCAEAssetTest() throws Exception {
476 ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
478 ArtifactInfo deploymentArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", ArtifactTypeEnum.OTHER.getType());
479 DeploymentArtifactPage.clickAddNewArtifact();
480 ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
481 assertTrue(DeploymentArtifactPage.checkElementsCountInTable(1));
483 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
485 CompositionPage.showDeploymentArtifactTab();
486 List<WebElement> deploymentArtifactsFromScreen = CompositionPage.getDeploymentArtifacts();
487 assertTrue(1 == deploymentArtifactsFromScreen.size());
489 String actualArtifactFileName = deploymentArtifactsFromScreen.get(0).getText();
490 assertTrue("asc_heat-0-2.yaml".equals(actualArtifactFileName));
494 public void checkoutDCAEAssetTest() throws Exception {
495 ResourceReqDetails vfMetaData = createDCAEAsset();
497 ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
498 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
499 GeneralPageElements.clickCheckoutButton();
501 vfMetaData.setVersion("0.2");
502 VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
503 VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
504 //TODO Andrey should click on certify button
505 ResourceGeneralPage.clickCertifyButton(vfMetaData.getName());
507 /*reloginWithNewRole(UserRoleEnum.TESTER);
508 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
509 TesterOperationPage.certifyComponent(vfMetaData.getName());
511 reloginWithNewRole(UserRoleEnum.DESIGNER);*/
512 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
513 ResourceGeneralPage.clickCheckoutButton();
515 vfMetaData.setVersion("1.1");
516 vfMetaData.setUniqueId(null);
517 VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
518 VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
522 public void deleteInstanceFromDCAEAssetCanvas() throws Exception {
523 ResourceReqDetails vfMetaData = createDCAEAsset();
525 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
526 CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
527 CanvasElement computeElement = CompositionPage.addElementToCanvasScreen(LeftPanelCanvasItems.COMPUTE, vfCanvasManager);
529 vfCanvasManager.clickOnCanvaElement(computeElement);
530 vfCanvasManager.deleteElementFromCanvas(computeElement);
532 VfVerificator.verifyNumOfComponentInstances(vfMetaData, 2, getUser());
536 public void changeInstanceNameInDCAEAssetTest() throws Exception {
539 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
540 CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
541 CanvasElement computeElement = CompositionPage.addElementToCanvasScreen(LeftPanelCanvasItems.COMPUTE, vfCanvasManager);
543 String updatedInstanceName = "updatedName";
544 vfCanvasManager.updateElementNameInCanvas(computeElement, updatedInstanceName);
546 String actualSelectedInstanceName = CompositionPage.getSelectedInstanceName();
547 assertTrue(updatedInstanceName.equals(actualSelectedInstanceName));
551 public void submitDCAEAssetForTestingWithNonCertifiedAsset() throws Exception {
552 String fileName = "importVFC_VFC17.yml";
554 ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
555 ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
556 //TODO Andrey changed to click on checkIn button
557 ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName());
559 ResourceReqDetails vfMetaData = createDCAEAsset();
560 DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
561 CanvasManager canvasManager = CanvasManager.getCanvasManager();
562 CompositionPage.addElementToCanvasScreen(atomicResourceMetaData.getName(), canvasManager);
565 //TODO Andrey should click on certify button
566 CompositionPage.clickCertifyButton(vfMetaData.getName());
568 } catch (Exception e) {
569 String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
570 String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
571 Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
573 ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
578 public void isDisabledAndReadOnlyInCheckinDCAEAssetTest() throws Exception {
579 ResourceReqDetails vfMetaData = createDCAEAsset();
580 ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
581 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
583 ResourceMetadataEnum[] fieldsForCheck = {ResourceMetadataEnum.RESOURCE_NAME,
584 ResourceMetadataEnum.DESCRIPTION,
585 ResourceMetadataEnum.VENDOR_NAME,
586 ResourceMetadataEnum.VENDOR_RELEASE,
587 ResourceMetadataEnum.CONTACT_ID,
588 ResourceMetadataEnum.CATEGORY,
589 ResourceMetadataEnum.TAGS};
591 for (ResourceMetadataEnum field : fieldsForCheck) {
592 VfVerificator.verifyIsElementDisabled(field.getValue(), field.name());
594 VfVerificator.verifyIsElementDisabled(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue(), DataTestIdEnum.LifeCyleChangeButtons.CREATE.name());
598 public void removeFileFromGeneralPageDCAEAssetTest() throws Exception {
599 String fileName2 = SERVICE_INPUT_TEST_VF2_CSAR;
600 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
601 ResourceUIUtils.importVfFromCsarNoCreate(resourceMetaData, filePath, fileName2, getUser());
602 GeneralPageElements.clickDeleteFile();
605 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue(), CLICKING_ON_ELEMENT_TIMEOUT);
607 } catch (Exception e) {
613 public void activityLogDCAEAssetTest() throws Exception {
616 ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
618 ArtifactInfo informationalArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", ArtifactTypeEnum.OTHER.getType());
619 InformationalArtifactPage.clickAddNewArtifact();
620 ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact);
622 ResourceGeneralPage.getLeftMenu().moveToActivityLogScreen();
624 int numberOfRows = GeneralUIUtils.getElementsByCSS("div[class^='flex-container']").size();
625 assertTrue("Wrong rows number, should be 2", numberOfRows == 2);
629 public void checkinCheckoutChangeDeleteVersionDCAEAssetTest() throws Exception {
630 ResourceReqDetails atomicResourceMetaData = createDCAEAsset();
632 ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName());
633 GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
634 GeneralPageElements.clickCheckoutButton();
635 VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
637 GeneralPageElements.selectVersion("V0.1");
638 VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKIN);
639 GeneralUIUtils.clickJSOnElementByText("latest version");
641 GeneralPageElements.clickTrashButtonAndConfirm();
642 GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
643 String actualVersion = GeneralUIUtils.getSelectedElementFromDropDown(DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue()).getText();
644 assertTrue("Expected version: V0.1, Actual version: " + actualVersion, actualVersion.equals("V0.1"));
648 public void badFileDCAEAssetTest() throws Exception {
649 String customFileName = "badVF.csar";
650 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
652 ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, customFileName, getUser());
654 } catch (Exception e) {
655 String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
656 String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.CSAR_INVALID.name());
657 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating error messdge..."));
658 Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
663 public void validContactAfterCreateDCAEAssetTest() throws Exception {
664 ResourceReqDetails resourceMetaData = createDCAEAsset();
665 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating that userID equal to user that was logged in..."));
666 assertTrue("Wrong userId", resourceMetaData.getContactId().equals(ResourceGeneralPage.getContactIdText()));
669 public ResourceReqDetails createDCAEAsset() throws Exception {
670 String fileName2 = SERVICE_INPUT_TEST_VF2_CSAR;
671 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
672 ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser());
673 resourceMetaData.setVersion("0.1");
674 return resourceMetaData;
678 protected UserRoleEnum getRole() {
679 return UserRoleEnum.DESIGNER;