2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.ci.tests.execute.AmdocsComplexService;
23 import static org.testng.AssertJUnit.assertNotNull;
24 import static org.testng.AssertJUnit.assertTrue;
26 import java.awt.AWTException;
27 import java.io.Console;
29 import java.io.IOException;
30 import java.util.ArrayList;
31 import java.util.Arrays;
32 import java.util.Collections;
33 import java.util.HashMap;
34 import java.util.List;
36 import java.util.stream.Collectors;
37 import java.util.Random;
38 import com.mongodb.util.JSON;
39 import org.apache.commons.lang.RandomStringUtils;
40 import org.json.JSONObject;
41 import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders;
42 import org.openecomp.sdc.ci.tests.datatypes.*;
43 import org.openecomp.sdc.ci.tests.datatypes.enums.CircleSize;
44 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
45 import org.openecomp.sdc.ci.tests.execute.sanity.Service;
46 import org.openecomp.sdc.ci.tests.execute.setup.ArtifactsCorrelationManager;
47 import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
48 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
49 import org.openecomp.sdc.ci.tests.pages.CompositionPage;
50 import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
51 import org.openecomp.sdc.ci.tests.pages.GovernorOperationPage;
52 import org.openecomp.sdc.ci.tests.pages.HomePage;
53 import org.openecomp.sdc.ci.tests.pages.OpsOperationPage;
54 import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
55 import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
56 import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
57 import org.openecomp.sdc.ci.tests.utilities.FileHandling;
58 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
59 import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
60 import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
61 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
62 import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
63 import org.openqa.selenium.By;
64 import org.openqa.selenium.WebElement;
65 import org.stringtemplate.v4.ST;
66 import org.testng.Assert;
67 import org.testng.AssertJUnit;
68 import org.testng.annotations.BeforeMethod;
69 import org.testng.annotations.DataProvider;
70 import org.testng.annotations.Optional;
71 import org.testng.annotations.Parameters;
72 import org.testng.annotations.Test;
74 import com.aventstack.extentreports.Status;
75 import com.clearspring.analytics.util.Pair;
77 public class CreatePath extends SetupCDTest {
79 protected static String filepath = FileHandling.getVnfRepositoryPath();
80 protected String makeDistributionValue;
82 @Parameters({"makeDistribution"})
84 public void beforeTestReadParams(@Optional("true") String makeDistributionReadValue) {
85 makeDistributionValue = makeDistributionReadValue;
88 //------------------------------------------Tests-----------------------------------------------------
93 public void AssertPathButtons() throws Exception, Throwable {
94 filepath = "C:\\Users\\ShiraShe\\Desktop";
95 String vnfFile = "fullComposition.zip";
96 String vspName = getToPathFlow(filepath, vnfFile);
97 reloginWithNewRole(UserRoleEnum.DESIGNER);
98 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
99 ServiceUIUtils.createService(serviceMetadata, getUser());
100 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
104 //SetupCDTest.getExtendTest().log(Status.INFO, String.format("disables buttons are OK"));
109 public void CreatePathTestSanity() throws Exception, Throwable {
110 filepath = "C:\\Users\\ShiraShe\\Desktop";
111 // List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList();
112 //String vnfFile = fileNamesFromFolder.get(0).toString();
113 String vnfFile = "fullComposition.zip";
114 String vspName = getToPathFlow(filepath, vnfFile);
120 public void CreatePathCheckIO() throws Exception, Throwable {
121 filepath = "C:\\Users\\ShiraShe\\Desktop";
122 // List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList();
123 //String vnfFile = fileNamesFromFolder.get(0).toString();
124 String vnfFile = "fullComposition.zip";
127 String vspName = onboardAndCertify(filepath, vnfFile);
128 reloginWithNewRole(UserRoleEnum.DESIGNER);
131 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
132 ServiceUIUtils.createService(serviceMetadata, getUser());
133 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
136 String pathName = createPath(vspName);
139 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.LifeCyleChangeButtons.CHECK_IN.getValue());
140 GeneralUIUtils.getWebElementByTestID("checkindialog").sendKeys("check in automated confirmation message");
141 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
142 GeneralUIUtils.ultimateWait();
144 // go to service composition
145 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue()).sendKeys(serviceMetadata.getName());
146 getDriver().findElements(By.xpath("//*[@data-tests-id='dashboard-Elements']//*[@data-tests-id='" + serviceMetadata.getName() + "']")).get(0).click();
147 GeneralUIUtils.ultimateWait();
148 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
150 AssertCreatedPathExistInCompositionPage(pathName);
153 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.LifeCyleChangeButtons.CHECKOUT.getValue());
154 GeneralUIUtils.ultimateWait();
156 AssertCreatedPathExistInCompositionPage(pathName);
162 public void CreateMultiplePaths() throws Exception, Throwable {
163 filepath = "C:\\Users\\ShiraShe\\Desktop";
164 // List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList();
165 //String vnfFile = fileNamesFromFolder.get(0).toString();
166 String vnfFile = "fullComposition.zip";
167 String vspName = getToPathFlow(filepath, vnfFile);
170 createPathNumOfRows(7);
171 createPathNumOfRows(6);
172 createPathNumOfRows(4);
173 SetupCDTest.getExtendTest().log(Status.INFO, String.format("multiple paths have been created"));
178 public void CreatePathWithComplex() throws Exception, Throwable {
179 List<String> vnfFiles = new ArrayList<>();
180 vnfFiles.add("fullComposition.zip");
181 vnfFiles.add("fullCompositionNew.zip");
182 filepath = "C:\\Users\\ShiraShe\\Desktop";
183 CreatePathComplexServiceFlow(filepath, vnfFiles);
184 //String vnfFile = "fullComposition.zip";
185 // String vnfFile2 = "fullCompositionNew.zip";
186 // runCreatePathComplexServiceFlow(filepath, vnfFile, vnfFile2);
187 SetupCDTest.getExtendTest().log(Status.INFO, String.format("path with complex service has been created"));
192 public void RealScenarioComplex() throws Exception, Throwable {
193 filepath = "C:\\Users\\ShiraShe\\Desktop\\Srini";
194 List<String> vnfFiles = new ArrayList<>();
195 vnfFiles.add("HSS.zip");
196 vnfFiles.add("VMME.zip");
197 CreatePathComplexServiceFlow(filepath, vnfFiles);
198 ExtentTestActions.addScreenshot(Status.INFO, "Complex service_" + vnfFiles.get(0) ,"Complex service created " + vnfFiles.get(1) + " is as follows : ");
199 SetupCDTest.getExtendTest().log(Status.INFO, String.format("path with complex service has been created"));
204 public void CreateExtendedPathWithComplex() throws Exception, Throwable {
205 filepath = "C:\\Users\\ShiraShe\\Desktop";
206 List<String> vnfFiles = new ArrayList<>();
207 vnfFiles.add("fullComposition.zip");
208 vnfFiles.add("fullCompositionNew.zip");
209 //String vnfFile = "fullComposition.zip";
210 //String vnfFile2 = "fullCompositionNew.zip";
211 String[] services = ToComplexService(filepath, vnfFiles);
212 createComplexExtendedPath(services[0], services[1]);
213 ExtentTestActions.addScreenshot(Status.INFO, "Complex service_" + services[0] ,"Complex service created " + services[1] + " is as follows : ");
219 public void CreatePathExtendedTest() throws Exception, Throwable {
220 filepath = "C:\\Users\\ShiraShe\\Desktop";
221 // List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList();
222 //String vnfFile = fileNamesFromFolder.get(0).toString();
223 String vnfFile = "fullComposition.zip";
224 runCreateExtendedPathFlow(filepath, vnfFile);
228 public ServiceReqDetails createService() throws Exception, AWTException {
229 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
230 ServiceUIUtils.createService(serviceMetadata, getUser());
231 return serviceMetadata;
234 // workflow leading to path
235 public String onboardAndCertify(String filepath, String vnfFile) throws Exception, IOException {
237 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
238 Pair<String, VendorSoftwareProductObject> onboardAndValidate = OnboardingUiUtils.onboardAndValidate(resourceReqDetails,filepath, vnfFile, getUser());
239 String vspName = onboardAndValidate.left;
241 DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen();
242 ExtentTestActions.addScreenshot(Status.INFO, "TopologyTemplate_" + vnfFile ,"The topology template for " + vnfFile + " is as follows : ");
244 DeploymentArtifactPage.clickSubmitForTestingButton(vspName);
245 SetupCDTest.getExtendTest().log(Status.INFO, String.format("relogin as TESTER"));
246 reloginWithNewRole(UserRoleEnum.TESTER);
247 GeneralUIUtils.findComponentAndClick(vspName);
248 TesterOperationPage.certifyComponent(vspName);
252 public List<String> onboardAndCertifyMultipleVFs(String filepath, List<String> vnfFiles) throws Exception, IOException {
254 List<String> VFNames = new ArrayList<>();
255 for(int i = 0; i<vnfFiles.size(); i++)
257 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
258 Pair<String, VendorSoftwareProductObject> onboardAndValidate = OnboardingUiUtils.onboardAndValidate(resourceReqDetails,filepath, vnfFiles.get(i), getUser());
259 VFNames.add(i, onboardAndValidate.left);
260 DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen();
261 ExtentTestActions.addScreenshot(Status.INFO, "TopologyTemplate_" + vnfFiles.get(i) ,"The topology template for " + vnfFiles.get(i) + " is as follows : ");
262 DeploymentArtifactPage.clickSubmitForTestingButton(VFNames.get(i));
264 SetupCDTest.getExtendTest().log(Status.INFO, String.format("relogin as TESTER"));
265 reloginWithNewRole(UserRoleEnum.TESTER);
266 for (int j = 0; j< VFNames.size(); j++)
268 GeneralUIUtils.findComponentAndClick(VFNames.get(j));
269 TesterOperationPage.certifyComponent(VFNames.get(j));
277 public void AssertCreatePath() throws Exception, IOException {
278 String check = getDriver().findElements(By.xpath("//*[@data-tests-id='Create']")).get(0).getAttribute("disabled");
279 if (check.intern() != "true")
281 throw new Exception("Button create path should be disabled. open bug to UI team");
285 public void AssertCreatedPathExistInCompositionPage(String pathName) throws Exception, IOException {
286 // check path in the list filter
287 checkPathFilter(pathName, true);
291 // assert path is in the list
292 String PathListName1 = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']")).get(0).getText();
293 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesAssignmentScreen.INPUT_DELETE_DIALOG_CLOSE.getValue());
296 public void AssertExtendPath() throws Exception, IOException {
297 String check = getDriver().findElements(By.xpath("//*[@data-tests-id='extendPathlnk']")).get(0).getAttribute("class");
298 if (check.intern() != "disabled")
300 throw new Exception("Button extend path should be disabled. open bug to UI team");
304 public void createPathNumOfRows(int numOfPathRows)throws Exception, AWTException{
306 insertValues("extended" + RandomStringUtils.randomAlphanumeric(8),"pathProtocol1", "pathPortNumbers1");
307 selectFirstLineParam();
308 extendPath(numOfPathRows);
309 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue());
312 public void linkVFs(String vspName, int linksNum)throws Exception, AWTException {
314 CompositionPage.searchForElement(vspName);
315 CanvasManager canvasManager = CanvasManager.getCanvasManager();
316 List <CanvasElement> VFs = new ArrayList<CanvasElement>();
318 VFs.add(canvasManager.createElementOnCanvas(vspName));
320 for (int i = 1; i<linksNum; i++)
322 VFs.add(canvasManager.createElementOnCanvas(vspName));
323 GeneralUIUtils.ultimateWait();
324 canvasManager.linkElements(VFs.get(i), CircleSize.VF, VFs.get(i-1), CircleSize.VF);
325 SetupCDTest.getExtendTest().log(Status.INFO, String.format("link VFs"));
326 GeneralUIUtils.ultimateWait();
330 public void linkServices(String Service1, String Service2, int linksNum)throws Exception, AWTException {
332 CanvasManager canvasManager = CanvasManager.getCanvasManager();
333 List <CanvasElement> VFs = new ArrayList<CanvasElement>();
336 CompositionPage.searchForElement(Service1);
337 VFs.add(canvasManager.createElementOnCanvas(Service1));
339 String service = Service2;
340 for (int i = 1; i<linksNum; i++)
342 CompositionPage.searchForElement(service);
343 VFs.add(canvasManager.createElementOnCanvas(service));
344 GeneralUIUtils.ultimateWait();
345 canvasManager.linkElements(VFs.get(i), CircleSize.SERVICE, VFs.get(i-1), CircleSize.SERVICE);
346 SetupCDTest.getExtendTest().log(Status.INFO, String.format("link services"));
347 GeneralUIUtils.ultimateWait();
349 // change service to link
350 if (service.equals(Service2)) {
359 public void openCreatePath() throws Exception, AWTException{
361 getDriver().findElements(By.xpath("//*[@data-tests-id='pathsMenuBtn']/parent::*")).get(0).click();
362 GeneralUIUtils.ultimateWait();
363 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_PATH_MENU_BUTTON.getValue());
366 public void openPathList() throws Exception, AWTException {
367 getDriver().findElements(By.xpath("//*[@data-tests-id='pathsMenuBtn']/parent::*")).get(0).click();
368 GeneralUIUtils.ultimateWait();
369 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.PATH_LIST_BUTTON.getValue());
372 public void sendValue(String DataTestId, String value) throws Exception, AWTException {
374 GeneralUIUtils.getWebElementByTestID(DataTestId).sendKeys(value);
375 GeneralUIUtils.ultimateWait();
378 public void insertValues(String pathName, String pathProtocol, String pathPortNumbers) throws Exception, AWTException {
380 sendValue(DataTestIdEnum.ComplexServiceAmdocs.PATH_NAME.getValue(),pathName);
381 sendValue(DataTestIdEnum.ComplexServiceAmdocs.PATH_PROTOCOL.getValue(),pathProtocol);
382 sendValue(DataTestIdEnum.ComplexServiceAmdocs.PATH_PORT_NUMBER.getValue(),pathPortNumbers);
385 public void selectFirstLineParam() throws Exception, AWTException{
386 getDriver().findElements(By.xpath("//*[@data-tests-id='linkSrc']//option")).get(0).click();
387 GeneralUIUtils.ultimateWait();
388 getDriver().findElements(By.xpath("//*[@data-tests-id='linkSrcCP']//option")).get(0).click();
389 GeneralUIUtils.ultimateWait();
390 getDriver().findElements(By.xpath("//*[@data-tests-id='linkTarget']//option")).get(0).click();
391 GeneralUIUtils.ultimateWait();
392 getDriver().findElements(By.xpath("//*[@data-tests-id='linkTargetCP']//option")).get(0).click();
393 GeneralUIUtils.ultimateWait();
396 public void checkPathFilter(String pathName, boolean isFound) throws Exception, AWTException{
397 GeneralUIUtils.ultimateWait();
398 List<WebElement> pathFilterList = getDriver().findElements(By.xpath("//*[@data-tests-id='service-path-selector']//option"));
400 for (int i = 0; i < pathFilterList.size(); i++) {
401 String element_text = pathFilterList.get(i).getText();
402 if (element_text.equals(pathName))
406 if (i == pathFilterList.size() -1 )
408 SetupCDTest.getExtendTest().log(Status.INFO, String.format("path list filter check failed"));
409 throw new Exception("path filter list is missing a path");
414 for (int i = 0; i < pathFilterList.size(); i++) {
415 String element_text = pathFilterList.get(i).getText();
416 if (element_text.equals(pathName))
418 SetupCDTest.getExtendTest().log(Status.INFO, String.format("path list filter check failed"));
419 throw new Exception("path filter list is has a path that should be deleted");
423 SetupCDTest.getExtendTest().log(Status.INFO, String.format("path list filter check passed"));
426 public void extendPath(int numOfLines) throws Exception, AWTException {
429 for (i = 0; i < numOfLines; i++) {
431 String index = Integer.toString(i + 2);
432 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.EXTEND_BUTTON.getValue());
433 List<WebElement> linkSrcs = getDriver().findElements(By.xpath("//*[@data-tests-id='linkSrc']//select"));
434 List<WebElement> linkSrcCPs = getDriver().findElements(By.xpath("//*[@data-tests-id='linkSrcCP']//select"));
435 List<WebElement> linkTargets = getDriver().findElements(By.xpath("//*[@data-tests-id='linkTarget']//select"));
436 List<WebElement> linkTargetCPs = getDriver().findElements(By.xpath("//*[@data-tests-id='linkTargetCP']//select"));
438 for (int j = 0; j < i + 2; j++) {
439 check = linkSrcs.get(j).getAttribute("class");
440 if (!check.intern().contains("disabled")) {
441 throw new Exception("Source should be disabled. open bug to UI team");
443 check = linkSrcCPs.get(j).getAttribute("class");
444 if (!check.intern().contains("disabled")) {
445 throw new Exception("Source connection point of last lines should be disabled. open bug to UI team");
448 for (int j = 0; j < i + 1; j++) {
450 check = linkTargets.get(j).getAttribute("class");
451 if (!check.intern().contains("disabled")) {
452 throw new Exception("Target of last lines should be disabled. open bug to UI team");
454 check = linkTargetCPs.get(j).getAttribute("class");
455 if (!check.intern().contains("disabled")) {
456 throw new Exception("Target connection point of last lines should be disabled. open bug to UI team");
460 List <WebElement> choices = getDriver().findElements(By.xpath("//*[" + index + "]/*[@data-tests-id='linkTarget']//option"));
461 choices.get((new Random()).nextInt(choices.size())).click();
462 choices = getDriver().findElements(By.xpath("//*[" + index + "]/*[@data-tests-id='linkTargetCP']//option"));
463 choices.get((new Random()).nextInt(choices.size())).click();
467 public String editPath(String pathName) throws Exception, AWTException{
468 getDriver().findElements(By.xpath("//*[text()='"+pathName+"']/parent::*//span")).get(0).click();
470 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ComplexServiceAmdocs.PATH_NAME.getValue()).clear();
471 sendValue(DataTestIdEnum.ComplexServiceAmdocs.PATH_NAME.getValue(), pathName);
472 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.SAVE.getValue());
476 public int deleteLines(int numOfLinesToDelete,int numOfLines)throws Exception, AWTException{
478 for (int i=0; i<numOfLinesToDelete; i++){
479 getDriver().findElements(By.xpath("//*[@data-tests-id='removeLnk']//span")).get(0).click();
482 if (getDriver().findElements(By.xpath("//*[@data-tests-id='linkTargetCP']//option")).size()>(numOfLines+1))
484 throw new Exception("Path element was not deleted");
486 GeneralUIUtils.ultimateWait();
490 public String getToPathFlow(String filepath, String vnfFile) throws Exception, AWTException {
492 String vspName = onboardAndCertify(filepath, vnfFile);
493 reloginWithNewRole(UserRoleEnum.DESIGNER);
495 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
496 ServiceUIUtils.createService(serviceMetadata, getUser());
497 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
503 public String createPath(String vspName) throws Exception, AWTException {
507 String pathName = "name1";
508 insertValues(pathName, "pathProtocol1", "pathPortNumbers1");
509 //select path elements
510 selectFirstLineParam();
511 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue());
512 SetupCDTest.getExtendTest().log(Status.INFO, String.format("path has been created"));
518 public void createExtendedPath(String vspName) throws Exception, AWTException {
519 //drag and drop VFs and link them
522 //open create path box
524 String pathName = "name1";
525 insertValues(pathName, "pathProtocol1", "pathPortNumbers1");
526 selectFirstLineParam();
529 extendPath(numOfLines);
531 int numOfLinesToDelete = 1;
532 numOfLines = deleteLines(numOfLinesToDelete, numOfLines);
533 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue());
534 ExtentTestActions.log(Status.INFO, "path has been created");
536 // check that path exist in the path filter list
537 checkPathFilter(pathName, true);
539 // check that path exist in the path list
540 getDriver().findElements(By.xpath("//*[@data-tests-id='pathsMenuBtn']/parent::*")).get(0).click();
541 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.PATH_LIST_BUTTON.getValue());
542 String PathListName1 = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']")).get(0).getText();
545 pathName = editPath(pathName);
547 // go back to path's list
548 getDriver().findElements(By.xpath("//*[@data-tests-id='pathsMenuBtn']/parent::*")).get(0).click();
549 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.PATH_LIST_BUTTON.getValue());
552 String PathListName2 = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']")).get(0).getText();
554 // assert names changed
555 if (PathListName1.equals(PathListName2))
557 throw new Exception("path name expected to change after edit but did not");
561 int paths_before_deletion = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']/parent::*//span")).size();
562 getDriver().findElements(By.xpath("//*[text()='"+pathName+"']/parent::*//span")).get(1).click();
563 GeneralUIUtils.ultimateWait();
564 int paths_after_deletion = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']/parent::*//span")).size();
565 if (paths_after_deletion == paths_before_deletion)
567 throw new Exception("path expected to be deleted but did not");
570 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesAssignmentScreen.INPUT_DELETE_DIALOG_CLOSE.getValue());
571 //ArtifactsCorrelationManager.addVNFtoServiceArtifactCorrelation(serviceMetadata.getName(), vspName);
572 //ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
573 //ExtentTestActions.addScreenshot(Status.INFO, "ServiceComposition_" + vnfFile, "The service topology is as follows: ");
574 //ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
575 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Path has been created"));
577 // check that path got deleted in the path filter list
578 checkPathFilter(pathName, false);
581 public void createComplexExtendedPath(String Service1, String Service2) throws Exception, AWTException {
582 //drag and drop Services and link them
583 linkServices(Service1, Service2, 5);
585 //-----------------------------------------create path-------------------------------------------------
587 //open create path box
590 String pathName = "name1";
591 String pathProtocol = "pathProtocol1";
592 String pathPortNumbers = "pathPortNumbers1";
594 insertValues(pathName, pathProtocol, pathPortNumbers);
596 //select path parameters
597 selectFirstLineParam();
600 extendPath(numOfLines);
603 int numOfLinesToDelete = 1;
604 numOfLines = deleteLines(numOfLinesToDelete, numOfLines);
605 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue());
606 ExtentTestActions.log(Status.INFO, "path has been created");
608 //---------------------------------------check path's list-----------------------------
614 String PathListName1 = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']")).get(0).getText();
617 pathName = editPath(pathName);
619 // go back to path's list
620 getDriver().findElements(By.xpath("//*[@data-tests-id='pathsMenuBtn']/parent::*")).get(0).click();
621 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.PATH_LIST_BUTTON.getValue());
624 String PathListName2 = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']")).get(0).getText();
626 // assert names changed
627 if (PathListName1.equals(PathListName2))
629 throw new Exception("path name expected to change after edit but did not");
633 int paths_before_deletion = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']/parent::*//span")).size();
634 getDriver().findElements(By.xpath("//*[text()='"+pathName+"']/parent::*//span")).get(1).click();
636 int paths_after_deletion = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']/parent::*//span")).size();
637 if (paths_after_deletion == paths_before_deletion)
639 throw new Exception("path expected to be deleted but did not");
641 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesAssignmentScreen.INPUT_DELETE_DIALOG_CLOSE.getValue());
642 //ArtifactsCorrelationManager.addVNFtoServiceArtifactCorrelation(serviceMetadata.getName(), vspName);
644 //assertNotNull(vfElement);
645 //ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
646 //ExtentTestActions.addScreenshot(Status.INFO, "ServiceComposition_" + vnfFile, "The service topology is as follows: ");
648 //ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
649 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Path has been created"));
652 public String[] getToComplexService(String filepath, String vnfFile, String vnfFile2) throws Exception, AWTException{
653 // create & certify 2 VF
654 String vspName1 = onboardAndCertify(filepath, vnfFile);
655 reloginWithNewRole(UserRoleEnum.DESIGNER);
656 String vspName2 = onboardAndCertify(filepath, vnfFile2);
659 reloginWithNewRole(UserRoleEnum.DESIGNER);
660 ServiceReqDetails serviceMetadata1 = createService();
662 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
664 createPath(vspName1);
665 getDriver().findElements(By.xpath("//*[@data-tests-id='submit_for_testing']")).get(0).click();
666 getDriver().findElements(By.xpath("//*[@data-tests-id='changeLifeCycleMessage']")).get(0).sendKeys("new Service to test");
667 getDriver().findElements(By.xpath("//*[@data-tests-id='OK']")).get(0).click();
670 ServiceReqDetails serviceMetadata2 = createService();
672 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
674 createPath(vspName2);
675 getDriver().findElements(By.xpath("//*[@data-tests-id='submit_for_testing']")).get(0).click();
676 getDriver().findElements(By.xpath("//*[@data-tests-id='changeLifeCycleMessage']")).get(0).sendKeys("new Service to test");
677 getDriver().findElements(By.xpath("//*[@data-tests-id='OK']")).get(0).click();
680 reloginWithNewRole(UserRoleEnum.TESTER);
681 GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName());
682 TesterOperationPage.certifyComponent(serviceMetadata1.getName());
683 GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName());
684 TesterOperationPage.certifyComponent(serviceMetadata2.getName());
687 reloginWithNewRole(UserRoleEnum.GOVERNOR);
688 GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName());
689 GovernorOperationPage.approveSerivce(serviceMetadata1.getName());
690 GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName());
691 GovernorOperationPage.approveSerivce(serviceMetadata2.getName());
693 //create service for complex service
694 reloginWithNewRole(UserRoleEnum.DESIGNER);
696 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
697 ServiceUIUtils.createService(serviceMetadata, getUser());
699 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
701 return new String[]{serviceMetadata1.getName(), serviceMetadata2.getName()};
704 public String[] ToComplexService(String filepath, List<String> vnfFiles) throws Exception, AWTException{
705 // create & certify 2 VF
706 List<String> VFNames = onboardAndCertifyMultipleVFs(filepath, vnfFiles);
709 reloginWithNewRole(UserRoleEnum.DESIGNER);
710 ServiceReqDetails serviceMetadata1 = createService();
712 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
714 createPath(VFNames.get(0));
715 getDriver().findElements(By.xpath("//*[@data-tests-id='submit_for_testing']")).get(0).click();
716 getDriver().findElements(By.xpath("//*[@data-tests-id='changeLifeCycleMessage']")).get(0).sendKeys("new Service to test");
717 getDriver().findElements(By.xpath("//*[@data-tests-id='OK']")).get(0).click();
718 GeneralUIUtils.ultimateWait();;
721 ServiceReqDetails serviceMetadata2 = createService();
722 GeneralUIUtils.ultimateWait();;
724 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
726 createPath(VFNames.get(1));
727 getDriver().findElements(By.xpath("//*[@data-tests-id='submit_for_testing']")).get(0).click();
728 getDriver().findElements(By.xpath("//*[@data-tests-id='changeLifeCycleMessage']")).get(0).sendKeys("new Service to test");
729 getDriver().findElements(By.xpath("//*[@data-tests-id='OK']")).get(0).click();
732 reloginWithNewRole(UserRoleEnum.TESTER);
733 GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName());
734 TesterOperationPage.certifyComponent(serviceMetadata1.getName());
735 GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName());
736 TesterOperationPage.certifyComponent(serviceMetadata2.getName());
739 reloginWithNewRole(UserRoleEnum.GOVERNOR);
740 GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName());
741 GovernorOperationPage.approveSerivce(serviceMetadata1.getName());
742 GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName());
743 GovernorOperationPage.approveSerivce(serviceMetadata2.getName());
745 //create service for complex service
746 reloginWithNewRole(UserRoleEnum.DESIGNER);
748 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
749 ServiceUIUtils.createService(serviceMetadata, getUser());
751 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
753 return new String[]{serviceMetadata1.getName(), serviceMetadata2.getName()};
756 public void runCreatePathComplexServiceFlow(String filepath, String vnfFile, String vnfFile2) throws Exception, AWTException {
757 // create & certify 2 VF
758 String vspName1 = onboardAndCertify(filepath, vnfFile);
759 reloginWithNewRole(UserRoleEnum.DESIGNER);
760 String vspName2 = onboardAndCertify(filepath, vnfFile2);
763 reloginWithNewRole(UserRoleEnum.DESIGNER);
764 ServiceReqDetails serviceMetadata1 = createService();
766 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
768 createPath(vspName1);
769 getDriver().findElements(By.xpath("//*[@data-tests-id='submit_for_testing']")).get(0).click();
770 getDriver().findElements(By.xpath("//*[@data-tests-id='changeLifeCycleMessage']")).get(0).sendKeys("new Service to test");
771 getDriver().findElements(By.xpath("//*[@data-tests-id='OK']")).get(0).click();
774 ServiceReqDetails serviceMetadata2 = createService();
776 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
778 createPath(vspName2);
779 getDriver().findElements(By.xpath("//*[@data-tests-id='submit_for_testing']")).get(0).click();
780 getDriver().findElements(By.xpath("//*[@data-tests-id='changeLifeCycleMessage']")).get(0).sendKeys("new Service to test");
781 getDriver().findElements(By.xpath("//*[@data-tests-id='OK']")).get(0).click();
784 reloginWithNewRole(UserRoleEnum.TESTER);
785 GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName());
786 TesterOperationPage.certifyComponent(serviceMetadata1.getName());
787 GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName());
788 TesterOperationPage.certifyComponent(serviceMetadata2.getName());
791 reloginWithNewRole(UserRoleEnum.GOVERNOR);
792 GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName());
793 GovernorOperationPage.approveSerivce(serviceMetadata1.getName());
794 GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName());
795 GovernorOperationPage.approveSerivce(serviceMetadata2.getName());
797 //create service for complex service
798 reloginWithNewRole(UserRoleEnum.DESIGNER);
800 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
801 ServiceUIUtils.createService(serviceMetadata, getUser());
803 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
805 CanvasManager canvasManager = CanvasManager.getCanvasManager();
806 CompositionPage.searchForElement(serviceMetadata1.getName());
807 CanvasElement service1 = canvasManager.createElementOnCanvas(serviceMetadata1.getName());
808 CompositionPage.searchForElement(serviceMetadata2.getName());
809 CanvasElement service2 = canvasManager.createElementOnCanvas(serviceMetadata2.getName());
810 canvasManager.linkElements(service1,CircleSize.SERVICE, service2, CircleSize.SERVICE);
814 insertValues("name1", "pathProtocol1", "pathPortNumbers1");
815 selectFirstLineParam();
816 GeneralUIUtils.getWebElementByTestID("Create").click();
819 public void CreatePathComplexServiceFlow(String filepath, List<String> vnfFiles) throws Exception, AWTException {
820 // create & certify 2 VF
821 List<String> vfNames = onboardAndCertifyMultipleVFs(filepath, vnfFiles);
824 reloginWithNewRole(UserRoleEnum.DESIGNER);
825 ServiceReqDetails serviceMetadata1 = createService();
827 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
829 createPath(vfNames.get(0));
830 getDriver().findElements(By.xpath("//*[@data-tests-id='submit_for_testing']")).get(0).click();
831 getDriver().findElements(By.xpath("//*[@data-tests-id='changeLifeCycleMessage']")).get(0).sendKeys("new Service to test");
832 getDriver().findElements(By.xpath("//*[@data-tests-id='OK']")).get(0).click();
835 ServiceReqDetails serviceMetadata2 = createService();
837 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
839 createPath(vfNames.get(0));
840 getDriver().findElements(By.xpath("//*[@data-tests-id='submit_for_testing']")).get(0).click();
841 getDriver().findElements(By.xpath("//*[@data-tests-id='changeLifeCycleMessage']")).get(0).sendKeys("new Service to test");
842 getDriver().findElements(By.xpath("//*[@data-tests-id='OK']")).get(0).click();
845 reloginWithNewRole(UserRoleEnum.TESTER);
846 GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName());
847 TesterOperationPage.certifyComponent(serviceMetadata1.getName());
848 GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName());
849 TesterOperationPage.certifyComponent(serviceMetadata2.getName());
852 reloginWithNewRole(UserRoleEnum.GOVERNOR);
853 GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName());
854 GovernorOperationPage.approveSerivce(serviceMetadata1.getName());
855 GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName());
856 GovernorOperationPage.approveSerivce(serviceMetadata2.getName());
858 //create service for complex service
859 reloginWithNewRole(UserRoleEnum.DESIGNER);
861 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
862 ServiceUIUtils.createService(serviceMetadata, getUser());
864 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
866 CanvasManager canvasManager = CanvasManager.getCanvasManager();
867 CompositionPage.searchForElement(serviceMetadata1.getName());
868 CanvasElement service1 = canvasManager.createElementOnCanvas(serviceMetadata1.getName());
869 CompositionPage.searchForElement(serviceMetadata2.getName());
870 CanvasElement service2 = canvasManager.createElementOnCanvas(serviceMetadata2.getName());
871 canvasManager.linkElements(service1,CircleSize.SERVICE, service2, CircleSize.SERVICE);
875 insertValues("name1", "pathProtocol1", "pathPortNumbers1");
876 selectFirstLineParam();
877 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue());
880 public void runCreateExtendedPathFlow(String filepath, String vnfFile) throws Exception, AWTException {
882 String vspName = getToPathFlow(filepath, vnfFile);
884 //drag and drop VFs and link them
887 //-----------------------------------------create path-------------------------------------------------
889 //open create path box
891 String pathName = "name1";
892 insertValues(pathName, "pathProtocol1", "pathPortNumbers1");
894 //select path parameters
895 selectFirstLineParam();
898 extendPath(numOfLines);
901 int numOfLinesToDelete = 1;
902 numOfLines = deleteLines(numOfLinesToDelete, numOfLines);
903 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue());
904 ExtentTestActions.log(Status.INFO, "path has been created");
906 // check path is on the list
908 String PathListName1 = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']")).get(0).getText();
911 pathName = editPath(pathName);
913 // go back to path's list
914 getDriver().findElements(By.xpath("//*[@data-tests-id='pathsMenuBtn']/parent::*")).get(0).click();
915 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.PATH_LIST_BUTTON.getValue());
918 String PathListName2 = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']")).get(0).getText();
920 // assert names changes
921 if (PathListName1.equals(PathListName2))
923 throw new Exception("path name expected to change after edit but did not");
927 int paths_before_deletion = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']/parent::*//span")).size();
928 getDriver().findElements(By.xpath("//*[text()='"+pathName+"']/parent::*//span")).get(1).click();
929 GeneralUIUtils.ultimateWait();
930 int paths_after_deletion = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']/parent::*//span")).size();
931 if (paths_after_deletion == paths_before_deletion)
933 throw new Exception("path expected to be deleted but did not");
935 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesAssignmentScreen.INPUT_DELETE_DIALOG_CLOSE.getValue());
936 //ArtifactsCorrelationManager.addVNFtoServiceArtifactCorrelation(serviceMetadata.getName(), vspName);
937 //ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
938 //ExtentTestActions.addScreenshot(Status.INFO, "ServiceComposition_" + vnfFile, "The service topology is as follows: ");
939 //ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
940 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Path has been created"));
943 public void runCreatePathFlow(String filepath, String vnfFile) throws Exception, AWTException {
944 String vspName = onboardAndCertify(filepath, vnfFile);
946 reloginWithNewRole(UserRoleEnum.DESIGNER);
948 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
949 ServiceUIUtils.createService(serviceMetadata, getUser());
951 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
953 CompositionPage.searchForElement(vspName);
954 CanvasManager canvasManager = CanvasManager.getCanvasManager();
955 CanvasElement vfElement1 = canvasManager.createElementOnCanvas(vspName);
956 CanvasElement vfElement2 = canvasManager.createElementOnCanvas(vspName);
957 CanvasElement vfElement3 = canvasManager.createElementOnCanvas(vspName);
958 CanvasElement vfElement4 = canvasManager.createElementOnCanvas(vspName);
959 CanvasElement vfElement5 = canvasManager.createElementOnCanvas(vspName);
960 canvasManager.linkElements(vfElement1, CircleSize.VF, vfElement2, CircleSize.VF);
961 canvasManager.linkElements(vfElement3,CircleSize.VF, vfElement2, CircleSize.VF);
962 canvasManager.linkElements(vfElement3, CircleSize.VF, vfElement4, CircleSize.VF);
963 canvasManager.linkElements(vfElement5, CircleSize.VF, vfElement4, CircleSize.VF);
964 canvasManager.linkElements(vfElement5, CircleSize.VF, vfElement1, CircleSize.VF);
968 getDriver().findElements(By.xpath("//*[@data-tests-id='pathsMenuBtn']/parent::*")).get(0).click();
969 // GeneralUIUtils.getWebElementByTestID("pathsMenuBtn").click();
970 GeneralUIUtils.getWebElementByTestID("createPathMenuItem").click();
972 GeneralUIUtils.getWebElementByTestID("pathName").sendKeys("name");
973 GeneralUIUtils.getWebElementByTestID("pathProtocol").sendKeys("pathProtocol");
974 GeneralUIUtils.getWebElementByTestID("pathPortNumbers").sendKeys("pathPortNumbers");
975 //select path parameters
977 getDriver().findElements(By.xpath("//*[@data-tests-id='linkSrc']//option")).get(0).click();
978 getDriver().findElements(By.xpath("//*[@data-tests-id='linkSrcCP']//option")).get(0).click();
979 getDriver().findElements(By.xpath("//*[@data-tests-id='linkTarget']//option")).get(0).click();
980 getDriver().findElements(By.xpath("//*[@data-tests-id='linkTargetCP']//option")).get(0).click();
981 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue());
983 //ArtifactsCorrelationManager.addVNFtoServiceArtifactCorrelation(serviceMetadata.getName(), vspName);
985 //assertNotNull(vfElement);
986 //ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
987 //ExtentTestActions.addScreenshot(Status.INFO, "ServiceComposition_" + vnfFile, "The service topology is as follows: ");
989 //ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
993 protected UserRoleEnum getRole() {
994 return UserRoleEnum.DESIGNER;