From 66af8b9b391879be78660d6ccb0a1f1f9340b423 Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Mon, 11 Mar 2019 09:34:34 +0200 Subject: Merge automation from ECOMP's repository Reference commit in ECOMP: 8e92a8c6 Issue-ID: VID-378 Change-Id: Ia32f4813378ef95097f788246aa5b1172e20ca48 Signed-off-by: Ittay Stern --- .../onap/sdc/ci/tests/utilities/LoginUtils.java | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/LoginUtils.java (limited to 'vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/LoginUtils.java') 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(); + } +} -- cgit 1.2.3-korg