1 package org.openecomp.sdc.ci.tests.pages;
4 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
5 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.PropertiesAssignmentScreen;
6 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
7 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
8 import org.openqa.selenium.WebElement;
10 import com.aventstack.extentreports.Status;
12 public class PropertiesAssignmentPage {
13 public static void clickOnInputTab(){
14 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Input Tab"));
15 GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.INPUTS_TAB.getValue());
16 GeneralUIUtils.ultimateWait();
19 public static void clickOnPropertiesTab(){
20 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Properties Tab"));
21 GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.PROPERTIES_TAB.getValue());
22 GeneralUIUtils.ultimateWait();
25 public static void clickOnCompositionRightTab(){
26 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Composition Right Tab"));
27 GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.COMPOSITION_TAB.getValue());
28 GeneralUIUtils.ultimateWait();
31 public static void clickOnPropertyStructureRightTab(){
32 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Property Structure Right Tab"));
33 GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.PROPERTY_STRUCTURE_TAB.getValue());
34 GeneralUIUtils.ultimateWait();
37 public static void clickOnDeclareButton(){
38 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Declare Button"));
39 GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.DECLARE_BUTTON.getValue());
40 GeneralUIUtils.ultimateWait();
43 public static void findSearchBoxAndClick(String resourceName) throws Exception {
44 SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + resourceName + " in homepage");
45 WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesAssignmentScreen.SEARCH_BOX.getValue());
47 searchTextbox.clear();
48 searchTextbox.sendKeys(resourceName);
49 GeneralUIUtils.ultimateWait();
52 SetupCDTest.getExtendTest().log(Status.INFO, "Can't interact with search bar");
58 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on the %s component from home screen", resourceName));
59 GeneralUIUtils.clickOnElementByTestId(resourceName);
60 GeneralUIUtils.ultimateWait();
61 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue());
64 SetupCDTest.getExtendTest().log(Status.INFO, "Can't click on component named " + resourceName);
69 public static void clickOnProperty(String propertyName) {
70 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on property %s ", propertyName));
71 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_NAME.getValue() + propertyName);
72 GeneralUIUtils.ultimateWait();
75 public static void clickOnDeleteInputButton(){
76 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Delete Input Button"));
77 GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.INPUT_DELETE_BUTTON.getValue());
78 GeneralUIUtils.ultimateWait();
81 public static void clickOnDeleteInputDialogConfirmationButton(){
82 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Delete Input Dialog Confirmation Button"));
83 GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.INPUT_DELETE_DIALOG_DELETE.getValue());
84 GeneralUIUtils.ultimateWait();
87 public static void clickOnFilterAll() {
88 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on property %s "));
89 GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.FILTER_CHECKBOX_ALL.getValue());
90 GeneralUIUtils.ultimateWait();
93 public static void clickOnComponentInComposition(String resourceName) throws Exception{
95 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on the %s component from properties composition", resourceName));
96 GeneralUIUtils.clickOnElementByTestId(resourceName);
97 GeneralUIUtils.ultimateWait();
98 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue());
101 SetupCDTest.getExtendTest().log(Status.INFO, "Can't click on component named " + resourceName);
106 public static void findInput(String componentName, String resourceName) throws Exception {
107 SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + componentName + "_" + resourceName + " in homepage");
108 WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesAssignmentScreen.SEARCH_BOX.getValue());
109 String searchPattern = componentName + "_" + resourceName;
111 searchTextbox.clear();
112 searchTextbox.sendKeys(searchPattern);
113 GeneralUIUtils.ultimateWait();
116 SetupCDTest.getExtendTest().log(Status.INFO, "Can't interact with search bar");
122 public static void findProperty(String resourceName) throws Exception {
123 SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + resourceName + " in homepage");
124 WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesAssignmentScreen.SEARCH_BOX.getValue());
127 searchTextbox.clear();
128 searchTextbox.sendKeys(resourceName);
129 GeneralUIUtils.ultimateWait();
132 SetupCDTest.getExtendTest().log(Status.INFO, "Can't interact with search bar");
138 public static Boolean isPropertyChecked(String resourceName){
139 // TODO add better implementation for css string
140 GeneralUIUtils.ultimateWait();
141 Boolean isDisabled = GeneralUIUtils.checkForDisabledAttributeInHiddenElement("checkbox[data-tests-id='" + resourceName + "'] input");