diff options
8 files changed, 309 insertions, 40 deletions
diff --git a/vid-automation/pom.xml b/vid-automation/pom.xml index 697e1a910..16a756c3d 100644 --- a/vid-automation/pom.xml +++ b/vid-automation/pom.xml @@ -11,7 +11,7 @@ <jackson.version>2.9.9</jackson.version> <jackson.databind.version>2.9.9.3</jackson.databind.version> <aspectj.version>1.8.10</aspectj.version> - <selenium.version>3.6.0</selenium.version> + <selenium.version>3.141.59</selenium.version> <log4j.version>2.12.0</log4j.version> <apachehttp.version>4.4.1</apachehttp.version> diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/EcompPortalUtilities.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/EcompPortalUtilities.java index bded65be8..97938c741 100644 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/EcompPortalUtilities.java +++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/EcompPortalUtilities.java @@ -9,7 +9,6 @@ public class EcompPortalUtilities { WebElement appImage = GeneralUIUtils.getClickableButtonBy(by, 3 * 60); appImage.click(); GeneralUIUtils.getDriver().switchTo().frame(1); - GeneralUIUtils.waitForBackLoader(); GeneralUIUtils.waitForAngular(); GeneralUIUtils.getWebElementByClassName("applicationWindow"); } diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java index e834c15ac..c2c93e734 100644 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java +++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java @@ -21,33 +21,45 @@ package org.onap.sdc.ci.tests.utilities; //import com.automation.common.report_portal_integration.annotations.Step; + +import static org.hamcrest.Matchers.is; + import com.aventstack.extentreports.Status; +import java.awt.Robot; +import java.awt.event.KeyEvent; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; import org.apache.commons.io.FileUtils; import org.junit.Assert; import org.onap.sdc.ci.tests.datatypes.DataTestIdEnum; import org.onap.sdc.ci.tests.datatypes.DataTestIdEnum.DashboardCardEnum; import org.onap.sdc.ci.tests.execute.setup.DriverFactory; import org.onap.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openqa.selenium.*; +import org.openqa.selenium.By; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.Keys; +import org.openqa.selenium.NoSuchElementException; +import org.openqa.selenium.OutputType; +import org.openqa.selenium.TakesScreenshot; +import org.openqa.selenium.TimeoutException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.*; +import org.openqa.selenium.support.ui.ExpectedCondition; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.FluentWait; +import org.openqa.selenium.support.ui.Select; +import org.openqa.selenium.support.ui.WebDriverWait; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.awt.*; -import java.awt.event.KeyEvent; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.function.Supplier; - -import static org.hamcrest.Matchers.is; - public final class GeneralUIUtils { @@ -131,6 +143,13 @@ public final class GeneralUIUtils { return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))); } + public static WebElement getWebElementByTestID(String dataTestId, String text, int timeout) { + WebElement webElementByTestID = getWebElementByTestID(dataTestId, timeout); + + newWait(timeout).until(ExpectedConditions.textToBePresentInElement(webElementByTestID, text)); + return webElementByTestID; + } + public static boolean isWebElementExistByTestId(String dataTestId) { if(getDriver().findElements(By.xpath("//*[@data-tests-id='" + dataTestId + "']")).size() == 0) { return false; @@ -355,8 +374,7 @@ public final class GeneralUIUtils { } public static void waitForLoader(int timeOut) { - sleep(1); - waitForElementInVisibilityBy(By.className("tlv-loader"), timeOut); + newWait(timeOut).until(ExpectedConditions.invisibilityOfElementLocated(By.className("sdc-loader-background"))); } public static void findComponentAndClick(String resourceName) throws Exception { @@ -630,6 +648,7 @@ public final class GeneralUIUtils { } catch (TimeoutException | org.openqa.selenium.ScriptTimeoutException e) { logger.info("Ignoring TimeoutException while waiting for angular2: {}", e, e); } + waitForLoader(10); } public static Object getAllElementAttributes(WebElement element) { @@ -807,13 +826,4 @@ public final class GeneralUIUtils { ultimateWait(); } - public static void waitForBackLoader() { - waitForBackLoader(timeOut); - } - - public static void waitForBackLoader(int timeOut) { - sleep(1); - waitForElementInVisibilityBy(By.className("tlv-loader-back"), timeOut); - } - } diff --git a/vid-automation/src/main/java/vid/automation/test/sections/deploy/DeployModernUIBase.java b/vid-automation/src/main/java/vid/automation/test/sections/deploy/DeployModernUIBase.java index 747f4ebde..dd605ff7c 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/deploy/DeployModernUIBase.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/deploy/DeployModernUIBase.java @@ -19,7 +19,7 @@ public abstract class DeployModernUIBase extends DeployDialogBase { String dialogTitle = "Set a new service instance"; public void assertTitle(){ - WebElement modalTitle = GeneralUIUtils.getWebElementByTestID(Constants.CREATE_MODAL_TITLE_ID, 30); + WebElement modalTitle = GeneralUIUtils.getWebElementByTestID(Constants.CREATE_MODAL_TITLE_ID, dialogTitle, 30); assertThat(modalTitle.getText(), containsString(dialogTitle)); } diff --git a/vid-automation/src/test/java/org/onap/vid/api/InstantiationTemplatesApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/InstantiationTemplatesApiTest.java index 145db8b9d..cf3d508e8 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/InstantiationTemplatesApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/InstantiationTemplatesApiTest.java @@ -28,6 +28,7 @@ import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import vid.automation.test.Constants.Users; import vid.automation.test.infra.FeatureTogglingTest; @@ -88,10 +89,18 @@ public class InstantiationTemplatesApiTest extends AsyncInstantiationBase { return uri.toASCIIString() + "/instantiationTemplates/templateTopology/" + jobId; } - @Test - public void templateTopology_givenDeployFromCypressE2E_getTemplateTopologyDataIsEquivalent() { + @DataProvider + public static Object[][] deployFromCypressE2EFilenames() { + return new Object[][]{ + {"asyncInstantiation/templates__instance_template.json"}, + {"asyncInstantiation/templates__instance_template_network.json"}, + }; + } + + @Test(dataProvider = "deployFromCypressE2EFilenames") + public void templateTopology_givenDeployFromCypressE2E_getTemplateTopologyDataIsEquivalent(String fileName) { templateTopology_givenDeploy_templateTopologyIsEquivalentToBody( - fileAsJsonNode("asyncInstantiation/templates__instance_template.json")); + fileAsJsonNode(fileName)); } @Test diff --git a/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template_network.json b/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template_network.json new file mode 100644 index 000000000..5669ee285 --- /dev/null +++ b/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template_network.json @@ -0,0 +1,110 @@ +{ + "modelInfo": { + "modelInvariantId": "ce23786e-b2b1-4258-b561-f77ef93ada9c", + "modelVersionId": "a1a14610-ee40-4049-8007-0608a20dd1fa", + "modelName": "int_pktmirror_net NC SRIOV network", + "modelType": "service", + "modelVersion": "3.0" + }, + "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc", + "owningEntityName": "WayneHolland", + "projectName": "WATKINS", + "globalSubscriberId": "e433710f-9217-458d-a79d-1c7aff376d89", + "subscriberName": "SILVIA ROBBINS", + "productFamilyId": null, + "instanceName": "SDN_int_pktmirror_net_svc", + "subscriptionServiceType": "TYLER SILVIA", + "lcpCloudRegionId": null, + "tenantId": null, + "tenantName": null, + "aicZoneId": null, + "aicZoneName": null, + "existingVNFCounterMap": {}, + "existingVRFCounterMap": {}, + "existingVnfGroupCounterMap": {}, + "existingNetworksCounterMap": { + "f6b6d141-0d4c-427d-ad35-797f3d1abe71": 1, + "e01e26b2-aa26-4e11-9243-105d4589ff08": 1 + }, + "existingNames": { + }, + "vnfs": {}, + "networks": { + "SR-IOV Provider 2-1": { + "modelInfo": { + "modelCustomizationName": "SR-IOV Provider 2-1", + "modelCustomizationId": "f6b6d141-0d4c-427d-ad35-797f3d1abe71", + "modelInvariantId": "ffb9e45c-e674-4289-aad3-00040ad746e4", + "modelVersionId": "01f4c475-3f89-4f00-a2f4-39a873dba0ae", + "modelName": "NETWORK_CLOUD_PROVIDER_NETWORK", + "modelType": "network", + "modelVersion": "1.0" + }, + "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89", + "instanceName": "SDN_int_pktmirror_net_1", + "action": "Create", + "platformName": "xxx1", + "lcpCloudRegionId": "hvf6", + "tenantId": "4914ab0ab3a743e58f0eefdacc1dde77", + "instanceParams": [ + {} + ], + "rollbackOnFailure": true, + "instanceId": null, + "trackById": "2e8455cb-4c28-4aa7-929d-f1e1881aaaa1", + "isFailed": false, + "statusMessage": null, + "position": null, + "lineOfBusiness": "zzz1" + }, + "SR-IOV Provider 2-2": { + "modelInfo": { + "modelCustomizationName": "SR-IOV Provider 2-2", + "modelCustomizationId": "e01e26b2-aa26-4e11-9243-105d4589ff08", + "modelInvariantId": "ffb9e45c-e674-4289-aad3-00040ad746e4", + "modelVersionId": "01f4c475-3f89-4f00-a2f4-39a873dba0ae", + "modelName": "NETWORK_CLOUD_PROVIDER_NETWORK", + "modelType": "network", + "modelVersion": "1.0" + }, + "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89", + "instanceName": "SDN_int_pktmirror_net_2", + "action": "Create", + "platformName": "xxx1", + "lcpCloudRegionId": "hvf6", + "tenantId": "4914ab0ab3a743e58f0eefdacc1dde77", + "instanceParams": [ + {} + ], + "rollbackOnFailure": true, + "instanceId": null, + "trackById": "e43ffa05-ea78-4c34-a0c8-02449851d827", + "isFailed": false, + "statusMessage": null, + "position": null, + "lineOfBusiness": "zzz1" + } + }, + "vnfGroups": {}, + "vrfs": {}, + "instanceParams": [ + {} + ], + "pause": false, + "bulkSize": 1, + "rollbackOnFailure": "true", + "isALaCarte": true, + "testApi": "GR_API", + "instanceId": null, + "action": "Create", + "trackById": "4157dcfb-fa22-435d-8df9-659628137177", + "isFailed": false, + "statusMessage": null, + "vidNotions": { + "instantiationUI": "networkWithPropertyNetworkTechnologyEqualsStandardSriovOrOvs", + "modelCategory": "5G Provider Network", + "viewEditUI": "legacy", + "instantiationType": "ALaCarte" + }, + "position": null +} diff --git a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts index a73576d9a..e481c3e8b 100644 --- a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts @@ -155,7 +155,7 @@ describe('Drawing Board: Instantiation Templates', function () { ...vnfPath, "vfModules", module1CustomizationId, ]; - let serviceInstanceElementOnRedux = state.service.serviceInstance[serviceModelId]; + let serviceInstanceElementOnRedux = state.service.serviceInstance[(templateWithVnfSetup.serviceModelId)]; let latestVfModule_1Path = findPathOfLatestVfModule(serviceInstanceElementOnRedux, vfModules_1Path); // This is a funny merge, as values are already there, but that way ensures @@ -182,6 +182,21 @@ describe('Drawing Board: Instantiation Templates', function () { }); + it('Given a template - User can remove existing vfmodule', function () { + + loadDrawingBoardWithRecreateMode(); + nodeAction('node-c09e4530-8fd8-418f-9483-2f57ce927b05-vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1', 'Remove'); + let removed_vfModule_Path = [ + ...vnfPath, "vfModules", + "vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1", + ]; + + assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd([ + {path: [...vnfPath, "vnfStoreKey"], value: "vProbe_NC_VNF 0"}, // side-effect + {path: [...removed_vfModule_Path], value: undefined}, + ]); + }); + [ {desc: "with changes", modifySomeValues: true}, {desc: "without changes", modifySomeValues: false}, @@ -236,34 +251,72 @@ describe('Drawing Board: Instantiation Templates', function () { }); + it(`Given a stored template of Network - - it is loaded`, () => { + + loadDrawingBoardWithRecreateModeNetwork(); + + // Then... + cy.getElementByDataTestsId("node-SR-IOV Provider 2-1").should('be.visible'); + cy.getElementByDataTestsId("node-SR-IOV Provider 2-2").should('be.visible'); + assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd_network(); + }); + + }); }); }); -const serviceModelId = '6cfeeb18-c2b0-49df-987a-da47493c8e38'; +let apiTestResources = '../vid-automation/src/test/resources/asyncInstantiation/'; + +const templateWithVnfSetup = { + serviceModelId: '6cfeeb18-c2b0-49df-987a-da47493c8e38', + instanceTemplateFile: apiTestResources + 'templates__instance_template.json', + instanceTemplateSetWithoutModifyFile: apiTestResources + 'templates__instance_from_template__set_without_modify1.json', + serviceModelFile: '../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model.json', +}; + +const templateWithNetworkSetup = { + serviceModelId: 'a1a14610-ee40-4049-8007-0608a20dd1fa', + instanceTemplateFile: apiTestResources + 'templates__instance_template_network.json', + serviceModelFile: '../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model_network.json', +}; const vnfPath = [ "vnfs", "vProbe_NC_VNF 0" ]; function loadDrawingBoardWithRecreateMode() { + loadDrawingBoardWithRecreateModeInternal( + '../../' + templateWithVnfSetup.instanceTemplateFile, + templateWithVnfSetup.serviceModelId, + templateWithVnfSetup.serviceModelFile); +} + +function loadDrawingBoardWithRecreateModeNetwork() { + loadDrawingBoardWithRecreateModeInternal( + '../../' + templateWithNetworkSetup.instanceTemplateFile, + templateWithNetworkSetup.serviceModelId, + templateWithNetworkSetup.serviceModelFile); +} + +function loadDrawingBoardWithRecreateModeInternal(instanceTemplate: string, serviceModelIdToLoad: any, serviceModel: string) { const templateUuid = "46390edd-7100-46b2-9f18-419bd24fb60b"; const drawingBoardAction = `RECREATE`; const templateTopologyEndpoint = "templateTopology"; - cy.route(`**/rest/models/services/${serviceModelId}`, - 'fixture:../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model.json') + cy.route(`**/rest/models/services/${serviceModelIdToLoad}`, + 'fixture:' + serviceModel) .as('serviceModel'); cy.route(`**/instantiationTemplates/${templateTopologyEndpoint}/${templateUuid}`, - 'fixture:../../../vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json') + 'fixture:' + instanceTemplate) .as('templateTopology'); // When... cy.openIframe(`app/ui/#/servicePlanning/${drawingBoardAction}` + `?jobId=${templateUuid}` + - `&serviceModelId=${serviceModelId}`); + `&serviceModelId=${serviceModelIdToLoad}`); cy.wait('@serviceModel'); cy.wait('@templateTopology'); @@ -288,9 +341,17 @@ function removeVNFWithVFModules(dataTestId: string) { } function assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd(deviationFromExpected: { path: PropertyPath, value: any }[] = []) { + assertThatBodyFromDeployRequestEqualsToTemplateFromBackEndInternal(templateWithVnfSetup.instanceTemplateFile, deviationFromExpected); +} + +function assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd_network(deviationFromExpected: { path: PropertyPath, value: any }[] = []) { + assertThatBodyFromDeployRequestEqualsToTemplateFromBackEndInternal(templateWithNetworkSetup.instanceTemplateFile, deviationFromExpected); +} + +function assertThatBodyFromDeployRequestEqualsToTemplateFromBackEndInternal(filePathOfExpected: string, deviationFromExpected: { path: PropertyPath; value: any }[]) { cy.getDrawingBoardDeployBtn().click(); cy.wait('@expectedPostAsyncInstantiation').then(xhr => { - cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json').then((expectedResult) => { + cy.readFile(filePathOfExpected).then((expectedResult) => { convertRollbackOnFailureValueFromStringToBoolean(expectedResult); let xhrBodyWithoutIsDirtyField = removeIsDirtyFieldFromXhrRequestBody(xhr); @@ -305,7 +366,7 @@ function assertThatBodyFromDeployRequestEqualsToFile(deviationFromExpected: { pa cy.getDrawingBoardDeployBtn().click(); cy.wait('@expectedPostAsyncInstantiation').then(xhr => { - cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json').then((expectedResult) => { + cy.readFile(templateWithVnfSetup.instanceTemplateSetWithoutModifyFile).then((expectedResult) => { setDeviationInExpected(expectedResult, deviationFromExpected); cy.deepCompare(xhr.request.body, expectedResult); }); diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model_network.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model_network.json new file mode 100644 index 000000000..08597a918 --- /dev/null +++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model_network.json @@ -0,0 +1,80 @@ +{ + "service": { + "uuid": "a1a14610-ee40-4049-8007-0608a20dd1fa", + "invariantUuid": "ce23786e-b2b1-4258-b561-f77ef93ada9c", + "name": "int_pktmirror_net NC SRIOV network", + "version": "3.0", + "toscaModelURL": null, + "category": "Network Service", + "serviceType": "INFRASTRUCTURE", + "serviceRole": "PROVIDER-NETWORK", + "description": "SRIOV network model for NC 1.0, VLAN ID 187 and 188.", + "serviceEcompNaming": "false", + "instantiationType": "A-La-Carte", + "inputs": {}, + "vidNotions": { + "instantiationUI": "anyAlacarteWhichNotExcluded", + "modelCategory": "5G Provider Network", + "viewEditUI": "legacy", + "instantiationType": "ALaCarte" + } + }, + "vnfs": {}, + "networks": { + "SR-IOV Provider 2-1": { + "uuid": "01f4c475-3f89-4f00-a2f4-39a873dba0ae", + "invariantUuid": "ffb9e45c-e674-4289-aad3-00040ad746e4", + "description": "NETWORK_CLOUD_PROVIDER_NETWORK", + "name": "NETWORK_CLOUD_PROVIDER_NETWORK", + "version": "1.0", + "customizationUuid": "f6b6d141-0d4c-427d-ad35-797f3d1abe71", + "inputs": {}, + "commands": {}, + "properties": { + "network_role": "int_pktmirror_net_1", + "exVL_naming": "{ecomp_generated_naming=false}", + "network_flows": "{is_network_policy=false, is_bound_to_vpn=false}", + "network_scope": "GLOBAL", + "ecomp_generated_naming": "false", + "network_type": "SR-IOV-PROVIDER2-1", + "provider_network": "{physical_network_name=sriovnet1, is_provider_network=true}", + "network_technology": "STANDARD-SR-IOV", + "network_homing": "{ecomp_selected_instance_node_target=false}" + }, + "type": "VL", + "modelCustomizationName": "SR-IOV Provider 2-1" + }, + "SR-IOV Provider 2-2": { + "uuid": "01f4c475-3f89-4f00-a2f4-39a873dba0ae", + "invariantUuid": "ffb9e45c-e674-4289-aad3-00040ad746e4", + "description": "NETWORK_CLOUD_PROVIDER_NETWORK", + "name": "NETWORK_CLOUD_PROVIDER_NETWORK", + "version": "1.0", + "customizationUuid": "e01e26b2-aa26-4e11-9243-105d4589ff08", + "inputs": {}, + "commands": {}, + "properties": { + "network_role": "int_pktmirror_net_2", + "exVL_naming": "{ecomp_generated_naming=false}", + "network_flows": "{is_network_policy=false, is_bound_to_vpn=false}", + "network_scope": "GLOBAL", + "ecomp_generated_naming": "false", + "network_type": "SR-IOV-PROVIDER2-2", + "provider_network": "{physical_network_name=sriovnet2, is_provider_network=true}", + "network_technology": "STANDARD-SR-IOV", + "network_homing": "{ecomp_selected_instance_node_target=false}" + }, + "type": "VL", + "modelCustomizationName": "SR-IOV Provider 2-2" + } + }, + "collectionResources": {}, + "configurations": {}, + "fabricConfigurations": {}, + "serviceProxies": {}, + "vfModules": {}, + "volumeGroups": {}, + "pnfs": {}, + "vnfGroups": {}, + "vrfs": {} +} |