2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.ci.tests.US;
23 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
24 import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
25 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
26 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
27 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
28 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
29 import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
30 import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
31 import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
32 import org.openecomp.sdc.ci.tests.pages.UploadArtifactPopup;
33 import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
34 import org.openecomp.sdc.ci.tests.utilities.FileHandling;
35 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
36 import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
37 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
38 import org.testng.Assert;
39 import org.testng.annotations.Test;
41 import static org.testng.AssertJUnit.assertTrue;
44 public class NewArtifactTypeGuide extends SetupCDTest {
46 private String folder ="";
49 // Upload information artifact of type GUIDE to VF
51 public void crudGuideInformationArtifactForVf() throws Exception {
52 String filePath = FileHandling.getFilePath(folder);
54 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
55 ResourceUIUtils.createVF(resourceMetaData, getUser());
57 ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
59 ArtifactInfo informationArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "GUIDE");
61 InformationalArtifactPage.clickAddNewArtifact();
62 ArtifactUIUtils.fillAndAddNewArtifactParameters(informationArtifact);
64 assertTrue("Only created artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
66 String artifactUUID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText();
67 ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "1", informationArtifact.getArtifactType(), true, true, true, false);
69 InformationalArtifactPage.clickEditArtifact(informationArtifact.getArtifactLabel());
70 UploadArtifactPopup artifactPopup = new UploadArtifactPopup();
71 artifactPopup.loadFile(filePath, "CP.yml");
72 artifactPopup.clickDoneButton();
74 assertTrue("Only updated artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
75 Assert.assertNotEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText(), artifactUUID);
76 ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "2", informationArtifact.getArtifactType(), true, true, true, false);
78 InformationalArtifactPage.clickDeleteArtifact(informationArtifact.getArtifactLabel());
79 InformationalArtifactPage.clickOK();
83 // Upload information artifact of type GUIDE to VFC
85 public void crudGuideInformationArtifactForVfc() throws Exception {
86 String filePath = FileHandling.getFilePath(folder);
88 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VFC, getUser());
89 ResourceUIUtils.importVfc(resourceMetaData, filePath, "guidevFW_VFC.yml", getUser());
91 ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
93 ArtifactInfo informationArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "GUIDE");
95 InformationalArtifactPage.clickAddNewArtifact();
96 ArtifactUIUtils.fillAndAddNewArtifactParameters(informationArtifact);
98 assertTrue("Only created artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
99 String artifactUUID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText();
100 ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "1", informationArtifact.getArtifactType(), true, true, true, false);
102 InformationalArtifactPage.clickEditArtifact(informationArtifact.getArtifactLabel());
103 UploadArtifactPopup artifactPopup = new UploadArtifactPopup();
104 artifactPopup.loadFile(filePath, "CP.yml");
105 artifactPopup.clickDoneButton();
107 assertTrue("Only updated artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
108 Assert.assertNotEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText(), artifactUUID);
109 ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "2", informationArtifact.getArtifactType(), true, true, true, false);
111 InformationalArtifactPage.clickDeleteArtifact(informationArtifact.getArtifactLabel());
112 InformationalArtifactPage.clickOK();
118 protected UserRoleEnum getRole() {
119 return UserRoleEnum.DESIGNER;