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.pages;
23 import com.aventstack.extentreports.Status;
24 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
25 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
26 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
27 import org.openqa.selenium.By;
28 import org.openqa.selenium.WebElement;
30 import java.util.List;
32 public class PropertiesPage extends GeneralPageElements {
34 public PropertiesPage() {
38 public static List<WebElement> getElemenetsFromTable() {
39 return GeneralUIUtils.getInputElements(DataTestIdEnum.PropertiesPageEnum.PROPERTY_ROW.getValue());
42 public static void clickAddPropertyArtifact() {
43 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.ADD_NEW_PROPERTY.getValue()).click();
44 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.POPUP_FORM.getValue());
47 public static void clickEditPropertyArtifact(String propertyName) {
48 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.EDIT_PROPERTY.getValue() + propertyName).click();
51 public static void clickDeletePropertyArtifact(String propertyName) {
52 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Delete property %s", propertyName));
53 GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.PropertiesPageEnum.PROPERTY_NAME.getValue() + propertyName);
54 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPageEnum.DELETE_PROPERTY.getValue() + propertyName);
55 GeneralPageElements.clickOKButton();
56 GeneralUIUtils.waitForElementInVisibilityBy(By.className("w-sdc-modal-confirmation"), 10);
59 public static void clickDeletePropertyFromPopup(String propertyName) {
60 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Delete property %s", propertyName));
61 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPageEnum.PROPERTY_NAME.getValue() + propertyName);
62 GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.PropertiesPageEnum.DELETE_PROPERTY_POPUP.getValue());
63 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
66 public static void clickOnProperty(String propertyName) {
67 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.PROPERTY_NAME.getValue() + propertyName).click();
70 public static PropertyPopup getPropertyPopup() {
71 return new PropertyPopup();
74 public static boolean verifyTotalProperitesField(int count){
75 String totalPropertiesCount = GeneralUIUtils.getWebElementBy(By.id("properties-count")).getText();
76 return ("Total Properties: " + count).equals(totalPropertiesCount);