[SDC-29] rebase continue work to align source
[sdc.git] / ui-ci / src / main / java / org / openecomp / sdc / ci / tests / pages / PropertiesPage.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.sdc.ci.tests.pages;
22
23 import java.util.List;
24
25 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
26 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
27 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
28 import org.openqa.selenium.By;
29 import org.openqa.selenium.WebElement;
30
31 import com.aventstack.extentreports.Status;
32
33 public class PropertiesPage extends GeneralPageElements {
34
35         public PropertiesPage() {
36                 super();
37         }
38
39         public static List<WebElement> getElemenetsFromTable() {
40                 return GeneralUIUtils.getInputElements(DataTestIdEnum.PropertiesPageEnum.PROPERTY_ROW.getValue());
41         }
42
43         public static void clickAddPropertyArtifact() {
44                 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.ADD_NEW_PROPERTY.getValue()).click();
45                 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.POPUP_FORM.getValue());
46         }
47
48         public static void clickEditPropertyArtifact(String propertyName) {
49                 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.EDIT_PROPERTY.getValue() + propertyName).click();
50         }
51
52         public static void clickDeletePropertyArtifact(String propertyName) {
53                 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Delete property %s", propertyName));
54                 GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.PropertiesPageEnum.PROPERTY_NAME.getValue() + propertyName);
55                 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPageEnum.DELETE_PROPERTY.getValue() + propertyName);
56                 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
57                 GeneralUIUtils.waitForElementInVisibilityBy(By.className("w-sdc-modal-confirmation"), 10);
58         }
59
60         public static void clickOnProperty(String propertyName) {
61                 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.PROPERTY_NAME.getValue() + propertyName).click();
62         }
63
64         public static PropertyPopup getPropertyPopup() {
65                 return new PropertyPopup();
66         }
67         
68         public static boolean verifyTotalProperitesField(int count){
69                 String totalPropertiesCount = GeneralUIUtils.getWebElementBy(By.id("properties-count")).getText();
70                 return ("Total Properties: " + count).equals(totalPropertiesCount);
71         }
72         
73
74 }