aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/LoginUtils.java
diff options
context:
space:
mode:
authorAmichai Hemli <ah0398@intl.att.com>2019-03-18 10:07:02 +0000
committerGerrit Code Review <gerrit@onap.org>2019-03-18 10:07:02 +0000
commita036637a4d466662128cde1823816578e76c69e0 (patch)
treed58add45a75701717e67de676463fc6b15068f9d /vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/LoginUtils.java
parent756a9c041981e05a3f5bd740ebc0d3fc22579003 (diff)
parent66af8b9b391879be78660d6ccb0a1f1f9340b423 (diff)
Merge "Merge automation from ECOMP's repository"
Diffstat (limited to 'vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/LoginUtils.java')
-rw-r--r--vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/LoginUtils.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/LoginUtils.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/LoginUtils.java
new file mode 100644
index 000000000..eca3599c6
--- /dev/null
+++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/LoginUtils.java
@@ -0,0 +1,42 @@
+package org.onap.sdc.ci.tests.utilities;
+
+import org.onap.sdc.ci.tests.datatypes.UserCredentials;
+import org.onap.sdc.ci.tests.datatypes.UserRoleEnum;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+public class LoginUtils {
+
+ private static final String WEB_SEAL_PASSWORD = "123123a";
+
+ public static void loginToLocalWebsealSimulator(UserRoleEnum role) {
+ WebDriver driver = GeneralUIUtils.getDriver();
+ WebDriverWait wait = new WebDriverWait(driver, 30);
+
+ wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath("//*[@method='" + "post" + "']"))));
+
+ WebElement userIdTextbox = GeneralUIUtils.getWebElementBy(By.name("userId"));
+ userIdTextbox.sendKeys(role.getUserId());
+ WebElement passwordTextbox = GeneralUIUtils.getWebElementBy(By.name("password"));
+ passwordTextbox.sendKeys(WEB_SEAL_PASSWORD);
+
+ wait.until(ExpectedConditions.elementToBeClickable(driver.findElement(By.xpath("//*[@value='" + "Login" + "']")))).click();
+ }
+
+ public static void loginToLocalWebsealSimulator(UserCredentials user) {
+ WebDriver driver = GeneralUIUtils.getDriver();
+ WebDriverWait wait = new WebDriverWait(driver, 30);
+
+ wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath("//*[@method='" + "post" + "']"))));
+
+ WebElement userIdTextbox = GeneralUIUtils.getWebElementBy(By.name("userId"));
+ userIdTextbox.sendKeys(user.getUserId());
+ WebElement passwordTextbox = GeneralUIUtils.getWebElementBy(By.name("password"));
+ passwordTextbox.sendKeys(user.getPassword());
+
+ wait.until(ExpectedConditions.elementToBeClickable(driver.findElement(By.xpath("//*[@value='" + "Login" + "']")))).click();
+ }
+}