aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/LoginUtils.java
diff options
context:
space:
mode:
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();
+ }
+}