adding orchestration type to service models view
[vid.git] / vid-automation / src / main / java / vid / automation / test / test / BrowseASDCTest.java
index 2b5a098..eb08c1f 100644 (file)
@@ -1,26 +1,16 @@
 package vid.automation.test.test;
 
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static vid.automation.test.infra.Features.FLAG_5G_IN_NEW_INSTANTIATION_UI;
-import static vid.automation.test.infra.ModelInfo.aLaCarteForBrowseSdc;
-import static vid.automation.test.infra.ModelInfo.aLaCarteServiceCreationTest;
-import static vid.automation.test.infra.ModelInfo.instantiationTypeAlacarte_vidNotionsInstantiationUIByUUID;
-import static vid.automation.test.infra.ModelInfo.macroForBrowseSdc;
-
 import com.google.common.collect.ImmutableList;
-import java.util.List;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.hamcrest.Matchers;
-import org.onap.sdc.ci.tests.datatypes.UserCredentials;
-import org.onap.sdc.ci.tests.utilities.GeneralUIUtils;
 import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset;
 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetServicesGet;
 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet;
 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIServiceDesignAndCreationPut;
 import org.onap.simulator.presetGenerator.presets.ecompportal_att.PresetGetSessionSlotCheckIntervalGet;
+import org.onap.sdc.ci.tests.datatypes.UserCredentials;
+import org.onap.sdc.ci.tests.utilities.GeneralUIUtils;
 import org.openqa.selenium.By;
 import org.openqa.selenium.WebElement;
 import org.testng.Assert;
@@ -29,23 +19,23 @@ import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 import vid.automation.test.Constants;
-import vid.automation.test.infra.Click;
-import vid.automation.test.infra.Exists;
-import vid.automation.test.infra.FeatureTogglingTest;
-import vid.automation.test.infra.Features;
-import vid.automation.test.infra.Get;
-import vid.automation.test.infra.ModelInfo;
-import vid.automation.test.infra.SelectOption;
+import vid.automation.test.infra.*;
 import vid.automation.test.model.Service;
 import vid.automation.test.model.User;
-import vid.automation.test.sections.BrowseASDCPage;
-import vid.automation.test.sections.DeployMacroDialogBase;
-import vid.automation.test.sections.DeployMacroDialogOld;
-import vid.automation.test.sections.SideMenu;
-import vid.automation.test.sections.ViewEditPage;
+import vid.automation.test.sections.*;
 import vid.automation.test.services.ServicesService;
 import vid.automation.test.services.SimulatorApi;
 
+import java.util.List;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static vid.automation.test.infra.Features.FLAG_5G_IN_NEW_INSTANTIATION_UI;
+import static vid.automation.test.infra.Features.FLAG_SHOW_ORCHESTRATION_TYPE;
+import static vid.automation.test.infra.Features.FLAG_1908_TRANSPORT_SERVICE_NEW_INSTANTIATION_UI;
+import static vid.automation.test.infra.ModelInfo.*;
+
 
 public class BrowseASDCTest extends CreateInstanceDialogBaseTest {
     private final String invariantUUIDAlacarte = aLaCarteForBrowseSdc.modelInvariantId;
@@ -193,7 +183,8 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest {
     }
 
     @Test
-    private void browseServiceModel_deployServiceMacroWithCR_creationPopupIsOldMacro() throws Exception {
+    @FeatureTogglingTest(flagActive = false, value = FLAG_1908_TRANSPORT_SERVICE_NEW_INSTANTIATION_UI)
+    public void browseServiceModel_deployServiceMacroWithCR_creationPopupIsOldMacro() throws Exception {
         deployServiceAndAssertInstantiationType(
                 "csar15782222_instantiationTypeMacroWithCR.zip",
                 invariantUUIDMacro,
@@ -204,7 +195,7 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest {
 
     @Test
     private void browseServiceModel_deployServiceMacroWithNetwork_creationPopupIsMacroByFF() throws Exception {
-        String macroInstantiationAccordingFF = Features.FLAG_ASYNC_INSTANTIATION.isActive() && Features.FLAG_NETWORK_TO_ASYNC_INSTANTIATION.isActive() ? instantiationTypeNameMacro : oldMacro;
+        String macroInstantiationAccordingFF = Features.FLAG_NETWORK_TO_ASYNC_INSTANTIATION.isActive() ? instantiationTypeNameMacro : oldMacro;
         deployServiceAndAssertInstantiationType(
                 "csar15782222_instantiationTypeMacroWithNetwork.zip",
                 invariantUUIDMacro,
@@ -406,7 +397,7 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest {
         viewEditPage.selectNodeInstanceToAdd("VID-RODERICK-05-15-17 0");
         viewEditPage.generateAndSetInstanceName(Constants.ViewEdit.VNF_INSTANCE_NAME_PREFIX);
         viewEditPage.selectProductFamily("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
-        viewEditPage.selectLcpRegion("JANET25", "AIC");
+        viewEditPage.selectLcpRegion("AAIAIC25", "AIC");
         viewEditPage.selectTenant("092eb9e8e4b7412e8787dd091bc58e86");
         viewEditPage.setLegacyRegion("llkjhlkjhlkjh");
 
@@ -489,4 +480,39 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest {
         assertFalse(Exists.tagNameInAnotherElement(serviceModelsTbody, "tr"), "Table should be empty on empty results");
         resetGetServicesCache();
     }
+
+    private static final String[] macroModelsIds = {
+            "f1bde010-cc5f-4765-941f-75f15b24f9fc",
+            "lmoser410-connector-model-version-id",
+            "ipe-resource-id-ps-02",
+            "797a6c41-0f80-4d35-a288-3920c4e06baa",
+    };
+    private static final String[] alacarteModelsIds = {
+            "0903e1c0-8e03-4936-b5c2-260653b96413",
+            "666a06ee-4b57-46df-bacf-908da8f10c3f",
+            "20c4431c-246d-11e7-93ae-92361f002671",
+    };
+
+    @DataProvider
+    public static Object[][] filterOrchestrationType() {
+        return new Object[][]{{"a la carte", 3, alacarteModelsIds},{"macro", 4, macroModelsIds}};
+    }
+
+    @Test(dataProvider = "filterOrchestrationType")
+    @FeatureTogglingTest(FLAG_SHOW_ORCHESTRATION_TYPE)
+    public void browseSdcModel_filterModelsWithOrchestrationType_alacarte(
+            String orchestrationType,int numberOfOccurrence, String[] expectedModelsIds) {
+        resetGetServicesCache();
+        SimulatorApi.clearAll();
+        BrowseASDCPage browseAsdcPage = registerSimulatorAndGoToBrowseSDC();
+        GeneralUIUtils.ultimateWait();
+        assertThat(browseAsdcPage.countCurrentRowsInTable(),(Matchers.greaterThan(numberOfOccurrence)));
+        browseAsdcPage.fillFilterText(orchestrationType);
+        Assert.assertEquals(browseAsdcPage.countCurrentRowsInTable(),numberOfOccurrence);
+        for(String id : expectedModelsIds) {
+            Assert.assertTrue(browseAsdcPage.isModelWithGivenServiceUUIDVisible(id));
+        }
+        browseAsdcPage.fillFilterText("");
+    }
+
 }