X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=vid-automation%2Fsrc%2Fmain%2Fjava%2Fvid%2Fautomation%2Ftest%2Ftest%2FBrowseASDCTest.java;h=a9378e6df9f38e7b4b597ca25e8971f43cb61704;hb=cbe6877e50b69370170bea4057bb8d5baf42946e;hp=2b5a0982309b06639e1d569236b5f2ff93de8ca9;hpb=9e9f17ce23167e8b5fe85597048d39985d8a5277;p=vid.git diff --git a/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java b/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java index 2b5a09823..a9378e6df 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java @@ -3,7 +3,12 @@ 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_1908_COLLECTION_RESOURCE_NEW_INSTANTIATION_UI; +import static vid.automation.test.infra.Features.FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI; +import static vid.automation.test.infra.Features.FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND; import static vid.automation.test.infra.Features.FLAG_5G_IN_NEW_INSTANTIATION_UI; +import static vid.automation.test.infra.Features.FLAG_NETWORK_TO_ASYNC_INSTANTIATION; +import static vid.automation.test.infra.Features.FLAG_SHOW_ORCHESTRATION_TYPE; 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; @@ -14,6 +19,7 @@ import java.util.List; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.hamcrest.Matchers; +import org.jetbrains.annotations.NotNull; import org.onap.sdc.ci.tests.datatypes.UserCredentials; import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; @@ -24,6 +30,7 @@ import org.onap.simulator.presetGenerator.presets.ecompportal_att.PresetGetSessi import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.testng.Assert; +import org.testng.SkipException; import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; @@ -32,17 +39,19 @@ 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.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.deploy.DeployDialogBase; +import vid.automation.test.sections.deploy.DeployModernUIALaCarteDialog; +import vid.automation.test.sections.deploy.DeployModernUIMacroDialog; +import vid.automation.test.sections.deploy.DeployOldALaCarteDialog; +import vid.automation.test.sections.deploy.DeployOldMacroDialog; import vid.automation.test.services.ServicesService; import vid.automation.test.services.SimulatorApi; @@ -50,10 +59,6 @@ import vid.automation.test.services.SimulatorApi; public class BrowseASDCTest extends CreateInstanceDialogBaseTest { private final String invariantUUIDAlacarte = aLaCarteForBrowseSdc.modelInvariantId; private final String invariantUUIDMacro = macroForBrowseSdc.modelInvariantId; - private final String instantiationTypeNameAlacarte = "a la carte"; - private final String instantiationTypeNameMacro = "macro"; - private final String oldMacro = "old macro"; - private final String newAlacarte = "new a la carte"; public static final String modelInvariantUUID1 = "aeababbc-010b-4a60-8df7-e64c07389466"; public static final String modelInvariantUUID2 = "aa2f8e9c-9e47-4b15-a95c-4a9385599abc"; public static final String modelInvariantUUID3 = "d849c57d-b6fe-4843-8349-4ab8bbb08d71"; @@ -79,7 +84,7 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { return new UserCredentials(user.credentials.userId, user.credentials.password, Constants.Users.EMANUEL_EMANUEL, "", ""); } - @Test(groups = {"shouldBeMigratedToWorkWithSimulator"}) + //@Test(groups = {"shouldBeMigratedToWorkWithSimulator"}) public void testPNFOnCreatePopup() { Service service = servicesService.getService("f39389e4-2a9c-4085-8ac3-04aea9c651be"); BrowseASDCPage browseASDCPage = new BrowseASDCPage(); @@ -95,12 +100,9 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { validateServiceCreationDialog(service); } -// @BeforeMethod -// public void clearSimulator() { -// SimulatorApi.clearAll(); -// } - @Test(groups = {"shouldBeMigratedToWorkWithSimulator"}) + + //@Test(groups = {"shouldBeMigratedToWorkWithSimulator"}) private void testPNFMacroInstantation() throws Exception { User user = usersService.getUser(Constants.Users.EMANUEL_EMANUEL); relogin(user.credentials); @@ -136,88 +138,97 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { } @Test - private void browseServiceModel_deployServiceALaCarteByBackendInput_creationPopupIsALaCarte() throws Exception { + private void browseServiceModel_deployServiceALaCarteByBackendInput_creationPopupIsALaCarte() { // model uuid should be of macro deployServiceAndAssertInstantiationType( "csar15782222_instantiationTypeAlacarte_invariantUUIDMacro.zip", invariantUUIDMacro, - instantiationTypeNameAlacarte + getAlacarteDialogByFlagValue() ); } + @NotNull + public static DeployDialogBase getAlacarteDialogByFlagValue() { + return FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI.isActive() ? + new DeployModernUIALaCarteDialog() : + new DeployOldALaCarteDialog(); + } + @Test @FeatureTogglingTest(FLAG_5G_IN_NEW_INSTANTIATION_UI) - private void browseServiceModel_deployServiceALaCarteByBackendInputHintNewUI_creationPopupIsAngular2() throws Exception { + private void browseServiceModel_deployServiceALaCarteByBackendInputHintNewUI_creationPopupIsAngular2() { deployServiceAndAssertInstantiationType( instantiationTypeAlacarte_vidNotionsInstantiationUIByUUID, - newAlacarte + new DeployModernUIALaCarteDialog() ); } @Test - private void browseServiceModel_deployServiceALaCarteBecauseNotOnMACRO_SERVICESConfig_creationPopupIsALaCarte() throws Exception { + private void browseServiceModel_deployServiceALaCarteBecauseNotOnMACRO_SERVICESConfig_creationPopupIsALaCarte() { deployServiceAndAssertInstantiationType( "csar15782222_instantiationTypeEmpty_invariantUUIDAlacarte.zip", invariantUUIDAlacarte, - instantiationTypeNameAlacarte + getAlacarteDialogByFlagValue() ); } @Test - private void browseServiceModel_deployServiceMacroByBackendInput_creationPopupIsMacro() throws Exception { + private void browseServiceModel_deployServiceMacroByBackendInput_creationPopupIsMacro() { deployServiceAndAssertInstantiationType( - "csar15782222_instantiationTypeMacro_invariantUUIDAlacarte_withoutNetworks.zip", - invariantUUIDAlacarte, - instantiationTypeNameMacro + ModelInfo.serviceWithInstantiationTypeMacro, + new DeployModernUIMacroDialog() ); } @Test - private void browseServiceModel_deployServiceMacroByMACRO_SERVICESConfig_creationPopupIsOldMacro() throws Exception { + private void browseServiceModel_deployServiceMacroByMACRO_SERVICESConfig_creationPopupIsOldMacro() { + if (FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI.isActive() && + ! FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND.isActive()) { + throw new SkipException("some 2002 flags shall come along together"); + } deployServiceAndAssertInstantiationType( "csar15782222_invariantUUIDMacro.zip", invariantUUIDMacro, - oldMacro - + new DeployOldMacroDialog() ); } @Test - private void browseServiceModel_deployServiceMacroWithPnf_creationPopupIsOldMacro() throws Exception { + private void browseServiceModel_deployServiceMacroWithPnf_creationPopupIsOldMacro() { deployServiceAndAssertInstantiationType( "csar15782222_instantiationTypeMacroWithPnf.zip", invariantUUIDMacro, - oldMacro - + new DeployOldMacroDialog() ); } @Test - private void browseServiceModel_deployServiceMacroWithCR_creationPopupIsOldMacro() throws Exception { + public void browseServiceModel_deployServiceMacroWithCR_creationPopupIsOldMacro() { deployServiceAndAssertInstantiationType( - "csar15782222_instantiationTypeMacroWithCR.zip", - invariantUUIDMacro, - oldMacro - + ModelInfo.collectionResourceService, + FLAG_1908_COLLECTION_RESOURCE_NEW_INSTANTIATION_UI.isActive() ? + new DeployModernUIMacroDialog() : + new DeployOldMacroDialog() ); } @Test - private void browseServiceModel_deployServiceMacroWithNetwork_creationPopupIsMacroByFF() throws Exception { - String macroInstantiationAccordingFF = Features.FLAG_ASYNC_INSTANTIATION.isActive() && Features.FLAG_NETWORK_TO_ASYNC_INSTANTIATION.isActive() ? instantiationTypeNameMacro : oldMacro; + private void browseServiceModel_deployServiceMacroWithNetwork_creationPopupIsMacroByFF() { deployServiceAndAssertInstantiationType( "csar15782222_instantiationTypeMacroWithNetwork.zip", invariantUUIDMacro, - macroInstantiationAccordingFF + FLAG_NETWORK_TO_ASYNC_INSTANTIATION.isActive() ? + new DeployModernUIMacroDialog() : + new DeployOldMacroDialog() ); } - private void deployServiceAndAssertInstantiationType(String modelZipFileName, String modelInvariantId, String expectedInstantiationType) throws Exception { - deployServiceAndAssertInstantiationType(new ModelInfo("4d71990b-d8ad-4510-ac61-496288d9078e", modelInvariantId, modelZipFileName), expectedInstantiationType); + private void deployServiceAndAssertInstantiationType(String modelZipFileName, String modelInvariantId, DeployDialogBase deployDialog) { + deployServiceAndAssertInstantiationType(new ModelInfo("4d71990b-d8ad-4510-ac61-496288d9078e", modelInvariantId, modelZipFileName), deployDialog); } - private void deployServiceAndAssertInstantiationType(ModelInfo modelInfo, String expectedInstantiationType) throws Exception { + private void deployServiceAndAssertInstantiationType(ModelInfo modelInfo, DeployDialogBase deployDialog) { registerExpectationForLegacyServiceDeployment(modelInfo, "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); User user = usersService.getUser(Constants.Users.EMANUEL_EMANUEL); @@ -228,19 +239,13 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { GeneralUIUtils.ultimateWait(); browseASDCPage.clickDeployServiceButtonByServiceUUID(modelInfo.modelVersionId); - DeployMacroDialogBase macroDialog = null; - if (expectedInstantiationType.equals(instantiationTypeNameAlacarte)) { - GeneralUIUtils.ultimateWait(); - browseASDCPage.clickCancelButtonByTestID(); - } else { //macro - macroDialog = expectedInstantiationType.equals(oldMacro) ? new DeployMacroDialogOld() : getMacroDialog(); - macroDialog.assertTitle(); - macroDialog.closeDialog(); - } + + deployDialog.waitForDialogAssertAndClose(); } + @FeatureTogglingTest(value = FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI, flagActive = false) @Test - private void testServiceInstantiationAlaCarte() throws Exception { + private void testServiceInstantiationAlaCarte() { User user = usersService.getUser(Constants.Users.EMANUEL_EMANUEL); relogin(user.credentials); @@ -312,8 +317,9 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { BrowseASDCPage browseASDCPage = registerSimulatorAndGoToBrowseSDC(); Service service = servicesService.getService("2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"); browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid); - DeployMacroDialogBase deployMacroDialog = getMacroDialog(); - deployMacroDialog.assertDialogExists(); + DeployModernUIMacroDialog deployMacroDialog = new DeployModernUIMacroDialog(); + deployMacroDialog.waitForDialogToLoad(); + deployMacroDialog.assertDialog(); deployMacroDialog.clickProjectSelect(); deployMacroDialog.clickOwningEntitySelect(); } @@ -333,7 +339,7 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { return new BrowseASDCPage(); } - @Test(groups = {"shouldBeMigratedToWorkWithSimulator"}) + //@Test(groups = {"shouldBeMigratedToWorkWithSimulator"}) private void testOwningEntityRequiredAndProjectOptional() throws Exception { User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA); relogin(user.credentials); @@ -367,7 +373,7 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { assertSuccessfulServiceInstanceCreation(); } - @Test(groups = {"shouldBeMigratedToWorkWithSimulator"}) + //@Test(groups = {"shouldBeMigratedToWorkWithSimulator"}) protected void testLineOfBusinessOptionalAndPlatformRequired() throws Exception { User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA); @@ -406,7 +412,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 +495,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(""); + } + }