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 static org.testng.AssertJUnit.assertTrue;
25 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
26 import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
27 import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
28 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
29 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
30 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
31 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
32 import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
33 import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
34 import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
35 import org.openecomp.sdc.ci.tests.pages.UploadArtifactPopup;
36 import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
37 import org.openecomp.sdc.ci.tests.utilities.FileHandling;
38 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
39 import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
40 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
41 import org.testng.Assert;
42 import org.testng.annotations.Test;
45 public class NewArtifactTypeGuide extends SetupCDTest {
47 private String folder ="";
50 // Upload information artifact of type GUIDE to VF
52 public void crudGuideInformationArtifactForVf() throws Exception {
53 String filePath = FileHandling.getFilePath(folder);
55 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
56 ResourceUIUtils.createResource(resourceMetaData, getUser());
58 ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
60 ArtifactInfo informationArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "GUIDE");
62 InformationalArtifactPage.clickAddNewArtifact();
63 ArtifactUIUtils.fillAndAddNewArtifactParameters(informationArtifact);
65 assertTrue("Only created artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
67 String artifactUUID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText();
68 ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "1", informationArtifact.getArtifactType(), true, true, true, false);
70 InformationalArtifactPage.clickEditArtifact(informationArtifact.getArtifactLabel());
71 UploadArtifactPopup artifactPopup = new UploadArtifactPopup();
72 artifactPopup.loadFile(filePath, "CP.yml");
73 artifactPopup.clickDoneButton();
75 assertTrue("Only updated artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
76 Assert.assertNotEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText(), artifactUUID);
77 ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "2", informationArtifact.getArtifactType(), true, true, true, false);
79 InformationalArtifactPage.clickDeleteArtifact(informationArtifact.getArtifactLabel());
80 InformationalArtifactPage.clickOK();
84 // Upload information artifact of type GUIDE to VFC
86 public void crudGuideInformationArtifactForVfc() throws Exception {
87 String filePath = FileHandling.getFilePath(folder);
89 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VFC, getUser());
90 ResourceUIUtils.importVfc(resourceMetaData, filePath, "guidevFW_VFC.yml", getUser());
92 ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
94 ArtifactInfo informationArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "GUIDE");
96 InformationalArtifactPage.clickAddNewArtifact();
97 ArtifactUIUtils.fillAndAddNewArtifactParameters(informationArtifact);
99 assertTrue("Only created artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
100 String artifactUUID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText();
101 ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "1", informationArtifact.getArtifactType(), true, true, true, false);
103 InformationalArtifactPage.clickEditArtifact(informationArtifact.getArtifactLabel());
104 UploadArtifactPopup artifactPopup = new UploadArtifactPopup();
105 artifactPopup.loadFile(filePath, "CP.yml");
106 artifactPopup.clickDoneButton();
108 assertTrue("Only updated artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
109 Assert.assertNotEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText(), artifactUUID);
110 ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "2", informationArtifact.getArtifactType(), true, true, true, false);
112 InformationalArtifactPage.clickDeleteArtifact(informationArtifact.getArtifactLabel());
113 InformationalArtifactPage.clickOK();
119 protected UserRoleEnum getRole() {
120 return UserRoleEnum.DESIGNER;