2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.sdc.frontend.ci.tests.execute.sanity;
23 import org.onap.sdc.frontend.ci.tests.datatypes.ArtifactInfo;
24 import org.onap.sdc.frontend.ci.tests.datatypes.DataTestIdEnum;
25 import org.onap.sdc.backend.ci.tests.datatypes.ResourceReqDetails;
26 import org.onap.sdc.frontend.ci.tests.pages.CompositionPage;
27 import org.onap.sdc.frontend.ci.tests.utilities.ArtifactUIUtils;
28 import org.onap.sdc.frontend.ci.tests.utilities.FileHandling;
29 import org.onap.sdc.frontend.ci.tests.utilities.GeneralUIUtils;
30 import org.onap.sdc.frontend.ci.tests.utilities.ResourceUIUtils;
31 import org.onap.sdc.backend.ci.tests.utils.general.ElementFactory;
32 import org.onap.sdc.backend.ci.tests.utils.validation.ErrorValidationUtils;
33 import org.openecomp.sdc.be.dao.api.ActionStatus;
34 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
35 import org.openecomp.sdc.be.model.User;
36 import org.onap.sdc.backend.ci.tests.datatypes.enums.UserRoleEnum;
37 import org.onap.sdc.frontend.ci.tests.execute.setup.SetupCDTest;
38 import org.onap.sdc.frontend.ci.tests.pages.ResourceGeneralPage;
39 import org.openecomp.sdc.common.api.ArtifactTypeEnum;
40 import org.openqa.selenium.WebElement;
41 import org.testng.annotations.Test;
43 import java.util.ArrayList;
44 import java.util.List;
46 import static org.assertj.core.api.Assertions.assertThat;
49 public class VfDeploymentInformationalArtifacts extends SetupCDTest {
52 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
54 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
56 // US824719 - Import VSP - VF informational artifacts
57 // TC1434241 - Import VF Artifacts - Deployment Artifacts - One Artifact, One Type
59 public void importVfArtifactsDeploymentArtifactsOneArtifactOneType() throws Exception {
60 String fileName = "TC1434241.csar";
61 String folder = "US825779";
63 List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
64 deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
65 deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
66 deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
68 importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
71 // US824719 - Import VSP - VF informational artifacts
72 // TC1434245 - Import VF Artifacts - Deployment Artifacts - Multiple Artifacts, Multiple Types
74 public void importVfArtifactsDeploymentArtifactsMultipleArtifactsMultipleTypes() throws Exception {
75 String fileName = "TC1434245.csar";
76 String folder = "US825779";
78 List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
79 deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
80 deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname2.yaml", null, "heatartifactname2", ArtifactTypeEnum.HEAT.getType(), "1"));
82 deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName1.yaml", null, "HeatVolArtifactName1", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
83 deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName2.yaml", null, "HeatVolArtifactName2", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
84 deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName3.yaml", null, "HeatVolArtifactName3", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
86 deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
87 deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
89 importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
92 // US824719 - Import VSP - VF informational artifacts
93 // TC1434247 - Import VF Artifacts - Informational Artifacts - One Artifact, One Type
95 public void importVfArtifactsInformationalArtifactsOneArtifactOneType() throws Exception {
96 String fileName = "TC1434247.csar";
97 String folder = "US825779";
99 List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
100 deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
101 deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
103 List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
104 informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
106 importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
109 // US824719 - Import VSP - VF informational artifacts
110 // TC1434248 - Import VF Artifacts - Informational Artifacts - Multiple Artifacts, Multiple Types
112 public void importVfArtifactsInformationalArtifactsMultipleArtifactsMultipleTypes() throws Exception {
113 String fileName = "TC1434248.csar";
114 String folder = "US825779";
116 List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
117 deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
118 deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
120 List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
121 informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
122 informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact1.yml", null, "GuideInfoArtifact1", ArtifactTypeEnum.GUIDE.getType(), "1"));
123 informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact2.yml", null, "GuideInfoArtifact2", ArtifactTypeEnum.GUIDE.getType(), "1"));
125 importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
128 // US824719 - Import VSP - VF informational artifacts
129 // TC1434249 - Import VF Artifacts - Deployment and Informational Artifacts - Multiple Artifacts, Multiple Types
131 public void importVfArtifactsDeploymentAndInformationalArtifactsMultipleArtifactsMultipleTypes() throws Exception {
132 String fileName = "TC1434249.csar";
133 String folder = "US825779";
135 List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
136 deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
137 deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname2.yaml", null, "heatartifactname2", ArtifactTypeEnum.HEAT.getType(), "1"));
138 deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName1.yaml", null, "HeatVolArtifactName1", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
139 deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName2.yaml", null, "HeatVolArtifactName2", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
140 deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName3.yaml", null, "HeatVolArtifactName3", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
141 deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
142 deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
144 List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
145 informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
146 informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact1.yml", null, "GuideInfoArtifact1", ArtifactTypeEnum.GUIDE.getType(), "1"));
147 informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact2.yml", null, "GuideInfoArtifact2", ArtifactTypeEnum.GUIDE.getType(), "1"));
149 importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
152 // TODO: there is defect in flow: "Updated button enabled for artifact in invalid type folder"
153 // TODO: re-check it after defect fix
154 // US824719 - Import VSP - VF informational artifacts
155 // TC1438310 - Import VF Artifacts - Deployment Artifacts - Artifact Type Invalid
157 public void importVFArtifactsDeploymentArtifactsArtifactTypeInvalid() throws Exception {
158 String fileName = "DeploymentArtifactWithInvalidType.csar";
159 String folder = "US825779";
161 List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
162 deploymentArtifacts.add(new ArtifactInfo(null, "ArtifactName.yaml", null, "ArtifactName", ArtifactTypeEnum.OTHER.getType(), "1"));
163 deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
164 deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
166 importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
169 // US824719 - Import VSP - VF informational artifacts
170 // TC1438311 - Import VF Artifacts - Informational Artifacts - Artifact Type Invalid
172 public void importVfArtifactsInformationalArtifactsArtifactTypeInvalid() throws Exception {
173 String fileName = "InformationArtifactWithInvalidType.csar";
174 String folder = "US825779";
176 List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
177 deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
178 deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
180 List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
181 informationalArtifacts.add(new ArtifactInfo(null, "ArtifactName.yaml", null, "ArtifactName", ArtifactTypeEnum.OTHER.getType(), "1"));
183 importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
186 // US824719 - Import VSP - VF informational artifacts
187 // TC1438231 - Import VF Artifacts - Deployment Artifacts - Artifact Name To Long
189 public void importVfArtifactsDeploymentArtifactsArtifactNameToLong() throws Exception {
190 String folder = "US825779";
191 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
193 String fileName = "DeploymentArtifactWithLongName.csar";
195 importVfFromCsar(resourceMetaData, folder, fileName, getUser());
197 String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
198 String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.EXCEEDS_LIMIT.name());
199 assertThat(errorMessage).contains(checkUIResponseOnError);
202 // US824719 - Import VSP - VF informational artifacts
203 // TC1438232 - Import VF Artifacts - Informational Artifacts - Artifact Name To Long
204 // TODO: make informational artifact name longer then 255
205 // TODO: windows/linux not allowed it
206 @Test(enabled = true)
207 public void importVfArtifactsInformationalArtifactsArtifactNameToLong() throws Exception {
208 String folder = "US825779";
209 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
211 String fileName = "InformationArtifactWithLongName.csar";
213 importVfFromCsar(resourceMetaData, folder, fileName, getUser());
215 String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
216 String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.EXCEEDS_LIMIT.name());
217 assertThat(errorMessage).contains(checkUIResponseOnError);
220 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
222 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
225 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
227 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
229 // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
230 // TC1443954 - Update With Multiple Changes In Deployment And Informational Artifacts
232 public void updateWithMultipleChangesInDeploymentAndInformationalArtifacts() throws Exception {
233 String folder = "US825779";
234 String fileName = "ImportTC1443954.csar";
236 ArtifactInfo deploymentHeat1 = new ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1");
237 ArtifactInfo deploymentHeat2 = new ArtifactInfo(null, "heatartifactname2.yaml", null, "heatartifactname2", ArtifactTypeEnum.HEAT.getType(), "1");
238 ArtifactInfo deploymentHeat3 = new ArtifactInfo(null, "heatartifactname3.yaml", null, "heatartifactname3", ArtifactTypeEnum.HEAT.getType(), "1");
240 ArtifactInfo deploymentHeatVol1 = new ArtifactInfo(null, "HeatVolArtifactName1.yaml", null, "HeatVolArtifactName1", ArtifactTypeEnum.HEAT_VOL.getType(), "1");
241 ArtifactInfo deploymentHeatVol2 = new ArtifactInfo(null, "HeatVolArtifactName2.yaml", null, "HeatVolArtifactName2", ArtifactTypeEnum.HEAT_VOL.getType(), "1");
243 List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
244 deploymentArtifacts.add(deploymentHeat1);
245 deploymentArtifacts.add(deploymentHeat2);
246 deploymentArtifacts.add(deploymentHeat3);
247 deploymentArtifacts.add(deploymentHeatVol1);
248 deploymentArtifacts.add(deploymentHeatVol2);
250 ArtifactInfo infoGuide1 = new ArtifactInfo(null, "GuideInfoArtifact1.yml", null, "GuideInfoArtifact1", ArtifactTypeEnum.GUIDE.getType(), "1");
251 ArtifactInfo infoGuide2 = new ArtifactInfo(null, "GuideInfoArtifact2.yml", null, "GuideInfoArtifact2", ArtifactTypeEnum.GUIDE.getType(), "1");
253 ArtifactInfo infoOther1 = new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1");
254 ArtifactInfo infoOther2 = new ArtifactInfo(null, "artifactname2.txt", null, "artifactname2", ArtifactTypeEnum.OTHER.getType(), "1");
255 ArtifactInfo infoOther3 = new ArtifactInfo(null, "artifactname3.txt", null, "artifactname3", ArtifactTypeEnum.OTHER.getType(), "1");
257 List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
258 informationalArtifacts.add(infoGuide1);
259 informationalArtifacts.add(infoGuide2);
260 informationalArtifacts.add(infoOther1);
261 informationalArtifacts.add(infoOther2);
262 informationalArtifacts.add(infoOther3);
264 importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
266 GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
268 fileName = "UpdateTC1443954.csar";
270 List<ArtifactInfo> informationalArtifactsNotExist = new ArrayList<ArtifactInfo>();
271 List<ArtifactInfo> deploymentArtifactsNotExist = new ArrayList<ArtifactInfo>();
273 // Changes in deployment artifacts
274 deploymentArtifactsNotExist.add(deploymentHeat1);
275 deploymentArtifactsNotExist.add(deploymentHeat2);
276 deploymentArtifacts.remove(deploymentHeat1);
277 deploymentArtifacts.remove(deploymentHeat2);
278 deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname4.yaml", null, "heatartifactname4", ArtifactTypeEnum.HEAT.getType(), "1"));
279 deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname5.yaml", null, "heatartifactname5", ArtifactTypeEnum.HEAT.getType(), "1"));
280 deploymentHeatVol1.setArtifactVersion("2");
281 deploymentHeatVol2.setArtifactVersion("2");
283 // Changes in informational artifacts
284 infoGuide1.setArtifactVersion("2");
285 infoOther1.setArtifactVersion("2");
286 informationalArtifactsNotExist.add(infoGuide2);
287 informationalArtifactsNotExist.add(infoOther2);
288 informationalArtifacts.remove(infoGuide2);
289 informationalArtifacts.remove(infoOther2);
290 informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact3.yml", null, "GuideInfoArtifact3", ArtifactTypeEnum.GUIDE.getType(), "1"));
291 informationalArtifacts.add(new ArtifactInfo(null, "artifactname4.txt", null, "artifactname4", ArtifactTypeEnum.OTHER.getType(), "1"));
293 updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, informationalArtifacts, deploymentArtifactsNotExist, informationalArtifactsNotExist);
297 // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
298 // TC1444206 - Update With Existed Deployment Artifact By Artifact With Different Type
300 public void updateWithExistedDeploymentArtifactByArtifactWithDifferentType() throws Exception {
301 String folder = "US825779";
302 String fileName = "ImportTC1444206.csar";
303 List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
304 deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
305 deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
306 deploymentArtifacts.add(new ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
308 importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
310 GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
312 fileName = "UpdateTC1444206.csar";
313 String filePath = FileHandling.getFilePath(folder);
315 ResourceUIUtils.updateVfWithCsar(filePath, fileName);
317 String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
318 String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.ARTIFACT_EXIST.name());
319 assertThat(errorMessage).contains(checkUIResponseOnError);
322 // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
323 // TC1444207 - Update With Existed Informational Artifact By Artifact With Different Type
325 public void updateWithExistedInformationalArtifactByArtifactWithDifferentType() throws Exception {
326 String folder = "US825779";
327 String fileName = "ImportTC1444207.csar";
329 List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
330 deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
331 deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
333 List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
334 informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
336 importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
338 GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
340 fileName = "UpdateTC1444207.csar";
341 String filePath = FileHandling.getFilePath(folder);
343 ResourceUIUtils.updateVfWithCsar(filePath, fileName);
345 String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
346 String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.ARTIFACT_EXIST.name());
347 assertThat(errorMessage).contains(checkUIResponseOnError);
351 // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
352 // TC1444208 - Update With Existed Informational Artifact By Deployment Artifact With Different Type
354 public void updateWithExistedInformationalArtifactByDeploymentArtifactWithDifferentType() throws Exception {
355 String folder = "US825779";
356 String fileName = "ImportTC1444208.csar";
358 List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
359 deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
360 deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
361 deploymentArtifacts.add(new ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
363 importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
365 GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
367 fileName = "UpdateTC1444208.csar";
368 String filePath = FileHandling.getFilePath(folder);
370 ResourceUIUtils.updateVfWithCsar(filePath, fileName);
372 String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
373 String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.ARTIFACT_EXIST.name());
374 assertThat(errorMessage).contains(checkUIResponseOnError);
377 // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
378 // TC1444520 - Update Deployment Artifact With Name To Long
380 public void updateDeploymentArtifactWithNameToLong() throws Exception {
381 String folder = "US825779";
383 String fileName = "ImportTC1444520.csar";
385 importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, null, null);
387 GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
389 fileName = "UpdateTC1444520.csar";
390 String filePath = FileHandling.getFilePath(folder);
392 ResourceUIUtils.updateVfWithCsar(filePath, fileName);
394 String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
395 String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.EXCEEDS_LIMIT.name());
396 assertThat(errorMessage).contains(checkUIResponseOnError);
399 // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
400 // TC1444521 - Update Informational Artifact With Name To Long
402 public void updateInformationalArtifactWithNameToLong() throws Exception {
404 String folder = "US825779";
405 String fileName = "ImportTC1444521.csar";
407 importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, null, null);
409 GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
411 fileName = "UpdateTC1444521.csar";
412 String filePath = FileHandling.getFilePath(folder);
414 ResourceUIUtils.updateVfWithCsar(filePath, fileName);
416 String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
417 String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.EXCEEDS_LIMIT.name());
418 assertThat(errorMessage).contains(checkUIResponseOnError);
421 // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
422 // TC1444531 - Update Informational Artifact With Invalid Type
424 public void updateInformationalArtifactWithInvalidType() throws Exception {
425 String folder = "US825779";
426 String fileName = "ImportTC1444531.csar";
428 importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, null, null);
430 GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
432 fileName = "UpdateTC1444531.csar";
434 List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
435 informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
437 updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, null, informationalArtifacts, null, null);
442 public void importValidInformationalArtifactInInvalidFolerTest_TC1438313() throws Exception {
443 String fileName = "ValidArtifactNameInInvalidFolder.csar";
444 String folder = "US824719";
446 List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
447 deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
448 deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
450 importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
454 public void updateValidInformationalArtifactInInvalidFolerTest_TC1444533() throws Exception {
455 String fileName = "ImportTC1444533.csar";
456 String folder = "US824719";
457 String filePath = FileHandling.getFilePath(folder);
459 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
460 ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
462 String updatedCsarFileName = "UpdateTC1444533.csar";
464 List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
465 deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
466 deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "4"));
468 updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, updatedCsarFileName, deploymentArtifacts, null, null, null);
472 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
474 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
477 public void updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(String folder, String fileName,
478 List<ArtifactInfo> deploymentArtifacts, List<ArtifactInfo> informationalArtifacts,
479 List<ArtifactInfo> deploymentArtifactsNotExist, List<ArtifactInfo> informationalArtifactsNotExist) throws Exception {
480 String filePath = FileHandling.getFilePath(folder);
481 ResourceUIUtils.updateVfWithCsar(filePath, fileName);
483 validateDeploymentArtifactPage(deploymentArtifacts, null);
484 validateInformationalArtifactPage(informationalArtifacts, null);
486 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
488 validateDeploymentArtifactInComposition(deploymentArtifacts, null);
489 validateInformationalArtifactInComposition(informationalArtifacts, null);
494 public void importVfFromCsar(ResourceReqDetails resourceMetaData, String folder, String fileName, User user) {
495 String filePath = FileHandling.getFilePath(folder);
496 GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.Dashboard.IMPORT_AREA.getValue());
497 // Insert file to the browse dialog
498 WebElement browseWebElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VF_FILE.getValue());
499 browseWebElement.sendKeys(filePath + fileName);
501 // Fill the general page fields.
502 GeneralUIUtils.waitForLoader();
503 ResourceUIUtils.fillResourceGeneralInformationPage(resourceMetaData, getUser(), true);
504 GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue());
508 public void importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(String fileName, String folder, List<ArtifactInfo> deploymentArtifacts, List<ArtifactInfo> informationalArtifacts) throws Exception {
509 String filePath = FileHandling.getFilePath(folder);
510 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
511 ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
513 validateDeploymentArtifactPage(deploymentArtifacts, null);
514 validateInformationalArtifactPage(informationalArtifacts, null);
516 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
518 validateDeploymentArtifactInComposition(deploymentArtifacts, null);
519 validateInformationalArtifactInComposition(informationalArtifacts, null);
522 public void validateInformationalArtifactInComposition(List<ArtifactInfo> informationalArtifacts, List<ArtifactInfo> informationalArtifactsNotExist) throws Exception {
523 CompositionPage.showInformationArtifactTab();
524 // Composition informational
525 if (informationalArtifacts != null && informationalArtifacts.size() > 0) {
526 validateEachArtifactOnCompositionRightMenuInformationPage(informationalArtifacts);
528 if (informationalArtifactsNotExist != null && informationalArtifactsNotExist.size() > 0) {
529 validateEachArtifactNotExistOnCompositionRightMenuInformationPage(informationalArtifactsNotExist);
533 public void validateDeploymentArtifactInComposition(List<ArtifactInfo> deploymentArtifacts, List<ArtifactInfo> deploymentArtifactsNotExist) throws Exception {
534 CompositionPage.showDeploymentArtifactTab();
535 // Composition deployment
536 if (deploymentArtifacts != null && deploymentArtifacts.size() > 0) {
537 validateEachArtifactOnCompositionRightMenuDeploymentPage(deploymentArtifacts);
539 if (deploymentArtifactsNotExist != null && deploymentArtifactsNotExist.size() > 0) {
540 validateEachArtifactNotExistOnCompositionRightMenuDeploymentPage(deploymentArtifactsNotExist);
544 public void validateInformationalArtifactPage(List<ArtifactInfo> informationalArtifacts, List<ArtifactInfo> informationalArtifactsNotExist) {
545 ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
546 // Informational page
547 if (informationalArtifacts != null && informationalArtifacts.size() > 0) {
548 validateEachArtifactInformationPage(informationalArtifacts);
550 if (informationalArtifactsNotExist != null && informationalArtifactsNotExist.size() > 0) {
551 validateEachArtifactNotExistInformationPage(informationalArtifactsNotExist);
555 public void validateDeploymentArtifactPage(List<ArtifactInfo> deploymentArtifacts, List<ArtifactInfo> deploymentArtifactsNotExist) {
556 ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
558 if (deploymentArtifacts != null && deploymentArtifacts.size() > 0) {
559 validateEachArtifactOnDeploymentPage(deploymentArtifacts);
561 if (deploymentArtifactsNotExist != null && deploymentArtifactsNotExist.size() > 0) {
562 validateEachArtifactNotExistOnDeploymentPage(deploymentArtifactsNotExist);
566 // TODO: add validation that if not editable / deleteable then button should not appear
567 public void validateEachArtifactOnDeploymentPage(List<ArtifactInfo> artifactInfoList) {
568 for (ArtifactInfo artifact : artifactInfoList) {
569 String type = artifact.getArtifactType();
570 String label = artifact.getArtifactLabel();
571 String version = artifact.getArtifactVersion();
573 if (type.equals(ArtifactTypeEnum.HEAT.getType()) || type.equals(ArtifactTypeEnum.HEAT_VOL.getType()) || type.equals(ArtifactTypeEnum.HEAT_NET.getType())) {
574 ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(label, null, version, type, true, false, false, true);
576 ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(label, null, version, type, true, true, true, false);
581 public void validateEachArtifactNotExistOnDeploymentPage(List<ArtifactInfo> artifactInfoList) {
582 for (ArtifactInfo artifact : artifactInfoList) {
583 ArtifactUIUtils.validateNotExistArtifactOnDeploymentInformationPage(artifact.getArtifactLabel());
587 public void validateEachArtifactInformationPage(List<ArtifactInfo> artifactInfoList) {
588 for (ArtifactInfo artifact : artifactInfoList) {
589 ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(artifact.getArtifactLabel(), null, artifact.getArtifactVersion(), artifact.getArtifactType(), true, true, true, false);
593 public void validateEachArtifactNotExistInformationPage(List<ArtifactInfo> artifactInfoList) {
594 for (ArtifactInfo artifact : artifactInfoList) {
595 ArtifactUIUtils.validateNotExistArtifactOnDeploymentInformationPage(artifact.getArtifactLabel());
599 public void validateEachArtifactOnCompositionRightMenuDeploymentPage(List<ArtifactInfo> artifactInfoList) {
600 for (ArtifactInfo artifact : artifactInfoList) {
602 String type = artifact.getArtifactType();
603 String label = artifact.getArtifactLabel();
604 String filename = artifact.getFilename();
606 if (type.equals(ArtifactTypeEnum.HEAT.getType()) || type.equals(ArtifactTypeEnum.HEAT_VOL.getType()) || type.equals(ArtifactTypeEnum.HEAT_NET.getType())) {
607 ArtifactUIUtils.validateExistArtifactOnCompositionRightMenuDeploymentInformationPage(filename, label, false, true, true, false);
609 ArtifactUIUtils.validateExistArtifactOnCompositionRightMenuDeploymentInformationPage(filename, label, true, false, true, true);
614 public void validateEachArtifactNotExistOnCompositionRightMenuDeploymentPage(List<ArtifactInfo> artifactInfoList) {
615 for (ArtifactInfo artifact : artifactInfoList) {
616 ArtifactUIUtils.validateNotExistArtifactOnCompositionRightMenuDeploymentInformationPage(artifact.getArtifactLabel());
620 // TODO: there is defect in this flow
621 // TODO: change isEditable to false when defect fix
622 public void validateEachArtifactOnCompositionRightMenuInformationPage(List<ArtifactInfo> artifactInfoList) {
623 for (ArtifactInfo artifact : artifactInfoList) {
624 ArtifactUIUtils.validateExistArtifactOnCompositionRightMenuDeploymentInformationPage(artifact.getFilename(), artifact.getArtifactLabel(), true, false, true, true);
628 public void validateEachArtifactNotExistOnCompositionRightMenuInformationPage(List<ArtifactInfo> artifactInfoList) {
629 for (ArtifactInfo artifact : artifactInfoList) {
630 ArtifactUIUtils.validateNotExistArtifactOnCompositionRightMenuDeploymentInformationPage(artifact.getArtifactLabel());
636 protected UserRoleEnum getRole() {
637 return UserRoleEnum.DESIGNER;