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