diff options
Diffstat (limited to 'ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService')
8 files changed, 0 insertions, 2151 deletions
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/CreatePath.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/CreatePath.java deleted file mode 100644 index 485b069f15..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/CreatePath.java +++ /dev/null @@ -1,299 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.AmdocsComplexService; - -import com.aventstack.extentreports.Status; -import com.clearspring.analytics.util.Pair; -import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; -import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; -import org.openecomp.sdc.ci.tests.datatypes.enums.CircleSize; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.pages.CompositionPage; -import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; -import org.openecomp.sdc.ci.tests.pages.GovernorOperationPage; -import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; -import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage; -import org.openecomp.sdc.ci.tests.pages.TesterOperationPage; -import org.openecomp.sdc.ci.tests.utilities.FileHandling; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Optional; -import org.testng.annotations.Parameters; -import org.testng.annotations.Test; - -import java.util.ArrayList; -import java.util.List; - - -public class CreatePath extends SetupCDTest { - - protected static String filePath = FileHandling.getFilePath("ComplexService"); - private static String fullCompositionFile = "fullComposition.zip"; - private static String fullCompositionFile2 = "fullCompositionNew.zip"; - private static String HSSFile = "HSS.zip"; - private static String VMMEFile = "VMME.zip"; - private static String makeDistributionValue; - - @Parameters({"makeDistribution"}) - @BeforeMethod - public void beforeTestReadParams(@Optional("true") String makeDistributionReadValue) { - makeDistributionValue = makeDistributionReadValue; - } - - //------------------------------------------Tests----------------------------------------------------- - - - // Test#1 Jira issue 5610 - @Test - public void AssertPathButtons() throws Exception { - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - getToPathFlow(resourceReqDetails, filePath, fullCompositionFile); - reloginWithNewRole(UserRoleEnum.DESIGNER); - PathUtilities.createService(getUser()); - PathUtilities.openCreatePath(); - PathValidations.AssertCreatePath(); - PathValidations.AssertExtendPath(); - } - - // Test#2 Jira issue 5441 - @Test - public void CreatePathTestSanity() throws Exception { - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - Pair<String, ServiceReqDetails> pair = getToPathFlow(resourceReqDetails, filePath, fullCompositionFile); - String vspName = pair.left; - String serviceName = pair.right.getName(); - String pathName = "Test1"; - PathUtilities.createPath(pathName, vspName); - PathValidations.validateServicePath(serviceName, pathName); - } - - // Test#3 Jira issue 5611 - @Test - public void CreatePathCheckIO() throws Exception { - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - String vspName = onboardAndCertify(resourceReqDetails, filePath, fullCompositionFile); - reloginWithNewRole(UserRoleEnum.DESIGNER); - String serviceName = PathUtilities.createService(getUser()).getName(); - String pathName = PathUtilities.createPath("Test3", vspName); - - // @@ check in @@ - ResourceGeneralPage.clickCheckinButton(serviceName); - GeneralUIUtils.findComponentAndClick(serviceName); - ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); - PathValidations.AssertCreatedPathExistInCompositionPage(pathName); - - // @@ check out @@ - ResourceGeneralPage.clickCheckoutButton(); - PathValidations.AssertCreatedPathExistInCompositionPage(pathName); - } - - // Test#4 Jira issue 5441 - @Test - public void CreateMultiplePaths() throws Exception { - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - Pair<String, ServiceReqDetails> pair = getToPathFlow(resourceReqDetails, filePath, HSSFile); - String vspName = pair.left; - PathUtilities.createPath("Test4_path1", vspName); - PathUtilities.createPath("Test4_path2", vspName); - PathValidations.createPathNumOfRows(7); - PathValidations.createPathNumOfRows(6); - SetupCDTest.getExtendTest().log(Status.INFO, "multiple paths have been created"); - } - - // Test#5 Jira issue 5506 - @Test - public void CreatePathWithComplex() throws Exception { - List<String> vnfFiles = new ArrayList<>(); - vnfFiles.add(HSSFile); - vnfFiles.add(VMMEFile); - Pair<String, String> complex = CreatePathComplexServiceFlow(filePath, vnfFiles); - String serviceName = complex.left; - String pathName = complex.right; - PathValidations.validateServicePath(serviceName, pathName); - SetupCDTest.getExtendTest().log(Status.INFO, "path with complex service has been created"); - } - - // Test#6 Jira issue 5506 - @Test - public void CreateExtendedPathWithComplex() throws Exception { - List<String> vnfFiles = new ArrayList<>(); - vnfFiles.add(fullCompositionFile); - vnfFiles.add(fullCompositionFile2); - String[] services = getToComplexService(filePath, vnfFiles); - PathValidations.validateComplexExtendedPath(services); - SetupCDTest.getExtendTest().log(Status.INFO, "path with complex service has been created"); - } - - // Test#7 Jira issue 5441 - @Test - public void CreatePathExtendedTest() throws Exception { - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - runCreateExtendedPathFlow(resourceReqDetails, filePath, fullCompositionFile); - } - - //////////////////////////////////////////////////////////////////////////////////////// - // flow methods // - //////////////////////////////////////////////////////////////////////////////////////// - - // workflow leading to path - public String onboardAndCertify(ResourceReqDetails resourceReqDetails, String filePath, String vnfFile) throws Exception { - VendorSoftwareProductObject vendorSoftwareProductObject = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser()); - String vspName = vendorSoftwareProductObject.getName(); - - DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen(); - ExtentTestActions.addScreenshot(Status.INFO, "TopologyTemplate_" + vnfFile, "The topology template for " + vnfFile + " is as follows : "); - - DeploymentArtifactPage.clickSubmitForTestingButton(vspName); - SetupCDTest.getExtendTest().log(Status.INFO, "relogin as TESTER"); - reloginWithNewRole(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(vspName); - TesterOperationPage.certifyComponent(vspName); - return vspName; - } - - public List<String> onboardAndCertifyMultipleVFs(String filePath, List<String> vnfFiles) throws Exception { - List<String> VFNames = new ArrayList<>(); - for (int i = 0; i < vnfFiles.size(); i++) { - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - VendorSoftwareProductObject vendorSoftwareProductObject = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFiles.get(i), getUser()); - VFNames.add(i, vendorSoftwareProductObject.getName()); - DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen(); - ExtentTestActions.addScreenshot(Status.INFO, "TopologyTemplate_" + vnfFiles.get(i), "The topology template for " + vnfFiles.get(i) + " is as follows : "); - DeploymentArtifactPage.clickSubmitForTestingButton(VFNames.get(i)); - } - SetupCDTest.getExtendTest().log(Status.INFO, "relogin as TESTER"); - reloginWithNewRole(UserRoleEnum.TESTER); - for (String VFName : VFNames) { - GeneralUIUtils.findComponentAndClick(VFName); - TesterOperationPage.certifyComponent(VFName); - } - return VFNames; - } - - public Pair<String, ServiceReqDetails> getToPathFlow(ResourceReqDetails resourceReqDetails, String filepath, String vnfFile) throws Exception { - String vspName = onboardAndCertify(resourceReqDetails, filepath, vnfFile); - reloginWithNewRole(UserRoleEnum.DESIGNER); - ServiceReqDetails serviceMetadata = PathUtilities.createService(getUser()); - return new Pair<>(vspName, serviceMetadata); - } - - public String[] getToComplexService(String filepath, List<String> vnfFiles) throws Exception { - // create & certify 2 VF - List<String> VFNames = onboardAndCertifyMultipleVFs(filepath, vnfFiles); - reloginWithNewRole(UserRoleEnum.DESIGNER); - ServiceReqDetails serviceMetadata1 = PathUtilities.createService(getUser()); - - // create path 1 - PathUtilities.createPath("newPath", VFNames.get(0)); - PathUtilities.submitForTesting(); - GeneralUIUtils.ultimateWait(); - ServiceReqDetails serviceMetadata2 = PathUtilities.createService(getUser()); - - // create path 2 - PathUtilities.createPath("newPath2", VFNames.get(1)); - PathUtilities.submitForTesting(); - - //tester - reloginWithNewRole(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName()); - TesterOperationPage.certifyComponent(serviceMetadata1.getName()); - GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName()); - TesterOperationPage.certifyComponent(serviceMetadata2.getName()); - - //governor - reloginWithNewRole(UserRoleEnum.GOVERNOR); - GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName()); - GovernorOperationPage.approveService(serviceMetadata1.getName()); - GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName()); - GovernorOperationPage.approveService(serviceMetadata2.getName()); - - //create service for complex service - reloginWithNewRole(UserRoleEnum.DESIGNER); - ServiceReqDetails serviceMetadata3 = PathUtilities.createService(getUser()); - return new String[]{serviceMetadata1.getName(), serviceMetadata2.getName(), serviceMetadata3.getName()}; - } - - public Pair<String, String> CreatePathComplexServiceFlow(String filepath, List<String> vnfFiles) throws Exception { - String[] servicesName = getToComplexService(filepath, vnfFiles); - CanvasManager canvasManager = CanvasManager.getCanvasManager(); - CompositionPage.searchForElement(servicesName[0]); - CanvasElement service1 = canvasManager.createElementOnCanvas(servicesName[0]); - CompositionPage.searchForElement(servicesName[1]); - CanvasElement service2 = canvasManager.createElementOnCanvas(servicesName[1]); - canvasManager.linkElements(service1, CircleSize.SERVICE, service2, CircleSize.SERVICE); - - // create path - String pathName = "name1"; - PathUtilities.openCreatePath(); - PathUtilities.insertValues(pathName, "pathProtocol1", "pathPortNumbers1"); - PathUtilities.selectFirstLineParam(); - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue()).click(); - return new Pair<>(servicesName[2], pathName); - } - - public void runCreateExtendedPathFlow(ResourceReqDetails resourceReqDetails, String filepath, String vnfFile) throws Exception { - Pair<String, ServiceReqDetails> pair = getToPathFlow(resourceReqDetails, filepath, vnfFile); - String vspName = pair.left; - PathUtilities.linkVFs(vspName, 4); - - //create path - PathUtilities.openCreatePath(); - String pathName = "name1"; - PathUtilities.insertValues(pathName, "pathProtocol1", "pathPortNumbers1"); - PathUtilities.selectFirstLineParam(); - int numOfLines = 3; - PathValidations.extendPath(numOfLines); - - //delete line - PathUtilities.deleteLines(1, numOfLines); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue()); - ExtentTestActions.log(Status.INFO, "path has been created"); - - // check path is on the list - PathUtilities.openPathList(); - String PathListName1 = GeneralUIUtils.findByText(pathName).getText(); - String newPathName = "name2"; - PathUtilities.editPathName(pathName, newPathName); - GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.PATH_MENU_BUTTON.getValue() + "']/parent::*").get(0).click(); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.PATH_LIST_BUTTON.getValue()); - String PathListName2 = GeneralUIUtils.findByText(newPathName).getText(); - PathValidations.AssertNameChangeFromPathList(PathListName1, PathListName2); - - // delete path and validate - PathValidations.ValidateAndDeletePathFromPathList(newPathName); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesAssignmentScreen.INPUT_DELETE_DIALOG_CLOSE.getValue()); - SetupCDTest.getExtendTest().log(Status.INFO, "Path has been created"); - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } - -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/ElementsChanges.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/ElementsChanges.java deleted file mode 100644 index 67d3f3df56..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/ElementsChanges.java +++ /dev/null @@ -1,735 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.AmdocsComplexService; - -import com.aventstack.extentreports.Status; -import com.clearspring.analytics.util.Pair; -import org.apache.http.HttpStatus; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; -import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.pages.CompositionPage; -import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; -import org.openecomp.sdc.ci.tests.pages.GovernorOperationPage; -import org.openecomp.sdc.ci.tests.pages.HomePage; -import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage; -import org.openecomp.sdc.ci.tests.pages.TesterOperationPage; -import org.openecomp.sdc.ci.tests.utilities.FileHandling; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils; -import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.utils.general.VendorSoftwareProductRestUtils; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Optional; -import org.testng.annotations.Parameters; -import org.testng.annotations.Test; - -import java.util.ArrayList; -import java.util.List; - -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertNotSame; - - -public class -ElementsChanges extends SetupCDTest { - - private static final int NUMBER_OF_LINKS = 3; - protected static String filePath = FileHandling.getFilePath("ComplexService"); - private static String fullCompositionFile = "fullComposition.zip"; - private static String test = "test.zip"; - private static String fullCompositionFile2 = "test.zip"; - private static String HSSFile = "HSS.zip"; - private static String VMMEFile = "VMME.zip"; - private static String WithPort = "withPort.zip"; - private static String withoutPort = "withoutPort.zip"; - private static String makeDistributionValue; - - @Parameters({"makeDistribution"}) - @BeforeMethod - public void beforeTestReadParams(@Optional("true") String makeDistributionReadValue) { - makeDistributionValue = makeDistributionReadValue; - } - - //------------------------------------------Tests----------------------------------------------------- - - // Test#1 Jira issue 6324 - @Test - public void DeleteComponent() throws Exception { - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - String vspName = onboardAndCertify(resourceReqDetails, filePath, fullCompositionFile); - reloginWithNewRole(UserRoleEnum.DESIGNER); - ServiceReqDetails serviceMetadata = PathUtilities.createService(getUser()); - List<CanvasElement> VFs = PathUtilities.linkVFs(vspName, NUMBER_OF_LINKS); - String pathName = PathUtilities.createPathWithoutLink("DeleteComponent", vspName); - PathUtilities.deleteComponents(VFs); - PathValidations.validatePathListIsEmpty(); - certifyServiceAsTester(serviceMetadata); - - } - - // Test#2 Jira issue 6325 - @Test - public void DeleteServiceComponent() throws Exception { - ServiceReqDetails serviceMetadata = getToComplexService(filePath, fullCompositionFile); - reloginWithNewRole(UserRoleEnum.DESIGNER); - ServiceReqDetails complexService = PathUtilities.createService(getUser()); - List<CanvasElement> services = createComplexPath(serviceMetadata.getName()); - PathUtilities.deleteComponents(services); - PathValidations.validatePathListIsEmpty(); - certifyServiceAsTester(complexService); - } - - // Test#3 Jira issue 6364 - @Test - public void ManualUpdateVF() throws Exception { - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - String vspName = onboardAndCertify(resourceReqDetails, filePath, fullCompositionFile); - reloginWithNewRole(UserRoleEnum.DESIGNER); - ServiceReqDetails serviceMetadata = PathUtilities.createService(getUser()); - PathUtilities.createPath("ManualUpdateVF", vspName); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.HOME_FROM_COMPOSITION.getValue()); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.MainMenuButtons.ONBOARD_BUTTON.getValue()); - /// GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.ONBOARD_CATALOG.getValue()); - ResourceUIUtils.clickOnElementByText(vspName, null); - ResourceUIUtils.clickOnElementByText("Create New Version", null); - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ComplexServiceAmdocs.NEW_VSP_VERSION_DESCRIPTION.getValue()).sendKeys("new vsap version for service path"); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.SUBMIT_NEW_VSP_VERSION_DESCRIPTION.getValue()); - - // VendorSoftwareProductObject v = new VendorSoftwareProductObject(); - //VendorSoftwareProductRestUtils.uploadHeatPackage(filePath,fullCompositionFile,v,getUser()); -//upload new heat +commit submit - //go to home - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.MainMenuButtons.ONBOARD_BUTTON.getValue()); - - GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); - ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); - // CanvasManager.getCanvasManager().clickOnCanvaElement(vf); - //update version - //validate path still exist - certifyServiceAsTester(serviceMetadata); - } - - @Test - public void UpdateComponent() throws Exception { - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - String vspName = onboardAndCertify(resourceReqDetails, filePath, VMMEFile); - - } - - @Test - public void UpdateComponentWithouForwarder() throws Exception { - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - String vsp_v2_description = "change description for version 2"; - VendorSoftwareProductObject vendorSoftwareProductObject = getToPathServiceVersions(resourceReqDetails, filePath, WithPort, vsp_v2_description, withoutPort, getUser()); - - // create service - ServiceReqDetails service = PathUtilities.createService(getUser()); - - // create path - String vspName = vendorSoftwareProductObject.getName(); - String pathName = "path1"; - List<CanvasElement> VFs = PathUtilities.linkVFs(vspName, 2); - CanvasManager canvasManager = CanvasManager.getCanvasManager(); - for (CanvasElement element : VFs) { - CompositionPage.changeComponentVersion(canvasManager, element, "1.0", false); - } - PathUtilities.openCreatePath(); - PathUtilities.insertValues(pathName, "pathProtocol1", "pathPortNumbers1"); - PathUtilities.selectFirstLineParam(); - PathValidations.extendPath(NUMBER_OF_LINKS); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue()); - - ///////////////// - // test case // - ///////////////// - - // validate version change has no effect - for (CanvasElement element : VFs) { - RestResponse ServiceForwardingPathsResponse = PathUtilities.getServiceForwardingPathsAPI(service.getName()); - // change to version with different capabiliteis - CompositionPage.changeComponentVersion(canvasManager, element, "3.0", false); - // click on warning message - GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.OK.getValue() + "']").get(0).click(); - GeneralUIUtils.ultimateWait(); - // validate paths changed - RestResponse ServiceForwardingPathsResponse2 = PathUtilities.getServiceForwardingPathsAPI(service.getName()); - assertNotSame( - "response message failed expectation, expectation is to change", - ServiceForwardingPathsResponse.getResponse(), - ServiceForwardingPathsResponse2.getResponse()); - // validate there are no error messages - PathValidations.ValidateThereIsNoErrorMessage(); - - CompositionPage.changeComponentVersion(canvasManager, element, "1.0", false); - GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.OK.getValue() + "']").get(0).click(); - GeneralUIUtils.ultimateWait(); - // validate paths hasn't changed - RestResponse ServiceForwardingPathsResponse3 = PathUtilities.getServiceForwardingPathsAPI(service.getName()); - assertEquals( - "response message failed expectation, expectation is not to change", - ServiceForwardingPathsResponse2.getResponse(), - ServiceForwardingPathsResponse3.getResponse()); - // validate there are no error messages - PathValidations.ValidateThereIsNoErrorMessage(); - } - - /////////////////////// - // post requisites // - /////////////////////// - - // finish flow - certifyServiceAsTester(service); - } - - //TODO run and debug -// Test#3 Jira issue - 6230 - @Test - public void ValidatePathServiceVersions() throws Exception { - - ////////////////////// - // pre requisites // - ////////////////////// - - // start flow - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - String vsp_v2_description = "change description for version 2"; - VendorSoftwareProductObject vendorSoftwareProductObject = getToPathServiceVersions(resourceReqDetails, filePath, HSSFile, vsp_v2_description, fullCompositionFile, getUser()); - - // create service - ServiceReqDetails service = PathUtilities.createService(getUser()); - - // create path - String vspName = vendorSoftwareProductObject.getName(); - String pathName = "path1"; - List<CanvasElement> VFs = PathUtilities.linkVFs(vspName, 2); - CanvasManager canvasManager = CanvasManager.getCanvasManager(); - for (CanvasElement element : VFs) { - CompositionPage.changeComponentVersion(canvasManager, element, "1.0", false); - } - PathUtilities.openCreatePath(); - PathUtilities.insertValues(pathName, "pathProtocol1", "pathPortNumbers1"); - PathUtilities.selectFirstLineParam(); - PathValidations.extendPath(NUMBER_OF_LINKS); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue()); - - ///////////////// - // test case // - ///////////////// - - // validate version change has no effect - for (CanvasElement element : VFs) { - RestResponse ServiceForwardingPathsResponse = PathUtilities.getServiceForwardingPathsAPI(service.getName()); - - CompositionPage.changeComponentVersion(canvasManager, element, "2.0", false); - // validate paths hasn't changed - RestResponse ServiceForwardingPathsResponse2 = PathUtilities.getServiceForwardingPathsAPI(service.getName()); - assertEquals( - "response message failed expectation, expectation is not to change", - ServiceForwardingPathsResponse.getResponse(), - ServiceForwardingPathsResponse2.getResponse()); - // validate there are no error messages - PathValidations.ValidateThereIsNoErrorMessage(); - - CompositionPage.changeComponentVersion(canvasManager, element, "1.0", false); - // validate paths hasn't changed - RestResponse ServiceForwardingPathsResponse3 = PathUtilities.getServiceForwardingPathsAPI(service.getName()); - assertEquals( - "response message failed expectation, expectation is not to change", - ServiceForwardingPathsResponse.getResponse(), - ServiceForwardingPathsResponse3.getResponse()); - // validate there are no error messages - PathValidations.ValidateThereIsNoErrorMessage(); - } - - /////////////////////// - // post requisites // - /////////////////////// - - // finish flow - certifyServiceAsTester(service); - } - - //TODO run and debug -// Test#3 Jira issue - 6189 - @Test - public void ValidatePathServiceVersionsDifferentCapabilities() throws Exception { - - ////////////////////// - // pre requisites // - ////////////////////// - - // start flow - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - String vsp_v2_description = "change description for version 2"; - VendorSoftwareProductObject vendorSoftwareProductObject = getToPathServiceVersions(resourceReqDetails, filePath, HSSFile, vsp_v2_description, fullCompositionFile, getUser()); - - // create service - ServiceReqDetails service = PathUtilities.createService(getUser()); - - // create path - String vspName = vendorSoftwareProductObject.getName(); - String pathName = "path1"; - List<CanvasElement> VFs = PathUtilities.linkVFs(vspName, 2); - CanvasManager canvasManager = CanvasManager.getCanvasManager(); - for (CanvasElement element : VFs) { - CompositionPage.changeComponentVersion(canvasManager, element, "1.0", false); - } - PathUtilities.openCreatePath(); - PathUtilities.insertValues(pathName, "pathProtocol1", "pathPortNumbers1"); - PathUtilities.selectFirstLineParam(); - PathValidations.extendPath(NUMBER_OF_LINKS); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue()); - - ///////////////// - // test case // - ///////////////// - - // validate version change has no effect - for (CanvasElement element : VFs) { - RestResponse ServiceForwardingPathsResponse = PathUtilities.getServiceForwardingPathsAPI(service.getName()); - // change to version with different capabiliteis - CompositionPage.changeComponentVersion(canvasManager, element, "3.0", false); - // click on warning message - GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.OK.getValue() + "']").get(0).click(); - GeneralUIUtils.ultimateWait(); - // validate paths changed - RestResponse ServiceForwardingPathsResponse2 = PathUtilities.getServiceForwardingPathsAPI(service.getName()); - assertNotSame( - "response message failed expectation, expectation is to change", - ServiceForwardingPathsResponse.getResponse(), - ServiceForwardingPathsResponse2.getResponse()); - // validate there are no error messages - PathValidations.ValidateThereIsNoErrorMessage(); - - CompositionPage.changeComponentVersion(canvasManager, element, "1.0", false); - GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.OK.getValue() + "']").get(0).click(); - GeneralUIUtils.ultimateWait(); - // validate paths hasn't changed - RestResponse ServiceForwardingPathsResponse3 = PathUtilities.getServiceForwardingPathsAPI(service.getName()); - assertEquals( - "response message failed expectation, expectation is not to change", - ServiceForwardingPathsResponse2.getResponse(), - ServiceForwardingPathsResponse3.getResponse()); - // validate there are no error messages - PathValidations.ValidateThereIsNoErrorMessage(); - } - - /////////////////////// - // post requisites // - /////////////////////// - - // finish flow - certifyServiceAsTester(service); - } - - //TODO run and debug -// Test#3 Jira issue - 6231 - @Test - public void ValidatePathServiceVersionsnegative() throws Exception { - - ////////////////////// - // pre requisites // - ////////////////////// - - // start flow - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - String vsp_v2_description = "change description for version 2"; - VendorSoftwareProductObject vendorSoftwareProductObject = getToPathServiceVersions(resourceReqDetails, filePath, HSSFile, vsp_v2_description, fullCompositionFile, getUser()); - - // create service - ServiceReqDetails service = PathUtilities.createService(getUser()); - - // create path - String vspName = vendorSoftwareProductObject.getName(); - String pathName = "path1"; - List<CanvasElement> VFs = PathUtilities.linkVFs(vspName, 2); - CanvasManager canvasManager = CanvasManager.getCanvasManager(); - for (CanvasElement element : VFs) { - CompositionPage.changeComponentVersion(canvasManager, element, "1.0", false); - } - PathUtilities.openCreatePath(); - PathUtilities.insertValues(pathName, "pathProtocol1", "pathPortNumbers1"); - PathUtilities.selectFirstLineParam(); - PathValidations.extendPath(NUMBER_OF_LINKS); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue()); - - ///////////////// - // test case // - ///////////////// - - // validate version change has no effect - for (CanvasElement element : VFs) { - RestResponse ServiceForwardingPathsResponse = PathUtilities.getServiceForwardingPathsAPI(service.getName()); - // change to version with different capabiliteis - CompositionPage.changeComponentVersion(canvasManager, element, "3.0", false); - // click on warning message to cancel - GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ModalItems.CANCEL.getValue() + "']").get(0).click(); - GeneralUIUtils.ultimateWait(); - // validate paths changed - RestResponse ServiceForwardingPathsResponse2 = PathUtilities.getServiceForwardingPathsAPI(service.getName()); - assertEquals( - "response message failed expectation, expectation is not to change", - ServiceForwardingPathsResponse.getResponse(), - ServiceForwardingPathsResponse2.getResponse()); - // validate there are no error messages - PathValidations.ValidateThereIsNoErrorMessage(); - - CompositionPage.changeComponentVersion(canvasManager, element, "3.0", true); - // click on warning message - GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.OK.getValue() + "']").get(0).click(); - GeneralUIUtils.ultimateWait(); - // validate paths hasn't changed - RestResponse ServiceForwardingPathsResponse3 = PathUtilities.getServiceForwardingPathsAPI(service.getName()); - assertNotSame( - "response message failed expectation, expectation is to change", - ServiceForwardingPathsResponse2.getResponse(), - ServiceForwardingPathsResponse3.getResponse()); - // validate there are no error messages - PathValidations.ValidateThereIsNoErrorMessage(); - } - - /////////////////////// - // post requisites // - /////////////////////// - - // finish flow - certifyServiceAsTester(service); - } - - //TODO finish -// Test#3 Jira issue - 6189 - @Test - public void ValidatePathServiceVersionsDifferentCapabilitiesInComplexService() throws Exception { - - ////////////////////// - // pre requisites // - ////////////////////// - - // start flow - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - String vsp_v2_description = "change description for version 2"; - VendorSoftwareProductObject vendorSoftwareProductObject = getToPathServiceVersions(resourceReqDetails, filePath, HSSFile, vsp_v2_description, fullCompositionFile, getUser()); - - // create service - ServiceReqDetails service = PathUtilities.createService(getUser()); - - // create path - String vspName = vendorSoftwareProductObject.getName(); - String pathName = "path1"; - List<CanvasElement> VFs = PathUtilities.linkVFs(vspName, 2); - CanvasManager canvasManager = CanvasManager.getCanvasManager(); - for (CanvasElement element : VFs) { - CompositionPage.changeComponentVersion(canvasManager, element, "1.0", false); - } - PathUtilities.openCreatePath(); - PathUtilities.insertValues(pathName, "pathProtocol1", "pathPortNumbers1"); - PathUtilities.selectFirstLineParam(); - PathValidations.extendPath(NUMBER_OF_LINKS); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue()); - - // certify Service - certifyServiceAsTester(service); - - reloginWithNewRole(UserRoleEnum.DESIGNER); - - // create new version - GeneralUIUtils.findComponentAndClick(service.getName()); - ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); - canvasManager = CanvasManager.getCanvasManager(); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.LifeCyleChangeButtons.CHECKOUT.getValue()); - - ///////////////// - // test case // - ///////////////// - - // validate version change has no effect - for (CanvasElement element : VFs) { - RestResponse ServiceForwardingPathsResponse = PathUtilities.getServiceForwardingPathsAPI(service.getName()); - // change to version with different capabilities - CompositionPage.changeComponentVersion(canvasManager, element, "3.0", false); - // click on warning message - GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.OK.getValue() + "']").get(0).click(); - GeneralUIUtils.ultimateWait(); - // validate paths changed - RestResponse ServiceForwardingPathsResponse2 = PathUtilities.getServiceForwardingPathsAPI(service.getName()); - assertNotSame( - "response message failed expectation, expectation is to change", - ServiceForwardingPathsResponse.getResponse(), - ServiceForwardingPathsResponse2.getResponse()); - // validate there are no error messages - PathValidations.ValidateThereIsNoErrorMessage(); - - CompositionPage.changeComponentVersion(canvasManager, element, "1.0", false); - GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.OK.getValue() + "']").get(0).click(); - GeneralUIUtils.ultimateWait(); - // validate paths hasn't changed - RestResponse ServiceForwardingPathsResponse3 = PathUtilities.getServiceForwardingPathsAPI(service.getName()); - assertEquals( - "response message failed expectation, expectation is not to change", - ServiceForwardingPathsResponse2.getResponse(), - ServiceForwardingPathsResponse3.getResponse()); - // validate there are no error messages - PathValidations.ValidateThereIsNoErrorMessage(); - } - - /////////////////////// - // post requisites // - /////////////////////// - - // finish flow - certifyServiceAsTester(service); - } - - @Test - public void ComplexServiceSanity() throws Exception { - // create & certify 2 VFs - List<String> vnfFiles = new ArrayList<>(); - vnfFiles.add(HSSFile); - vnfFiles.add(fullCompositionFile); - List<String> VFNames = onboardAndCertifyMultipleVFs(filePath, vnfFiles); - reloginWithNewRole(UserRoleEnum.DESIGNER); - - // create service 1 - ServiceReqDetails serviceMetadata1 = PathUtilities.createService(getUser()); - - // create path 1 - String path1 = "newPath"; - PathUtilities.createPath(path1, VFNames.get(0)); - PathUtilities.submitForTesting(); - GeneralUIUtils.ultimateWait(); - - // create service 2 - ServiceReqDetails serviceMetadata2 = PathUtilities.createService(getUser()); - - // create path 2 - String path2 = "newPath2"; - PathUtilities.createPath(path2, VFNames.get(1)); - PathUtilities.submitForTesting(); - - // tester - reloginWithNewRole(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName()); - TesterOperationPage.certifyComponent(serviceMetadata1.getName()); - GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName()); - TesterOperationPage.certifyComponent(serviceMetadata2.getName()); - - // governor - reloginWithNewRole(UserRoleEnum.GOVERNOR); - GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName()); - GovernorOperationPage.approveService(serviceMetadata1.getName()); - GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName()); - GovernorOperationPage.approveService(serviceMetadata2.getName()); - - // create service for complex service - reloginWithNewRole(UserRoleEnum.DESIGNER); - ServiceReqDetails serviceMetadata3 = PathUtilities.createService(getUser()); - - // validate complex's path - String[] services = {serviceMetadata1.getName(), serviceMetadata2.getName(), serviceMetadata3.getName()}; - PathValidations.validateComplexExtendedPath(services); - - // validate certification - certifyServiceAsTester(serviceMetadata3); - } - - //////////////////////////////////////////////////////////////////////////////////////// - // flow methods // - //////////////////////////////////////////////////////////////////////////////////////// - - // workflow leading to path - public String onboardAndCertify(ResourceReqDetails resourceReqDetails, String filePath, String vnfFile) throws Exception { - VendorSoftwareProductObject vendorSoftwareProductObject = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser()); - String vspName = vendorSoftwareProductObject.getName(); - - DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen(); - ExtentTestActions.addScreenshot(Status.INFO, "TopologyTemplate_" + vnfFile, "The topology template for " + vnfFile + " is as follows : "); - - DeploymentArtifactPage.clickSubmitForTestingButton(vspName); - SetupCDTest.getExtendTest().log(Status.INFO, "relogin as TESTER"); - reloginWithNewRole(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(vspName); - TesterOperationPage.certifyComponent(vspName); - return vspName; - } - - public List<String> onboardAndCertifyMultipleVFs(String filePath, List<String> vnfFiles) throws Exception { - List<String> VFNames = new ArrayList<>(); - for (int i = 0; i < vnfFiles.size(); i++) { - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - VendorSoftwareProductObject vendorSoftwareProductObject = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFiles.get(i), getUser()); - VFNames.add(i, vendorSoftwareProductObject.getName()); - DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen(); - ExtentTestActions.addScreenshot(Status.INFO, "TopologyTemplate_" + vnfFiles.get(i), "The topology template for " + vnfFiles.get(i) + " is as follows : "); - DeploymentArtifactPage.clickSubmitForTestingButton(VFNames.get(i)); - } - SetupCDTest.getExtendTest().log(Status.INFO, "relogin as TESTER"); - reloginWithNewRole(UserRoleEnum.TESTER); - for (String VFName : VFNames) { - GeneralUIUtils.findComponentAndClick(VFName); - TesterOperationPage.certifyComponent(VFName); - } - return VFNames; - } - - public static List<CanvasElement> createComplexPath(String service) throws Exception { - List<CanvasElement> services = PathUtilities.linkServices(service, service, NUMBER_OF_LINKS); - PathUtilities.createPathWithoutLink("name1", service); - PathUtilities.createPathWithoutLink("name2", service); - return services; - } - - public ServiceReqDetails getToComplexService(String filepath, String vnfFile) throws Exception { - // create & certify VF - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - String vspName = onboardAndCertify(resourceReqDetails, filepath, vnfFile); - reloginWithNewRole(UserRoleEnum.DESIGNER); - ServiceReqDetails serviceMetadata1 = PathUtilities.createService(getUser()); - - // create path - PathUtilities.createPath("newPath", vspName); - PathUtilities.submitForTesting(); - GeneralUIUtils.ultimateWait(); - - //tester - reloginWithNewRole(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName()); - TesterOperationPage.certifyComponent(serviceMetadata1.getName()); - - //governor - reloginWithNewRole(UserRoleEnum.GOVERNOR); - GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName()); - GovernorOperationPage.approveService(serviceMetadata1.getName()); - return serviceMetadata1; - } - - public VendorSoftwareProductObject getToPathServiceVersions(ResourceReqDetails resourceReqDetails, String filepath, String vnfFileV1, String descriptionV2, String vnfFileV3, User user) throws Exception { - - //////////////////////////////////// - // VF v1 // - //////////////////////////////////// - - VendorSoftwareProductObject vendorSoftwareProduct = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFileV1, getUser()); - String vspName = vendorSoftwareProduct.getName(); - - DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen(); - ExtentTestActions.addScreenshot(Status.INFO, "TopologyTemplate_" + vnfFileV1, "The topology template for " + vnfFileV1 + " is as follows : "); - DeploymentArtifactPage.clickSubmitForTestingButton(vspName); - SetupCDTest.getExtendTest().log(Status.INFO, "relogin as TESTER"); - reloginWithNewRole(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(vspName); - TesterOperationPage.certifyComponent(vspName); - reloginWithNewRole(UserRoleEnum.DESIGNER); - - //////////////////////////////////// - // VF v2 // - //////////////////////////////////// - - // vsp create new version - Pair<RestResponse, OnboardItemObject> newItemVersion = PathUtilities.createNewItemVersion( - vendorSoftwareProduct.getVspId(), - vendorSoftwareProduct.getComponentId(), - "version with different description", user); - assertEquals("did not succeed to create new item version", HttpStatus.SC_OK, newItemVersion.left.getErrorCode().intValue()); - vendorSoftwareProduct.setVersion(newItemVersion.right.getItemId()); - vendorSoftwareProduct.setComponentId(newItemVersion.right.getItemId()); - - // update vsp description - vendorSoftwareProduct.setDescription(descriptionV2); - RestResponse restResponse = PathUtilities.updateVendorSoftwareProduct(vendorSoftwareProduct, user); - assertEquals("did not succeed to update vsp", HttpStatus.SC_OK, restResponse.getErrorCode().intValue()); - - // commit & submit vsp - VendorSoftwareProductRestUtils.prepareVspForUse(user, vendorSoftwareProduct, false); - - // update VF - HomePage.showVspRepository(); - PathUtilities.updateVF(vspName, vendorSoftwareProduct); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.UPDATE_VF.getValue()); - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.SUBMIT_FOR_TESTING_BUTTON.getValue()).click(); - GeneralUIUtils.ultimateWait(); - - // certify VF - reloginWithNewRole(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(vspName); - TesterOperationPage.certifyComponent(vspName); - reloginWithNewRole(UserRoleEnum.DESIGNER); - - //////////////////////////////////// - // VF v3 // - //////////////////////////////////// - - // create new version - newItemVersion = PathUtilities.createNewItemVersion( - vendorSoftwareProduct.getVspId(), - vendorSoftwareProduct.getVersion(), - "version with different heat", user); - assertEquals("did not succeed to create new item version", HttpStatus.SC_OK, newItemVersion.left.getErrorCode().intValue()); - vendorSoftwareProduct.setVersion(newItemVersion.right.getItemId()); - vendorSoftwareProduct.setComponentId(newItemVersion.right.getItemId()); - - // upload new heat - RestResponse uploadHeatPackage = VendorSoftwareProductRestUtils.uploadHeatPackage(filepath, vnfFileV3, vendorSoftwareProduct, user); - assertEquals("did not succeed to upload HEAT package", HttpStatus.SC_OK, uploadHeatPackage.getErrorCode().intValue()); - - RestResponse validateUpload = VendorSoftwareProductRestUtils.validateUpload(vendorSoftwareProduct, user); - assertEquals("did not succeed to validate upload process, reason: " + validateUpload.getResponse(), HttpStatus.SC_OK, validateUpload.getErrorCode().intValue()); - - // commit & submit vsp - VendorSoftwareProductRestUtils.prepareVspForUse(user, vendorSoftwareProduct, false); - - // update VF - HomePage.showVspRepository(); - PathUtilities.updateVF(vspName, vendorSoftwareProduct); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.UPDATE_VSP.getValue()); - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.SUBMIT_FOR_TESTING_BUTTON.getValue()).click(); - GeneralUIUtils.ultimateWait(); - - // certify VF - reloginWithNewRole(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(vspName); - TesterOperationPage.certifyComponent(vspName); - reloginWithNewRole(UserRoleEnum.DESIGNER); - - return vendorSoftwareProduct; - } - - public void certifyServiceAsTester(ServiceReqDetails serviceMetaData) throws Exception { - PathUtilities.submitForTesting(); - reloginWithNewRole(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(serviceMetaData.getName()); - TesterOperationPage.certifyComponent(serviceMetaData.getName()); - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/OnboardItemObject.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/OnboardItemObject.java deleted file mode 100644 index 516cc3aea5..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/OnboardItemObject.java +++ /dev/null @@ -1,83 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.AmdocsComplexService; - - -public class OnboardItemObject extends OnboardItemObjectReqDetails { - - private String itemId; - private String name; - private String baseId; - private String status; - - public OnboardItemObject() { - super(); - } - - public OnboardItemObject(String itemId, String name, String baseId, String status) { - this.itemId = itemId; - this.name = name; - this.baseId = baseId; - this.status = status; - } - - public String getItemId() { - return itemId; - } - - public void setItemId(String itemId) { - this.itemId = itemId; - } - - public String getName() { - return name; - } - - public void setName(String itemId) { - this.name = name; - } - - public String getBaseId() { - return baseId; - } - - public void setBaseId(String baseId) { - this.baseId = baseId; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - @Override - public String toString() { - return "OnboardItemObject{" - + "itemId='" + itemId + '\'' - + ", name='" + name + '\'' - + ", baseId='" + baseId + '\'' - + ", status='" + status + '\'' - + '}'; - } -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/OnboardItemObjectReqDetails.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/OnboardItemObjectReqDetails.java deleted file mode 100644 index 181dc434ca..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/OnboardItemObjectReqDetails.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.AmdocsComplexService; - - -public class OnboardItemObjectReqDetails { - - private String creationMethod; - private String description; - - public OnboardItemObjectReqDetails() { - } - - public OnboardItemObjectReqDetails(String creationMethod, String description) { - this.creationMethod = creationMethod; - this.description = description; - } - - public String getCreationMethod() { - return creationMethod; - } - - public void setCreationMethod(String creationMethod) { - this.creationMethod = creationMethod; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - @Override - public String toString() { - return "OnboardItemObjectReqDetails{" - + "creationMethod='" + creationMethod + '\'' - + ", description='" + description + '\'' - + '}'; - } -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/PathName.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/PathName.java deleted file mode 100644 index 16c5553fbc..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/PathName.java +++ /dev/null @@ -1,136 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.AmdocsComplexService; - -import com.aventstack.extentreports.Status; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; -import org.openecomp.sdc.ci.tests.pages.TesterOperationPage; -import org.openecomp.sdc.ci.tests.utilities.FileHandling; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Optional; -import org.testng.annotations.Parameters; -import org.testng.annotations.Test; - -public class PathName extends SetupCDTest { - - protected static String filePath = FileHandling.getFilePath("ComplexService"); - private static String fullCompositionFile = "fullComposition.zip"; - private static String fullCompositionFile2 = "fullCompositionNew.zip"; - private static String HSSFile = "HSS.zip"; - private static String VMMEFile = "VMME.zip"; - private static String makeDistributionValue; - - @Parameters({"makeDistribution"}) - @BeforeMethod - public void beforeTestReadParams(@Optional("true") String makeDistributionReadValue) { - makeDistributionValue = makeDistributionReadValue; - } - - //------------------------------------------Tests----------------------------------------------------- - - // Test#8 Jira issue 6168 - @Test - public void ValidateSameNameTest() throws Exception { - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - String vspName = onboardAndCertify(resourceReqDetails, filePath, fullCompositionFile); - reloginWithNewRole(UserRoleEnum.DESIGNER); - PathUtilities.createService(getUser()); - String firstPathName = PathUtilities.createPath("Oren", vspName); - PathUtilities.createPathWithoutLink(firstPathName, vspName); - try { - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.OK.getValue()); - } catch (Exception e) { - throw new Exception("when creating another path with duplicate name, expected error did not appear"); - } - } - - // Test#9 Jira issue 6183 - @Test - public void ValidateEditName() throws Exception { - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - String vspName = onboardAndCertify(resourceReqDetails, filePath, fullCompositionFile); - reloginWithNewRole(UserRoleEnum.DESIGNER); - PathUtilities.createService(getUser()); - String firstPathName = PathUtilities.createPath("Oren", vspName); - String secondPathName = PathUtilities.createPathWithoutLink("blabla", vspName); - PathValidations.validateEditToExistingName(firstPathName, secondPathName); - } - - // Test#10 Jira issue 6411 - @Test - public void SpacesName() throws Exception { - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - String vspName = onboardAndCertify(resourceReqDetails, filePath, fullCompositionFile); - reloginWithNewRole(UserRoleEnum.DESIGNER); - PathUtilities.createService(getUser()); - PathUtilities.createPath(" ", vspName); - try { - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.OK.getValue()); - } catch (Exception e) { - throw new Exception("service path name cannot be empty or spaces "); - } - } - - // Test#11 Jira issue 6186 - @Test - public void ValidateNameWithSpaces() throws Exception { - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - String vspName = onboardAndCertify(resourceReqDetails, filePath, fullCompositionFile); - reloginWithNewRole(UserRoleEnum.DESIGNER); - PathUtilities.createService(getUser()); - PathValidations.validateNameWithSpaces("New", vspName); - } - - //////////////////////////////////////////////////////////////////////////////////////// - // flow methods // - //////////////////////////////////////////////////////////////////////////////////////// - - // workflow leading to path - public String onboardAndCertify(ResourceReqDetails resourceReqDetails, String filePath, String vnfFile) throws Exception { - VendorSoftwareProductObject vendorSoftwareProductObject = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser()); - String vspName = vendorSoftwareProductObject.getName(); - - DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen(); - ExtentTestActions.addScreenshot(Status.INFO, "TopologyTemplate_" + vnfFile, "The topology template for " + vnfFile + " is as follows : "); - - DeploymentArtifactPage.clickSubmitForTestingButton(vspName); - SetupCDTest.getExtendTest().log(Status.INFO, "relogin as TESTER"); - reloginWithNewRole(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(vspName); - TesterOperationPage.certifyComponent(vspName); - return vspName; - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } - -}
\ No newline at end of file diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/PathUrls.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/PathUrls.java deleted file mode 100644 index de1150c110..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/PathUrls.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.openecomp.sdc.ci.tests.execute.AmdocsComplexService; - -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -import org.openecomp.sdc.ci.tests.utils.Utils; - - -public interface PathUrls { - - String SDC_HTTP_METHOD = Utils.getConfigHandleException() == null ? "http" : Utils.getConfigHandleException().getSdcHttpMethod(); - String AMDOCS_HTTP_METHOD = SDC_HTTP_METHOD; - - // onboard - String CREATE_NEW_ITEM_VERSION = SDC_HTTP_METHOD + "://%s:%s/onboarding-api/v1.0/items/%s/versions/%s/"; - String UPDATE_VENDOR_SOFTWARE_PRODUCT = SDC_HTTP_METHOD + "://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/%s"; - String GET_SERVICE_PATHS = SDC_HTTP_METHOD + "://%s:%s/sdc1/feProxy/rest/v1/catalog/services/%s/filteredDataByParams?include=componentInstancesRelations&include=componentInstances&include=forwardingPaths"; - String SERVICE_PATH_LINK_MAP = SDC_HTTP_METHOD + "://%s:%s/sdc1/rest/v1/catalog/services/%s/linksMap"; - String SERVICE_FORWARDING_PATHS = SDC_HTTP_METHOD + "://%s:%s/sdc1/rest/v1/catalog/services/%s/filteredDataByParams?include=componentInstancesRelations&include=componentInstances&include=forwardingPaths"; -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/PathUtilities.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/PathUtilities.java deleted file mode 100644 index 3ee26d3f2e..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/PathUtilities.java +++ /dev/null @@ -1,439 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.AmdocsComplexService; - -import com.aventstack.extentreports.Status; -import com.clearspring.analytics.util.Pair; -import com.google.gson.Gson; -import org.apache.http.HttpStatus; -import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.config.Config; -import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; -import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; -import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; -import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.pages.CompositionPage; -import org.openecomp.sdc.ci.tests.pages.GeneralPageElements; -import org.openecomp.sdc.ci.tests.pages.HomePage; -import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils; -import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; -import org.openecomp.sdc.ci.tests.verificator.VfVerificator; -import org.openqa.selenium.WebElement; -import org.testng.Assert; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.testng.AssertJUnit.assertEquals; - - -public class PathUtilities { - - private static final int WAITING_FOR_LOADRE_TIME_OUT = 60 * 10; - private static final int NUMBER_OF_LINKS = 3; - - static void openPathList() throws Exception { - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.PATH_MENU_BUTTON.getValue()); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.PATH_LIST_BUTTON.getValue()); - } - - public static ServiceReqDetails createService(User user) throws Exception { - ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata); - ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); - GeneralUIUtils.ultimateWait(); - return serviceMetadata; - } - - public static List<CanvasElement> linkVFs(String vspName, int linksNum) throws Exception { - CompositionPage.searchForElement(vspName); - GeneralUIUtils.ultimateWait(); - CanvasManager canvasManager = CanvasManager.getCanvasManager(); - GeneralUIUtils.ultimateWait(); - List<CanvasElement> VFs = new ArrayList<CanvasElement>(); - VFs.add(canvasManager.createElementOnCanvas(vspName)); - for (int i = 1; i < linksNum; i++) { - VFs.add(canvasManager.createElementOnCanvas(vspName)); - GeneralUIUtils.ultimateWait(); -// for(int a=0; a<3; a++) -// try { -// canvasManager.linkElements(VFs.get(i), CircleSize.VF, VFs.get(i - 1), CircleSize.VF); -// break; -// } catch (Exception ignore) {} - SetupCDTest.getExtendTest().log(Status.INFO, "link VFs"); - GeneralUIUtils.ultimateWait(); - } - return VFs; - } - - public static List<CanvasElement> linkServices(String service1, String service2, int linksNum) throws Exception { - CanvasManager canvasManager = CanvasManager.getCanvasManager(); - List<CanvasElement> VFs = new ArrayList<CanvasElement>(); - - // get first service - CompositionPage.searchForElement(service1); - VFs.add(canvasManager.createElementOnCanvas(service1)); - - String service = service2; - for (int i = 1; i < linksNum; i++) { - CompositionPage.searchForElement(service); - VFs.add(canvasManager.createElementOnCanvas(service)); - GeneralUIUtils.ultimateWait(); -// for(int a=0; a<3; a++) -// try { -// canvasManager.linkElements(VFs.get(i), CircleSize.SERVICE, VFs.get(i-1), CircleSize.SERVICE); -// break; -// } catch (Exception ignore) {} - SetupCDTest.getExtendTest().log(Status.INFO, "link services"); - GeneralUIUtils.ultimateWait(); - - // change service to link - if (service.equals(service2)) { - service = service1; - } else { - service = service2; - } - } - return VFs; - } - - public static void openCreatePath() throws Exception { - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.PATH_MENU_BUTTON.getValue()); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_PATH_MENU_BUTTON.getValue()); - } - - public static void sendValue(String DataTestId, String value) throws Exception { - GeneralUIUtils.getWebElementByTestID(DataTestId).sendKeys(value); - GeneralUIUtils.ultimateWait(); - } - - public static void insertValues(String pathName, String pathProtocol, String pathPortNumbers) throws Exception { - sendValue(DataTestIdEnum.ComplexServiceAmdocs.PATH_NAME.getValue(), pathName); - sendValue(DataTestIdEnum.ComplexServiceAmdocs.PATH_PROTOCOL.getValue(), pathProtocol); - sendValue(DataTestIdEnum.ComplexServiceAmdocs.PATH_PORT_NUMBER.getValue(), pathPortNumbers); - GeneralUIUtils.ultimateWait(); - } - - public static void selectFirstLineParam() throws Exception { - GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.LINK_SOURCE.getValue() + "']//option").get(0).click(); - GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.LINK_SOURCE_CP.getValue() + "']//option").get(0).click(); - GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.LINK_TARGET.getValue() + "']//option").get(0).click(); - GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.LINK_TARGET_CP.getValue() + "']//option").get(0).click(); - } - - public static void editPathName(String pathName, String newName) throws Exception { - GeneralUIUtils.findElementsByXpath("//*[text()='" + pathName + "']/parent::*//span").get(0).click(); - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ComplexServiceAmdocs.PATH_NAME.getValue()).clear(); - sendValue(DataTestIdEnum.ComplexServiceAmdocs.PATH_NAME.getValue(), newName); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.SAVE.getValue()); - } - - public static void editPathProtocol(String pathName, String newProtocol) throws Exception { - GeneralUIUtils.findElementsByXpath("//*[text()='" + pathName + "']/parent::*//span").get(0).click(); - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ComplexServiceAmdocs.PATH_PROTOCOL.getValue()).clear(); - sendValue(DataTestIdEnum.ComplexServiceAmdocs.PATH_PROTOCOL.getValue(), newProtocol); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.SAVE.getValue()); - } - - public static int deleteLines(int numOfLinesToDelete, int numOfLines) throws Exception { - for (int i = 0; i < numOfLinesToDelete; i++) { - GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.REMOVE_LINK.getValue() + "']//span").get(0).click(); - numOfLines--; - } - if (GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.LINK_TARGET_CP + "']//option").size() > (numOfLines + 1)) { - throw new Exception("Path element was not deleted"); - } - GeneralUIUtils.ultimateWait(); - return numOfLines; - } - - public static String createPath(String pathName, String vspName) throws Exception { - linkVFs(vspName, NUMBER_OF_LINKS); - openCreatePath(); - insertValues(pathName, "pathProtocol1", "pathPortNumbers1"); - selectFirstLineParam(); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue()); - SetupCDTest.getExtendTest().log(Status.INFO, "path" + pathName + " has been created"); - return pathName; - } - - public static void deleteComponents(List<CanvasElement> elements) throws Exception { - for (CanvasElement element : elements) { - CanvasManager.getCanvasManager().clickOnCanvaElement(element); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.DELETE_COMPONENT.getValue()); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.OK.getValue()); - } - } - - public static void updateVF(String vspName, VendorSoftwareProductObject vendorSoftwareProduct) throws Exception { - boolean vspFound = HomePage.searchForVSP(vspName); - if (vspFound) { - final List<WebElement> elementsFromTable = GeneralPageElements.getElementsFromTable(); - elementsFromTable.get(1).click(); - GeneralUIUtils.waitForLoader(); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.UPDATE_VSP.getValue()); - - OnboardingUiUtils.doCheckOut(); - - //Metadata verification - VfVerificator.verifyOnboardedVnfMetadata(vspName, vendorSoftwareProduct); - - ExtentTestActions.log(Status.INFO, "Clicking create/update VNF"); - String duration = GeneralUIUtils.getActionDuration(() -> waitUntilVnfCreated()); - ExtentTestActions.log(Status.INFO, "Succeeded in importing/updating " + vspName, duration); - } else { - Assert.fail("Did not find VSP named " + vspName); - } - } - - public static void waitUntilVnfCreated() { - GeneralUIUtils.clickOnElementByTestIdWithoutWait(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue()); - GeneralUIUtils.waitForLoader(WAITING_FOR_LOADRE_TIME_OUT); - GeneralUIUtils.waitForAngular(); - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue()); - } - - public static void deleteComponent(CanvasElement element) throws Exception { - CanvasManager.getCanvasManager().clickOnCanvaElement(element); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.DELETE_COMPONENT.getValue()); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.OK.getValue()); - } - - public static void submitForTesting() { - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.SUBMIT_FOR_TESTING.getValue()); - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ComplexServiceAmdocs.CHANGE_LIFE_CYCLE_MESSAGE.getValue()).sendKeys("new service to certify"); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.OK.getValue()); - } - - public static String createPathWithoutLink(String pathName, String vspName) throws Exception { - openCreatePath(); - insertValues(pathName, "pathProtocol1", "pathPortNumbers1"); - selectFirstLineParam(); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue()); - SetupCDTest.getExtendTest().log(Status.INFO, "path" + pathName + " has been created"); - return pathName; - } - - // rest apis - private static String getServiceUUIDfromCompositionURL() throws Exception { - String url = SetupCDTest.getDriver().getCurrentUrl(); - String[] result = url.split("/"); - for (int i = 0; i < result.length; i++) { - if (result[i].equals("workspace")) { - return result[i + 1]; - } - } - throw new Exception("service uuid not found in the url"); - } - - private static Map<String, String> prepareHeadersMap(String userId) { - Map<String, String> headersMap = new HashMap<String, String>(); - headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json"); - headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json"); - headersMap.put(HttpHeaderEnum.USER_ID.getValue(), userId); - return headersMap; - } - - public static Pair<RestResponse, ServiceReqDetails> getServiceIDByNameAndVersion(String serviceName, String version) throws Exception { - User sdncUserDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); - - RestResponse restResponse = ServiceRestUtils.getServiceByNameAndVersion(sdncUserDetails, serviceName, version); - ServiceReqDetails service = new ServiceReqDetails(); - service.setName(serviceName); - service.setUniqueId(ResponseParser.getUniqueIdFromResponse(restResponse)); - service.setVersion(version); - - return new Pair<>(restResponse, service); - } - - public static RestResponse createServiceAPI(User sdncUserDetails, ServiceReqDetails serviceDetails) throws Exception { - String serviceBaseVersion = "0.1"; - RestResponse restResponse = ServiceRestUtils.createService(serviceDetails, sdncUserDetails); - assertEquals("Check API response code for CreateServiceAPI call", HttpStatus.SC_CREATED, restResponse.getErrorCode().intValue()); - return restResponse; - } - - public static RestResponse getServiceAPI(User sdncUserDetails, ServiceReqDetails serviceDetails) throws Exception { - String serviceBaseVersion = "0.1"; - // choose user - // User sdncUserDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN); - - // create serviceDetails - // ServiceReqDetails serviceDetails = ElementFactory.getDefaultService(); - - // get service - RestResponse restResponse = ServiceRestUtils.getServiceByNameAndVersion(sdncUserDetails, serviceDetails.getName(), - serviceBaseVersion); - assertEquals("Check API response code for GetServiceAPI call", HttpStatus.SC_OK, restResponse.getErrorCode().intValue()); - - Service service = ResponseParser.convertServiceResponseToJavaObject(restResponse.getResponse()); - String uniqueId = service.getUniqueId(); - serviceDetails.setUniqueId(uniqueId); - // ServiceValidationUtils.validateServiceResponseMetaData(serviceDetails, service, sdncUserDetails, (LifecycleStateEnum) null); - return restResponse; - } - - public static RestResponse getServiceForwardingPathsAPI(String serviceName) throws Exception { - User sdncUserDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN); - - // get service - Pair<RestResponse, ServiceReqDetails> servicePaths = getServiceIDByNameAndVersion(serviceName, "0.1"); - - // set url - Config config = Utils.getConfig(); - String url = String.format( - PathUrls.SERVICE_FORWARDING_PATHS, - config.getCatalogBeHost(), - config.getCatalogBePort(), - servicePaths.right.getUniqueId() - ); - String userId = sdncUserDetails.getUserId(); - - Map<String, String> headersMap = prepareHeadersMap(userId); - - HttpRequest http = new HttpRequest(); - RestResponse restResponse = http.httpSendGet(url, headersMap); - assertEquals("Check API response code for GetServiceForwardingPathsAPI call", HttpStatus.SC_OK, restResponse.getErrorCode().intValue()); - return restResponse; - } - - public static RestResponse getServicePathLinkMapAPI(String serviceName) throws Exception { - User sdncUserDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); - - // get service - Pair<RestResponse, ServiceReqDetails> servicePaths = getServiceIDByNameAndVersion(serviceName, "0.1"); - - // set url - Config config = Utils.getConfig(); - String url = String.format( - PathUrls.SERVICE_PATH_LINK_MAP, - config.getCatalogBeHost(), - config.getCatalogBePort(), - servicePaths.right.getUniqueId() - ); - - String userId = sdncUserDetails.getUserId(); - - Map<String, String> headersMap = prepareHeadersMap(userId); - - HttpRequest http = new HttpRequest(); - RestResponse restResponse = http.httpSendGet(url, headersMap); - assertEquals("Check API response code for GetServiceForwardingPathsAPI call", HttpStatus.SC_OK, restResponse.getErrorCode().intValue()); - return restResponse; - } - - public static Pair<RestResponse, ServiceReqDetails> getServicePathsAPI(String serviceName) throws Exception { - User sdncUserDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); - // get service - Pair<RestResponse, ServiceReqDetails> servicePaths = getServiceIDByNameAndVersion(serviceName, "0.1"); - - // set url - Config config = Utils.getConfig(); - String url = String.format( - PathUrls.GET_SERVICE_PATHS, - config.getCatalogFeHost(), - config.getCatalogFePort(), - servicePaths.right.getUniqueId()); - - String userId = sdncUserDetails.getUserId(); - - Map<String, String> headersMap = prepareHeadersMap(userId); - - HttpRequest http = new HttpRequest(); - RestResponse restResponse = http.httpSendGet(url, headersMap); - assertEquals("Check API response code for GetServiceForwardingPathsAPI call", HttpStatus.SC_OK, restResponse.getErrorCode().intValue()); - return new Pair<>(restResponse, servicePaths.right); - } - - public static Pair<RestResponse, OnboardItemObject> createNewItemVersion(String itemId, String itemVersion, String description, User user) throws Exception { - Config config = Utils.getConfig(); - String url = String.format( - PathUrls.CREATE_NEW_ITEM_VERSION, - config.getCatalogBeHost(), - config.getCatalogBePort(), - itemId, itemVersion); - String userId = user.getUserId(); - OnboardItemObject onboardItemObject = new OnboardItemObject(); - - onboardItemObject.setCreationMethod("major"); - onboardItemObject.setDescription(description); - - Map<String, String> headersMap = prepareHeadersMap(userId); - HttpRequest http = new HttpRequest(); - Gson gson = new Gson(); - String body = gson.toJson(onboardItemObject); - - RestResponse response = http.httpSendPost(url, body, headersMap); - - onboardItemObject.setItemId(ResponseParser.getValueFromJsonResponse(response.getResponse(), "id")); - onboardItemObject.setName(ResponseParser.getValueFromJsonResponse(response.getResponse(), "name")); - onboardItemObject.setBaseId(ResponseParser.getValueFromJsonResponse(response.getResponse(), "baseId")); - onboardItemObject.setStatus(ResponseParser.getValueFromJsonResponse(response.getResponse(), "status")); - - return new Pair<>(response, onboardItemObject); - } - - public static RestResponse updateVendorSoftwareProduct(VendorSoftwareProductObject vendorSoftwareProductObject, User user) throws Exception { - Config config = Utils.getConfig(); - String url = String.format( - PathUrls.UPDATE_VENDOR_SOFTWARE_PRODUCT, - config.getCatalogBeHost(), - config.getCatalogBePort(), - vendorSoftwareProductObject.getVspId(), - vendorSoftwareProductObject.getComponentId()); - String userId = user.getUserId(); - VendorSoftwareProductObject updateVendorSoftwareProductObject = new VendorSoftwareProductObject(); - - updateVendorSoftwareProductObject.setName(vendorSoftwareProductObject.getName()); - updateVendorSoftwareProductObject.setDescription(vendorSoftwareProductObject.getDescription()); - updateVendorSoftwareProductObject.setCategory(vendorSoftwareProductObject.getCategory()); - updateVendorSoftwareProductObject.setSubCategory(vendorSoftwareProductObject.getSubCategory()); - updateVendorSoftwareProductObject.setVendorName(vendorSoftwareProductObject.getVendorName()); - updateVendorSoftwareProductObject.setVendorId(vendorSoftwareProductObject.getVendorId()); - updateVendorSoftwareProductObject.setIcon(vendorSoftwareProductObject.getIcon()); - updateVendorSoftwareProductObject.setLicensingData(vendorSoftwareProductObject.getLicensingData()); - updateVendorSoftwareProductObject.setLicensingVersion(vendorSoftwareProductObject.getLicensingVersion()); - - Map<String, String> headersMap = prepareHeadersMap(userId); - HttpRequest http = new HttpRequest(); - Gson gson = new Gson(); - String body = gson.toJson(updateVendorSoftwareProductObject); - - return http.httpSendPut(url, body, headersMap); - } - -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/PathValidations.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/PathValidations.java deleted file mode 100644 index 5396d75dae..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/PathValidations.java +++ /dev/null @@ -1,362 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.AmdocsComplexService; - -import com.aventstack.extentreports.Status; -import com.clearspring.analytics.util.Pair; -import org.apache.commons.lang.RandomStringUtils; -import org.json.JSONObject; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; -import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; -import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar; -import org.openecomp.sdc.ci.tests.execute.setup.ArtifactsCorrelationManager; -import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; -import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; -import org.openecomp.sdc.ci.tests.utilities.DownloadManager; -import org.openecomp.sdc.ci.tests.utilities.FileHandling; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils; -import org.openqa.selenium.WebElement; - -import java.io.File; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.stream.Collectors; - -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertNotSame; - - -public class PathValidations { - - - public static final int NUMBER_OF_LINKS = 5; - public static final int NUMBER_OF_LINES = 3; - public static final int NUMBER_OF_LINES_TO_DELETE = 1; - - public static String[] validateServiceExtendedPath(String vspName) throws Exception { - PathUtilities.linkVFs(vspName, NUMBER_OF_LINKS); - PathUtilities.openCreatePath(); - String pathName = "name1"; - PathUtilities.insertValues(pathName, "pathProtocol1", "pathPortNumbers1"); - PathUtilities.selectFirstLineParam(); - PathValidations.extendPath(NUMBER_OF_LINES); - //delete line - PathUtilities.deleteLines(NUMBER_OF_LINES_TO_DELETE, NUMBER_OF_LINES); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue()); - ExtentTestActions.log(Status.INFO, "path has been created"); - PathValidations.checkPathFilter(pathName, true); - GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.PATH_MENU_BUTTON.getValue() + "']/parent::*").get(0).click(); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.PATH_LIST_BUTTON.getValue()); - String PathListName1 = GeneralUIUtils.findByText(pathName).getText(); - // edit path - String newPathName = "name2"; - PathUtilities.editPathName(pathName, newPathName); - - GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.PATH_MENU_BUTTON.getValue() + "']/parent::*").get(0).click(); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.PATH_LIST_BUTTON.getValue()); - String PathListName2 = GeneralUIUtils.findByText(newPathName).getText(); - - // assert names changed - assertNotSame("path name expected to change after edit but did not", PathListName1, PathListName2); - - // delete path - int paths_before_deletion = GeneralUIUtils.findElementsByXpath("//*[text()='" + newPathName + "']/parent::*//span").size(); - GeneralUIUtils.findElementsByXpath(newPathName).get(1).click(); - GeneralUIUtils.ultimateWait(); - int paths_after_deletion = GeneralUIUtils.findElementsByXpath("//*[text()='" + newPathName + "']/parent::*//span").size(); - assertNotSame("path expected to be deleted but did not", paths_after_deletion, paths_before_deletion); - - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesAssignmentScreen.INPUT_DELETE_DIALOG_CLOSE.getValue()); - SetupCDTest.getExtendTest().log(Status.INFO, "Path has been created"); - // check that path got deleted in the path filter list - PathValidations.checkPathFilter(newPathName, false); - return new String[]{pathName, newPathName}; - } - - public static String[] validateComplexExtendedPath(String[] services) throws Exception { - PathUtilities.linkServices(services[0], services[1], NUMBER_OF_LINKS); - PathUtilities.openCreatePath(); - String pathName = "name1"; - PathUtilities.insertValues(pathName, "pathProtocol1", "pathPortNumbers"); - PathUtilities.selectFirstLineParam(); - PathValidations.extendPath(NUMBER_OF_LINES); - //delete line - PathUtilities.deleteLines(NUMBER_OF_LINES_TO_DELETE, NUMBER_OF_LINES); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue()); - ExtentTestActions.log(Status.INFO, "path has been created"); - PathUtilities.openPathList(); - String PathListName1 = GeneralUIUtils.findByText(pathName).getText(); - String newPathName = "name2"; - PathUtilities.editPathName(pathName, newPathName); - GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.PATH_MENU_BUTTON.getValue() + "']/parent::*").get(0).click(); - GeneralUIUtils.ultimateWait(); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.PATH_LIST_BUTTON.getValue()); - String PathListName2 = GeneralUIUtils.findByText(newPathName).getText(); - - // assert names changed - assertNotSame("path name expected to change after edit but did not", PathListName1, PathListName2); - - // delete path - int paths_before_deletion = GeneralUIUtils.findElementsByXpath("//*[text()='" + newPathName + "']/parent::*//span").size(); - GeneralUIUtils.findElementsByXpath("//*[text()='" + newPathName + "']/parent::*//span").get(1).click(); - GeneralUIUtils.ultimateWait(); - - int paths_after_deletion = GeneralUIUtils.findElementsByXpath("//*[text()='" + newPathName + "']/parent::*//span").size(); - assertNotSame("path expected to be deleted but did not", paths_after_deletion, paths_before_deletion); - - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesAssignmentScreen.INPUT_DELETE_DIALOG_CLOSE.getValue()); - PathValidations.validateServicePath(services[2], pathName); - PathValidations.validateServicePath(services[2], newPathName); - SetupCDTest.getExtendTest().log(Status.INFO, "Paths have been validated"); - return new String[]{pathName, newPathName}; - } - - public static void createPathNumOfRows(int numOfPathRows) throws Exception { - final int numberOfRandomCharacters = 8; - PathUtilities.openCreatePath(); - PathUtilities.insertValues("extended" + RandomStringUtils.randomAlphanumeric(numberOfRandomCharacters), "pathProtocol1", "pathPortNumbers1"); - PathUtilities.selectFirstLineParam(); - extendPath(numOfPathRows); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue()); - SetupCDTest.getExtendTest().log(Status.INFO, "Path with " + numOfPathRows + " rows has been created"); - } - - public static void extendPath(int numOfLines) throws Exception { - for (int i = 0; i < numOfLines; i++) { - String check; - String index = Integer.toString(i + 2); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.EXTEND_BUTTON.getValue()); - - List<WebElement> linkSrcs = GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.LINK_SOURCE.getValue() + "']//select"); - List<WebElement> linkSrcCPs = GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.LINK_SOURCE_CP.getValue() + "']//select"); - List<WebElement> linkTargets = GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.LINK_TARGET.getValue() + "']//select"); - List<WebElement> linkTargetCPs = GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.LINK_TARGET_CP.getValue() + "']//select"); - for (int j = 0; j < i + 2; j++) { - validateExtendedPathDisabledButtons(linkSrcs, j, "Source should be disabled. open bug to UI team"); - check = linkSrcCPs.get(j).getAttribute("class"); - validateElementDisabledAttribute(check, "Source connection point"); - } - for (int j = 0; j < i + 1; j++) { - check = linkTargets.get(j).getAttribute("class"); - validateElementDisabledAttribute(check, "Target"); - check = linkTargetCPs.get(j).getAttribute("class"); - validateElementDisabledAttribute(check, "Target connection point"); - } - List<WebElement> choices = GeneralUIUtils.findElementsByXpath("//*[" + index + "]/*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.LINK_TARGET.getValue() + "']//option"); - choices.get((new Random()).nextInt(choices.size())).click(); - choices = GeneralUIUtils.findElementsByXpath("//*[" + index + "]/*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.LINK_TARGET_CP.getValue() + "']//option"); - choices.get((new Random()).nextInt(choices.size())).click(); - } - } - - public static void validateElementDisabledAttribute(String check, String param) throws Exception { - assertEquals(param + " of last lines should be disabled", check.contains("disabled"), true); - } - - public static void validateExtendedPathDisabledButtons(List<WebElement> linkSrcs, int i, String errMsg) throws Exception { - String check = linkSrcs.get(i).getAttribute("class"); - assertEquals(errMsg, check.contains("disabled"), true); - } - - public static void validatePathListIsEmpty() throws Exception { - PathUtilities.openPathList(); - try { - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.PATH_LIST_DELETE.getValue()); - } catch (Exception e) { - SetupCDTest.getExtendTest().log(Status.INFO, "path list is empty"); - } - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CLOSE.getValue()); - } - - public static void AssertNameChangeFromPathList(String pathListName1, String pathListName2) throws Exception { - assertNotSame("path name is expected to change after edit", pathListName1, pathListName2); - } - - public static void ValidateAndDeletePathFromPathList(String pathName) throws Exception { - // count paths - List<WebElement> path_list_name = GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.ComplexServiceAmdocs.PATH_LIST_NAME.getValue()); - // delete paths - List<WebElement> path_delete = GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.ComplexServiceAmdocs.PATH_LIST_DELETE.getValue()); - int paths_before_deletion = 0; - for (int i = 0; i < path_list_name.size(); i++) { - if (path_list_name.get(i).getText().equals(pathName)) { - paths_before_deletion++; - path_delete.get(i).click(); - } - } - int paths_after_deletion = 0; - List<WebElement> path_list_name2; - try { - path_list_name2 = GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.ComplexServiceAmdocs.PATH_LIST_NAME.getValue()); - for (WebElement path_list_element : path_list_name2) { - if (path_list_element.getText().equals(pathName)) { - paths_after_deletion++; - } - } - } catch (Exception ignore) { - } - // assert deletion - assertNotSame("path is expected to be deleted", paths_after_deletion, paths_before_deletion); - } - - public static void checkPathFilter(String pathName, boolean isFound) throws Exception { - List<WebElement> pathFilterList = GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.SERVICE_PATH_SELECTOR.getValue() + "']//option"); - GeneralUIUtils.ultimateWait(); - if (isFound) { - for (int i = 0; i < pathFilterList.size(); i++) { - String element_text = pathFilterList.get(i).getText(); - if (element_text.equals(pathName)) { - break; - } - assertNotSame("path filter list is missing a path", i, pathFilterList.size() - 1); - } - } else { - for (WebElement aPathFilterList : pathFilterList) { - String element_text = aPathFilterList.getText(); - assertNotSame("path filter list is has a path that should be deleted", element_text, pathName); - } - } - SetupCDTest.getExtendTest().log(Status.INFO, "path list filter check passed"); - } - - public static void AssertCreatePath() throws Exception { - String check = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue()).getAttribute("disabled"); - assertEquals("create button path should be disabled", check, "true"); - } - - public static void AssertCreatedPathExistInCompositionPage(String pathName) throws Exception { - checkPathFilter(pathName, true); - PathUtilities.openPathList(); - - // assert path is in the list - GeneralUIUtils.findByText(pathName).getText(); - GeneralUIUtils.ultimateWait(); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesAssignmentScreen.INPUT_DELETE_DIALOG_CLOSE.getValue()); -// GeneralUIUtils.ultimateWait(); - SetupCDTest.getExtendTest().log(Status.INFO, "Path is in the path list"); -// GeneralUIUtils.ultimateWait(); - } - - public static void AssertExtendPath() throws Exception { - String check = GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.ComplexServiceAmdocs.EXTEND_BUTTON.getValue()).get(0).getAttribute("class"); - assertEquals("Extend button should be disabled", check, "disabled"); - } - - public static Pair<RestResponse, ServiceReqDetails> validateServicePath(String serviceName, String name) throws Exception { - Pair<RestResponse, ServiceReqDetails> servicePaths = PathUtilities.getServicePathsAPI(serviceName); - String response = servicePaths.left.getResponse(); - - JSONObject jsonResponse = new JSONObject(response); - JSONObject forwardingPaths = jsonResponse.getJSONObject("forwardingPaths"); - Boolean validation_complete = Boolean.FALSE; - for (Object key : forwardingPaths.keySet()) { - String keyStr = (String) key; - JSONObject forwardingPath = forwardingPaths.getJSONObject(keyStr); - if (forwardingPath.getString("name").equals(name)) { - JSONObject pathElements = forwardingPath.getJSONObject("pathElements"); - Boolean empty = pathElements.getBoolean("empty"); - assertEquals("assert pathElements are not empty", empty, Boolean.FALSE); - validation_complete = Boolean.TRUE; - break; - } - } - assertEquals("validation success", validation_complete, Boolean.TRUE); - return servicePaths; - } - - public static void ValidateThereIsNoErrorMessage() throws Exception { - try { - GeneralUIUtils.findElementsByXpath("//*[@data-tests-id='" + DataTestIdEnum.ComplexServiceAmdocs.OK.getValue() + "']"); - throw new Exception("element should not be found"); - } catch (Exception e) { - if (e.getMessage().equals("element should not be found")) { - throw e; - } - } - } - - public static void validateEditToExistingName(String firstPathName, String secondPathName) throws Exception { - PathUtilities.openPathList(); - PathUtilities.editPathName(secondPathName, firstPathName); - try { - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.OK.getValue()); - } catch (Exception e) { - throw new Exception("when creating another path with duplicate name, expected error did not appear"); - } - PathUtilities.openPathList(); - PathUtilities.editPathName(secondPathName, firstPathName + " "); - try { - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.OK.getValue()); - } catch (Exception e) { - throw new Exception("space in beggining or end does not count. when creating another path with duplicate name, expected error did not appear"); - } - PathUtilities.openPathList(); - PathUtilities.editPathName(secondPathName, " " + firstPathName); - try { - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.OK.getValue()); - } catch (Exception e) { - throw new Exception("space in beggining or end does not count. when creating another path with duplicate name, expected error did not appear"); - } - PathUtilities.openPathList(); - PathUtilities.editPathProtocol(secondPathName, "pathProtocol2"); - } - - public static void validateNameWithSpaces(String pathName, String vspName) throws Exception { - PathUtilities.createPath(pathName + " ", vspName); - PathUtilities.openPathList(); - PathUtilities.editPathName(pathName, "newName"); - PathUtilities.createPathWithoutLink(" " + pathName, vspName); - PathUtilities.openPathList(); - PathUtilities.editPathName(pathName, "newName2"); - } - - public static void importAndVerifyVSP(VendorSoftwareProductObject createVendorSoftwareProduct, String filepath, String vnfFile) throws Exception { - DownloadManager.downloadCsarByNameFromVSPRepository(createVendorSoftwareProduct.getName(), createVendorSoftwareProduct.getVspId()); - File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir(); - - OnboardingUiUtils.importVSP(createVendorSoftwareProduct); - - ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); - - // Verify deployment artifacts - Map<String, Object> combinedMap = ArtifactFromCsar.combineHeatArtifacstWithFolderArtifacsToMap(latestFilefromDir.getAbsolutePath()); - - LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get("Deployment")); - ArtifactsCorrelationManager.addVNFartifactDetails(vnfFile, deploymentArtifacts); - - List<String> heatEnvFilesFromCSAR = deploymentArtifacts.stream().filter(e -> e.getType().equals("HEAT_ENV")). - map(e -> e.getFileName()). - collect(Collectors.toList()); - - OnboardingUiUtils.validateDeploymentArtifactsVersion(deploymentArtifacts, heatEnvFilesFromCSAR); - - DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile); - } - -} |