e2e test for instantiation template
[vid.git] / vid-automation / src / main / java / vid / automation / test / test / BrowseASDCTest.java
1 package vid.automation.test.test;
2
3 import static org.hamcrest.MatcherAssert.assertThat;
4 import static org.testng.Assert.assertEquals;
5 import static org.testng.Assert.assertFalse;
6 import static vid.automation.test.infra.Features.FLAG_1908_COLLECTION_RESOURCE_NEW_INSTANTIATION_UI;
7 import static vid.automation.test.infra.Features.FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI;
8 import static vid.automation.test.infra.Features.FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND;
9 import static vid.automation.test.infra.Features.FLAG_2004_TEMP_BUTTON_TO_INSTANTIATION_STATUS_FILTER;
10 import static vid.automation.test.infra.Features.FLAG_5G_IN_NEW_INSTANTIATION_UI;
11 import static vid.automation.test.infra.Features.FLAG_NETWORK_TO_ASYNC_INSTANTIATION;
12 import static vid.automation.test.infra.Features.FLAG_SHOW_ORCHESTRATION_TYPE;
13 import static vid.automation.test.infra.ModelInfo.aLaCarteForBrowseSdc;
14 import static vid.automation.test.infra.ModelInfo.aLaCarteServiceCreationTest;
15 import static vid.automation.test.infra.ModelInfo.instantiationTypeAlacarte_vidNotionsInstantiationUIByUUID;
16 import static vid.automation.test.infra.ModelInfo.macroForBrowseSdc;
17 import static vid.automation.test.sections.VidBasePage.goOutFromIframe;
18 import static vid.automation.test.sections.VidBasePage.goToIframe;
19
20 import com.google.common.collect.ImmutableList;
21 import java.util.List;
22 import org.apache.logging.log4j.LogManager;
23 import org.apache.logging.log4j.Logger;
24 import org.hamcrest.Matchers;
25 import org.jetbrains.annotations.NotNull;
26 import org.onap.sdc.ci.tests.datatypes.UserCredentials;
27 import org.onap.sdc.ci.tests.utilities.GeneralUIUtils;
28 import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset;
29 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetServicesGet;
30 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet;
31 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIServiceDesignAndCreationPut;
32 import org.onap.simulator.presetGenerator.presets.ecompportal_att.PresetGetSessionSlotCheckIntervalGet;
33 import org.openqa.selenium.By;
34 import org.openqa.selenium.WebElement;
35 import org.testng.Assert;
36 import org.testng.SkipException;
37 import org.testng.annotations.BeforeClass;
38 import org.testng.annotations.BeforeMethod;
39 import org.testng.annotations.DataProvider;
40 import org.testng.annotations.Test;
41 import vid.automation.test.Constants;
42 import vid.automation.test.infra.Click;
43 import vid.automation.test.infra.Exists;
44 import vid.automation.test.infra.FeatureTogglingTest;
45 import vid.automation.test.infra.Get;
46 import vid.automation.test.infra.ModelInfo;
47 import vid.automation.test.infra.SelectOption;
48 import vid.automation.test.model.Service;
49 import vid.automation.test.model.User;
50 import vid.automation.test.sections.BrowseASDCPage;
51 import vid.automation.test.sections.InstantiationStatusPage;
52 import vid.automation.test.sections.SideMenu;
53 import vid.automation.test.sections.ViewEditPage;
54 import vid.automation.test.sections.deploy.DeployDialogBase;
55 import vid.automation.test.sections.deploy.DeployModernUIALaCarteDialog;
56 import vid.automation.test.sections.deploy.DeployModernUIMacroDialog;
57 import vid.automation.test.sections.deploy.DeployOldALaCarteDialog;
58 import vid.automation.test.sections.deploy.DeployOldMacroDialog;
59 import vid.automation.test.services.ServicesService;
60 import vid.automation.test.services.SimulatorApi;
61
62
63 public class BrowseASDCTest extends CreateInstanceDialogBaseTest {
64     private final String invariantUUIDAlacarte = aLaCarteForBrowseSdc.modelInvariantId;
65     private final String invariantUUIDMacro = macroForBrowseSdc.modelInvariantId;
66     public static final String modelInvariantUUID1 = "aeababbc-010b-4a60-8df7-e64c07389466";
67     public static final String modelInvariantUUID2 = "aa2f8e9c-9e47-4b15-a95c-4a9385599abc";
68     public static final String modelInvariantUUID3 = "d849c57d-b6fe-4843-8349-4ab8bbb08d71";
69     public static final String modelUuid = "a8dcd72d-d44d-44f2-aa85-53aa9ca99cba";
70
71     private ServicesService servicesService = new ServicesService();
72
73     private final Logger logger = LogManager.getLogger(BrowseASDCTest.class);
74
75     @BeforeClass
76     public void beforeClass() {
77         resetGetServicesCache();
78     }
79
80     @BeforeMethod
81     public void resetSdcModelCaches() {
82         invalidateSdcModelsCache();
83     }
84
85     @Override
86     protected UserCredentials getUserCredentials() {
87         User user = usersService.getUser(Constants.Users.EMANUEL_EMANUEL);
88         return new UserCredentials(user.credentials.userId, user.credentials.password, Constants.Users.EMANUEL_EMANUEL, "", "");
89     }
90
91     //@Test(groups = {"shouldBeMigratedToWorkWithSimulator"})
92     public void testPNFOnCreatePopup() {
93         Service service = servicesService.getService("f39389e4-2a9c-4085-8ac3-04aea9c651be");
94         BrowseASDCPage browseASDCPage = new BrowseASDCPage();
95         SideMenu.navigateToBrowseASDCPage();
96         browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid);
97         assertThatServiceCreationDialogIsVisible();
98         validatePNFCreationDialog(service, "Emanuel", "pnf");
99     }
100
101     private void validatePNFCreationDialog(Service service, String serviceType, String serviceRole) {
102         assertServiceMetadata(serviceType, Constants.SERVICE_TYPE);
103         assertServiceMetadata(serviceRole, Constants.SERVICE_ROLE);
104         validateServiceCreationDialog(service);
105     }
106
107
108
109     //@Test(groups = {"shouldBeMigratedToWorkWithSimulator"})
110     private void testPNFMacroInstantation() throws Exception {
111         User user = usersService.getUser(Constants.Users.EMANUEL_EMANUEL);
112         relogin(user.credentials);
113
114         BrowseASDCPage browseASDCPage = new BrowseASDCPage();
115         SideMenu.navigateToBrowseASDCPage();
116         browseASDCPage.clickDeployServiceButtonByServiceUUID("f39389e4-2a9c-4085-8ac3-04aea9c651be");
117         assertThatServiceCreationDialogIsVisible();
118         assertDropdownPermittedItemsByLabel(user.subscriberNames, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
119         browseASDCPage.selectSubscriberById("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
120         browseASDCPage.selectProductFamily("ebc3bc3d-62fd-4a3f-a037-f619df4ff034");
121         GeneralUIUtils.ultimateWait();
122
123         browseASDCPage.selectServiceTypeByName("Emanuel");
124         GeneralUIUtils.ultimateWait();
125         browseASDCPage.selectLcpRegion("hvf16");
126
127         browseASDCPage.selectTenant("a259ae7b7c3f493cb3d91f95a7c18149");
128         assertAllIsPermitted(Constants.BrowseASDC.AIC_OPTION_CLASS);
129         browseASDCPage.selectAicZone("NFT1");
130
131         Click.onFirstSelectOptionById(Constants.OwningEntity.PROJECT_SELECT_TEST_ID);
132         Click.onFirstSelectOptionById(Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
133
134         browseASDCPage.clickConfirmButton();
135
136         assertSuccessfulServiceInstanceCreation();
137
138         browseASDCPage.clickCloseButton();
139
140         ViewEditPage viewEditPage = new ViewEditPage();
141         viewEditPage.clickActivateButton();
142     }
143
144     @Test
145     private void browseServiceModel_deployServiceALaCarteByBackendInput_creationPopupIsALaCarte()  {
146         // model uuid should be of macro
147         deployServiceAndAssertInstantiationType(
148                 "csar15782222_instantiationTypeAlacarte_invariantUUIDMacro.zip",
149                 invariantUUIDMacro,
150             getAlacarteDialogByFlagValue()
151         );
152     }
153
154     @NotNull
155     public static DeployDialogBase getAlacarteDialogByFlagValue() {
156         return FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI.isActive() ?
157             new DeployModernUIALaCarteDialog() :
158             new DeployOldALaCarteDialog();
159     }
160
161     @Test
162     @FeatureTogglingTest(FLAG_5G_IN_NEW_INSTANTIATION_UI)
163     private void browseServiceModel_deployServiceALaCarteByBackendInputHintNewUI_creationPopupIsAngular2()  {
164         deployServiceAndAssertInstantiationType(
165                 instantiationTypeAlacarte_vidNotionsInstantiationUIByUUID,
166                 new DeployModernUIALaCarteDialog()
167         );
168     }
169
170     @Test
171     private void browseServiceModel_deployServiceALaCarteBecauseNotOnMACRO_SERVICESConfig_creationPopupIsALaCarte()  {
172         deployServiceAndAssertInstantiationType(
173                 "csar15782222_instantiationTypeEmpty_invariantUUIDAlacarte.zip",
174                 invariantUUIDAlacarte,
175             getAlacarteDialogByFlagValue()
176         );
177     }
178
179     @Test
180     private void browseServiceModel_deployServiceMacroByBackendInput_creationPopupIsMacro()  {
181         deployServiceAndAssertInstantiationType(
182             ModelInfo.serviceWithInstantiationTypeMacro,
183             new DeployModernUIMacroDialog()
184         );
185     }
186
187     @Test
188     private void browseServiceModel_deployServiceMacroByMACRO_SERVICESConfig_creationPopupIsOldMacro()  {
189         if (FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI.isActive() &&
190         ! FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND.isActive()) {
191             throw new SkipException("some 2002 flags shall come along together");
192         }
193         deployServiceAndAssertInstantiationType(
194                 "csar15782222_invariantUUIDMacro.zip",
195                 invariantUUIDMacro,
196                 new DeployOldMacroDialog()
197         );
198     }
199
200     @Test
201     private void browseServiceModel_deployServiceMacroWithPnf_creationPopupIsOldMacro() {
202         deployServiceAndAssertInstantiationType(
203                 "csar15782222_instantiationTypeMacroWithPnf.zip",
204                 invariantUUIDMacro,
205             new DeployOldMacroDialog()
206         );
207     }
208
209     @Test
210     public void browseServiceModel_deployServiceMacroWithCR_creationPopupIsOldMacro()  {
211         deployServiceAndAssertInstantiationType(
212             ModelInfo.collectionResourceService,
213                 FLAG_1908_COLLECTION_RESOURCE_NEW_INSTANTIATION_UI.isActive() ?
214                     new DeployModernUIMacroDialog() :
215                     new DeployOldMacroDialog()
216         );
217     }
218
219     @Test
220     private void browseServiceModel_deployServiceMacroWithNetwork_creationPopupIsMacroByFF()  {
221         deployServiceAndAssertInstantiationType(
222                 "csar15782222_instantiationTypeMacroWithNetwork.zip",
223                 invariantUUIDMacro,
224                 FLAG_NETWORK_TO_ASYNC_INSTANTIATION.isActive() ?
225                 new DeployModernUIMacroDialog() :
226                 new DeployOldMacroDialog()
227         );
228     }
229
230
231     private void deployServiceAndAssertInstantiationType(String modelZipFileName, String modelInvariantId, DeployDialogBase deployDialog)  {
232         deployServiceAndAssertInstantiationType(new ModelInfo("4d71990b-d8ad-4510-ac61-496288d9078e", modelInvariantId, modelZipFileName), deployDialog);
233     }
234
235     private void deployServiceAndAssertInstantiationType(ModelInfo modelInfo, DeployDialogBase deployDialog)  {
236
237         registerExpectationForLegacyServiceDeployment(modelInfo, "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
238         User user = usersService.getUser(Constants.Users.EMANUEL_EMANUEL);
239         relogin(user.credentials);
240
241         BrowseASDCPage browseASDCPage = new BrowseASDCPage();
242         SideMenu.navigateToBrowseASDCPage();
243
244         GeneralUIUtils.ultimateWait();
245         browseASDCPage.clickDeployServiceButtonByServiceUUID(modelInfo.modelVersionId);
246
247         deployDialog.waitForDialogAssertAndClose();
248     }
249
250     @FeatureTogglingTest(value = FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI, flagActive = false)
251     @Test
252     private void testServiceInstantiationAlaCarte()  {
253         User user = usersService.getUser(Constants.Users.EMANUEL_EMANUEL);
254         relogin(user.credentials);
255
256         registerExpectationForLegacyServiceDeployment(aLaCarteServiceCreationTest, "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
257
258         BrowseASDCPage browseASDCPage = new BrowseASDCPage();
259         SideMenu.navigateToBrowseASDCPage();
260
261         Service service = new Service(
262                 "pnf",
263                 aLaCarteServiceCreationTest.modelVersionId,
264                 aLaCarteServiceCreationTest.modelInvariantId,
265                 "action-data",
266                 "1.0",
267                 "Network L1-3",
268                 "PASQUALE vMX vPE based on Juniper 17.2 release. Updated with updated VF for v8.0 of VLM",
269                 null);
270
271
272         logger.info("Expected service model properties: "+service.toString());
273         browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid);
274         validateServiceCreationDialog(service);
275
276         browseASDCPage.setInstanceName(browseASDCPage.generateInstanceName());
277
278         assertDropdownPermittedItemsByLabel(user.subscriberNames, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
279         browseASDCPage.selectSubscriberById("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
280
281         String serviceType = "Emanuel";
282         GeneralUIUtils.findAndWaitByText(serviceType, 30);
283
284         assertDropdownPermittedItemsByValue(user.serviceTypes, Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS);
285         browseASDCPage.selectServiceTypeByName(serviceType);
286
287         SelectOption.byTestIdAndVisibleText("yyy1", Constants.OwningEntity.PROJECT_SELECT_TEST_ID);
288         SelectOption.byTestIdAndVisibleText("aaa1", Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
289
290         browseASDCPage.selectSuppressRollback("false");
291
292         browseASDCPage.clickConfirmButton();
293
294         assertSuccessfulServiceInstanceCreation();
295     }
296
297     private static final String serviceName = "CONTRAIL30_L2NODHCP";
298     private static final String modelInvariantId = "5b607929-6088-4614-97ef-cac817508e0e";
299     private static final String serviceUuid = "797a6c41-0f80-4d35-a288-3920c4e06baa";
300
301
302     @DataProvider
303     public static Object[][] filterTexts() {
304         return new Object[][]{
305             {serviceName},
306             {modelInvariantId},
307             {serviceUuid}};
308     }
309
310     @Test(dataProvider = "filterTexts")
311     public void testFilterOptionsInBrowseSdc(String filterText){
312         BrowseASDCPage browseAsdcPage = registerSimulatorAndGoToBrowseSDC();
313         GeneralUIUtils.ultimateWait();
314         assertThat(browseAsdcPage.countCurrentRowsInTable(),(Matchers.greaterThan(1)));
315         browseAsdcPage.fillFilterText(filterText);
316         Assert.assertEquals(browseAsdcPage.countCurrentRowsInTable(),1);
317         Assert.assertTrue(Exists.byTestId("deploy-" + serviceUuid));
318         browseAsdcPage.fillFilterText("");
319
320     }
321
322     @Test
323     private void testCategoryParamsDropdownsExistsInCreationDialog() throws Exception {
324         String serviceId = "2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd";
325
326         DeployModernUIMacroDialog deployMacroDialog = getDeployModernUIMacroDialog(serviceId);
327         deployMacroDialog.assertDialog();
328         deployMacroDialog.clickProjectSelect();
329         deployMacroDialog.clickOwningEntitySelect();
330     }
331
332     private DeployModernUIMacroDialog getDeployModernUIMacroDialog(String serviceId) {
333         BrowseASDCPage browseASDCPage = registerSimulatorAndGoToBrowseSDC();
334         Service service = servicesService.getService(serviceId);
335         browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid);
336         DeployModernUIMacroDialog deployMacroDialog = new DeployModernUIMacroDialog();
337         deployMacroDialog.waitForDialogToLoad();
338         return deployMacroDialog;
339     }
340
341     @Test
342     @FeatureTogglingTest(FLAG_2004_TEMP_BUTTON_TO_INSTANTIATION_STATUS_FILTER)
343     public void testClickPreviousInstantiationsInCreationDialog() {
344         try {
345             String serviceId = "2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd";
346             DeployModernUIMacroDialog deployMacroDialog = getDeployModernUIMacroDialog(serviceId);
347             deployMacroDialog.clickPreviousInstantiationButton();
348
349             //exit form deploy dialog
350             goOutFromIframe();
351             //go into Instantiation Status page
352             goToIframe();
353
354             InstantiationStatusPage.verifyInstantiationStatusFilterValue(serviceId);
355         }
356         finally {
357             goOutFromIframe();
358         }
359     }
360
361     private BrowseASDCPage registerSimulatorAndGoToBrowseSDC() {
362         SimulatorApi.registerExpectation(SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET,
363                 "ecompportal_getSessionSlotCheckInterval.json",
364                 "browseASDC/aai_get_services.json",
365                 "browseASDC/get_sdc_catalog_services_2f80c596.json"
366         );
367         SimulatorApi.registerExpectationFromPresets(ImmutableList.of(
368                     new PresetAAIGetSubscribersGet(),
369                     new PresetAAIServiceDesignAndCreationPut()
370                 ),
371                 SimulatorApi.RegistrationStrategy.APPEND);
372         SideMenu.navigateToBrowseASDCPage();
373         return new BrowseASDCPage();
374     }
375
376     //@Test(groups = {"shouldBeMigratedToWorkWithSimulator"})
377     private void testOwningEntityRequiredAndProjectOptional() throws Exception {
378         User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA);
379         relogin(user.credentials);
380
381         BrowseASDCPage browseASDCPage = new BrowseASDCPage();
382         SideMenu.navigateToBrowseASDCPage();
383
384         Service service = servicesService.getService("c079d859-4d81-4add-a9c3-94551f96e2b0");
385
386         browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid);
387         validateServiceCreationDialog(service);
388
389         browseASDCPage.setInstanceName(browseASDCPage.generateInstanceName());
390
391         assertDropdownPermittedItemsByLabel(user.subscriberNames, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
392         browseASDCPage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89");
393
394         String serviceType = "TYLER SILVIA";
395         GeneralUIUtils.findAndWaitByText(serviceType, 30);
396
397         assertDropdownPermittedItemsByValue(user.serviceTypes, Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS);
398         browseASDCPage.selectServiceTypeByName(serviceType);
399
400         browseASDCPage.clickConfirmButton();
401
402         GeneralUIUtils.findAndWaitByText("Missing data", 5);
403
404         Click.onFirstSelectOptionById(Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
405
406         browseASDCPage.clickConfirmButton();
407         assertSuccessfulServiceInstanceCreation();
408     }
409
410     //@Test(groups = {"shouldBeMigratedToWorkWithSimulator"})
411     protected void testLineOfBusinessOptionalAndPlatformRequired() throws Exception {
412
413         User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA);
414         relogin(user.credentials);
415
416         BrowseASDCPage browseASDCPage = new BrowseASDCPage();
417         SideMenu.navigateToBrowseASDCPage();
418
419         Service service = servicesService.getService("c079d859-4d81-4add-a9c3-94551f96e2b0");
420
421         browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid);
422         validateServiceCreationDialog(service);
423
424         browseASDCPage.setInstanceName(browseASDCPage.generateInstanceName());
425
426         assertDropdownPermittedItemsByLabel(user.subscriberNames, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
427         browseASDCPage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89");
428
429         String serviceType = "TYLER SILVIA";
430         GeneralUIUtils.findAndWaitByText(serviceType, 30);
431
432         assertDropdownPermittedItemsByValue(user.serviceTypes, Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS);
433         browseASDCPage.selectServiceTypeByName(serviceType);
434
435         Click.onFirstSelectOptionById(Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
436
437         browseASDCPage.clickConfirmButton();
438         assertSuccessfulServiceInstanceCreation();
439
440         browseASDCPage.clickCloseButton();
441         GeneralUIUtils.ultimateWait();
442
443         //now add the VNF
444         ViewEditPage viewEditPage = new ViewEditPage();
445
446         viewEditPage.selectNodeInstanceToAdd("VID-RODERICK-05-15-17 0");
447         viewEditPage.generateAndSetInstanceName(Constants.ViewEdit.VNF_INSTANCE_NAME_PREFIX);
448         viewEditPage.selectProductFamily("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
449         viewEditPage.selectLcpRegion("AAIAIC25", "AIC");
450         viewEditPage.selectTenant("092eb9e8e4b7412e8787dd091bc58e86");
451         viewEditPage.setLegacyRegion("llkjhlkjhlkjh");
452
453         browseASDCPage.clickConfirmButton();
454
455         GeneralUIUtils.findAndWaitByText("Missing data", 5);
456         SelectOption.selectFirstTwoOptionsFromMultiselectById("multi-selectPlatform");
457
458         viewEditPage.clickConfirmButton();
459         assertSuccessfulVNFCreation();
460     }
461
462     private void prepareSimulatorWithServiceModelListBeforeBrowseASDCService(){
463         SimulatorApi.clearAll();
464
465         ImmutableList<BasePreset> presets = ImmutableList.of(
466                 new PresetGetSessionSlotCheckIntervalGet(),
467                 new PresetAAIGetSubscribersGet(),
468                 new PresetAAIServiceDesignAndCreationPut(),
469                 new PresetAAIGetServicesGet());
470
471         SimulatorApi.registerExpectationFromPresets(presets, SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET);
472     }
473
474     @Test
475     private void browseSDCServiceModelListCheckAAIResponse(){
476         prepareSimulatorWithServiceModelListBeforeBrowseASDCService();
477         SideMenu.navigateToBrowseASDCPage();
478         BrowseASDCPage browseASDCPage = new BrowseASDCPage();
479         browseASDCPage.fillFilterText("CheckAAIResponse");
480         GeneralUIUtils.ultimateWait();
481
482         WebElement sdcTableElement = Get.byId("sdcModelsTable");
483         List<WebElement> sdcModelList = sdcTableElement.findElements(By.className("sdcServiceModel"));
484
485         WebElement sdcFirstModel = sdcModelList.get(0);
486         WebElement sdcSecondModel = sdcModelList.get(1);
487         WebElement sdcThirdModel = sdcModelList.get(2);
488
489         //Check uuid
490         By uuid = By.className("uuid");
491         assertEquals(modelUuid, sdcFirstModel.findElement(uuid).getText());
492         assertEquals("1dae721c-a1ef-435f-b811-760c23f467bf" , sdcSecondModel.findElement(uuid).getText());
493         assertEquals("29236d45-e790-4c17-a115-1533cc09b7b1" , sdcThirdModel.findElement(uuid).getText());
494
495         //Check invariantUUID
496         By invariantUUID = By.className("invariantUUID");
497         assertEquals(modelInvariantUUID1, sdcFirstModel.findElement(invariantUUID).getText());
498         assertEquals(modelInvariantUUID2, sdcSecondModel.findElement(invariantUUID).getText());
499         assertEquals(modelInvariantUUID3, sdcThirdModel.findElement(invariantUUID).getText());
500
501         //Check Names
502         By name = By.className("name");
503         assertEquals("CheckAAIResponse_AAAvIRC_mm779p_Service" , sdcFirstModel.findElement(name).getText());
504         assertEquals("CheckAAIResponse_BBBvIRC_mm779p_Service" , sdcSecondModel.findElement(name).getText());
505         assertEquals("CheckAAIResponse_CCCvIRC_mm779p_Service" , sdcThirdModel.findElement(name).getText());
506
507         //Check distribution Status
508         By distributionStatus = By.className("distributionStatus");
509         assertEquals("DISTRIBUTION_COMPLETE_OK" , sdcFirstModel.findElement(distributionStatus).getText());
510         assertEquals("", sdcSecondModel.findElement(distributionStatus).getText());
511         assertEquals("DISTRIBUTION_COMPLETE_ERROR" , sdcThirdModel.findElement(distributionStatus).getText());
512
513         //Check another fields
514         assertEquals("service" , sdcFirstModel.findElement(By.className("category")).getText());
515         assertEquals("1.0" , sdcFirstModel.findElement(By.className("version")).getText());
516     }
517
518     @Test
519     public void browseSdcModel_getEmptyList_noModelsMessageIsShown() {
520         resetGetServicesCache();
521         SimulatorApi.clearAll();
522         SimulatorApi.registerExpectationFromPresets(ImmutableList.of(
523                 new PresetAAIServiceDesignAndCreationPut(true),
524                 new PresetAAIGetSubscribersGet()), SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET);
525         SideMenu.navigateToBrowseASDCPage();
526         GeneralUIUtils.ultimateWait();
527         WebElement serviceModelsTbody = Get.byXpath("//table[@data-tests-id='serviceModelsTable']/tbody");
528         assertFalse(Exists.tagNameInAnotherElement(serviceModelsTbody, "tr"), "Table should be empty on empty results");
529         resetGetServicesCache();
530     }
531
532     private static final String[] macroModelsIds = {
533             "f1bde010-cc5f-4765-941f-75f15b24f9fc",
534             "lmoser410-connector-model-version-id",
535             "ipe-resource-id-ps-02",
536             "797a6c41-0f80-4d35-a288-3920c4e06baa",
537     };
538     private static final String[] alacarteModelsIds = {
539             "0903e1c0-8e03-4936-b5c2-260653b96413",
540             "666a06ee-4b57-46df-bacf-908da8f10c3f",
541             "20c4431c-246d-11e7-93ae-92361f002671",
542     };
543
544     @DataProvider
545     public static Object[][] filterOrchestrationType() {
546         return new Object[][]{{"a la carte", 3, alacarteModelsIds},{"macro", 4, macroModelsIds}};
547     }
548
549     @Test(dataProvider = "filterOrchestrationType")
550     @FeatureTogglingTest(FLAG_SHOW_ORCHESTRATION_TYPE)
551     public void browseSdcModel_filterModelsWithOrchestrationType_alacarte(
552             String orchestrationType,int numberOfOccurrence, String[] expectedModelsIds) {
553         resetGetServicesCache();
554         SimulatorApi.clearAll();
555         BrowseASDCPage browseAsdcPage = registerSimulatorAndGoToBrowseSDC();
556         GeneralUIUtils.ultimateWait();
557         assertThat(browseAsdcPage.countCurrentRowsInTable(),(Matchers.greaterThan(numberOfOccurrence)));
558         browseAsdcPage.fillFilterText(orchestrationType);
559         Assert.assertEquals(browseAsdcPage.countCurrentRowsInTable(),numberOfOccurrence);
560         for(String id : expectedModelsIds) {
561             Assert.assertTrue(browseAsdcPage.isModelWithGivenServiceUUIDVisible(id));
562         }
563         browseAsdcPage.fillFilterText("");
564     }
565
566 }