Merge "Remove vendor from CloudOwner"
[vid.git] / vid-automation / src / main / java / vid / automation / test / infra / Input.java
1 package vid.automation.test.infra;
2
3 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
4 import org.openqa.selenium.WebElement;
5 import vid.automation.test.utils.ReadFile;
6
7 /**
8  * Created by itzikliderman on 11/09/2017.
9  */
10 public class Input {
11     public static void text(String text, String inputTestsId) {
12         WebElement inputElement = GeneralUIUtils.getWebElementByTestID(inputTestsId, 30);
13         inputElement.sendKeys(text);
14     }
15
16     public static void replaceText(String text, String inputTestsId) {
17         WebElement inputElement = GeneralUIUtils.getWebElementByTestID(inputTestsId, 30);
18         inputElement.clear();
19         inputElement.sendKeys(text);
20     }
21
22
23     public static String getValueByTestId(String testId) {
24         WebElement input = GeneralUIUtils.getInputElement(testId);
25         return input.getAttribute("value");
26     }
27
28     /*
29         Get relative path to resource and id of file input element,
30         and send the resource full path to the input element
31      */
32     public static void file(String pathInResources, String inputId) {
33
34         // Copy files from resources upon file-input field, so files will be accessible from inside a jar
35         String path = ReadFile.copyOfFileFromResources(pathInResources);
36         WebElement inputElement = Get.byId(inputId);
37         inputElement.sendKeys(path);
38     }
39 }