1 package org.onap.sdc.ci.tests.utilities;
3 import org.onap.sdc.ci.tests.datatypes.UserCredentials;
4 import org.onap.sdc.ci.tests.datatypes.UserRoleEnum;
5 import org.openqa.selenium.By;
6 import org.openqa.selenium.WebDriver;
7 import org.openqa.selenium.WebElement;
8 import org.openqa.selenium.support.ui.ExpectedConditions;
9 import org.openqa.selenium.support.ui.WebDriverWait;
11 public class LoginUtils {
13 private static final String WEB_SEAL_PASSWORD = "123123a";
15 public static void loginToLocalWebsealSimulator(UserRoleEnum role) {
16 WebDriver driver = GeneralUIUtils.getDriver();
17 WebDriverWait wait = new WebDriverWait(driver, 30);
19 wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath("//*[@method='" + "post" + "']"))));
21 WebElement userIdTextbox = GeneralUIUtils.getWebElementBy(By.name("userId"));
22 userIdTextbox.sendKeys(role.getUserId());
23 WebElement passwordTextbox = GeneralUIUtils.getWebElementBy(By.name("password"));
24 passwordTextbox.sendKeys(WEB_SEAL_PASSWORD);
26 wait.until(ExpectedConditions.elementToBeClickable(driver.findElement(By.xpath("//*[@value='" + "Login" + "']")))).click();
29 public static void loginToLocalWebsealSimulator(UserCredentials user) {
30 WebDriver driver = GeneralUIUtils.getDriver();
31 WebDriverWait wait = new WebDriverWait(driver, 30);
33 wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath("//*[@method='" + "post" + "']"))));
35 WebElement userIdTextbox = GeneralUIUtils.getWebElementBy(By.name("userId"));
36 userIdTextbox.sendKeys(user.getUserId());
37 WebElement passwordTextbox = GeneralUIUtils.getWebElementBy(By.name("password"));
38 passwordTextbox.sendKeys(user.getPassword());
40 wait.until(ExpectedConditions.elementToBeClickable(driver.findElement(By.xpath("//*[@value='" + "Login" + "']")))).click();