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.NoSuchElementException;
29 import org.openqa.selenium.WebElement;
30 import org.openqa.selenium.support.ui.Select;
32 public class PropertyPopup {
35 public PropertyPopup() {
38 public boolean getPopupForm(){
39 return GeneralUIUtils.waitForElementInVisibilityByTestId(DataTestIdEnum.PropertiesPageEnum.POPUP_FORM.getValue(), 60);
42 public void insertPropertyName(String name) {
43 WebElement propertyNameField = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_NAME.getValue());
44 propertyNameField.clear();
45 propertyNameField.sendKeys(name);
48 public void insertPropertyDefaultValue(String value) {
49 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Inserting to property default value: %s ", value));
50 WebElement selectedType = new Select(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_TYPE.getValue())).getFirstSelectedOption();
51 if(selectedType.getText().equals("boolean")) {
52 GeneralUIUtils.getSelectList(value, DataTestIdEnum.PropertiesPopupEnum.PROPERTY_BOOLEAN_VALUE.getValue());
54 WebElement propertyValue = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_VALUE.getValue());
55 propertyValue.clear();
56 propertyValue.sendKeys(value);
59 GeneralUIUtils.ultimateWait();
62 public void insertPropertyDescription(String description) {
63 WebElement propertyDescription = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_DESCRIPTION.getValue());
64 propertyDescription.clear();
65 propertyDescription.sendKeys(description);
68 public void selectPropertyType(String propertyType) {
69 boolean isEntrySchemaDisplayed;
71 GeneralUIUtils.getSelectList(propertyType, DataTestIdEnum.PropertiesPopupEnum.PROPERTY_TYPE.getValue());
72 isEntrySchemaDisplayed = GeneralUIUtils.getDriver().findElement(By.xpath(DataTestIdEnum.PropertiesPopupEnum.ENTRY_SCHEMA.getValue())).isDisplayed();
73 if (isEntrySchemaDisplayed){
74 PropertiesPage.getPropertyPopup().selectEntrySchema(propertyType);
77 catch(NoSuchElementException e){
82 public void selectEntrySchema(String propertyType){
83 GeneralUIUtils.getSelectList(propertyType, DataTestIdEnum.PropertiesPopupEnum.ENTRY_SCHEMA.getValue());
86 public void clickAdd() {
87 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPopupEnum.ADD.getValue());
88 // GeneralUIUtils.ultimateWait();
91 public void clickSave() {
92 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPopupEnum.SAVE.getValue());
96 public void clickCancel() {
97 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPopupEnum.CANCEL.getValue());
98 // GeneralUIUtils.ultimateWait();
101 public void clickDone() {
102 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPopupEnum.DONE.getValue());
103 // GeneralUIUtils.ultimateWait();
106 public void selectPropertyRadioButton(String propertyName) {
107 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_RADIO_BUTTON_CONTAINER.getValue() + propertyName).findElement(By.className(DataTestIdEnum.PropertiesPopupEnum.RADIO_BUTTON_CLASS.getValue())).click();