make GR_API the default testApi in automation tests
[vid.git] / vid-automation / src / main / java / vid / automation / test / test / ChangeManagementTest.java
index 179eb96..e092ad3 100644 (file)
@@ -1,37 +1,55 @@
 package vid.automation.test.test;
 
 
+import static java.util.Collections.emptyMap;
+import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals;
+import static org.apache.commons.lang3.exception.ExceptionUtils.rethrow;
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.hamcrest.CoreMatchers.everyItem;
 import static org.hamcrest.CoreMatchers.hasItem;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.CoreMatchers.startsWith;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.greaterThan;
 import static org.hamcrest.collection.IsEmptyCollection.empty;
 import static org.hamcrest.core.IsNot.not;
+import static org.onap.simulator.presetGenerator.presets.aai.PresetBaseAAICustomQuery.FORMAT.SIMPLE;
+import static org.onap.vid.api.BaseApiTest.getResourceAsString;
+import static vid.automation.test.infra.Features.FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG;
+import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND;
 
+import com.aventstack.extentreports.Status;
+import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.primitives.Ints;
+import java.io.IOException;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
+import net.javacrumbs.jsonunit.core.Option;
 import org.json.JSONException;
 import org.junit.Assert;
 import org.onap.sdc.ci.tests.datatypes.UserCredentials;
+import org.onap.sdc.ci.tests.execute.setup.ExtentTestActions;
 import org.onap.sdc.ci.tests.utilities.GeneralUIUtils;
 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet;
+import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetTenants;
+import org.onap.simulator.presetGenerator.presets.aai.PresetBaseAAICustomQuery;
+import org.onap.simulator.presetGenerator.presets.scheduler.PresetDeleteSchedulerChangeManagement;
 import org.openqa.selenium.JavascriptExecutor;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.remote.RemoteWebElement;
 import org.openqa.selenium.support.ui.Select;
 import org.skyscreamer.jsonassert.JSONAssert;
 import org.skyscreamer.jsonassert.JSONCompareMode;
+import org.testng.ITestResult;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeClass;
@@ -40,6 +58,8 @@ 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.Input;
 import vid.automation.test.infra.SelectOption;
@@ -51,7 +71,9 @@ import vid.automation.test.utils.DB_CONFIG;
 
 public class ChangeManagementTest extends VidBaseTestCase {
 
-    public static final  String SCHEDULED_ID = "0b87fe60-50b0-4bac-a0a7-49e951b0ba9e";
+    public static final String SCHEDULED_ID = "0b87fe60-50b0-4bac-a0a7-49e951b0ba9e";
+    private final String SCHEDULE_ERROR_PREFIX = "Portal not found. Cannot send: ";
+
     @Test
     public void testLeftPanelChangeManagementButton() {
         Assert.assertTrue(Wait.byText(Constants.SideMenu.VNF_CHANGES));
@@ -72,7 +94,15 @@ public class ChangeManagementTest extends VidBaseTestCase {
         Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalSubscriberInputId));
         Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalServiceTypeInputId));
         Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalVNFNameInputId));
-        Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalVNFTypeInputId));
+
+        if (Features.FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH.isActive()) {
+            Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalVNFTypeInputId1));
+            Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalVNFCloudRegion));
+            Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalVNFSearchVNF));
+        } else {
+            Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalVNFTypeInputId));
+        }
+
         Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalFromVNFVersionInputId));
         Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalWorkFlowInputId));
         Assert.assertTrue(Exists.byId(Constants.generalSubmitButtonId));
@@ -81,17 +111,29 @@ 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 cloudRegion = VNF_DATA_WITH_IN_PLACE.cloudRegion;
         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);
         Wait.angularHttpRequestsLoaded();
-        SelectOption.byIdAndVisibleText(Constants.ChangeManagement.newModalVNFTypeInputId, vnfType);
+
+        if (Features.FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH.isActive()) {
+            Input.text(vnfType, Constants.ChangeManagement.newModalVNFTypeInputId);
+            SelectOption.byIdAndVisibleText(Constants.ChangeManagement.newModalVNFCloudRegion, cloudRegion);
+            Click.byId(Constants.ChangeManagement.newModalVNFSearchVNF);
+        } else {
+            SelectOption.byIdAndVisibleText(Constants.ChangeManagement.newModalVNFTypeInputId, vnfType);
+        }
         Wait.angularHttpRequestsLoaded();
+
         SelectOption.byIdAndVisibleText(Constants.ChangeManagement.newModalFromVNFVersionInputId, vnfSourceVersion);
         Wait.angularHttpRequestsLoaded();
         Click.byId(Constants.ChangeManagement.newModalVNFNameInputId);
@@ -131,8 +173,10 @@ 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 cloudRegion = "AAIAIC25 (AIC)";
         static String vnfSourceVersion = "1.0";
         static String vnfName = "zolson3amdns02test2";
         static String vnfTargetVersion = "5.0";
@@ -167,17 +211,46 @@ public class ChangeManagementTest extends VidBaseTestCase {
     @BeforeClass
     protected void registerToSimulator() {
         SimulatorApi.clearAll();
-        SimulatorApi.registerExpectation(SimulatorApi.RegistrationStrategy.APPEND,
+        SimulatorApi.registerExpectation(APPEND,
                 "changeManagement/ecompportal_getSessionSlotCheckInterval.json"
-                        , "changeManagement/get_aai_sub_details.json"
-                        , "changeManagement/get_sdc_catalog_services_2f80c596.json"
-                        , "changeManagement/get_service-design-and-creation.json"
-                        , "changeManagement/get_vnf_data_by_globalid_and_service_type.json"
-                        , "changeManagement/service-design-and-creation.json"
-                        , "changeManagement/mso_get_manual_task.json"
-                        , "changeManagement/mso_post_manual_task.json"
+                , "changeManagement/get_aai_sub_details.json"
+                , "changeManagement/get_sdc_catalog_services_2f80c596.json"
+                , "changeManagement/get_service-design-and-creation.json"
+                , "changeManagement/get_vnf_data_by_globalid_and_service_type.json"
+                , "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);
+        SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(), APPEND);
+        if (FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG.isActive()) {
+            String AAI_VNFS_FOR_CHANGE_MANAGEMENT_JSON_BY_PARAMS = "registration_to_simulator/changeManagement/get_vnf_data_by_globalid_and_service_type_with_modelVer.json";
+            String globalCustomerId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb";
+            String serviceType = "vRichardson";
+            SimulatorApi.registerExpectationFromPreset(new PresetBaseAAICustomQuery(
+                    SIMPLE,
+                    "/business/customers/customer/" + globalCustomerId + "/service-subscriptions/service-subscription/"
+                            + serviceType + "/service-instances",
+                    "query/vnfs-fromServiceInstance-filterByCloudRegion?nfRole=vMobileDNS&cloudRegionID=AAIAIC25"
+            ) {
+                @Override
+                public Object getResponseBody() {
+                    return getResourceAsString(
+                            AAI_VNFS_FOR_CHANGE_MANAGEMENT_JSON_BY_PARAMS);
+                }
+            }, APPEND);
+        }
+
+
+        SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(), SimulatorApi.RegistrationStrategy.APPEND);
+
+        if (Features.FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH.isActive()) {
+            SimulatorApi.registerExpectationFromPreset(new PresetAAIGetTenants(
+                            VNF_DATA_WITH_IN_PLACE.subscriberId,
+                            VNF_DATA_WITH_IN_PLACE.serviceType),
+                    SimulatorApi.RegistrationStrategy.APPEND);
+
+        }
 
         registerDefaultTablesData();
         resetGetServicesCache();
@@ -185,12 +258,12 @@ public class ChangeManagementTest extends VidBaseTestCase {
 
     private void registerDefaultTablesData() {
         SimulatorApi.registerExpectation(
-                new String[] {"changeManagement/get_scheduler_details_short.json",
+                new String[]{"changeManagement/get_scheduler_details_short.json",
                         "changeManagement/mso_get_change_managements.json"
-                        ,"changeManagement/delete_scheduled_task.json"},
+                        , "changeManagement/delete_scheduled_task.json"},
                 ImmutableMap.of(
                         "<SCHEDULE_ID>", SCHEDULED_ID,
-                        "<IN_PROGRESS_DATE>", "Fri, 08 Sep 2017 19:34:32 GMT"), SimulatorApi.RegistrationStrategy.APPEND
+                        "<IN_PROGRESS_DATE>", "Fri, 08 Sep 2017 19:34:32 GMT"), APPEND
         );
     }
 
@@ -265,8 +338,10 @@ public class ChangeManagementTest extends VidBaseTestCase {
 
     @Test
     public void clickOnScheduledJob_SuccessfulMessageAppear() {
+
+        SimulatorApi.registerExpectationFromPreset(new PresetDeleteSchedulerChangeManagement(), APPEND);
+
         ChangeManagementPage.openChangeManagementPage();
-//        Wait.angularHttpRequestsLoaded();
         GeneralUIUtils.ultimateWait();
         clickAndAssertOnCancelButton(SCHEDULED_ID);
         updateSimulatorWithParametersOfScheduledJod("get_scheduler_details_short_with_after_cancel" +
@@ -284,13 +359,15 @@ public class ChangeManagementTest extends VidBaseTestCase {
 
     }
 
-    private void clickAndAssertOnCancelButton(String scheduledID){
-        Wait.waitByTestId("icon-status-"+ scheduledID, 5);
-        Click.byTestId("icon-status-"+ scheduledID);
+    private void clickAndAssertOnCancelButton(String scheduledID) {
+        Wait.waitByTestId("icon-status-" + scheduledID, 5);
+        Click.byTestId("icon-status-" + scheduledID);
         GeneralUIUtils.ultimateWait();
         WebElement cancelPendingConfirmationMessage = Get.byTestId("btn-cancel-workflow");
-        assertThat(cancelPendingConfirmationMessage.getText(),containsString("Are you sure you want to delete workflow"));
+        assertThat(cancelPendingConfirmationMessage.getText(), containsString("Are you sure you want to delete workflow"));
+        screenshot("delete workflow");
     }
+
     private void clickAndAssertClickOnCancelWorkflowButtonOnPendingPopUp() {
 
         try {
@@ -298,14 +375,15 @@ public class ChangeManagementTest extends VidBaseTestCase {
             GeneralUIUtils.ultimateWait();
             Assert.assertTrue(Exists.byClassAndText(Constants.generalModalTitleClass, "Success"));
         } finally {
-            if (Exists.byClassAndText("modal-title", "Pending")){
+            if (Exists.byClassAndText("modal-title", "Pending")) {
                 Click.byClass("pull-right modal-close");
             }
         }
-        Click.byClassAndVisibleText("btn","OK");
+        screenshot("cancel workflow");
+        Click.byClassAndVisibleText("btn", "OK");
     }
 
-    private void assertCorrectJobDeleted (String vnfName){
+    private void assertCorrectJobDeleted(String vnfName) {
         WebElement canceledScheduledJobRow = GeneralUIUtils.getWebElementByTestID("pending-table-cm-row");
         String scheduledVnfName = ((RemoteWebElement) canceledScheduledJobRow).findElementsByTagName("td").get(1).getText();
         String scheduledState = ((RemoteWebElement) canceledScheduledJobRow).findElementsByTagName("td").get(5).getText();
@@ -313,25 +391,29 @@ public class ChangeManagementTest extends VidBaseTestCase {
         Assert.assertEquals("Deleted", scheduledState);
     }
 
-    private void assertAndCheckStatusCellOnDeletedSheduledJob(String scheduledId, String classString){
+    private void assertAndCheckStatusCellOnDeletedSheduledJob(String scheduledId, String classString) {
         boolean isNotDisplayed = GeneralUIUtils.waitForElementInVisibilityByTestId("icon-status-" + scheduledId, 5);
         Assert.assertTrue(isNotDisplayed);
     }
-    public void updateSimulatorWithParametersOfScheduledJod(String jasonFile){
+
+    public void updateSimulatorWithParametersOfScheduledJod(String jasonFile) {
         SimulatorApi.registerExpectation(
-                new String[] {"changeManagement/"+jasonFile},
-                ImmutableMap.of("<SCHEDULE_ID>", SCHEDULED_ID), SimulatorApi.RegistrationStrategy.APPEND
+                new String[]{"changeManagement/" + jasonFile},
+                ImmutableMap.of("<SCHEDULE_ID>", SCHEDULED_ID), APPEND
         );
     }
 
+    @FeatureTogglingTest(value = Features.FLAG_HANDLE_SO_WORKFLOWS, flagActive = false)
     @Test
     public void testWorkflowVNFInPlaceSoftwareUpdateNotInWorkflowsListWhenNotExpected() {
+
         List<String> 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()  {
+    public void testWorkflowVNFInPlaceSoftwareUpdateInWorkflowsListWhenExpected() {
         List<String> workflows = getListOfWorkflowsFor(VNF_DATA_WITH_IN_PLACE.vnfName);
         assertThat(workflows, hasItem(VNF_DATA_WITH_IN_PLACE.workflowName));
     }
@@ -341,7 +423,10 @@ public class ChangeManagementTest extends VidBaseTestCase {
     }
 
     @AfterMethod(alwaysRun = true)
-    public void closeForm() {
+    public void screenshotAndCloseForm(ITestResult testResult) {
+
+        screenshot(testResult.getName() + (testResult.isSuccess() ? "" : " FAIL"));
+
         // Tries closing left-out popups, if any
         // If none -- catch clause will swallow the exception
         try {
@@ -354,15 +439,24 @@ public class ChangeManagementTest extends VidBaseTestCase {
         Wait.modalToDisappear();
     }
 
+    protected void screenshot(String testName) {
+        try {
+            ExtentTestActions.addScreenshot(Status.INFO, "ChangeManagementTest." + testName, testName);
+        } catch (IOException e) {
+            rethrow(e);
+        }
+    }
+
     @Test
     public void testWorkflowVNFInPlaceSoftwareUpdateShows3Fields() {
+
         openAndFill1stScreenWithWorkflowVNFInPlaceSoftwareUpdate();
 
         List<String> 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()));
@@ -415,13 +509,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<String> getListOfWorkflowsFor(String vnfName) {
@@ -438,19 +532,41 @@ public class ChangeManagementTest extends VidBaseTestCase {
 
     @DataProvider
     public static Object[][] dataForUpdateWorkflowPartialWithInPlace() {
-        return new Object[][] {
-                { "1111", "22222", "33333" }
+        return new Object[][]{
+                {"1111", "22222", "33333"}
                 , {"8", "3t3MhTRqkyjB85o5NC9OacAw", "B.bJ6f7KYI6Wz-----DMR0.fyNM9r4"}
                 , {"78058488", "n", "WkH"}
         };
     }
-    
-    // Deleted testVidToMsoCallbackDataWithInPlaceSWUpdate test. It was using assertThatVidToMsoCallbackDataIsOk which is no longer valid.
 
+    @Test(dataProvider = "dataForUpdateWorkflowPartialWithInPlace")
+    public void testVidToMsoCallbackDataWithInPlaceSWUpdate(String operationsTimeout, String existingSwVersion, String newSwVersion) {
 
+        openAndFill1stScreenWithWorkflowVNFInPlaceSoftwareUpdate();
+        fillVNFInPlace3Fields(operationsTimeout, existingSwVersion, newSwVersion);
 
-    // Deleted testUploadConfigUpdateFile test. It was using assertThatVidToMsoCallbackDataIsOk which is no longer valid.
+        assertThatVidToPortalCallbackDataIsOk(VNF_DATA_WITH_IN_PLACE.workflowName, ImmutableMap.of(
+                "existingSoftwareVersion", existingSwVersion,
+                "newSoftwareVersion", newSwVersion,
+                "operationTimeout", operationsTimeout
+        ));
+    }
+
+    @Test
+    public void testUploadConfigUpdateFile() {
+        String fileName = "configuration_file.csv";
+        updateConfigFile(fileName);
+        Assert.assertEquals(Get.byId(Constants.ChangeManagement.newModalConfigUpdateInputId + "-label").getText(), fileName);
+        Assert.assertTrue(Get.byId(Constants.generalSubmitButtonId).isEnabled());
+        assertThatVidToPortalCallbackDataIsOk("VNF Config Update", ImmutableMap.of(
+                "configUpdateFile",
+                "{\"request-parameters\":{\"vm\":[{\"vnfc\":["
+                        + "{\"vnfc-name\":\"ibcx0001vm001dbg001\",\"vnfc-function-code\":\"dbg\"}],\"vm-name\":\"ibcx0001vm001\"},"
+                        + "{\"vnfc\":[{\"vnfc-name\":\"ibcx0001vm002dbg001\"}],\"vm-name\":\"ibcx0001vm002\"}]},\"configuration-parameters\":{\"node0_hostname\":\"dbtx0001vm001\"}}"
+        ));
+    }
 
+    @FeatureTogglingTest(value = Features.FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH, flagActive = false)
     @Test
     public void testUploadConfigUpdateNonCsvFile() {
         String fileName = "non-valid.json";
@@ -470,7 +586,7 @@ public class ChangeManagementTest extends VidBaseTestCase {
 
     @DataProvider
     public static Object[][] invalidCsvFiles() {
-        return new Object[][] {
+        return new Object[][]{
                 {"emptyFile.csv"},
                 {"withoutPayload.csv"},
                 {"withoutConfigurationParameters.csv"},
@@ -478,7 +594,14 @@ public class ChangeManagementTest extends VidBaseTestCase {
         };
     }
 
-    // Deleted testVidToMsoCallbackData test. It was using assertThatVidToMsoCallbackDataIsOk which is no longer valid.
+    @Test
+    public void testVidToMsoCallbackData() {
+        String workflow = "Replace";
+
+        openAndFill1stScreen(VNF_DATA_WITH_IN_PLACE.vnfName, VNF_DATA_WITH_IN_PLACE.vnfTargetVersion, workflow);
+
+        assertThatVidToPortalCallbackDataIsOk(workflow, emptyMap());
+    }
 
     private void assertThatVidToMsoCallbackDataIsOk(String workflow, String payload) {
         Assert.assertTrue(Get.byId(Constants.generalSubmitButtonId).isEnabled());
@@ -499,6 +622,44 @@ public class ChangeManagementTest extends VidBaseTestCase {
         Click.byId(Constants.generalCancelButtonId);
     }
 
+    private void assertThatVidToPortalCallbackDataIsOk(String workflowName, Map<String, String> workflowParams) {
+        screenshot("submit to scheduler");
+        Assert.assertTrue(Get.byId(Constants.generalSubmitButtonId).isEnabled());
+        Click.byId(Constants.generalSubmitButtonId);
+
+        String errorMessage = GeneralUIUtils.getWebElementByTestID("error-message", 2).getText();
+
+        String modelInvariantId = "72e465fe-71b1-4e7b-b5ed-9496118ff7a8";
+        String vnfInstanceId = "8e5e3ba1-3fe6-4d86-966e-f9f03dab4855";
+
+        assertThat(errorMessage, startsWith(SCHEDULE_ERROR_PREFIX));
+        assertThat(errorMessage.replace(SCHEDULE_ERROR_PREFIX, ""), jsonEquals(
+                ImmutableMap.of(
+                        "widgetName", "Portal-Common-Scheduler",
+                        "widgetParameter", "",
+                        "widgetData", ImmutableMap.builder()
+                                .put("vnfNames", ImmutableList.of(ImmutableMap.of(
+                                        "id", vnfInstanceId,
+                                        "invariant-id", modelInvariantId,
+                                        "version", "5.0"
+                                )))
+                                .put("workflowParameters", emptyMap())
+                                .put("subscriberId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
+                                .put("fromVNFVersion", "" + "76e908e0-5201-44d2-a3e2-9e6128d05820" + "")
+                                .put("workflow", "" + workflowName + "")
+                                .put("policyYN", "Y")
+                                .put("sniroYN", "Y")
+                                .put("testApi", "GR_API")
+                                .put("vnfType", "vMobileDNS")
+                                .putAll(workflowParams)
+                                .build()
+                )
+        ).when(Option.IGNORING_EXTRA_FIELDS));
+
+
+        Click.byId(Constants.generalCancelButtonId);
+    }
+
     @Test(enabled = false)
     public void testUpdateWorkflowNow() {
 
@@ -544,24 +705,18 @@ public class ChangeManagementTest extends VidBaseTestCase {
     public void testFinishedSectionIncludeUnlockedItem() {
         ChangeManagementPage.openChangeManagementPage();
         Click.byId(Constants.ChangeManagement.dashboardFinishedTabId);
-        Assert.assertThat(Get.byClassAndText("vnf-name","Unlocked instance"),is(notNullValue()));
-
+        Assert.assertThat(Get.byClassAndText("vnf-name", "Unlocked instance"), is(notNullValue()));
     }
 
-
-
-
-
     @Test
-    public void testMainDashboardTableContent () {
+    public void testMainDashboardTableContent() {
         ChangeManagementPage.openChangeManagementPage();
         GeneralUIUtils.ultimateWait();
         List<WebElement> webElements = Get.multipleElementsByTestId(Constants.ChangeManagement.activeTableRowId);
-        assertThat("List of pending workflows is empty",webElements,is(not(empty())));
+        assertThat("List of pending workflows is empty", webElements, is(not(empty())));
         //TODO: After scheduler will be ready than we will examine if the content is valid.
     }
 
-
     @Test
     public void testOnlyOneModalIsOpen() throws Exception {
 
@@ -573,11 +728,10 @@ public class ChangeManagementTest extends VidBaseTestCase {
         GeneralUIUtils.ultimateWait();
 
 
-
         List<WebElement> elements = Get.byClass(Constants.ChangeManagement.pendingIconClass);
         Assert.assertTrue(elements != null && elements.size() > 0);
 
-        ((JavascriptExecutor)getDriver()).executeScript("arguments[0].scrollIntoView();", elements.get(0));
+        ((JavascriptExecutor) getDriver()).executeScript("arguments[0].scrollIntoView();", elements.get(0));
 
 
         elements.get(0).click();
@@ -598,7 +752,7 @@ public class ChangeManagementTest extends VidBaseTestCase {
     public void testOpenFailedStatusModal() {
         ChangeManagementPage.openChangeManagementPage();
 
-        if(!Exists.byClass(Constants.ChangeManagement.failedIconClass)) {
+        if (!Exists.byClass(Constants.ChangeManagement.failedIconClass)) {
             //TODO: Create a job which will shown with status fail.
         }
 
@@ -618,7 +772,7 @@ public class ChangeManagementTest extends VidBaseTestCase {
     public void testOpenInProgressStatusModal() {
         ChangeManagementPage.openChangeManagementPage();
 
-        if(!Exists.byClass(Constants.ChangeManagement.processIconClass)) {
+        if (!Exists.byClass(Constants.ChangeManagement.processIconClass)) {
             //TODO: Create a job which will shown with status in-progress.
         }
 
@@ -638,7 +792,7 @@ public class ChangeManagementTest extends VidBaseTestCase {
     public void testOpenAlertStatusModal() {
         ChangeManagementPage.openChangeManagementPage();
 
-        if(!Exists.byClass(Constants.ChangeManagement.alertIconClass)) {
+        if (!Exists.byClass(Constants.ChangeManagement.alertIconClass)) {
             //TODO: Create a job which will shown with status alert.
         }
 
@@ -658,7 +812,7 @@ public class ChangeManagementTest extends VidBaseTestCase {
     public void testOpenPendingStatusModal() {
         ChangeManagementPage.openChangeManagementPage();
 
-        if(!Exists.byClass(Constants.ChangeManagement.pendingIconClass)) {
+        if (!Exists.byClass(Constants.ChangeManagement.pendingIconClass)) {
             //TODO: Create a job which will shown with status pending.
         }
 
@@ -674,7 +828,7 @@ public class ChangeManagementTest extends VidBaseTestCase {
         Wait.modalToDisappear();
     }
 
-    @Test(enabled = false)
+    @Test
     public void testSuccessCancelPendingWorkflow() {
         ChangeManagementPage.openChangeManagementPage();
         Wait.angularHttpRequestsLoaded();
@@ -684,6 +838,7 @@ public class ChangeManagementTest extends VidBaseTestCase {
         Assert.assertTrue(Exists.modal());
         Assert.assertTrue(Exists.byId(Constants.ChangeManagement.pendingModalHeaderId));
         Assert.assertTrue(Exists.byClass(Constants.ChangeManagement.pendingModalCancelWorkflowButtonClass));
+        screenshot("pendingModalCancelWorkflow");
         Click.byClass(Constants.ChangeManagement.pendingModalCancelWorkflowButtonClass);
         Wait.angularHttpRequestsLoaded();
 
@@ -691,6 +846,7 @@ public class ChangeManagementTest extends VidBaseTestCase {
         Assert.assertTrue(Exists.modal());
         Assert.assertTrue(Exists.byId(Constants.ChangeManagement.alertModalHeaderId));
         Assert.assertTrue(Exists.byClassAndText(Constants.generalModalTitleClass, "Success"));
+        screenshot("successCancelWorkflow");
         Click.byClass(Constants.generalCloseModalButtonClass);
         Wait.modalToDisappear();
         //TODO check the workflow deleted from table/changed to deleted action
@@ -702,13 +858,13 @@ public class ChangeManagementTest extends VidBaseTestCase {
         GeneralUIUtils.ultimateWait();
         List<WebElement> pendingRows = Get.multipleElementsByTestId(Constants.ChangeManagement.pendingTableRowId);
         List<WebElement> activeRows = Get.multipleElementsByTestId(Constants.ChangeManagement.activeTableRowId);
-        assertThat("The pending table has no content",pendingRows, is(not(empty())));
-        assertThat("The active table has no content",activeRows, is(not(empty())));
+        assertThat("The pending table has no content", pendingRows, is(not(empty())));
+        assertThat("The active table has no content", activeRows, is(not(empty())));
         Click.byTestId(Constants.ChangeManagement.refreshBtnTestId);
         GeneralUIUtils.ultimateWait();
         pendingRows = Get.multipleElementsByTestId(Constants.ChangeManagement.pendingTableRowId);
-        assertThat("The pending table has no content",pendingRows, is(not(empty())));
-        assertThat("The active table has no content",activeRows, is(not(empty())));
+        assertThat("The pending table has no content", pendingRows, is(not(empty())));
+        assertThat("The active table has no content", activeRows, is(not(empty())));
         //return the register requests to the default state
         registerDefaultTablesData();
     }