From ec47169ebb8d480fed1f4bf513a0e79e0243da4e Mon Sep 17 00:00:00 2001 From: RachelF Date: Tue, 23 Jul 2019 09:05:23 +0300 Subject: Merge workflow from vid to onap, fix workflow selenium tests Issue-ID: VID-532 Change-Id: I5ae0a74d382cd31a9da1ec5b1220c5322f3abb40 Signed-off-by: RachelF --- .../PresetDeleteSchedulerChangeManagement.java | 26 +++++++++++++++ .../main/java/vid/automation/test/Constants.java | 2 +- .../java/vid/automation/test/infra/Features.java | 1 + .../automation/test/test/ChangeManagementTest.java | 38 +++++++++++++--------- 4 files changed, 50 insertions(+), 17 deletions(-) create mode 100644 vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/scheduler/PresetDeleteSchedulerChangeManagement.java (limited to 'vid-automation/src/main/java') diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/scheduler/PresetDeleteSchedulerChangeManagement.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/scheduler/PresetDeleteSchedulerChangeManagement.java new file mode 100644 index 000000000..0005cbd75 --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/scheduler/PresetDeleteSchedulerChangeManagement.java @@ -0,0 +1,26 @@ +package org.onap.simulator.presetGenerator.presets.scheduler; + +import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; +import org.springframework.http.HttpMethod; + +public class PresetDeleteSchedulerChangeManagement extends BasePreset { + + @Override + public HttpMethod getReqMethod() { + return HttpMethod.DELETE; + } + + @Override + public String getReqPath() { + return getRootPath() + "/83aec7bf-602f-49eb-9788-bbc33ac550d9"; + } + + @Override + protected String getRootPath() { + return "/scheduler/v1/ChangeManagement/schedules"; + } + + @Override + public int getResponseCode() { return 204; } + +} diff --git a/vid-automation/src/main/java/vid/automation/test/Constants.java b/vid-automation/src/main/java/vid/automation/test/Constants.java index 6605fe2e6..0e614dece 100644 --- a/vid-automation/src/main/java/vid/automation/test/Constants.java +++ b/vid-automation/src/main/java/vid/automation/test/Constants.java @@ -97,7 +97,7 @@ public class Constants { public static final String newModalFromVNFVersionInputId = "fromVNFVersion"; public static final String newModalVNFNameInputId = "vnfName"; public static final String newModalWorkFlowInputId = "workflow"; - public static final String newModalConfigUpdateInputId = "config-update-input"; + public static final String newModalConfigUpdateInputId = "internal-workflow-parameter-file-5-attach-configuration-file"; public static final String newModalTargetVersionInputsClass = "vnf-versions-select-as-text"; public static final String newModalSubscriberText = "CRAIG/ROBERTS"; public static final String newModalServiceTypeText = "vRichardson"; diff --git a/vid-automation/src/main/java/vid/automation/test/infra/Features.java b/vid-automation/src/main/java/vid/automation/test/infra/Features.java index 005c06551..40f3013dd 100644 --- a/vid-automation/src/main/java/vid/automation/test/infra/Features.java +++ b/vid-automation/src/main/java/vid/automation/test/infra/Features.java @@ -40,6 +40,7 @@ public enum Features implements Feature { FLAG_1908_RESUME_MACRO_SERVICE, FLAG_1908_RELEASE_TENANT_ISOLATION, FLAG_1908_VNF_FC_NEW_INSTANTIATION_UI, + FLAG_HANDLE_SO_WORKFLOWS ; public boolean isActive() { diff --git a/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java b/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java index 2f5489f31..dbc603c26 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java @@ -8,6 +8,7 @@ import org.junit.Assert; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; import org.onap.sdc.ci.tests.datatypes.UserCredentials; import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.simulator.presetGenerator.presets.scheduler.PresetDeleteSchedulerChangeManagement; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.RemoteWebElement; @@ -69,11 +70,13 @@ public class ChangeManagementTest extends VidBaseTestCase { private void openAndFill1stScreen(String vnfName, String vnfTargetVersion, String workflow) { String subscriberId = VNF_DATA_WITH_IN_PLACE.subscriberId; + String subscriberName = VNF_DATA_WITH_IN_PLACE.subscriberName; String serviceType = VNF_DATA_WITH_IN_PLACE.serviceType; String vnfType = VNF_DATA_WITH_IN_PLACE.vnfType; String vnfSourceVersion = VNF_DATA_WITH_IN_PLACE.vnfSourceVersion; ChangeManagementPage.openNewChangeManagementModal(); Wait.angularHttpRequestsLoaded(); + SelectOption.waitForOptionInSelect(subscriberName, "subscriberName"); ChangeManagementPage.selectSubscriberById(subscriberId); Wait.angularHttpRequestsLoaded(); SelectOption.byIdAndVisibleText(Constants.ChangeManagement.newModalServiceTypeInputId, serviceType); @@ -119,6 +122,7 @@ public class ChangeManagementTest extends VidBaseTestCase { static final int vnfZrdm3amdns02test2Id = 11822; static final int vnfHarrisonKrisId = 12822; static String subscriberId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"; + static String subscriberName = "Emanuel"; static String serviceType = "vRichardson"; static String vnfType = "vMobileDNS"; static String vnfSourceVersion = "1.0"; @@ -164,6 +168,7 @@ public class ChangeManagementTest extends VidBaseTestCase { , "changeManagement/service-design-and-creation.json" , "changeManagement/mso_get_manual_task.json" , "changeManagement/mso_post_manual_task.json" + , "changeManagement/mso_get_change_managements_scaleout.json" ); SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(),SimulatorApi.RegistrationStrategy.APPEND); @@ -253,8 +258,10 @@ public class ChangeManagementTest extends VidBaseTestCase { @Test public void clickOnScheduledJob_SuccessfulMessageAppear() { + + SimulatorApi.registerExpectationFromPreset(new PresetDeleteSchedulerChangeManagement(),SimulatorApi.RegistrationStrategy.APPEND); + ChangeManagementPage.openChangeManagementPage(); -// Wait.angularHttpRequestsLoaded(); GeneralUIUtils.ultimateWait(); clickAndAssertOnCancelButton(SCHEDULED_ID); updateSimulatorWithParametersOfScheduledJod("get_scheduler_details_short_with_after_cancel" + @@ -305,6 +312,7 @@ public class ChangeManagementTest extends VidBaseTestCase { boolean isNotDisplayed = GeneralUIUtils.waitForElementInVisibilityByTestId("icon-status-" + scheduledId, 5); Assert.assertTrue(isNotDisplayed); } + public void updateSimulatorWithParametersOfScheduledJod(String jasonFile){ SimulatorApi.registerExpectation( new String[] {"changeManagement/"+jasonFile}, @@ -312,12 +320,15 @@ public class ChangeManagementTest extends VidBaseTestCase { ); } + @FeatureTogglingTest(value = Features.FLAG_HANDLE_SO_WORKFLOWS, flagActive = false) @Test public void testWorkflowVNFInPlaceSoftwareUpdateNotInWorkflowsListWhenNotExpected() { + List workflows = getListOfWorkflowsFor("Harrison Kris"); assertThat(workflows, not(hasItem(VNF_DATA_WITH_IN_PLACE.workflowName))); } + @FeatureTogglingTest(value = Features.FLAG_HANDLE_SO_WORKFLOWS, flagActive = false) @Test public void testWorkflowVNFInPlaceSoftwareUpdateInWorkflowsListWhenExpected() { List workflows = getListOfWorkflowsFor(VNF_DATA_WITH_IN_PLACE.vnfName); @@ -344,13 +355,14 @@ public class ChangeManagementTest extends VidBaseTestCase { @Test public void testWorkflowVNFInPlaceSoftwareUpdateShows3Fields() { + openAndFill1stScreenWithWorkflowVNFInPlaceSoftwareUpdate(); List idsWithoutMatchingElement = Stream.of( - "operations-timeout", - "existing-software-version", - "new-software-version") + "internal-workflow-parameter-text-2-operations-timeout", + "internal-workflow-parameter-text-3-existing-software-version", + "internal-workflow-parameter-text-4-new-software-version") .filter(id -> Get.byId(id) == null) .collect(Collectors.toList()); assertThat("all three special VNFInPlace fields should appear", idsWithoutMatchingElement, is(empty())); @@ -403,13 +415,13 @@ public class ChangeManagementTest extends VidBaseTestCase { } private void fillVNFInPlace3Fields(String operationsTimeout, String existingSwVersion, String newSwVersion) { - Get.byId("operations-timeout").clear(); - Get.byId("existing-software-version").clear(); - Get.byId("new-software-version").clear(); + Get.byId("internal-workflow-parameter-text-2-operations-timeout").clear(); + Get.byId("internal-workflow-parameter-text-3-existing-software-version").clear(); + Get.byId("internal-workflow-parameter-text-4-new-software-version").clear(); - Get.byId("operations-timeout").sendKeys(operationsTimeout); - Get.byId("existing-software-version").sendKeys(existingSwVersion); - Get.byId("new-software-version").sendKeys(newSwVersion); + Get.byId("internal-workflow-parameter-text-2-operations-timeout").sendKeys(operationsTimeout); + Get.byId("internal-workflow-parameter-text-3-existing-software-version").sendKeys(existingSwVersion); + Get.byId("internal-workflow-parameter-text-4-new-software-version").sendKeys(newSwVersion); } private List getListOfWorkflowsFor(String vnfName) { @@ -533,13 +545,8 @@ public class ChangeManagementTest extends VidBaseTestCase { ChangeManagementPage.openChangeManagementPage(); Click.byId(Constants.ChangeManagement.dashboardFinishedTabId); Assert.assertThat(Get.byClassAndText("vnf-name","Unlocked instance"),is(notNullValue())); - } - - - - @Test public void testMainDashboardTableContent () { ChangeManagementPage.openChangeManagementPage(); @@ -549,7 +556,6 @@ public class ChangeManagementTest extends VidBaseTestCase { //TODO: After scheduler will be ready than we will examine if the content is valid. } - @Test public void testOnlyOneModalIsOpen() throws Exception { -- cgit 1.2.3-korg