blob: eca3599c648ab553b53c46807a6aa53781e750f8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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();
}
}
|