aboutsummaryrefslogtreecommitdiffstats
path: root/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfAPI.java
blob: accea723b84902ab14c762e3d31c2321b5e95de9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
/*-
 * ============LICENSE_START=======================================================
 * SDC
 * ================================================================================
 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */

package org.openecomp.sdc.ci.tests.execute.sanity;

import com.aventstack.extentreports.Status;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifactsPlaceholders;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ResourceMetadataEnum;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ToscaArtifactsScreenEnum;
import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.execute.setup.AttFtpClient;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
import org.openecomp.sdc.ci.tests.pages.CompositionPage;
import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
import org.openecomp.sdc.ci.tests.pages.HomePage;
import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
import org.openecomp.sdc.ci.tests.pages.InputsPage;
import org.openecomp.sdc.ci.tests.pages.PropertiesPage;
import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage;
import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils;
import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
import org.openecomp.sdc.ci.tests.verificator.VfModuleVerificator;
import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.AssertJUnit;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.assertj.core.api.Assertions.assertThat;


public class VfAPI extends SetupCDTest {

    private String filePath;

    @BeforeClass
    public void beforeClass() {
        filePath = FileHandling.getFilePath("");
    }

    @BeforeMethod
    public void beforeTest() {
        System.out.println("File repository is : " + filePath);
        getExtendTest().log(Status.INFO, "File repository is : " + filePath);
    }

    private ResourceReqDetails createVFviaAPI() {
        ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
        SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating VF %s", vfMetaData.getName()));
        AtomicOperationUtils.createResourceByResourceDetails(vfMetaData, UserRoleEnum.DESIGNER, true).left().value();
        return vfMetaData;
    }


    @Test
    public void updateVF() throws Exception {

        // create Resource
        ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
        ResourceUIUtils.createVF(resourceMetaData, getUser());

        // update Resource
        ResourceReqDetails updatedResource = new ResourceReqDetails();
        updatedResource.setName(ElementFactory.getResourcePrefix() + "UpdatedName" + resourceMetaData.getName());
        updatedResource.setDescription("kuku");
        updatedResource.setVendorName("updatedVendor");
        updatedResource.setVendorRelease("updatedRelease");
        updatedResource.setContactId("ab0001");
        updatedResource.setCategories(resourceMetaData.getCategories());
        updatedResource.setVersion("0.1");
        updatedResource.setResourceType(ResourceTypeEnum.VF.getValue());
        List<String> newTags = resourceMetaData.getTags();
        newTags.remove(resourceMetaData.getName());
        newTags.add(updatedResource.getName());
        updatedResource.setTags(newTags);
        ResourceUIUtils.updateResource(updatedResource, getUser());

        VfVerificator.verifyVFMetadataInUI(updatedResource);
        VfVerificator.verifyVFUpdated(updatedResource, getUser());
    }


    @Test
    public void vfcLinkedToComputeInVfFlowApi() throws Exception {
        String fileName = "vFW_VFC2.yml";
        ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());

        try {
            //Create VFC via API
            Resource vfc = AtomicOperationUtils.importResource(filePath, fileName).left().value();
            atomicResourceMetaData.setName(vfc.getName());

            //Certify VFC via API
            vfc = (Resource) AtomicOperationUtils.changeComponentState(vfc, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();

            //Create VF via API
            ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
            AtomicOperationUtils.createResourceByResourceDetails(vfMetaData, UserRoleEnum.DESIGNER, true).left().value();

            //Go to Catalog and find the created VF
            CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
            GeneralUIUtils.findComponentAndClick(vfMetaData.getName());

            //Composition - drag the created VFC and another element, link between them
            DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
            CanvasManager canvasManager = CanvasManager.getCanvasManager();
            CompositionPage.searchForElement(String.format("%s %s", LeftPanelCanvasItems.COMPUTE.getValue(), "1.0"));
            CanvasElement computeElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
            CompositionPage.searchForElement(atomicResourceMetaData.getName());
            CanvasElement cpElement = canvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
            AssertJUnit.assertNotNull(cpElement);
            ServiceVerificator.verifyNumOfComponentInstances(vfMetaData, "0.1", 2, getUser());
            canvasManager.linkElements(cpElement, computeElement);

            vfMetaData.setVersion("0.1");
            VfVerificator.verifyLinkCreated(vfMetaData, getUser(), 1);
        } finally {
            ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0");
        }

    }


    @Test
    public void addUpdateDeleteDeploymentArtifactToVfTestApi() throws Exception {
        //Create VF via API
        ResourceReqDetails vfMetaData = createVFviaAPI();

        //Go to Catalog and find the created VF
        CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
        GeneralUIUtils.findComponentAndClick(vfMetaData.getName());

        ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();

        List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
        deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"));
        deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "YANG_XML"));
        for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
            DeploymentArtifactPage.clickAddNewArtifact();
            ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
        }
        AssertJUnit.assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));

        String newDescription = "new description";
        DeploymentArtifactPage.clickEditArtifact(deploymentArtifactList.get(0).getArtifactLabel());
        DeploymentArtifactPage.artifactPopup().insertDescription(newDescription);
        DeploymentArtifactPage.artifactPopup().clickDoneButton();
        String actualArtifactDescription = DeploymentArtifactPage.getArtifactDescription(deploymentArtifactList.get(0).getArtifactLabel());
        AssertJUnit.assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));

        DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifactList.get(0).getArtifactLabel());
        DeploymentArtifactPage.clickOK();
        AssertJUnit.assertTrue("artifact " + deploymentArtifactList.get(0).getArtifactLabel() + "is not deleted", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size() - 1));

        AssertJUnit.assertTrue("artifact " + deploymentArtifactList.get(1).getArtifactLabel() + "is not displayed", DeploymentArtifactPage.clickOnArtifactDescription(deploymentArtifactList.get(1).getArtifactLabel()).isDisplayed());
    }


    @Test
    public void addUpdateDeleteInformationalArtifactApi() throws Exception {
        //Create VF via API
        ResourceReqDetails vfMetaData = createVFviaAPI();

        //Go to Catalog and find the created VF
        CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
        GeneralUIUtils.findComponentAndClick(vfMetaData.getName());

        ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();

        ArtifactInfo informationalArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER");
        InformationalArtifactPage.clickAddNewArtifact();
        ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact);

        AssertJUnit.assertTrue("artifact table does not contain artifacts uploaded", InformationalArtifactPage.checkElementsCountInTable(1));

        String newDescription = "new description";
        InformationalArtifactPage.clickEditArtifact(informationalArtifact.getArtifactLabel());
        InformationalArtifactPage.artifactPopup().insertDescription(newDescription);
        InformationalArtifactPage.artifactPopup().clickDoneButton();
        String actualArtifactDescription = InformationalArtifactPage.getArtifactDescription(informationalArtifact.getArtifactLabel());
        AssertJUnit.assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));

        InformationalArtifactPage.clickDeleteArtifact(informationalArtifact.getArtifactLabel());
        InformationalArtifactPage.clickOK();
        AssertJUnit.assertTrue("artifact " + informationalArtifact.getArtifactLabel() + "is not deleted", InformationalArtifactPage.checkElementsCountInTable(0));
    }


    @Test
    public void addPropertiesToVfcInstanceInVfTestApi() throws Exception {

        String fileName = "vFW_VFC.yml";
        ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());

        try {
            //Create VFC via API
            Resource vfc = AtomicOperationUtils.importResource(filePath, fileName).left().value();
            atomicResourceMetaData.setName(vfc.getName());

            //Certify VFC via API
            vfc = (Resource) AtomicOperationUtils.changeComponentState(vfc, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();

            //Create VF via API
            ResourceReqDetails vfMetaData = createVFviaAPI();

            //Go to Catalog and find the created VF
            CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
            GeneralUIUtils.findComponentAndClick(vfMetaData.getName());

            ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
            CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
            CompositionPage.searchForElement(atomicResourceMetaData.getName());
            CanvasElement vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());

            vfCanvasManager.clickOnCanvaElement(vfcElement);
            CompositionPage.showPropertiesAndAttributesTab();
            List<WebElement> properties = CompositionPage.getProperties();
            String propertyValue = "abc123";
            for (int i = 0; i < 2; i++) {
                WebElement findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-and-attribute-label"));
                findElement.click();
                PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(propertyValue);
                PropertiesPage.getPropertyPopup().clickSave();


                findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-value"));
                AssertJUnit.assertTrue(findElement.getText().equals(propertyValue));
            }
        } finally {
            ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
        }
    }
	
/*	@Test
	public void changeInstanceVersionTest() throws Exception{
		
		ResourceReqDetails atomicResourceMetaData = null;
		ResourceReqDetails vfMetaData = null;
		CanvasManager vfCanvasManager;
		CanvasElement vfcElement = null;
		String fileName = "vFW_VFC3.yml";
		try{
			atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
			ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
			ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
			
			vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
			ResourceUIUtils.createVF(vfMetaData, getUser());
			ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
			vfCanvasManager = CanvasManager.getCanvasManager();
			CompositionPage.searchForElement(atomicResourceMetaData.getName());
			vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
			
		
			CompositionPage.clickSubmitForTestingButton(vfMetaData.getName());
			assert(false);
		}
		catch(Exception e){ 
			String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
			String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
			AssertJUnit.assertTrue(errorMessage.contains(checkUIResponseOnError));
			
			
			reloginWithNewRole(UserRoleEnum.TESTER);
			GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
			TesterOperationPage.certifyComponent(atomicResourceMetaData.getName());
			
			reloginWithNewRole(UserRoleEnum.DESIGNER);
			GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
			ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
			vfCanvasManager = CanvasManager.getCanvasManager();
			CompositionPage.changeComponentVersion(vfCanvasManager, vfcElement, "1.0");
			
			//verification
			VfVerificator.verifyInstanceVersion(vfMetaData, getUser(), atomicResourceMetaData.getName(), "1.0");
		}
			
		finally{
			ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0");
		}
		
	}*/

    // future removed from ui
    @Test(enabled = true)
    public void addUpdateDeleteSimplePropertiesToVfTest() throws Exception {
        ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
        ResourceUIUtils.createVF(vfMetaData, getUser());

        ResourceGeneralPage.getLeftMenu().moveToPropertiesScreen();
        List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER);
        int propertiesCount = PropertiesPage.getElemenetsFromTable().size();
        for (PropertyTypeEnum prop : propertyList) {
            PropertiesUIUtils.addNewProperty(prop);
        }
        AssertJUnit.assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> PropertiesPage.getElemenetsFromTable()));
        VfVerificator.verifyPropertiesInUI(propertyList);
        PropertiesPage.verifyTotalProperitesField(propertiesCount + propertyList.size());


        PropertyTypeEnum prop = propertyList.get(0);
        prop.setDescription("updatedDescription");
        prop.setValue("value");
        PropertiesUIUtils.updateProperty(prop);

        PropertiesPage.clickDeletePropertyArtifact(prop.getName());
        AssertJUnit.assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size() - 1, () -> PropertiesPage.getElemenetsFromTable()));
    }

    // future removed from ui
    @Test(enabled = true)
    public void vfcInstancesInputScreenTest() throws Exception {
        ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
        ResourceUIUtils.createVF(vfMetaData, getUser());

        ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
        CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();

        Map<String, String> elementsIntancesMap = new HashMap<String, String>();
        for (LeftPanelCanvasItems element : Arrays.asList(LeftPanelCanvasItems.DATABASE, LeftPanelCanvasItems.BLOCK_STORAGE)) {
            CanvasElement elementOnCanvas = vfCanvasManager.createElementOnCanvas(element);
            vfCanvasManager.clickOnCanvaElement(elementOnCanvas);
            String selectedInstanceName = CompositionPage.getSelectedInstanceName();
            elementsIntancesMap.put(selectedInstanceName, element.getValue());
        }

        CompositionPage.moveToInputsScreen();
        int canvasElementsSize = vfCanvasManager.getCanvasElements().size();
        AssertJUnit.assertTrue("Instances count is not as expected: " + canvasElementsSize, InputsPage.checkElementsCountInTable(canvasElementsSize));

        for (String element : elementsIntancesMap.keySet()) {
            String resourceName = elementsIntancesMap.get(element);
            ResourceReqDetails resource = new ResourceReqDetails();
            resource.setName(resourceName);
            resource.setVersion("1.0");
            resource.setResourceType(ResourceTypeEnum.VFC.toString());
            RestResponse restResponse = RestCDUtils.getResource(resource, getUser());
            Map<String, String> propertiesNameTypeJson = ResponseParser.getPropertiesNameType(restResponse);

            List<WebElement> propertyRowsFromTable = InputsPage.getInstancePropertiesList(element);
            AssertJUnit.assertTrue("Some properties are missing in table. Instance name is : " + element, propertyRowsFromTable.size() == propertiesNameTypeJson.size());
            VfVerificator.verifyVfInputs(element, propertiesNameTypeJson, propertyRowsFromTable);

            GeneralUIUtils.clickOnElementByText(element);
        }

    }


    @Test
    public void addAllInformationalArtifactPlaceholdersInVfTestApi() throws Exception {
        //Create VF via API
        ResourceReqDetails vfMetaData = createVFviaAPI();
        //Go to Catalog and find the created VF
        CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
        GeneralUIUtils.findComponentAndClick(vfMetaData.getName());

        ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
        int fileNameCounter = 0;
        String fileName;
        for (InformationalArtifactsPlaceholders informArtifact : InformationalArtifactsPlaceholders.values()) {
            fileName = HEAT_FILE_YAML_NAME_PREFIX + fileNameCounter + HEAT_FILE_YAML_NAME_SUFFIX;
            ArtifactUIUtils.fillPlaceHolderInformationalArtifact(informArtifact,
                    FileHandling.getFilePath("uniqueFileNames"), fileName,
                    informArtifact.getValue());
            fileNameCounter++;
        }
        assertThat(InformationalArtifactPage.checkElementsCountInTable(InformationalArtifactsPlaceholders.values().length)).isTrue();
    }

    @Test
    public void verifyToscaArtifactsExistApi() throws Exception {
        //Create VF via API
        ResourceReqDetails vfMetaData = createVFviaAPI();

        //Go to Catalog and find the created VF
        CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
        GeneralUIUtils.findComponentAndClick(vfMetaData.getName());

        final int numOfToscaArtifacts = 2;
        ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
        AssertJUnit.assertTrue(ToscaArtifactsPage.checkElementsCountInTable(numOfToscaArtifacts));

        for (int i = 0; i < numOfToscaArtifacts; i++) {
            String typeFromScreen = ToscaArtifactsPage.getArtifactType(i);
            AssertJUnit.assertTrue(typeFromScreen.equals(ArtifactTypeEnum.TOSCA_CSAR.getType()) || typeFromScreen.equals(ArtifactTypeEnum.TOSCA_TEMPLATE.getType()));
        }

        //TODO Andrey should click on certify button
        ToscaArtifactsPage.clickCertifyButton(vfMetaData.getName());
        vfMetaData.setVersion("1.0");
        VfVerificator.verifyToscaArtifactsInfo(vfMetaData, getUser());
    }

    @Test(enabled = true)
    public void testDownload() throws Exception {
//		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
//		ResourceUIUtils.createResource(vfMetaData, getUser());
//		
//		final int numOfToscaArtifacts = 2;
//		ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
//		assertTrue(ToscaArtifactsPage.checkElementsCountInTable(numOfToscaArtifacts));
//		GeneralUIUtils.clickOnElementByTestId("download-Tosca Model");
//		System.out.println("download me");

        AttFtpClient attFtpClient = AttFtpClient.getFtpClient();

        File retrieveLastModifiedFileFromFTP = attFtpClient.retrieveLastModifiedFileFromFTP();
        attFtpClient.deleteFilesFromFTPserver();
    }

    @Test
    public void vfCertificationTestApi() throws Exception {
        //Create VF via API
        ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
        Resource vf = AtomicOperationUtils.createResourceByResourceDetails(vfMetaData, UserRoleEnum.DESIGNER, true).left().value();

        //Certify  VF via API
        vf = (Resource) AtomicOperationUtils.changeComponentState(vf, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();

        //Go to Catalog and find the created VF
        CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
        GeneralUIUtils.findComponentAndClick(vfMetaData.getName());

        VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CERTIFIED);
    }

    @Test
    public void deleteVfCheckedoutTestApi() throws Exception {
        //Create VF via API
        ResourceReqDetails vfMetaData = createVFviaAPI();

        //Go to Catalog and find the created VF
        CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
        GeneralUIUtils.findComponentAndClick(vfMetaData.getName());

        GeneralPageElements.clickTrashButtonAndConfirm();

        vfMetaData.setVersion("0.1");
        VfVerificator.verifyVfDeleted(vfMetaData, getUser());
    }

    @Test
    public void revertVfMetadataTestApi() throws Exception {
        //Create VF via API
        ResourceReqDetails vfMetaData = createVFviaAPI();

        //Go to Catalog and find the created VF
        CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
        GeneralUIUtils.findComponentAndClick(vfMetaData.getName());

        ResourceReqDetails vfRevertDetails = new ResourceReqDetails();
        vfRevertDetails.setName("ciUpdatedName");
        vfRevertDetails.setDescription("kuku");
        vfRevertDetails.setCategories(vfMetaData.getCategories());
        vfRevertDetails.setVendorName("updatedVendor");
        vfRevertDetails.setVendorRelease("updatedRelease");
        ResourceUIUtils.fillResourceGeneralInformationPage(vfRevertDetails, getUser(), false);

        GeneralPageElements.clickRevertButton();

        VfVerificator.verifyVFMetadataInUI(vfMetaData);

    }

    @Test
    public void addDeploymentArtifactInCompositionScreenTestApi() throws Exception {
        //Create VF via API
        ResourceReqDetails vfMetaData = createVFviaAPI();

        //Go to Catalog and find the created VF
        CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
        GeneralUIUtils.findComponentAndClick(vfMetaData.getName());

        ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();

        ArtifactInfo artifact = new ArtifactInfo(filePath, "Heat-File.yaml", "kuku", "artifact3", "OTHER");
        CompositionPage.showDeploymentArtifactTab();
        CompositionPage.clickAddArtifactButton();
        ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());

        List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className("i-sdc-designer-sidebar-section-content-item-artifact"));
        AssertJUnit.assertEquals(1, actualArtifactList.size());
    }

    // future removed from ui
    @Test(enabled = true)
    public void addPropertyInCompositionScreenTest() throws Exception {
        ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
        ResourceUIUtils.createVF(vfMetaData, getUser());

        ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();

        CompositionPage.showPropertiesAndAttributesTab();
        List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER);
        int propertiesCount = CompositionPage.getProperties().size();
        for (PropertyTypeEnum prop : propertyList) {
            PropertiesUIUtils.addNewProperty(prop);
        }
        AssertJUnit.assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> CompositionPage.getProperties()));
    }

    @Test
    public void addDeploymentArtifactAndVerifyInCompositionScreenApi() throws Exception {
        //Create VF via API
        ResourceReqDetails vfMetaData = createVFviaAPI();

        //Go to Catalog and find the created VF
        CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
        GeneralUIUtils.findComponentAndClick(vfMetaData.getName());

        ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();

        ArtifactInfo deploymentArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER");
        DeploymentArtifactPage.clickAddNewArtifact();
        ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
        AssertJUnit.assertTrue(DeploymentArtifactPage.checkElementsCountInTable(1));

        ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();

        CompositionPage.showDeploymentArtifactTab();
        List<WebElement> deploymentArtifactsFromScreen = CompositionPage.getDeploymentArtifacts();
        AssertJUnit.assertTrue(1 == deploymentArtifactsFromScreen.size());

        String actualArtifactFileName = deploymentArtifactsFromScreen.get(0).getText();
        AssertJUnit.assertTrue("asc_heat-0-2.yaml".equals(actualArtifactFileName));
    }
	
	/*@Test
	public void checkoutVfTest() throws Exception{
		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
		ResourceUIUtils.createVF(vfMetaData, getUser());
		
		ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
		GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
		GeneralPageElements.clickCheckoutButton();
		
		vfMetaData.setVersion("0.2");
		VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
		VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
		
		ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName());
		
		reloginWithNewRole(UserRoleEnum.TESTER);
		GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
		TesterOperationPage.certifyComponent(vfMetaData.getName());
		
		reloginWithNewRole(UserRoleEnum.DESIGNER);
		GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
		ResourceGeneralPage.clickCheckoutButton();
		
		vfMetaData.setVersion("1.1");
		vfMetaData.setUniqueId(null);
		VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
		VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
	}*/

    @Test
    public void deleteInstanceFromVfCanvasApi() throws Exception {
        //Create VF via API
        ResourceReqDetails vfMetaData = createVFviaAPI();

        //Go to Catalog and find the created VF
        CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
        GeneralUIUtils.findComponentAndClick(vfMetaData.getName());

        ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
        CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
        CanvasElement computeElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
        vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.PORT);

        vfCanvasManager.clickOnCanvaElement(computeElement);
        vfCanvasManager.deleteElementFromCanvas(computeElement);

        VfVerificator.verifyNumOfComponentInstances(vfMetaData, 1, getUser());
    }

    @Test
    public void changeInstanceNameInVfTestApi() throws Exception {
        //Create VF via API
        ResourceReqDetails vfMetaData = createVFviaAPI();

        //Go to Catalog and find the created VF
        CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
        GeneralUIUtils.findComponentAndClick(vfMetaData.getName());

        ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
        CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
        CanvasElement computeElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);

        String updatedInstanceName = "updatedName";
        vfCanvasManager.updateElementNameInCanvas(computeElement, updatedInstanceName);

        String actualSelectedInstanceName = CompositionPage.getSelectedInstanceName();
        AssertJUnit.assertTrue(updatedInstanceName.equals(actualSelectedInstanceName));
    }
	
	
	/*@Test
	public void submitVfForTestingWithNonCertifiedAssetApi() throws Exception{
		String fileName = "vFW_VFC4.yml";
		ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
		
		//Create VFC via API
		Resource vfc = AtomicOperationUtils.importResource(filePath, fileName).left().value();
		atomicResourceMetaData.setName(vfc.getName());
		
		//Submit VFC for testing via API
		vfc = (Resource) AtomicOperationUtils.changeComponentState(vfc, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFICATIONREQUEST, true).getLeft();

		//Create VF via API
		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
		AtomicOperationUtils.createResourceByResourceDetails(vfMetaData, UserRoleEnum.DESIGNER, true).left().value();
		
		//Go to Catalog and find the created VF
		CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
		GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
		
		DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
		CanvasManager canvasManager = CanvasManager.getCanvasManager();
		CompositionPage.searchForElement(atomicResourceMetaData.getName());
		canvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
		
		try{
			//TODO Andrey should click on certify button
			CompositionPage.clickCertifyButton(vfMetaData.getName());
			assert(false);
		}
		catch(Exception e){ 
			String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
			String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
			AssertJUnit.assertTrue(errorMessage.contains(checkUIResponseOnError));	
		}
		finally{
			ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
		}
	}*/

    @Test
    public void isDisabledAndReadOnlyInCheckinApi() throws Exception {
        //Create VF via API
        ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
        Resource vf = AtomicOperationUtils.createResourceByResourceDetails(vfMetaData, UserRoleEnum.DESIGNER, true).left().value();

        //Check in  VF via API
        vf = (Resource) AtomicOperationUtils.changeComponentState(vf, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();

        //Go to Catalog and find the created VF
        CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
        GeneralUIUtils.findComponentAndClick(vfMetaData.getName());

        ResourceMetadataEnum[] fieldsForCheck = {ResourceMetadataEnum.RESOURCE_NAME,
                ResourceMetadataEnum.DESCRIPTION, ResourceMetadataEnum.VENDOR_NAME, ResourceMetadataEnum.VENDOR_RELEASE,
                ResourceMetadataEnum.CONTACT_ID};

        for (ResourceMetadataEnum field : fieldsForCheck) {
            AssertJUnit.assertTrue(GeneralUIUtils.isElementReadOnly(field.getValue()));
        }

        AssertJUnit.assertTrue(GeneralUIUtils.isElementDisabled(ResourceMetadataEnum.CATEGORY.getValue()));
        AssertJUnit.assertTrue(GeneralUIUtils.isElementDisabled(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue()));
    }

    @Test
    public void displayHomeAfterNavigationToOnboardingTest() throws Exception {
        //Production bug scenario: "Home" - Click on any VF/ Service - Copy the URL - Go to “ONBOARD” - Paste the URL - Review the breadcrumbs
        // Expected: "Home"       Actual: "Onboarding"

        //Create VF via API
        ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
        Resource vf = AtomicOperationUtils.createResourceByResourceDetails(vfMetaData, UserRoleEnum.DESIGNER, true).left().value();

        //Check in  VF via API
        vf = (Resource) AtomicOperationUtils.changeComponentState(vf, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();

        //Find the created VF on Home page
        CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
        HomePage.navigateToHomePage();
        GeneralUIUtils.findComponentAndClick(vfMetaData.getName());

        //Copy current URL, navigate to OB screen and paste URL
        String url = GeneralUIUtils.copyCurrentURL();
        CompositionPage.moveToOnboardScreen();
        GeneralUIUtils.navigateToURL(url);
        GeneralUIUtils.ultimateWait();

        //Validate that main menu button is Home and not Onboarding
        String id = DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue();
        WebElement button = GeneralUIUtils.getWebElementByTestID(id);
        AssertJUnit.assertTrue(button.getAttribute("text").trim().equals("HOME"));
    }

    @Test
    public void exportToscaWithModulePropertiesVFTest() throws Exception {
        String vnfFile = "1-Vf-zrdm5bpxmc02-092017-(MOBILITY)_v2.0.zip";
        ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
        VendorSoftwareProductObject vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
        String vspName = vsp.getName();
        ResourceGeneralPage.clickCertifyButton(vspName);
        Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "1.0");
        VfModuleVerificator.validateSpecificModulePropertiesFromRequest(resource);
    }

    @Test
    public void exportToscaWithModulePropertiesTemplateCheckVFTest() throws Exception {
        String vnfFile = "1-Vf-zrdm5bpxmc02-092017-(MOBILITY)_v2.0.zip";
        ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
        OnboardingUiUtils.onboardAndValidate(resourceReqDetails, FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
        ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
        GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_MODEL.getValue());
        File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir();
        ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(latestFilefromDir);
        VfModuleVerificator.validateSpecificModulePropertiesFromFile(toscaDefinition);
    }


    @Override
    protected UserRoleEnum getRole() {
        return UserRoleEnum.DESIGNER;
    }

}