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 org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
24 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
25 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
26 import org.openqa.selenium.By;
27 import org.openqa.selenium.NoSuchElementException;
28 import org.openqa.selenium.WebElement;
29 import org.openqa.selenium.support.ui.Select;
31 import com.aventstack.extentreports.Status;
33 public class PropertyPopup {
36 public PropertyPopup() {
39 public boolean getPopupForm(){
40 return GeneralUIUtils.waitForElementInVisibilityByTestId(DataTestIdEnum.PropertiesPageEnum.POPUP_FORM.getValue(), 60);
43 public void insertPropertyName(String name) {
44 WebElement propertyNameField = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_NAME.getValue());
45 propertyNameField.clear();
46 propertyNameField.sendKeys(name);
49 public void insertPropertyDefaultValue(String value) {
50 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Inserting to property default value: %s ", value));
51 WebElement selectedType = new Select(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_TYPE.getValue())).getFirstSelectedOption();
52 if(selectedType.getText().equals("boolean")) {
53 GeneralUIUtils.getSelectList(value, DataTestIdEnum.PropertiesPopupEnum.PROPERTY_BOOLEAN_VALUE.getValue());
55 WebElement propertyValue = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_VALUE.getValue());
56 propertyValue.clear();
57 propertyValue.sendKeys(value);
60 GeneralUIUtils.ultimateWait();
63 public void insertPropertyDescription(String description) {
64 WebElement propertyDescription = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_DESCRIPTION.getValue());
65 propertyDescription.clear();
66 propertyDescription.sendKeys(description);
69 public void selectPropertyType(String propertyType) {
70 boolean isEntrySchemaDisplayed;
72 GeneralUIUtils.getSelectList(propertyType, DataTestIdEnum.PropertiesPopupEnum.PROPERTY_TYPE.getValue());
73 isEntrySchemaDisplayed = GeneralUIUtils.getDriver().findElement(By.xpath(DataTestIdEnum.PropertiesPopupEnum.ENTRY_SCHEMA.getValue())).isDisplayed();
74 if (isEntrySchemaDisplayed){
75 PropertiesPage.getPropertyPopup().selectEntrySchema(propertyType);
78 catch(NoSuchElementException e){
83 public void selectEntrySchema(String propertyType){
84 GeneralUIUtils.getSelectList(propertyType, DataTestIdEnum.PropertiesPopupEnum.ENTRY_SCHEMA.getValue());
87 public void clickAdd() {
88 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPopupEnum.ADD.getValue());
89 GeneralUIUtils.ultimateWait();
92 public void clickSave() {
93 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPopupEnum.SAVE.getValue());
97 public void clickCancel() {
98 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPopupEnum.CANCEL.getValue());
99 GeneralUIUtils.ultimateWait();
102 public void clickDone() {
103 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPopupEnum.DONE.getValue());
104 GeneralUIUtils.ultimateWait();
107 public void selectPropertyRadioButton(String propertyName) {
108 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_RADIO_BUTTON_CONTAINER.getValue() + propertyName).findElement(By.className(DataTestIdEnum.PropertiesPopupEnum.RADIO_BUTTON_CLASS.getValue())).click();