aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/java/vid/automation/test/infra/Input.java
diff options
context:
space:
mode:
authorOfir Sonsino <os0695@att.com>2018-01-31 17:19:00 +0200
committerOfir Sonsino <os0695@att.com>2018-01-31 17:19:00 +0200
commit1cfb08779ea0e00be69e072a940b3063e049fe6b (patch)
tree6602a900387c8393ed0dcd81c0539381632903c6 /vid-automation/src/main/java/vid/automation/test/infra/Input.java
parent2f20b001b9243e0f8b44aecc768ec265fd538732 (diff)
org.onap migration
Change-Id: I52f0b2851f2c765752b6d21f49b32136d7d72a3d Issue-ID: VID-86 Signed-off-by: Ofir Sonsino <os0695@att.com>
Diffstat (limited to 'vid-automation/src/main/java/vid/automation/test/infra/Input.java')
-rw-r--r--vid-automation/src/main/java/vid/automation/test/infra/Input.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/vid-automation/src/main/java/vid/automation/test/infra/Input.java b/vid-automation/src/main/java/vid/automation/test/infra/Input.java
new file mode 100644
index 000000000..15fa22549
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/infra/Input.java
@@ -0,0 +1,38 @@
+package vid.automation.test.infra;
+
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang3.SystemUtils;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+
+/**
+ * Created by itzikliderman on 11/09/2017.
+ */
+public class Input {
+ public static void text(String text, String inputTestsId) {
+ WebElement inputElement = GeneralUIUtils.getWebElementByTestID(inputTestsId, 30);
+ inputElement.sendKeys(text);
+ }
+
+ public static String getValueByTestId(String testId) {
+ WebElement input = GeneralUIUtils.getInputElement(testId);
+ return input.getAttribute("value");
+ }
+
+ /*
+ Get relative path to resource and id of file input element,
+ and send the resource full path to the input element
+ */
+ public static void file(String pathInResources, String inputId) {
+
+ String path = Input.class.getResource("../../../../"+pathInResources).getPath().toString();
+ if (SystemUtils.IS_OS_WINDOWS) {
+ path = FilenameUtils.separatorsToSystem(path);
+ if (path.charAt(0)=='\\') {
+ path = path.substring(1);
+ }
+ }
+ WebElement inputElement = Get.byId(inputId);
+ inputElement.sendKeys(path);
+ }
+}