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.onap.sdc.frontend.ci.tests.pages;
23 import com.aventstack.extentreports.Status;
24 import org.onap.sdc.frontend.ci.tests.datatypes.DataTestIdEnum;
25 import org.onap.sdc.frontend.ci.tests.execute.setup.SetupCDTest;
26 import org.onap.sdc.frontend.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 private static final int WAIT_FOR_ELEMENT_TIME_OUT = 10;
36 private PropertiesPage() {
40 public static List<WebElement> getElemenetsFromTable() {
41 return GeneralUIUtils.getInputElements(DataTestIdEnum.PropertiesPageEnum.PROPERTY_ROW.getValue());
44 public static void clickAddPropertyArtifact() {
45 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.ADD_NEW_PROPERTY.getValue()).click();
46 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.POPUP_FORM.getValue());
49 public static void clickEditPropertyArtifact(String propertyName) {
50 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.EDIT_PROPERTY.getValue() + propertyName).click();
53 public static void clickDeletePropertyArtifact(String propertyName) {
54 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Delete property %s", propertyName));
55 GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.PropertiesPageEnum.PROPERTY_NAME.getValue() + propertyName);
56 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPageEnum.DELETE_PROPERTY.getValue() + propertyName);
57 GeneralPageElements.clickOKButton();
58 GeneralUIUtils.waitForElementInVisibilityBy(By.className("w-sdc-modal-confirmation"), WAIT_FOR_ELEMENT_TIME_OUT);
61 public static void clickDeletePropertyFromPopup(String propertyName) {
62 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Delete property %s", propertyName));
63 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPageEnum.PROPERTY_NAME.getValue() + propertyName);
64 GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.PropertiesPageEnum.DELETE_PROPERTY_POPUP.getValue());
65 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
68 public static void clickOnProperty(String propertyName) {
69 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.PROPERTY_NAME.getValue() + propertyName).click();
72 public static PropertyPopup getPropertyPopup() {
73 return new PropertyPopup();
76 public static boolean verifyTotalProperitesField(int count) {
77 String totalPropertiesCount = GeneralUIUtils.getWebElementBy(By.id("properties-count")).getText();
78 return ("Total Properties: " + count).equals(totalPropertiesCount);