re base code
[sdc.git] / ui-ci / src / main / java / org / openecomp / sdc / ci / tests / execute / sanity / VfArtifacts.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.sdc.ci.tests.execute.sanity;
22
23 import com.aventstack.extentreports.Status;
24 import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition;
25 import org.openecomp.sdc.be.model.ArtifactDefinition;
26 import org.openecomp.sdc.be.model.Resource;
27 import org.openecomp.sdc.ci.tests.businesslogic.ArtifactBusinessLogic;
28 import org.openecomp.sdc.ci.tests.config.Config;
29 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
30 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.CompositionScreenEnum;
31 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
32 import org.openecomp.sdc.ci.tests.datatypes.HeatWithParametersDefinition;
33 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
34 import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
35 import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
36 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
37 import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
38 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
39 import org.openecomp.sdc.ci.tests.pages.CompositionPage;
40 import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
41 import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
42 import org.openecomp.sdc.ci.tests.utilities.*;
43 import org.openecomp.sdc.ci.tests.utils.Utils;
44 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
45 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
46 import org.openqa.selenium.WebElement;
47 import org.testng.annotations.BeforeMethod;
48 import org.testng.annotations.DataProvider;
49 import org.testng.annotations.Test;
50
51 import java.awt.*;
52 import java.io.File;
53 import java.io.FileNotFoundException;
54 import java.util.HashMap;
55 import java.util.List;
56 import java.util.Map;
57 import java.util.Map.Entry;
58
59 import static org.testng.AssertJUnit.assertTrue;
60
61 public class VfArtifacts extends SetupCDTest{
62
63         public static final String VSAEGW_FDNT_30_1607_E2E_ZIP = "2016-043_vsaegw_fdnt_30_1607_e2e.zip";
64         public static final String VFW_FCGI_30_1607_E2E_ZIP = "2016-044_vfw_fcgi_30_1607_e2e.zip";
65         public static final String FDNT_UPDATE_HEAT_PARAMS_ZIP = "FDNT_UpdateHeatParams.zip";
66         public static final String FDNT_WITHOUT_ENV_FILES_ZIP = "FDNT_WithoutEnvFiles.zip";
67         public static final String VLANDSLIDE_LDSA_30_1607_E2E_ZIP = "2016-014_vlandslide_ldsa_30_1607_e2e.zip";
68         public static final String VJSA_VJSA_30_1610_E2E_ZIP = "2016-209_vjsa_vjsa_30_1610_e2e.zip";
69         public static final String VLB_LMSP_30_1607_E2E_ZIP = "2016-045_vlb_lmsp_30_1607_e2e.zip";
70         public static final String MOBT_MOBT_30_1607_E2E_ZIP = "2016-109_mobt_mobt_30_1607_e2e.zip";
71         public static final String MOBT_MOBT_30_1607_E2E_DIFFERENT_PARAMS_ZIP = "2016-109_mobt_mobt_30_1607_e2e_DifferentParams.zip";
72         public static final String VMSP_PXMC_30_1607_E2E_ZIP = "2016-042_vmsp_pxmc_30_1607_e2e.zip";
73         public static final String VFW_FNAT_30_1607_E2E_ZIP = "2016-044_vfw_fnat_30_1607_e2e.zip";
74         public static final String VLANDSLIDE_LDST_30_1607_E2E_ZIP = "2016-014_vlandslide_ldst_30_1607_e2e.zip";
75         public static final String VIXIA_IXLA_30_1607_E2E_ZIP = "2016-017_vixia_ixla_30_1607_e2e.zip";
76         private String filePath;
77         private String vnfsRepositoryPath;
78         private String createdEnvFilePath;
79         private static final String PARAMETERS = "parameters";
80         
81         @BeforeMethod
82         public void beforeTest() throws FileNotFoundException{
83                 filePath = getWindowTest().getDownloadDirectory();
84                 vnfsRepositoryPath = FileHandling.getFilePath("VfArtifacts");
85                 Config config = Utils.getConfig();
86                 createdEnvFilePath = config.getWindowsDownloadDirectory();
87         }
88
89         @Override
90         protected UserRoleEnum getRole() {
91                 return UserRoleEnum.DESIGNER;
92         }
93         
94         
95         @DataProvider(name = "heatEnvAndVersion", parallel = false)
96 //      parameters: VSP, updatedVsp, expectedHeatVersion, expectedHeatEnvVersion
97         public Object[][] provideData() {
98
99                 return new Object[][] { 
100                         { VSAEGW_FDNT_30_1607_E2E_ZIP, FDNT_UPDATE_HEAT_PARAMS_ZIP, "2", "2" }, //      expected heat version 2 and heatEnv 2
101                         { VSAEGW_FDNT_30_1607_E2E_ZIP, FDNT_WITHOUT_ENV_FILES_ZIP, "1", "2" }, //       expected heat version 1 and heatEnv 2
102                         {VLANDSLIDE_LDSA_30_1607_E2E_ZIP, VJSA_VJSA_30_1610_E2E_ZIP, "1", "1" }, //     expected heat version 1 and heatEnv 1
103                         {VLB_LMSP_30_1607_E2E_ZIP, VLB_LMSP_30_1607_E2E_ZIP, "1", "2" }, //     expected heat version 1 and heatEnv 2(DE270634)
104                         {MOBT_MOBT_30_1607_E2E_ZIP, MOBT_MOBT_30_1607_E2E_DIFFERENT_PARAMS_ZIP, "2", "2" } //   expected heat version 2 and heatEnv 2
105                 };
106         }
107         
108 //      update first env file and verify parameters value
109         @Test
110         public void uploadUpdatedHeatEnv() throws Exception{
111                 
112                 String vnfFile = VFW_FNAT_30_1607_E2E_ZIP;
113                 File updateEnvFile = null;
114                 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
115                 VendorSoftwareProductObject vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
116                 String vspName = vsp.getName();
117                 Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1");
118                 Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
119                 List<HeatWithParametersDefinition> envFilesList = ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts);
120 //              create env file and update it
121                 if(envFilesList.size()>0){
122 //              select index of env file to be updated 
123                         HeatWithParametersDefinition selectedEnvFileToUpdate = envFilesList.get(0);
124                         GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue()+selectedEnvFileToUpdate.getHeatEnvLabel());
125                         updateEnvFile = ArtifactUIUtils.uploadCreatedUpdateParametersEnvFile(selectedEnvFileToUpdate, createdEnvFilePath);
126                         ArtifactUIUtils.verifyUpdatedEnvParameters(selectedEnvFileToUpdate, updateEnvFile);
127                 }
128                 else{
129                         SetupCDTest.getExtendTest().log(Status.INFO, "Resource does not contain HEAT files");
130                 }
131         }
132
133 //      update all env files and verify parameters value in Deployment Artifact View
134         @Test
135         public void uploadUpdatedAllHeatEnv() throws Exception{
136                 
137                 String vnfFile = VFW_FNAT_30_1607_E2E_ZIP;
138                 File updateEnvFile = null;
139                 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
140                 VendorSoftwareProductObject vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
141                 String vspName = vsp.getName();
142                 Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1");
143                 Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
144                 List<HeatWithParametersDefinition> envFilesList = ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts);
145                 if(envFilesList.size()>0){
146                         for(HeatWithParametersDefinition selectedEnvFileToUpdate : envFilesList){
147         //                      create env file and update it
148                                 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue()+selectedEnvFileToUpdate.getHeatEnvLabel());
149                                 updateEnvFile = ArtifactUIUtils.uploadCreatedUpdateParametersEnvFile(selectedEnvFileToUpdate, createdEnvFilePath);
150                                 ArtifactUIUtils.verifyUpdatedEnvParameters(selectedEnvFileToUpdate, updateEnvFile);
151                                 }
152                 }else{
153                         SetupCDTest.getExtendTest().log(Status.INFO, "Resource does not contain HEAT files");
154                 }
155         }
156         
157 //      update all env files and verify parameters value in Composition
158         @Test
159         public void uploadUpdatedAllHeatEnvComposition() throws Exception{
160                 
161                 String vnfFile = VLANDSLIDE_LDST_30_1607_E2E_ZIP;
162                 File updateEnvFile = null;
163                 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
164                 VendorSoftwareProductObject vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
165                 String vspName = vsp.getName();
166                 Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1");
167                 Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
168                 List<HeatWithParametersDefinition> envFilesList = ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts);
169                 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.StepsEnum.COMPOSITION.getValue());
170                 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CompositionScreenEnum.DEPLOYMENT_ARTIFACT_TAB.getValue());
171                 if(envFilesList.size()>0){
172                         for(HeatWithParametersDefinition selectedEnvFileToUpdate : envFilesList){
173         //                      create env file and update it
174                                 String dataTestId = DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_ITEM.getValue()+selectedEnvFileToUpdate.getHeatArtifactDisplayName();
175                                 GeneralUIUtils.hoverOnAreaByTestId(dataTestId);
176                                 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue()+selectedEnvFileToUpdate.getHeatArtifactDisplayName());
177                                 updateEnvFile = ArtifactUIUtils.uploadCreatedUpdateParametersEnvFile(selectedEnvFileToUpdate, createdEnvFilePath);
178                                 ArtifactUIUtils.verifyUpdatedEnvParameters(selectedEnvFileToUpdate, updateEnvFile, dataTestId);
179                                 }
180                 }else{
181                         SetupCDTest.getExtendTest().log(Status.INFO, "Resource does not contain HEAT files");
182                 }
183         }
184         
185 //      expected heat version 1 and heatEnv 0
186         @Test
187         // Download ENV file from VF level Update VSP.
188         public void downloadEnvFromVFLevelUpdateVSP() throws Throwable {
189                 String vnfFile = VSAEGW_FDNT_30_1607_E2E_ZIP;
190                 String updatedVnfFile= VLANDSLIDE_LDSA_30_1607_E2E_ZIP;
191                 String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory();
192                 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
193                 VendorSoftwareProductObject CreatedVsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
194                 String vspName = CreatedVsp.getName();
195                 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
196                 OnboardingUiUtils.updateVnfAndValidate(vnfsRepositoryPath, CreatedVsp, updatedVnfFile, getUser());
197                 //get updated vsp env files
198                 Map<String, File> currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, downloadDirPath);
199                 GeneralUIUtils.findComponentAndClick(vspName);
200                 ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
201                 List<String> deploymentArtifcatsList = DeploymentArtifactPage.getDeploymentArtifactsNamesWorkSpace();
202                 
203                 for (int i = 0; i < deploymentArtifcatsList.size(); i++) {
204                         if (DeploymentArtifactPage.getArtifactType(deploymentArtifcatsList.get(i)).equalsIgnoreCase(ArtifactTypeEnum.HEAT.getType())) {
205                                 DeploymentArtifactPage.clickDownloadEnvArtifact(deploymentArtifcatsList.get(i));
206                                 GeneralUIUtils.ultimateWait();
207                                 File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir(downloadDirPath);
208                                 ArtifactUIUtils.compareYamlFilesByPattern(latestFilefromDir, currentZipEnvfiles.get(deploymentArtifcatsList.get(i)), PARAMETERS);
209                                 }
210                 }
211         }
212         
213         @Test
214         // Download ENV file from VF level Work-Space.
215         public void downloadEnvFromVFLevelWorkSpace() throws AWTException, Exception {
216                 String vnfFile = VSAEGW_FDNT_30_1607_E2E_ZIP;
217                 String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory();
218                 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
219                 VendorSoftwareProductObject vsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
220                 Map<String, File> currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vsp.getName(),downloadDirPath);
221                 GeneralUIUtils.findComponentAndClick(vsp.getName());
222                 ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
223                 List<String> deploymentArtifcatsList = DeploymentArtifactPage.getDeploymentArtifactsNamesWorkSpace();
224                 
225                 for (int i = 0; i < deploymentArtifcatsList.size(); i++) {
226                         
227                         if (DeploymentArtifactPage.getArtifactType(deploymentArtifcatsList.get(i)).equalsIgnoreCase(ArtifactTypeEnum.HEAT.getType())) {
228                                 DeploymentArtifactPage.clickDownloadEnvArtifact(deploymentArtifcatsList.get(i));
229                                 GeneralUIUtils.ultimateWait();
230                                 File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir(downloadDirPath);
231                                 ArtifactUIUtils.compareYamlFilesByPattern(latestFilefromDir,currentZipEnvfiles.get(deploymentArtifcatsList.get(i)), PARAMETERS);
232                         }
233                 }
234         }
235         
236         @Test
237         // Download ENV file from VF level Composition.
238         public void downloadEnvVFLevelComposition() throws AWTException, Exception {
239                 
240                 String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory();
241                 String vnfFile = VSAEGW_FDNT_30_1607_E2E_ZIP;
242                 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
243                 VendorSoftwareProductObject vsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
244                 Map<String, File> currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vsp.getName(),downloadDirPath);
245                 GeneralUIUtils.findComponentAndClick(vsp.getName());
246                 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
247                 CompositionPage.clickOnTabTestID(CompositionScreenEnum.DEPLOYMENT_ARTIFACT_TAB);
248                 List<WebElement> deploymentArtifcatsList = CompositionPage.getCompositionEnvArtifacts();
249                 
250                 for (int i = 0; i < deploymentArtifcatsList.size(); i++) {
251             String fileName = GeneralUIUtils.getDataTestIdAttributeValue(deploymentArtifcatsList.get(i)).replace(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_ENV.getValue(), "");
252                         if (GeneralUIUtils.isElementVisibleByTestId(GeneralUIUtils.getDataTestIdAttributeValue(deploymentArtifcatsList.get(i)))) {
253                                 CompositionPage.clickDownloadEnvArtifactComposition(fileName).click();
254                                 GeneralUIUtils.ultimateWait();
255                                 File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir(downloadDirPath);
256                                 ArtifactUIUtils.compareYamlFilesByPattern(latestFilefromDir,currentZipEnvfiles.get(fileName), PARAMETERS);
257                         }
258                 }
259         }
260         
261         @Test
262         // Download ENV file from VF level Update parameters in UI.
263         public void downloadEnvVFLevelUpdateParameters() throws Exception {
264                 
265                 String vnfFile = VFW_FCGI_30_1607_E2E_ZIP;
266                 String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory();
267                 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
268                 VendorSoftwareProductObject vendorSoftwareProductObject= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
269                 Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vendorSoftwareProductObject.getName(), "0.1");
270         Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
271         List<HeatWithParametersDefinition> envFilesList = ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts);
272         
273         for (int i = 0; i < envFilesList.size(); i++) {
274                 String artifactName = envFilesList.get(i).getHeatArtifactDisplayName();
275                         if (envFilesList.get(i).getHeatArtifactType().equalsIgnoreCase(ArtifactTypeEnum.HEAT.getType())) {
276                                 ExtentTestActions.log(Status.INFO, String.format("Opening the edit/view artifact parameters form of %s resource...", vnfFile));
277                                 DeploymentArtifactPage.clickEditEnvArtifact(envFilesList.get(i).getHeatArtifactDisplayName());
278                                 
279                                 ExtentTestActions.log(Status.INFO, String.format("Going To locating all artifact parameters from UI of  %s artifact...", artifactName));
280                                 Map<?, ?> dataToWriteInUI = ArtifactUIUtils.getDataToWriteInUI(envFilesList.get(i).getHeatParameterDefinition());
281                                 Map<?, ?> data = dataToWriteInUI;
282                                 ExtentTestActions.log(Status.INFO, String.format("Success to locate all artifact parameters from UI of  %s artifact...", artifactName));
283                                 
284                                 List<HeatParameterDataDefinition> listToSearchEnvParametersInUI = envFilesList.get(i).getHeatParameterDefinition();
285                                 fillHeatEnvParametersInUi(data, listToSearchEnvParametersInUI);
286                                 
287                                 DeploymentArtifactPage.clickSaveEnvParameters();
288                                 GeneralUIUtils.waitForLoader();
289                                 ExtentTestActions.log(Status.INFO, String.format("Going to get the %s updated resource ...", vendorSoftwareProductObject.getName()));
290                                 resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vendorSoftwareProductObject.getName(), "0.1");
291                         deploymentArtifacts = resource.getDeploymentArtifacts();
292                         Map<String,List<HeatWithParametersDefinition>> envFilesListupdated = new HashMap<>();
293                                 ExtentTestActions.log(Status.INFO, String.format("Mapping the %s artifact parameters ...", artifactName));
294                         envFilesListupdated.put(artifactName,ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts));
295                         List<HeatWithParametersDefinition> heatEnvUpdatedParameters=envFilesListupdated.get(artifactName);
296                                 DeploymentArtifactPage. clickDownloadEnvArtifact(artifactName);
297
298                                 Map<String,Object> mapExpectedProperties = new HashMap<>();
299                                 for (HeatParameterDataDefinition param : heatEnvUpdatedParameters.get(i).getHeatParameterDefinition()) {
300                                         mapExpectedProperties.put(param.getName(), ArtifactUIUtils.getValue(param));
301                                 }
302                                 ArtifactUIUtils.compareYamlParametersByPattern(mapExpectedProperties, FileHandling.getLastModifiedFileNameFromDir(downloadDirPath), PARAMETERS);
303                         }
304         }
305         }
306
307
308         @Test
309         public void checkDefaultCreatedEnvArtifacts() throws Exception{
310                 String vnfFile = VIXIA_IXLA_30_1607_E2E_ZIP;
311                 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
312                 VendorSoftwareProductObject vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
313                 String vspName = vsp.getName();
314                 Map<String, File> generatedEnvFileList = ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, filePath);
315                 HomeUtils.findComponentAndClick(vspName);
316                 GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT);
317                 for(Entry<String, File> envFileEntry : generatedEnvFileList.entrySet()){
318                         GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey());
319                         ArtifactUIUtils.compareYamlFilesByPattern(envFileEntry.getValue(), FileHandling.getLastModifiedFileNameFromDir(), PARAMETERS);
320 //                      if(true){
321 ////                            throw new SkipException("Test skipped, new artifact version design should be developed");
322 //                              SetupCDTest.getExtendTest().log(Status.INFO, "Test skipped, new artifact version design should be developed");
323 //                      }
324 //                      ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), "1", ArtifactTypeEnum.HEAT_ENV);
325 //                      ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), "1", ArtifactTypeEnum.HEAT);
326                 }
327         }
328         
329 //      -------------------------------------------------------------------------------
330         @Test(dataProvider = "heatEnvAndVersion")
331         public void checkDefaultCreatedEnvArtifactsAfterVspUpdate(String vnfFile, String updatedVnfFile, String expectedHeatVersion, String expectedHeatEnvVersion) throws Throwable{
332                 String stringForLog = String.format("%s:%s:%s:%s", vnfFile, updatedVnfFile, expectedHeatVersion, expectedHeatEnvVersion);
333                 setLog(stringForLog);
334                 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
335                 VendorSoftwareProductObject vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
336                 String vspName = vsp.getName();
337                 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
338                 OnboardingUiUtils.updateVnfAndValidate(vnfsRepositoryPath, vsp, updatedVnfFile, getUser());
339                 Map<String, File> generatedUpdatedEnvFileList = ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, filePath);
340                 HomeUtils.findComponentAndClick(vspName);
341                 GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT);
342                 for(Entry<String, File> envFileEntry : generatedUpdatedEnvFileList.entrySet()){
343 //                      TODO test will pass on case all objects on deployment view are visible 
344                         GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey());
345                         ArtifactUIUtils.compareYamlFilesByPattern(envFileEntry.getValue(), FileHandling.getLastModifiedFileNameFromDir(), PARAMETERS);
346 //                      ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), expectedHeatEnvVersion, ArtifactTypeEnum.HEAT_ENV);
347 //                      ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), expectedHeatVersion, ArtifactTypeEnum.HEAT);
348                 }
349                 if(true){
350 //                      throw new SkipException("Test skipped, new artifact version design should be developed");
351                         ExtentTestActions.log(Status.INFO, "Test skipped, new artifact version design should be developed");
352                 }
353         }
354         
355 //      expected heat version 1 and heatEnv 3
356         @Test
357         public void checkDefaultCreatedEnvArtifactsVspUpdatedWithSameVspTwice() throws Throwable{
358                 String vnfFile = VFW_FCGI_30_1607_E2E_ZIP;
359                 String updatedVnfFile = VFW_FCGI_30_1607_E2E_ZIP;
360                 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
361                 VendorSoftwareProductObject vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
362                 String vspName = vsp.getName();
363                 
364                 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
365                 OnboardingUiUtils.updateVnfAndValidate(vnfsRepositoryPath, vsp, updatedVnfFile, getUser());
366                 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
367                 OnboardingUiUtils.updateVnfAndValidate(vnfsRepositoryPath, vsp, updatedVnfFile, getUser());
368                 // Artifact validation commented until new artifact version design should be developed
369                 Map<String, File> generatedUpdatedSecondTimeEnvFileList = ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, filePath);
370                 HomeUtils.findComponentAndClick(vspName);
371                 GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT);
372                 for(Entry<String, File> envFileEntry : generatedUpdatedSecondTimeEnvFileList.entrySet()){
373                         GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey());
374                         ArtifactUIUtils.compareYamlFilesByPattern(envFileEntry.getValue(), FileHandling.getLastModifiedFileNameFromDir(), PARAMETERS);
375                         if(true){
376 //                              throw new SkipException("Test skipped, new artifact version design should be developed");
377                 ExtentTestActions.log(Status.INFO, "Test skipped, new artifact version design should be developed");
378                         }
379 //                      ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), "3", ArtifactTypeEnum.HEAT_ENV);
380 //                      ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), "1", ArtifactTypeEnum.HEAT);
381                 }
382         }
383         
384         
385         public void downloadFile(Entry<String, File> envFileEntry) {
386                 int fileCountBefore = FileHandling.getFileCountFromDefaulDownloadDirectory();
387                 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey());
388                 int fileCountAfter = FileHandling.getFileCountFromDefaulDownloadDirectory();
389                 assertTrue("Downloaded file is missing", (fileCountAfter - fileCountBefore) == 1 );
390         }
391
392         public static void fillHeatEnvParametersInUi(Map<?, ?> data,List<HeatParameterDataDefinition> listToSearchEnvParametersInUI) {
393                 ExtentTestActions.log(Status.INFO, String.format("Going to search parameters in UI and insert new current value to each parameter in UI..."));
394
395                 for (HeatParameterDataDefinition paramDefinition : listToSearchEnvParametersInUI){
396                         DeploymentArtifactPage.searchBoxEnv(paramDefinition.getName());
397                         WebElement currenValueField=GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.EnvParameterView.ENV_CURRENT_VALUE.getValue()+paramDefinition.getName());
398                         currenValueField.clear();
399                         currenValueField.sendKeys(data.get(paramDefinition.getName()).toString());
400                         GeneralUIUtils.ultimateWait();
401                         DeploymentArtifactPage.clearSearchBoxEnv();
402                 }
403         }
404         
405 }