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