Provide user to specify the ouput name while declaring the atrributes
[sdc.git] / integration-tests / src / test / java / org / onap / sdc / frontend / 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.onap.sdc.frontend.ci.tests.pages;
22
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;
29
30 import java.util.List;
31
32 public class PropertiesPage extends GeneralPageElements {
33
34     private static final int WAIT_FOR_ELEMENT_TIME_OUT = 10;
35
36     private PropertiesPage() {
37         super();
38     }
39
40     public static List<WebElement> getElemenetsFromTable() {
41         return GeneralUIUtils.getInputElements(DataTestIdEnum.PropertiesPageEnum.PROPERTY_ROW.getValue());
42     }
43
44     public static void clickAddPropertyArtifact() {
45         GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.ADD_NEW_PROPERTY.getValue()).click();
46         GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.POPUP_FORM.getValue());
47     }
48
49     public static void clickEditPropertyArtifact(String propertyName) {
50         GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.EDIT_PROPERTY.getValue() + propertyName).click();
51     }
52
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);
59     }
60
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());
66     }
67
68     public static void clickOnProperty(String propertyName) {
69         GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.PROPERTY_NAME.getValue() + propertyName).click();
70     }
71
72     public static PropertyPopup getPropertyPopup() {
73         return new PropertyPopup();
74     }
75
76     public static boolean verifyTotalProperitesField(int count) {
77         String totalPropertiesCount = GeneralUIUtils.getWebElementBy(By.id("properties-count")).getText();
78         return ("Total Properties: " + count).equals(totalPropertiesCount);
79     }
80
81
82 }