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.utilities;
23 import static org.testng.AssertJUnit.assertEquals;
24 import static org.testng.AssertJUnit.assertNotNull;
25 import static org.testng.AssertJUnit.assertTrue;
27 import java.awt.AWTException;
28 import java.awt.Robot;
29 import java.awt.Toolkit;
30 import java.awt.datatransfer.Clipboard;
31 import java.awt.datatransfer.StringSelection;
32 import java.awt.event.KeyEvent;
34 import java.util.Arrays;
35 import java.util.List;
36 import java.util.Random;
38 import org.apache.commons.lang3.tuple.ImmutablePair;
39 import org.apache.http.HttpStatus;
40 import org.json.simple.JSONArray;
41 import org.json.simple.JSONObject;
42 import org.json.simple.JSONValue;
43 import org.openecomp.sdc.be.model.User;
44 import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum;
45 import org.openecomp.sdc.ci.tests.datatypes.CreateAndImportButtonsEnum;
46 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
47 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.Dashboard;
48 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
49 import org.openecomp.sdc.ci.tests.datatypes.ResourceCategoriesNameEnum;
50 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
51 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
52 import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
53 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
54 import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
55 import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
56 import org.openqa.selenium.By;
57 import org.openqa.selenium.ElementNotVisibleException;
58 import org.openqa.selenium.WebDriver;
59 import org.openqa.selenium.WebElement;
60 import org.openqa.selenium.support.ui.ExpectedConditions;
61 import org.openqa.selenium.support.ui.Select;
62 import org.openqa.selenium.support.ui.WebDriverWait;
63 import org.testng.AssertJUnit;
65 import com.aventstack.extentreports.Status;
67 public final class ResourceUIUtils {
68 public static final String RESOURCE_NAME_PREFIX = "ResourceCDTest-";
69 protected static final boolean IS_BEFORE_TEST = true;
70 public static final String INITIAL_VERSION = "0.1";
71 public static final String ICON_RESOURCE_NAME = "call_controll";
72 protected static final String UPDATED_RESOURCE_ICON_NAME = "objectStorage";
74 private ResourceUIUtils() {
77 static WebDriver driver = GeneralUIUtils.getDriver();
79 public static void defineResourceName(String resourceName) {
81 WebElement resourceNameTextbox = GeneralUIUtils.getDriver().findElement(By.name("componentName"));
82 resourceNameTextbox.clear();
83 resourceNameTextbox.sendKeys(resourceName);
86 public static void defineResourceCategory(String category, String datatestsid) {
88 GeneralUIUtils.getSelectList(category, datatestsid);
91 // public static void uploadFileWithJavaRobot(String FilePath,String
92 // FileName) throws Exception{
94 // StringSelection Path= new StringSelection(FilePath+FileName);
95 // Thread.sleep(1000);
96 // java.awt.Toolkit.getDefaultToolkit().getSystemClipboard().setContents(Path,
98 // Robot robot = new Robot();
100 // robot.keyPress(KeyEvent.VK_CONTROL);
101 // robot.keyPress(KeyEvent.VK_V);
102 // robot.keyRelease(KeyEvent.VK_V);
103 // robot.keyRelease(KeyEvent.VK_CONTROL);
104 // robot.delay(1000);
105 // robot.keyPress(KeyEvent.VK_ENTER);
106 // robot.keyRelease(KeyEvent.VK_ENTER);
107 // robot.delay(1000);
109 // click and upload tosca file //**to be changed.
110 public static void importFileWithSendKey(String FilePath, String FileName, CreateAndImportButtonsEnum type)
112 WebElement importButton = HomeUtils.createAndImportButtons(type, driver).findElement(By.tagName("input"));
113 importButton.sendKeys(FilePath + FileName);
116 public static void importFileWithSendKeyBrowse(String FilePath, String FileName) throws Exception {
117 WebElement browsebutton = GeneralUIUtils.getWebElementByTestID("browseButton");
118 browsebutton.sendKeys(FilePath + FileName);
121 // public static void defineVendorName(String resourceVendorName) {
123 // WebElement resourceVendorNameTextbox =
124 // GeneralUIUtils.getWebElementByTestID("vendorName");
125 // resourceVendorNameTextbox.clear();
126 // resourceVendorNameTextbox.sendKeys(resourceVendorName);
129 // public static void defineTagsList(ResourceReqDetails resource,String
131 // List<String>taglist = new ArrayList<String>();;
132 // WebElement resourceTagsTextbox =
133 // GeneralUIUtils.getWebElementByTestID("i-sdc-tag-input");
134 // for (String tag : resourceTags) {
135 // resourceTagsTextbox.clear();
136 // resourceTagsTextbox.sendKeys(tag);
137 // resourceTagsTextbox.sendKeys(Keys.ENTER);
140 // resource.setTags(taglist);
143 public static String defineUserId(String userId) {
145 WebElement resourceUserIdTextbox = ResourceGeneralPage.getContactIdField();
146 resourceUserIdTextbox.clear();
147 resourceUserIdTextbox.sendKeys(userId);
151 public static void defineVendorRelease(String resourceVendorRelease) {
153 WebElement resourceVendorReleaseTextbox = GeneralUIUtils.getWebElementByTestID("vendorRelease");
154 resourceVendorReleaseTextbox.clear();
155 resourceVendorReleaseTextbox.sendKeys(resourceVendorRelease);
158 public static void selectResourceIcon(String resourceIcon) throws Exception {
159 WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 10);
160 wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//div[@data-tests-id='" + resourceIcon + "']")))
164 public static String definePropertyName(String name) {
166 WebElement nameProperty = GeneralUIUtils.getDriver().findElement(By.name("propertyName"));
167 nameProperty.sendKeys(name);
171 public static void selectRandomResourceIcon() throws Exception {
172 GeneralUIUtils.moveToStep(StepsEnum.ICON);
173 WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 4);
174 wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[contains(@data-tests-id, 'iconBox')]")));
175 List<WebElement> iconElement = GeneralUIUtils.getDriver()
176 .findElements(By.xpath("//*[contains(@data-tests-id, 'iconBox')]"));
177 iconElement.get(0).click();
180 public static List<WebElement> getAllObjectsOnWorkspace(WebDriver driver, ResourceReqDetails resource)
183 WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 10);
184 wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@*='" + resource.getName() + "']")));
185 return GeneralUIUtils.getDriver()
186 .findElements(By.xpath("//div[@class='" + "w-sdc-dashboard-card-info-name" + "']"));
190 public static String getErrorMessageText(String text) throws Exception {
192 return GeneralUIUtils.getWebElementByClassName(text).getText();
196 public static WebElement scrollElement(WebDriver driver) throws Exception {
198 return GeneralUIUtils.getDriver().findElement(By.className("ps-scrollbar-y"));
201 public static void scrollDownPage() throws AWTException, InterruptedException {
202 Robot robot = new Robot();
203 robot.keyPress(KeyEvent.VK_PAGE_DOWN);
204 robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
205 robot.keyPress(KeyEvent.VK_PAGE_DOWN);
206 robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
207 robot.keyPress(KeyEvent.VK_PAGE_DOWN);
208 robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
209 robot.keyPress(KeyEvent.VK_PAGE_DOWN);
210 robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
211 robot.keyPress(KeyEvent.VK_PAGE_DOWN);
212 robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
213 robot.keyPress(KeyEvent.VK_PAGE_DOWN);
214 robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
215 robot.keyPress(KeyEvent.VK_PAGE_DOWN);
216 robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
219 public static void defineNewSelectList(String Text) {
220 WebElement mySelectElm = GeneralUIUtils.getDriver().findElement(By.className("i-sdc-form-select"));
221 Select mySelectString = new Select(mySelectElm);
222 mySelectString.selectByVisibleText(Text);
225 public static void defineDefaultValueByType(String Value) {
227 WebElement valueString = GeneralUIUtils.getDriver().findElement(By.name("value"));
229 valueString.sendKeys(Value);
232 public static void defineBoolenDefaultValue(String Value) {
234 WebElement elementBoolean = GeneralUIUtils.getDriver().findElement(By.name("value"));
235 Select se = new Select(elementBoolean);
236 se.selectByValue(Value);
239 public static void clickButtonBlue() {
240 WebElement clickButtonBlue = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-btn-blue"));
241 clickButtonBlue.click();
244 public static void clickButton(String selectButton) {
246 WebElement clickButton = GeneralUIUtils.getDriver()
247 .findElement(By.xpath("//*[@data-tests-id='" + selectButton + "']"));
251 public static WebElement Waitfunctionforbuttons(String element, int timeout) {
252 WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), timeout);
253 return wait.until(ExpectedConditions.elementToBeClickable(By.xpath(element)));
256 public static WebElement waitToButtonSubmitForTesting() {
257 return Waitfunctionforbuttons("//*[@data-tests-id='submitForTesting']", 10);
260 public static WebElement waitToFinishButtonEnabled() {
261 return Waitfunctionforbuttons("//button[@data-tests-id='Finish']", 10);
264 public static WebElement waitToNextButtonEnabled() {
265 return Waitfunctionforbuttons("//button[@data-tests-id='Next']", 10);
268 public static WebElement waitToHomeMenu() {
269 return Waitfunctionforbuttons("//*[@data-tests-id='main-menu-button-home']", 10);
272 public static WebElement waitToCatalogMenu() {
273 return Waitfunctionforbuttons("//*[@data-tests-id='main-menu-button-catalog']", 10);
276 public static WebElement waitSearch() {
277 return Waitfunctionforbuttons("//*[@data-tests-id='main-menu-input-search']", 10);
280 public static WebElement waitSubmitforTestingCard() {
281 return Waitfunctionforbuttons("//*[@data-tests-id='i-sdc-dashboard-card-menu-item-SubmitforTesting']", 10);
284 public static WebElement waitViewCard() {
285 return Waitfunctionforbuttons("//*[@data-tests-id='i-sdc-dashboard-card-menu-item-View']", 5);
288 // public static void waitOpenCard(String requiredElementUniqueId) throws Exception {
289 // WebElement menu = GeneralUIUtils.getDriver()
290 // .findElement(By.xpath("//*[@data-tests-id='" + requiredElementUniqueId + "']"));
291 // GeneralUIUtils.hoverOnAreaByTestId(menu);
294 public static void fillResourceGeneralInformationPage(ResourceReqDetails resource, User user, boolean isNewResource) {
296 ResourceGeneralPage.defineName(resource.getName());
297 ResourceGeneralPage.defineDescription(resource.getDescription());
298 ResourceGeneralPage.defineCategory(resource.getCategories().get(0).getSubcategories().get(0).getName());
299 ResourceGeneralPage.defineVendorName(resource.getVendorName());
300 ResourceGeneralPage.defineVendorRelease(resource.getVendorRelease());
302 ResourceGeneralPage.defineTagsList(resource, new String[] { "This-is-tag", "another-tag", "Test-automation-tag" });
305 ResourceGeneralPage.defineTagsList(resource, new String[] { "one-more-tag" });
307 } catch (Exception e) {
308 throw new RuntimeException(e);
312 public static void fillMaxValueResourceGeneralInformationPage(ResourceReqDetails resource) {
313 String stringPattern = "ABCDabcd123456";
314 GeneralUIUtils.addStringtoClipboard(buildStringFromPattern(stringPattern, 5000));
315 ResourceGeneralPage.defineNameWithPaste();
316 ResourceGeneralPage.defineDescriptionWithPaste();
317 ResourceGeneralPage.defineVendorNameWithPaste();
318 ResourceGeneralPage.defineVendorReleaseWithPaste();
319 // ResourceGeneralPage.defineName(buildStringFromPattern(stringPattern, 5000));
320 // ResourceGeneralPage.defineDescription(buildStringFromPattern(stringPattern, 5000));
321 // ResourceGeneralPage.defineVendorName(buildStringFromPattern(stringPattern, 5000));
322 // ResourceGeneralPage.defineVendorRelease(buildStringFromPattern(stringPattern, 5000));
323 // ResourceGeneralPage.defineTagsList(resource, new String[] { buildStringFromPattern(stringPattern, 5000) });
324 ResourceGeneralPage.defineTagsListWithPaste();
325 GeneralUIUtils.waitForAngular();
328 public static String buildStringFromPattern(String stringPattern, int stringLength){
329 char[] chars = stringPattern.toCharArray();
330 StringBuilder sb = new StringBuilder();
331 Random random = new Random();
332 for (int i = 0; i < stringLength; i++) {
333 char c = chars[random.nextInt(chars.length)];
336 return sb.toString();
339 public static void fillNewResourceValues(ResourceReqDetails resource, User user) throws Exception {
340 fillResourceGeneralInformationPage(resource, user, true);
341 GeneralPageElements.clickCreateButton();
347 public static WebElement waitfunctionforallelements(String element) {
348 WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 5);
349 return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@*='" + element + "']")));
352 public static WebElement waitFunctionForaGetElements(String element, int timeout) {
353 WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), timeout);
355 ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + element + "']")));
358 public static void getVFCGeneralInfo(ResourceReqDetails resource, User user) throws InterruptedException {
360 String version = GeneralUIUtils.getWebElementsListByTestID("versionvalue").get(0).getText().substring(1);
361 String name = GeneralUIUtils.getWebElementByTestID("name").getAttribute("value");
362 String description = GeneralUIUtils.getWebElementByTestID("description").getAttribute("value");
363 String category = GeneralUIUtils.getSelectList(null, "selectGeneralCategory").getFirstSelectedOption()
365 String vendorName = GeneralUIUtils.getWebElementByTestID("vendorName").getAttribute("value");
366 String vendorRelease = GeneralUIUtils.getWebElementByTestID("vendorRelease").getAttribute("value");
367 List<WebElement> tags = GeneralUIUtils.getWebElementsListByTestID("i-sdc-tag-text");
368 String type = GeneralUIUtils.getWebElementsListByTestID("type").get(1).getText();
369 int index = type.lastIndexOf(":");
370 System.out.println(type.substring(0, index));
371 String AttContact = GeneralUIUtils.getWebElementByTestID("attContact").getAttribute("value");
372 System.out.println(resource.getVersion());
373 assertTrue(resource.getVersion().equals(version));
374 assertTrue(resource.getName().equals(name));
375 assertTrue(resource.getDescription().equals(description));
376 System.out.println(resource.getVendorName());
377 System.out.println(resource.getVendorRelease());
378 assertTrue(resource.getCategories().get(0).getSubcategories().get(0).getName().equals(category));
379 assertTrue(resource.getVendorName().equals(vendorName));
380 assertTrue(resource.getVendorRelease().equals(vendorRelease));
381 assertTrue(resource.getCreatorUserId().equals(AttContact));
382 assertEquals(type.substring(0, index), resource.getResourceType());
384 for (int i = 0; i < tags.size(); i++) {
385 assertEquals(resource.getTags().get(i), tags.get(i).getText());
389 public static void getGeneralInfo(ResourceReqDetails resource, User user) {
393 // componentType=waitFunctionForaGetElements("componentType",3).getText();
394 // String version=waitFunctionForaGetElements("version",3).getText();
396 // category=waitFunctionForaGetElements("category",3).getText();//get
397 // right panel Category.
399 // resourceType=waitFunctionForaGetElements("resourceType",3).getText();//get
400 // right panel SubCategory.
401 // String date=waitfunctionforelements("creationDate",3).getText();
402 // String aouthor=waitfunctionforallelements("author'",3).getText();
404 // vendorName=waitFunctionForaGetElements("vendorName",3).getText();
406 // vendorRelease=waitFunctionForaGetElements("vendorRelease",3).getText();
408 // AttContact=waitFunctionForaGetElements("attContact",3).getText();
410 // Description=waitFunctionForaGetElements("description",3).getText();
411 List<WebElement> tags = GeneralUIUtils.getWebElementsListByTestID("tag");
412 // // String TagVF=waitFunctionForaGetElements("tag",3).getText();
413 // assertTrue(componentType.equals("RESOURCE"));
414 // assertTrue(version.equals(resource.getVersion()));
415 // assertTrue(category.equals(resource.getCategories().get(0).getName()));
416 // assertEquals(resourceType,resource.getResourceType());
417 // // assertEquals(Date,resource.getCreationDate());
418 // // assertEquals(Aouthor,resource.getCreatorFullName());
419 // assertTrue(vendorName.equals(resource.getVendorName()));
420 // assertTrue(vendorRelease.equals(resource.getVendorRelease()));
421 // assertTrue(AttContact.equals(resource.getAttContact()));
422 // assertTrue(Description.equals(resource.getDescription()+"\nLess"));
423 for (WebElement tag : tags) {
424 System.out.println(resource.getTags().get(0));
428 public static void getGeneralInfoForTags(ResourceReqDetails resource, User user) {
431 String componentType = waitFunctionForaGetElements("componentType", 3).getText();
432 String version = waitFunctionForaGetElements("version", 3).getText();
433 String category = waitFunctionForaGetElements("category", 3).getText();// get
437 String resourceType = waitFunctionForaGetElements("resourceType", 3).getText();// get
441 String date = GeneralUIUtils.getWebElementByClassName("creationDate").getText();
442 String aouthor = waitfunctionforallelements("author'").getText();
443 String vendorName = waitFunctionForaGetElements("vendorName", 3).getText();
444 String vendorRelease = waitFunctionForaGetElements("vendorRelease", 3).getText();
445 String attContact = waitFunctionForaGetElements("attContact", 3).getText();
446 String description = waitFunctionForaGetElements("description", 3).getText();
447 List<WebElement> tags = GeneralUIUtils.getWebElementsListByTestID("tag");
448 assertTrue(componentType.equals("RESOURCE"));
449 assertTrue(version.equals(resource.getVersion()));
450 assertTrue(category.equals(resource.getCategories().get(0).getName()));
451 assertEquals(resourceType, resource.getResourceType());
452 // assertEquals(Date,resource.getCreationDate());
453 // assertEquals(Aouthor,resource.getCreatorFullName());
454 assertTrue(vendorName.equals(resource.getVendorName()));
455 assertTrue(vendorRelease.equals(resource.getVendorRelease()));
456 assertTrue(attContact.equals(resource.getContactId()));
457 assertTrue(description.equals(resource.getDescription() + "\nLess"));
458 assertTrue(tags.equals("Tag-150"));
461 public static WebElement searchVFNameInWorkspace(ResourceReqDetails resource, User user) throws Exception {
463 List<WebElement> findElements = GeneralUIUtils.getDriver()
464 .findElements(By.xpath("//div[@data-tests-id='" + resource.getUniqueId() + "']"));
465 assertNotNull("did not find any elements", findElements);
466 for (WebElement webElement : findElements) {
467 if (webElement.getText().contains(resource.getUniqueId())) {
468 System.out.println("I find it");
475 public static Boolean searchCheckOutWorkspace(ResourceReqDetails resource, User user,
476 CheckBoxStatusEnum checkBoxStatusEnum) throws Exception {
478 List<WebElement> findElements = GeneralUIUtils.getDriver()
479 .findElements(By.xpath("//div[@data-tests-id='component.lifecycleState']"));
480 assertNotNull("did not find any elements", findElements);
481 for (WebElement webElement : findElements) {
482 if (!webElement.getAttribute("class").contains(checkBoxStatusEnum.name())) {
490 public static void validateWithRightPalett(ResourceReqDetails resource, User user) {
492 // Type=Waitfunctionforallelements("sharingService.selectedEntity.getTypeForView()",3).getText();
493 String ResourceType = waitfunctionforallelements("selectedComponent.resourceType").getText();
494 System.out.println(ResourceType);
495 String Version = waitfunctionforallelements("selectedComponent.version").getText();
496 String Category = waitfunctionforallelements("selectedComponent.categories[0].name").getText();// get
500 String CanvasSubCategory = waitfunctionforallelements("selectedComponent.categories[0].subcategories[0].name")
501 .getText();// get right panel SubCategory.
502 // String Date=Waitfunctionforelements("selectedComponent.creationDate |
503 // date: 'MM/dd/yyyy'").getText();
505 // Aouthor=waitfunctionforallelements("selectedComponent.creatorFullName'").getText();
506 String VendorName = waitfunctionforallelements("selectedComponent.vendorName").getText();
507 String VendorRelease = waitfunctionforallelements("selectedComponent.vendorRelease").getText();
508 String AttContact = waitfunctionforallelements("selectedComponent.attContact").getText();
509 String Description = waitfunctionforallelements("selectedComponent.description").getText();
510 String TagVF = waitfunctionforallelements("tag").getText();
511 AssertJUnit.assertEquals(ResourceType, resource.getResourceType());
512 AssertJUnit.assertEquals(Version, resource.getVersion());
513 AssertJUnit.assertEquals(Category, resource.getCategories().get(0).getName());
514 AssertJUnit.assertEquals(CanvasSubCategory,
515 resource.getCategories().get(0).getSubcategories().get(0).getName());
516 // assertEquals(Date,resource.getCreationDate());
517 // assertEquals(Aouthor,resource.getCreatorFullName());
518 AssertJUnit.assertEquals(VendorName, resource.getVendorName());
519 AssertJUnit.assertEquals(VendorRelease, resource.getVendorRelease());
520 AssertJUnit.assertEquals(AttContact, resource.getContactId());
521 AssertJUnit.assertEquals(Description, resource.getDescription() + "\nLess");
522 AssertJUnit.assertEquals(TagVF, "qa123");
525 public static void clickMore() {
526 WebElement clickButtonSubmit = GeneralUIUtils.getDriver()
527 .findElement(By.className("ellipsis-directive-more-less"));
528 clickButtonSubmit.click();
531 public static RestResponse createResourceInUI(ResourceReqDetails resource, User user)
532 throws Exception, AWTException {
533 System.out.println("creating resource...");
534 fillNewResourceValues(resource, user);
535 RestResponse getCreatedResource = RestCDUtils.getResource(resource, user);
536 AssertJUnit.assertEquals("Did not succeed to get any resource", HttpStatus.SC_OK,
537 getCreatedResource.getErrorCode().intValue());
539 return getCreatedResource;
542 public static void createResource(ResourceReqDetails resource, User user) throws Exception {
543 ExtentTestActions.log(Status.INFO, "Going to create a new VF.");
544 WebElement addVFButton = null;
546 GeneralUIUtils.ultimateWait();
548 GeneralUIUtils.hoverOnAreaByClassName("w-sdc-dashboard-card-new");
549 addVFButton = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue());
552 File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resource.getName());
553 final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
554 SetupCDTest.getExtendTest().log(Status.WARNING, "Add VF button is not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath));
556 addVFButton = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue());
559 GeneralUIUtils.ultimateWait();
561 catch (Exception e ) {
562 SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on ADD VF button, retrying ... "));
563 GeneralUIUtils.hoverOnAreaByClassName("w-sdc-dashboard-card-new");
564 GeneralUIUtils.ultimateWait();
565 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue()).click();
566 GeneralUIUtils.ultimateWait();
568 fillResourceGeneralInformationPage(resource, user, true);
569 resource.setVersion("0.1");
570 GeneralPageElements.clickCreateButton();
573 public static void updateResource(ResourceReqDetails resource, User user){
574 ResourceGeneralPage.defineContactId(resource.getContactId());
575 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating General screen fields ..."));
576 fillResourceGeneralInformationPage(resource, user, false);
577 ResourceGeneralPage.clickUpdateButton();
582 public static RestResponse updateResourceInformationPage(ResourceReqDetails resource, User user)
583 throws Exception, AWTException {
585 fillResourceGeneralInformationPage(resource, user, true);
586 GeneralPageElements.clickCreateButton();
591 public static RestResponse checkInResourceInUI(ResourceReqDetails resource, User user) throws Exception {
593 WebElement ASDCLink = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-header-logo-link"));
597 List<WebElement> listFormInput = GeneralUIUtils.getDriver()
598 .findElements(By.className("i-sdc-left-sidebar-nav-item"));
599 WebElement addPropertyElement = listFormInput.get(0);
600 addPropertyElement.click();
603 WebElement searchResource = GeneralUIUtils.getDriver()
604 .findElement(By.className("w-sdc-header-catalog-search-input"));
605 searchResource.sendKeys("newresource4test");
609 WebElement buttonClickMenu = GeneralUIUtils.getDriver()
610 .findElement(By.className("w-sdc-dashboard-card-menu-button"));
611 buttonClickMenu.click();
613 WebElement clickMenu = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-dashboard-card-menu"));
616 List<WebElement> clickCheckIn = GeneralUIUtils.getDriver()
617 .findElements(By.className("i-sdc-dashboard-card-menu-item"));
618 WebElement clickCheckInMenu = clickCheckIn.get(1);
619 clickCheckInMenu.click();
621 WebElement descriptionForSubmit = GeneralUIUtils.getDriver()
622 .findElement(By.className("w-sdc-modal-body-comment"));
623 descriptionForSubmit.sendKeys("checkin resource");
625 WebElement clickButtonSubmitTwo = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-btn-blue"));
626 clickButtonSubmitTwo.click();
629 WebElement buttonClickMenu1 = GeneralUIUtils.getDriver()
630 .findElement(By.className("w-sdc-dashboard-card-menu-button"));
631 buttonClickMenu1.click();
633 WebElement clickMenu1 = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-dashboard-card-menu"));
636 List<WebElement> clickCheckOut = GeneralUIUtils.getDriver()
637 .findElements(By.className("i-sdc-dashboard-card-menu-item"));
638 WebElement clickCheckOutMenu = clickCheckOut.get(0);
639 clickCheckOutMenu.click();
642 RestResponse getResource = RestCDUtils.getResource(resource, user);
643 AssertJUnit.assertEquals("Did not succeed to get resource after create", 200,
644 getResource.getErrorCode().intValue());
649 public static String lifeCycleStateUI() throws InterruptedException {
650 return GeneralUIUtils.getWebElementByTestID("formlifecyclestate").getText();
653 public static List<String> catalogFilterResourceCategoriesChecBox(ResourceCategoriesNameEnum enumName)
655 List<String> categories = Arrays.asList();
658 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
659 categories = Arrays.asList("applicationServer", "defaulticon", "vl", "cp", "call_controll", "borderElement",
660 "network", "firewall", "database", "loadBalancer");
662 case APPLICATION_SERVER:
663 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
664 categories = Arrays.asList("applicationServer", "vl", "cp", "defaulticon");
667 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
668 categories = Arrays.asList("borderElement", "vl", "cp", "defaulticon");
671 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
672 categories = Arrays.asList("call_controll", "vl", "cp", "defaulticon");
674 case COMMON_NETWORK_RESOURCES:
675 GeneralUIUtils.getWebElementByLinkText("Common Network Resources").click();
676 categories = Arrays.asList("network", "vl", "cp", "defaulticon");
678 case CONNECTION_POINTS:
679 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
680 categories = Arrays.asList("cp", "defaulticon");
683 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
684 categories = Arrays.asList("database", "vl", "cp", "defaulticon");
686 case DATABASE_GENERIC:
687 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
688 categories = Arrays.asList("database", "vl", "cp", "defaulticon");
691 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
692 categories = Arrays.asList("firewall", "vl", "cp", "defaulticon");
695 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
696 categories = Arrays.asList("gateway", "vl", "cp", "defaulticon");
699 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
700 categories = Arrays.asList("connector", "vl", "cp", "defaulticon");
702 case INFRASTRUCTUREL23:
703 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
704 categories = Arrays.asList("ucpe", "vl", "cp", "defaulticon");
707 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
708 categories = Arrays.asList("network", "port", "connector", "vl", "cp", "defaulticon");
711 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
712 categories = Arrays.asList("loadBalancer", "vl", "cp", "defaulticon");
715 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
716 categories = Arrays.asList("network", "vl", "cp", "defaulticon");
719 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
720 categories = Arrays.asList("network", "vl", "cp", "defaulticon");
722 case NETWORK_ELEMENTS:
723 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
724 categories = Arrays.asList("port", "defaulticon", "network", "connector", "vl", "cp");
727 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
728 categories = Arrays.asList("network", "vl", "defaulticon", "cp", "router", "port", "connector", "gateway",
731 case NETWORK_CONNECTIVITY:
732 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
733 categories = Arrays.asList("network", "vl", "cp", "defaulticon");
736 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
737 categories = Arrays.asList("database", "port", "loadBalancer", "vl", "cp", "objectStorage", "compute",
738 "defaulticon", "ucpe", "network", "connector");
741 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
742 categories = Arrays.asList("objectStorage", "compute", "defaulticon", "cp", "vl");
745 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
746 categories = Arrays.asList("router", "vl", "cp", "defaulticon");
749 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
750 categories = Arrays.asList("vl", "defaulticon");
753 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
754 categories = Arrays.asList("network", "port", "connector", "vl", "cp", "defaulticon");
757 GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
758 categories = Arrays.asList("applicationServer", "vl", "cp", "defaulticon");
764 public static void deleteVersionInUI() throws Exception {
766 waitToDeleteVersion().click();
767 ResourceUIUtils.clickButtonBlue();
770 public static void selectTabInRightPallete(String className) throws Exception {
771 WebElement tab = GeneralUIUtils.getWebElementByClassName(className);
775 public static WebElement waitToDeleteVersion() {
776 return Waitfunctionforbuttons("//*[@data-tests-id='deleteVersion']", 10);
779 public static WebElement rihtPanelAPI() {
780 return waitFunctionForaGetElements("tab-api", 10);
784 * Click on HTML element.
789 public static void getWebElementByTestID(String dataTestId) throws Exception {
790 WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 20);
791 WebElement element = wait
792 .until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@data-tests-id='" + dataTestId + "']")));
794 // wait.until(ExpectedConditions.elemetto)
795 // WebElement serviceButton =
796 // GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='"
797 // + dataTestId + "']"));
799 // serviceButton.click();
803 * Move to HTML element by class name. When moving to the HTML element, it
804 * will raise hover event.
808 // public static void moveToHTMLElementByClassName(String className) {
809 // Actions actions = new Actions(GeneralUIUtils.getDriver());
810 // final WebElement createButtonsArea = GeneralUIUtils
811 // .retryMethodOnException(() -> GeneralUIUtils.getDriver().findElement(By.className(className)));
812 // actions.moveToElement(createButtonsArea).perform();
816 * Move to HTML element by element id. When moving to the HTML element, it
817 * will raise hover event.
821 // static void moveToHTMLElementByDataTestId(String dataTestId) {
822 // // WebElement hoverArea =
823 // // GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='"
824 // // + dataTestId + "']"));
825 // WebElement hoverArea = GeneralUIUtils.waitForElementVisibility(dataTestId);
826 // // WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(),
828 // // wait.until(ExpectedConditions.visibilityOf(hoverArea));
830 // Actions actions = new Actions(GeneralUIUtils.getDriver());
831 // actions.moveToElement(hoverArea).perform();
834 // public static ResourceReqDetails createResourceInUI(User user){
836 // ResourceReqDetails defineResourceDetails =
837 // defineResourceDetails(ResourceTypeEnum.VF);
838 // ResourceUIUtils.moveToHTMLElementByClassName("w-sdc-dashboard-card-new");
839 // ResourceUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue());
840 // GeneralUIUtils.waitForLoader();
841 //// GeneralUIUtils.sleep(1000);
842 // fillResourceGeneralInformationPage(defineResourceDetails, user);
843 // GeneralPageElements.clickCreateButton();
844 // return defineResourceDetails;
846 // catch( Exception e){
847 // throw new RuntimeException(e);
861 public static void importVfc(ResourceReqDetails resourceMetaData, String filePath, String fileName, User user)
863 GeneralUIUtils.ultimateWait();
864 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating new VFC resource ", resourceMetaData.getName()));
865 GeneralUIUtils.hoverOnAreaByTestId(Dashboard.IMPORT_AREA.getValue());
866 GeneralUIUtils.ultimateWait();
867 // Insert file to the browse dialog
868 WebElement buttonVFC = GeneralUIUtils.findByText("Import VFC");
869 WebElement fileInputElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VFC_FILE.getValue());
870 if (!buttonVFC.isDisplayed()){
871 File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resourceMetaData.getName());
872 final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
873 SetupCDTest.getExtendTest().log(Status.WARNING, "VFC button not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath));
876 fileInputElement.sendKeys(filePath + fileName);
877 } catch (ElementNotVisibleException e) {
878 SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on file input, converting VFC file input to visible"));
880 fileInputElement.sendKeys(filePath + fileName);
882 // Fill the general page fields.
883 GeneralUIUtils.ultimateWait();
884 fillResourceGeneralInformationPage(resourceMetaData, user, true);
885 GeneralPageElements.clickCreateButton();
888 public static void importVfcNoCreate(ResourceReqDetails resourceMetaData, String filePath, String fileName, User user)
890 GeneralUIUtils.hoverOnAreaByTestId(Dashboard.IMPORT_AREA.getValue());
891 // Insert file to the browse dialog
892 WebElement buttonVFC = GeneralUIUtils.findByText("Import VFC");
893 WebElement fileInputElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VFC_FILE.getValue());
894 if (!buttonVFC.isDisplayed()){
895 File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resourceMetaData.getName());
896 final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
897 SetupCDTest.getExtendTest().log(Status.WARNING, "VFC button not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath));
900 fileInputElement.sendKeys(filePath + fileName);
901 } catch (ElementNotVisibleException e) {
902 SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on file input, converting VFC file input to visible"));
904 fileInputElement.sendKeys(filePath + fileName);
906 // Fill the general page fields.
907 GeneralUIUtils.waitForLoader();
908 fillResourceGeneralInformationPage(resourceMetaData, user, true);
912 public static void importVfFromCsar(ResourceReqDetails resourceMetaData, String filePath, String fileName, User user)
914 GeneralUIUtils.ultimateWait();
915 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating new VF asset resource %s", resourceMetaData.getName()));
916 GeneralUIUtils.hoverOnAreaByTestId(Dashboard.IMPORT_AREA.getValue());
917 GeneralUIUtils.ultimateWait();
918 // Insert file to the browse dialog
919 WebElement buttonDCAE = GeneralUIUtils.findByText("Import DCAE asset");
920 WebElement fileInputElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VF_FILE.getValue());
921 if (!buttonDCAE.isDisplayed()){
922 File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resourceMetaData.getName());
923 final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
924 SetupCDTest.getExtendTest().log(Status.WARNING, "DCAE button not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath));
927 fileInputElement.sendKeys(filePath + fileName);
928 } catch (ElementNotVisibleException e) {
929 SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on file input, converting DCAE file input to visible"));
931 fileInputElement.sendKeys(filePath + fileName);
933 // Fill the general page fields.
934 GeneralUIUtils.ultimateWait();
935 fillResourceGeneralInformationPage(resourceMetaData, user, true);
936 GeneralPageElements.clickCreateButton(10*60);
937 // GeneralUIUtils.ultimateWait(); "don't change import of csar can take longer then 3 minutes"
938 GeneralUIUtils.waitForLoader(10*60);
941 public static void importVfFromCsarNoCreate(ResourceReqDetails resourceMetaData, String filePath, String fileName, User user)
943 GeneralUIUtils.ultimateWait();
944 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating new VF asset resource %s, Create button will not be clicked", resourceMetaData.getName()));
945 GeneralUIUtils.hoverOnAreaByTestId(Dashboard.IMPORT_AREA.getValue());
946 GeneralUIUtils.ultimateWait();
947 // Insert file to the browse dialog
948 WebElement buttonDCAE = GeneralUIUtils.findByText("Import DCAE asset");
949 WebElement fileInputElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VF_FILE.getValue());
950 if (!buttonDCAE.isDisplayed()){
951 File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resourceMetaData.getName());
952 final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
953 SetupCDTest.getExtendTest().log(Status.WARNING, "DCAE button not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath));
956 fileInputElement.sendKeys(filePath + fileName);
957 } catch (ElementNotVisibleException e) {
958 SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on file input, converting DCAE file input to visible"));
960 fileInputElement.sendKeys(filePath + fileName);
962 // Fill the general page fields.
963 GeneralUIUtils.ultimateWait();
964 fillResourceGeneralInformationPage(resourceMetaData, user, true);
965 GeneralUIUtils.waitForLoader(10*60);
968 public static void updateVfWithCsar(String filePath, String fileName) {
969 ExtentTestActions.log(Status.INFO, "Updating VF with updated CSAR file named " + fileName);
970 WebElement browseWebElement = GeneralUIUtils.getInputElement(DataTestIdEnum.GeneralElementsEnum.UPLOAD_FILE_INPUT.getValue());
971 browseWebElement.sendKeys(filePath + fileName);
972 GeneralUIUtils.ultimateWait();
973 GeneralPageElements.clickUpdateButton();
974 GeneralUIUtils.waitForLoader();
975 ExtentTestActions.log(Status.INFO, "VF is updated.");
980 // public static ResourceReqDetails importVfcInUI(User user, String
981 // filePath, String fileName, ResourceTypeEnum resourceType) {
982 // ResourceReqDetails defineResourceDetails =
983 // defineResourceDetails(resourceType);
984 // ResourceUIUtils.moveToHTMLElementByDataTestId(Dashboard.IMPORT_AREA.getValue());
986 // // Insert file to the browse dialog
987 // final WebElement browseWebElement =
988 // GeneralUIUtils.getWebElementByDataTestId(DataTestIdEnum.Dashboard.IMPORT_VFC_FILE.getValue());
989 // browseWebElement.sendKeys(filePath + fileName);
991 // // Fill the general page fields.
992 // GeneralUIUtils.waitForLoader();
993 // fillResourceGeneralInformationPage(defineResourceDetails, user);
994 // GeneralPageElements.clickCreateButton();
995 // return defineResourceDetails;
1007 // public static ResourceReqDetails importVfInUI(User user, String filePath,
1008 // String fileName) throws Exception {
1009 // ResourceReqDetails defineResourceDetails =
1010 // defineResourceDetails(ResourceTypeEnum.VF);
1011 // ResourceUIUtils.moveToHTMLElementByDataTestId(Dashboard.IMPORT_AREA.getValue());
1013 // // Insert file to the browse dialog
1014 // final WebElement browseWebElement =
1015 // GeneralUIUtils.getWebElementByDataTestId(DataTestIdEnum.Dashboard.IMPORT_VF_FILE.getValue());
1016 // browseWebElement.sendKeys(filePath + fileName);
1018 // // Fill the general page fields.
1019 // GeneralUIUtils.waitForLoader();
1020 // fillResourceGeneralInformationPage(defineResourceDetails, user);
1021 // GeneralPageElements.clickCreateButton();
1022 // return defineResourceDetails;
1025 // public static ResourceReqDetails defineResourceDetails(ResourceTypeEnum
1027 // ResourceReqDetails resource = new ResourceReqDetails();
1028 // resource = ElementFactory.getDefaultResource(NormativeTypesEnum.ROOT,
1029 // ResourceCategoryEnum.APPLICATION_L4_CALL_CONTROL);
1030 // resource.setVersion(INITIAL_VERSION);
1031 // resource.setIcon(ICON_RESOURCE_NAME);
1032 // resource.setResourceType(resourceType.toString());
1033 // resource.setName(getRandomComponentName(RESOURCE_NAME_PREFIX));
1035 // SetupCDTest.setCreatedComponents(Arrays.asList(resource));
1040 protected static String getRandomComponentName(String prefix) {
1041 return prefix + new Random().nextInt(10000);
1044 public static ImmutablePair<String, String> getFirstRIPos(ResourceReqDetails createResourceInUI, User user) {
1045 String responseAfterDrag = RestCDUtils.getResource(createResourceInUI, user).getResponse();
1046 JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
1047 String xPosPostDrag = (String) ((JSONObject) ((JSONArray) jsonResource.get("componentInstances")).get(0))
1049 String yPosPostDrag = (String) ((JSONObject) ((JSONArray) jsonResource.get("componentInstances")).get(0))
1051 return new ImmutablePair<String, String>(xPosPostDrag, yPosPostDrag);
1055 public static WebElement getErrorMessageText(WebDriver driver, String text) throws Exception {
1057 return GeneralUIUtils.getWebElementByClassName(text);
1061 public static void fillGeneralInfoValuesAndIcon(ResourceReqDetails resource, User user) throws Exception {
1062 fillResourceGeneralInformationPage(resource, user, true);
1064 GeneralPageElements.clickCreateButton();
1066 selectRandomResourceIcon();
1070 public static void getVFCGeneralInfoAndValidate(ResourceReqDetails resource, User user)
1071 throws InterruptedException {
1073 WebDriver driver = GeneralUIUtils.getDriver();
1074 String version = GeneralUIUtils.getSelectList(null, "versionHeader").getFirstSelectedOption().getText();
1075 String name = GeneralUIUtils.getWebElementByTestID( "name").getAttribute("value");
1076 String description = GeneralUIUtils.getWebElementByTestID( "description").getAttribute("value");
1077 String category = GeneralUIUtils.getSelectList(null, "selectGeneralCategory").getFirstSelectedOption()
1079 String vendorName = GeneralUIUtils.getWebElementByTestID( "vendorName").getAttribute("value");
1080 String vendorRelease = GeneralUIUtils.getWebElementByTestID( "vendorRelease").getAttribute("value");
1081 List<WebElement> tags = GeneralUIUtils.getWebElementsListByTestID("i-sdc-tag-text");
1082 String type = GeneralUIUtils.getWebElementsListByTestID("type").get(1).getText();
1083 int index = type.lastIndexOf(":");
1084 System.out.println(type.substring(0, index));
1085 String AttContact = GeneralUIUtils.getWebElementByTestID( "attContact").getAttribute("value");
1086 System.out.println(resource.getVersion());
1087 assertTrue(resource.getVersion().equals(version.substring(1)));
1088 assertTrue(resource.getName().equals(name));
1089 assertTrue(resource.getDescription().equals(description));
1090 System.out.println(resource.getVendorName());
1091 System.out.println(resource.getVendorRelease());
1092 assertTrue(resource.getCategories().get(0).getSubcategories().get(0).getName().equals(category));
1093 assertTrue(resource.getVendorName().equals(vendorName));
1094 assertTrue(resource.getVendorRelease().equals(vendorRelease));
1095 assertTrue(resource.getCreatorUserId().equals(AttContact));
1096 assertEquals(type.substring(0, index), resource.getResourceType());
1098 for (int i = 0; i < tags.size(); i++) {
1099 assertEquals(resource.getTags().get(i), tags.get(i).getText());
1103 public static RestResponse createResourceNG(ResourceReqDetails resource, User user) throws Exception, AWTException {
1105 GeneralUIUtils.hoverOnAreaByTestId("w-sdc-dashboard-card-new");
1106 ResourceUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue());
1107 fillResourceGeneralInformationPage(resource, user, true);
1108 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue());
1113 public static void showButtons(){
1114 String parentElementClassAttribute = "sdc-dashboard-import-element-container";
1115 WebElement fileInputElementWithVisible = GeneralUIUtils.getDriver().findElement(By.className(parentElementClassAttribute));
1116 GeneralUIUtils.unhideElement(fileInputElementWithVisible, parentElementClassAttribute);
1117 GeneralUIUtils.ultimateWait();
1118 SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Input buttons now visible..."));
1121 public static void showButtonsADD(){
1123 GeneralUIUtils.ultimateWait();
1124 String parentElementClassAttribute = "sdc-dashboard-create-element-container";
1125 WebElement fileInputElementWithVisible = GeneralUIUtils.getDriver().findElement(By.className(parentElementClassAttribute));
1126 GeneralUIUtils.unhideElement(fileInputElementWithVisible, parentElementClassAttribute);
1127 GeneralUIUtils.ultimateWait();
1128 } catch (Exception e ){
1129 GeneralUIUtils.ultimateWait();
1130 String parentElementClassAttribute = "sdc-dashboard-create-element-container";
1131 WebElement fileInputElementWithVisible = GeneralUIUtils.getDriver().findElement(By.className(parentElementClassAttribute));
1132 GeneralUIUtils.unhideElement(fileInputElementWithVisible, parentElementClassAttribute);
1133 GeneralUIUtils.ultimateWait();
1135 SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Input buttons now visible..."));
1138 public static void clickOnElementByText(String textToClick, String customizationFoLog){
1139 String customizationFoLogLocal = customizationFoLog != null ? customizationFoLog : "";
1140 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s %s", textToClick, customizationFoLogLocal));
1141 GeneralUIUtils.clickOnElementByText(textToClick);